/* CSS FILE: All styling for the page - theme colors (dark/light), layout, header, cards, forms, and the profile switch popup */
  /* ==========================================================================
     OPTIMIZED DESIGN TOKENS & COLOR PALETTES
     ========================================================================== */
  :root {
    --transition-fast: background-color 0.2s ease, border-color 0.2s ease, color 0.15s ease, box-shadow 0.2s ease;
  }

  /* Refined Modern Light Mode (Clean Executive Ivory & Crisp Navy) */
  html[data-theme="light"] {
    --bg-app: #f4f6f8;
    --paper: #ffffff;
    --paper-card: #ffffff;
    --paper-line: #e2e8f0;
    --margin-red: #dc2626;
    --margin-red-subtle: rgba(220, 38, 38, 0.08);
    --ink: #0f172a;
    --ink-secondary: #334155;
    --ink-muted: #64748b;
    --ink-placeholder: #94a3b8;
    --stamp-red: #dc2626;
    --stamp-glow: rgba(220, 38, 38, 0.14);
    --hole: #cbd5e1;
    --hole-shadow: #94a3b8;
    --hole-ring: rgba(255, 255, 255, 0.9);
    --header-bg: rgba(255, 255, 255, 0.92);
    --header-border: #e2e8f0;
    --header-text: #0f172a;
    --input-line: #cbd5e1;
    --input-focus: #dc2626;
    --button-bg: #0f172a;
    --button-text: #ffffff;
    --button-hover: #1e293b;
    --card-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.08), 0 0 0 1px #e2e8f0;
    --panel-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.07), 0 0 0 1px #e2e8f0;
    --good-green: #059669;
    --good-green-bg: #ecfdf5;
    --good-green-border: #a7f3d0;
    --good-green-bar: linear-gradient(90deg, #10b981, #059669);
    --low-red: #dc2626;
    --low-red-bg: #fef2f2;
    --low-red-border: #fecaca;
    --low-red-bar: linear-gradient(90deg, #ef4444, #dc2626);
    --badge-bg: #f1f5f9;
    --badge-text: #334155;
    --menu-bg: #ffffff;
    --menu-hover: #f8fafc;
    --stat-box-bg: #f8fafc;
  }

  /* Sleek Modern Dark Mode (Deep Slate Noir) */
  html[data-theme="dark"] {
    --bg-app: #090d14;
    --paper: #111722;
    --paper-card: #161e2c;
    --paper-line: #222d3e;
    --margin-red: #ef4444;
    --margin-red-subtle: rgba(239, 68, 68, 0.12);
    --ink: #f8fafc;
    --ink-secondary: #cbd5e1;
    --ink-muted: #8493a8;
    --ink-placeholder: #506179;
    --stamp-red: #f87171;
    --stamp-glow: rgba(248, 113, 113, 0.25);
    --hole: #06090e;
    --hole-shadow: #020407;
    --hole-ring: rgba(255, 255, 255, 0.05);
    --header-bg: rgba(17, 23, 34, 0.92);
    --header-border: #222d3e;
    --header-text: #f8fafc;
    --input-line: #334155;
    --input-focus: #f87171;
    --button-bg: #ef4444;
    --button-text: #ffffff;
    --button-hover: #dc2626;
    --card-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.07);
    --panel-shadow: 0 18px 36px -15px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
    --good-green: #34d399;
    --good-green-bg: rgba(52, 211, 153, 0.1);
    --good-green-border: rgba(52, 211, 153, 0.25);
    --good-green-bar: linear-gradient(90deg, #10b981, #34d399);
    --low-red: #f87171;
    --low-red-bg: rgba(248, 113, 113, 0.12);
    --low-red-border: rgba(248, 113, 113, 0.28);
    --low-red-bar: linear-gradient(90deg, #ef4444, #f87171);
    --badge-bg: #1e2838;
    --badge-text: #cbd5e1;
    --menu-bg: #141c28;
    --menu-hover: #1b2637;
    --stat-box-bg: #121824;
  }

  /* ==========================================================================
     BASE RESET & OPTIMIZED PERFORMANCE
     ========================================================================== */
  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--bg-app);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--ink);
    overflow-x: hidden;
    touch-action: manipulation;
    transition: var(--transition-fast);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  :focus-visible {
    outline: 2px solid var(--stamp-red);
    outline-offset: 2px;
  }

  /* ==========================================================================
     APP HEADER & NAVIGATION
     ========================================================================== */
  .app-header {
    display: none;
    position: sticky;
    top: 0;
    width: 100%;
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--header-border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 50;
    transition: var(--transition-fast);
  }

  .app-header.visible {
    display: block;
    animation: fadeInDown 0.25s ease-out;
  }

  @keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .app-header-inner {
    max-width: 620px;
    margin: 0 auto;
    padding: 12px 20px;
    padding-top: max(12px, env(safe-area-inset-top));
    display: flex;
    align-items: center;
    position: relative;
    gap: 12px;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--margin-red-subtle);
    border-radius: 50%;
    border: 1px solid var(--margin-red);
    padding: 3px;
    transition: transform 0.15s ease;
    overflow: hidden;
  }

  .brand:hover .brand-logo {
    transform: scale(1.05);
  }

  .brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
  }

  /* Two logo assets (dark-bg source / light-bg source, both made
     transparent) — swap by theme instead of re-coloring one image, since
     the artwork itself has different accent placement per theme. */
  html[data-theme="dark"] .brand-logo-dark {
    display: block;
  }

  html[data-theme="light"] .brand-logo-light {
    display: block;
  }

  .brand-info {
    display: flex;
    flex-direction: column;
  }

  .brand-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--header-text);
    text-transform: uppercase;
  }

  .brand-subtext {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9.5px;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
    text-transform: uppercase;
  }

  .header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .theme-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--header-border);
    background: var(--paper-card);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease;
  }

  .theme-toggle-btn:hover {
    border-color: var(--stamp-red);
    transform: translateY(-1px);
  }

  .theme-toggle-btn svg {
    width: 18px;
    height: 18px;
  }

  html[data-theme="dark"] .theme-icon-sun { display: block; }
  html[data-theme="dark"] .theme-icon-moon { display: none; }
  html[data-theme="light"] .theme-icon-sun { display: none; }
  html[data-theme="light"] .theme-icon-moon { display: block; }

  .hamburger-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--header-border);
    background: var(--paper-card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ink);
    padding: 0;
    transition: transform 0.15s ease, background-color 0.15s ease;
  }

  .hamburger-btn:hover {
    border-color: var(--stamp-red);
    transform: translateY(-1px);
  }

  .hamburger-btn svg {
    width: 19px;
    height: 19px;
  }

  .hamburger-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 20px;
    background: var(--menu-bg);
    border: 1px solid var(--header-border);
    border-radius: 10px;
    box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    min-width: 210px;
    overflow: hidden;
    z-index: 60;
    animation: menuDrop 0.18s ease-out;
  }

  .header-profile-wrap {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--stamp-red);
    box-shadow: 0 2px 8px var(--stamp-glow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--paper-card);
    transition: transform 0.15s ease, border-color 0.15s ease;
  }

  .header-avatar-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .account-menu {
    left: auto;
    right: 20px;
  }

  .saved-accounts-list {
    display: flex;
    flex-direction: column;
    max-height: 240px;
    overflow-y: auto;
    border-bottom: 1px solid var(--header-border);
  }

  .saved-account-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.12s ease;
  }

  .saved-account-row:hover {
    background: var(--margin-red-subtle);
  }

  .saved-account-row.active {
    background: var(--margin-red-subtle);
  }

  .saved-account-avatar {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--stamp-red);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 700;
  }

  .saved-account-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  .saved-account-name {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .saved-account-reg {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--ink-muted);
  }

  .saved-account-active-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.05em;
    color: var(--good-green, #3B6B4A);
    text-transform: uppercase;
    flex-shrink: 0;
  }

  .saved-account-remove {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .saved-account-remove:hover {
    background: var(--stamp-red);
    color: #fff;
  }

  .no-saved-accounts {
    padding: 14px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--ink-muted);
    text-align: center;
  }

  .header-profile-wrap:hover {
    transform: scale(1.05);
    border-color: var(--ink);
  }

  .header-profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .header-profile-fallback {
    width: 18px;
    height: 18px;
    color: var(--ink-muted);
  }

  @keyframes menuDrop {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .hamburger-menu.open {
    display: flex;
  }

  .menu-item {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: left;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--paper-line);
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.12s ease, color 0.12s ease;
  }

  .menu-item:last-child {
    border-bottom: none;
  }

  .menu-item:hover:not(:disabled) {
    background: var(--menu-hover);
    color: var(--stamp-red);
  }

  .menu-item:disabled {
    color: var(--ink-muted);
    cursor: not-allowed;
  }

  .menu-item.logout {
    color: var(--stamp-red);
    font-weight: 600;
  }

  /* ==========================================================================
     RADIAL NAVIGATION MENU (FAB + scrollable curved arc wheel, bottom-right)
     ========================================================================== */
  .radial-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--good-green-bar);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 24px -4px rgba(5, 150, 105, 0.5), 0 0 0 5px var(--good-green-bg);
    z-index: 75;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }

  .radial-fab:active {
    transform: scale(0.94);
  }

  .radial-fab-close {
    display: none;
  }

  .radial-fab.open .radial-fab-dots {
    display: none;
  }

  .radial-fab.open .radial-fab-close {
    display: block;
  }

  .radial-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.22s ease;
    pointer-events: none;
    z-index: 70;
  }

  .radial-menu-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .radial-menu {
    position: fixed;
    right: 0;
    bottom: 0;
    width: 320px;
    height: 320px;
    z-index: 74;
    pointer-events: none;
    overflow: visible;
    user-select: none;
    -webkit-user-select: none;
  }

  .radial-menu.open {
    pointer-events: auto;
  }

  .radial-menu-items {
    position: absolute;
    inset: 0;
    overflow: visible;
  }

  .radial-item.menu-item {
    position: absolute;
    right: 48px; /* FAB center anchor horizontal */
    bottom: 48px; /* FAB center anchor vertical */
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    height: auto;
    width: auto;
    min-width: 140px;
    max-width: 220px;
    border-radius: 24px;
    background: var(--paper-card);
    border: 1px solid var(--header-border);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ink);
    opacity: 0;
    pointer-events: none;
    transform-origin: center center;
    /* We align item's center point perfectly on the coordinate using translate(50%, 50%) */
    transform: translate(50%, 50%) scale(0.3);
    transition: opacity 0.2s ease, background 0.15s ease, box-shadow 0.15s ease;
  }

  .radial-item.menu-item:hover {
    background: var(--stat-box-bg);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  }

  .radial-item .radial-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .radial-item .radial-item-label {
    display: block;
    line-height: 1.2;
    text-align: left;
    white-space: nowrap;
    overflow: visible;
  }



  /* ==========================================================================
     PAGE CONTAINER
     ========================================================================== */
  .page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 500px;
    padding: max(20px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    margin: auto 0;
    position: relative;
  }

  @media (min-width: 640px) {
    .page {
      max-width: 520px;
      padding: 32px 20px;
    }
  }

  .login-theme-bar {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }

  .theme-toggle-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--header-border);
    background: var(--paper);
    color: var(--ink-secondary);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: transform 0.15s ease, border-color 0.15s ease;
  }

  .theme-toggle-pill:hover {
    transform: translateY(-1px);
    border-color: var(--stamp-red);
  }

  .theme-toggle-pill svg {
    width: 14px;
    height: 14px;
  }

  /* ==========================================================================
     LEDGER CARD
     ========================================================================== */
  .ledger {
    position: relative;
    width: 100%;
    background-color: var(--paper);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 40px 32px 40px 72px;
    overflow: hidden;
    transition: var(--transition-fast);
  }

  .margin-rule {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 52px;
    width: 2px;
    background: var(--margin-red);
    opacity: 0.8;
  }

  .holes {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 18px;
    width: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    padding: 24px 0;
    pointer-events: none;
  }

  .hole {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--hole);
    box-shadow: inset 0 2px 3px var(--hole-shadow), 0 1px 0 var(--hole-ring);
    border: 1px solid rgba(0, 0, 0, 0.04);
  }

  .eyebrow {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--ink-muted);
    text-transform: uppercase;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .eyebrow::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--stamp-red);
  }

  h1 {
    font-family: 'Zilla Slab', Georgia, serif;
    font-weight: 700;
    font-size: clamp(23px, 4.5vw, 28px);
    color: var(--ink);
    margin: 0 0 6px;
    letter-spacing: 0.01em;
    line-height: 1.2;
  }

  .underline {
    width: 52px;
    height: 3px;
    border-radius: 2px;
    background: var(--stamp-red);
    margin: 6px 0 24px;
  }

  .greeting-typer {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-muted);
    margin: -14px 0 20px;
    min-height: 18px;
    letter-spacing: 0.02em;
  }

  .greeting-typer .typer-cursor {
    display: inline-block;
    margin-left: 1px;
    animation: typerBlink 1s step-end infinite;
  }

  @keyframes typerBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
  }

  .row {
    margin-bottom: 22px;
    position: relative;
  }

  .row label {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 6px;
  }

  .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
  }

  .row input[type="text"],
  .row input[type="password"] {
    width: 100%;
    border: none;
    background: transparent;
    border-bottom: 1.5px solid var(--input-line);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--ink);
    padding: 6px 34px 8px 2px;
    border-radius: 0;
    transition: border-color 0.15s ease, color 0.15s ease;
  }

  .row input:focus {
    outline: none;
    border-bottom: 2px solid var(--input-focus);
  }

  .row input::placeholder {
    color: var(--ink-placeholder);
    font-weight: 400;
  }

  .row input.writing {
    animation: inkStroke 0.25s ease-out;
  }

  @keyframes inkStroke {
    0% { color: var(--stamp-red); text-shadow: 0 0 4px var(--stamp-glow); }
    100% { color: var(--ink); text-shadow: none; }
  }

  .password-toggle-btn {
    position: absolute;
    right: 2px;
    background: transparent;
    border: none;
    color: var(--ink-muted);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
  }

  .password-toggle-btn:hover {
    color: var(--ink);
  }

  .password-toggle-btn svg {
    width: 18px;
    height: 18px;
  }

  .remember-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 24px;
    user-select: none;
  }

  .custom-checkbox {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
  }

  .custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
  }

  .checkmark {
    width: 17px;
    height: 17px;
    border-radius: 4px;
    border: 1.5px solid var(--input-line);
    background: var(--paper-card);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .custom-checkbox input:checked ~ .checkmark {
    background: var(--stamp-red);
    border-color: var(--stamp-red);
  }

  .checkmark svg {
    display: none;
    width: 11px;
    height: 11px;
    color: #ffffff;
    stroke-width: 3;
  }

  .custom-checkbox input:checked ~ .checkmark svg {
    display: block;
  }

  .checkbox-label {
    font-size: 13px;
    color: var(--ink-secondary);
    cursor: pointer;
  }

  .actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    flex-wrap: wrap;
  }

  button#loginBtn {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--button-text);
    background: var(--button-bg);
    border: none;
    border-radius: 6px;
    padding: 12px 26px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.12s ease, background 0.15s ease;
  }

  button#loginBtn:hover:not(:disabled) {
    transform: translateY(-1px);
    background: var(--button-hover);
  }

  button#loginBtn:active:not(:disabled) {
    transform: translateY(0);
  }

  button#loginBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }

  .status {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    color: var(--stamp-red);
    min-height: 18px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .stamp-wrap {
    position: absolute;
    top: 28px;
    right: 24px;
    width: 90px;
    height: 90px;
    pointer-events: none;
    opacity: 0;
    transform: scale(1.6) rotate(-18deg);
  }

  .stamp-wrap.show {
    animation: stampIn 0.4s cubic-bezier(0.2, 0.8, 0.3, 1.1) forwards;
  }

  @keyframes stampIn {
    0% { opacity: 0; transform: scale(1.8) rotate(-24deg); }
    100% { opacity: 0.9; transform: scale(1) rotate(-11deg); }
  }

  /* ==========================================================================
     PROFILE PANEL & CARDS
     ========================================================================== */
  .profile-panel {
    display: none;
    width: 100%;
    background: var(--paper);
    border-radius: 12px;
    padding: 26px;
    box-shadow: var(--panel-shadow);
    color: var(--ink);
    animation: panelFade 0.22s ease-out;
    transition: var(--transition-fast);
  }

  @keyframes panelFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--paper-line);
    padding-bottom: 12px;
  }

  .panel-header h2 {
    font-family: 'Zilla Slab', Georgia, serif;
    font-size: 21px;
    font-weight: 700;
    margin: 0;
    color: var(--ink);
  }

  .panel-header .greeting-typer {
    margin: 4px 0 0;
    min-height: 16px;
  }

  .panel-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--good-green-bg);
    color: var(--good-green);
    border: 1px solid var(--good-green-border);
    display: inline-flex;
    align-items: center;
    gap: 5px;
  }

  .panel-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
  }

  .profile-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 18px;
  }

  .profile-panel img[src*="/api/photo"],
  .profile-avatar-img {
    display: block;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--stamp-red);
    box-shadow: 0 4px 14px var(--stamp-glow);
    margin: 0 auto 10px;
  }

  .profile-fields {
    border: 1px solid var(--paper-line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--paper-card);
  }

  .profile-field {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--paper-line);
  }

  .profile-field:last-child {
    border-bottom: none;
  }

  .profile-field:hover {
    background: var(--menu-hover);
  }

  .profile-field-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    color: var(--stamp-red);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .profile-field-icon svg {
    width: 100%;
    height: 100%;
  }

  .profile-field-body {
    flex: 1;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
    min-width: 0;
  }

  .profile-field-label {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 2px;
  }

  .profile-field-value {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    color: var(--ink);
    font-size: 12.5px;
  }

  .coming-soon-note {
    margin: 18px 0 0;
    padding-top: 12px;
    border-top: 1px dashed var(--paper-line);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
    color: var(--ink-muted);
  }

  /* ==========================================================================
     ATTENDANCE DASHBOARD
     ========================================================================== */
  .attendance-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
  }

  .subject-card {
    background: var(--paper-card);
    border: 1px solid var(--paper-line);
    border-radius: 8px;
    padding: 14px 16px;
    transition: transform 0.15s ease, border-color 0.15s ease;
  }

  .subject-card:hover {
    transform: translateY(-1px);
    border-color: var(--ink-muted);
  }

  .subject-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
  }

  .subject-name {
    font-family: 'Zilla Slab', Georgia, serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
    line-height: 1.3;
  }

  .subject-percent {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: 15px;
    padding: 2px 8px;
    border-radius: 5px;
    white-space: nowrap;
  }

  .subject-percent.good {
    color: var(--good-green);
    background: var(--good-green-bg);
    border: 1px solid var(--good-green-border);
  }

  .subject-percent.low {
    color: var(--low-red);
    background: var(--low-red-bg);
    border: 1px solid var(--low-red-border);
  }

  .progress-track {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--paper-line);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 6px;
  }

  .progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
  }

  .progress-fill.good {
    background: var(--good-green-bar);
  }

  .progress-fill.low {
    background: var(--low-red-bar);
  }

  .subject-minmax {
    display: flex;
    justify-content: space-between;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    color: var(--ink-muted);
    margin-bottom: 10px;
  }

  .subject-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .stat-box {
    background: var(--stat-box-bg);
    border: 1px solid var(--paper-line);
    border-radius: 6px;
    padding: 6px 8px;
    text-align: center;
  }

  .stat-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-muted);
    margin-bottom: 2px;
  }

  .stat-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
  }

  .stat-value.present {
    color: var(--good-green);
  }

  .stat-value.absent {
    color: var(--low-red);
  }

  /* Internal marks — component-wise breakdown table */
  .marks-breakdown-table {
    border: 1px solid var(--paper-line);
    border-radius: 8px;
    overflow: hidden;
  }

  .marks-breakdown-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    align-items: center;
  }

  .marks-breakdown-row + .marks-breakdown-row {
    border-top: 1px solid var(--paper-line);
  }

  .marks-breakdown-row.header {
    background: var(--stat-box-bg);
  }

  .marks-breakdown-cell {
    font-family: 'IBM Plex Mono', monospace;
    padding: 8px 10px;
  }

  .marks-breakdown-row.header .marks-breakdown-cell {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-muted);
  }

  .marks-breakdown-row:not(.header) .marks-breakdown-cell {
    font-size: 12px;
    color: var(--ink);
  }

  .marks-breakdown-row:not(.header) .marks-breakdown-cell:first-child {
    font-weight: 600;
  }

  .marks-breakdown-cell.numeric {
    text-align: right;
    color: var(--ink-muted);
  }

  /* ==========================================================================
     LIVE MARK ATTENDANCE VIEW
     ========================================================================== */
  .code-label {
    display: block;
    text-align: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 14px;
  }

  .code-boxes-wrap {
    padding: 12px;
    border-radius: 12px;
    background: var(--paper-card);
    border: 1px solid var(--paper-line);
    margin-bottom: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
  }

  .code-boxes-wrap.error-glow {
    border-color: var(--stamp-red);
    box-shadow: 0 0 0 3px var(--stamp-glow);
  }

  .code-boxes-wrap.success-glow {
    border-color: var(--good-green);
    box-shadow: 0 0 0 3px var(--good-green-bg);
  }

  .code-boxes {
    display: flex;
    gap: clamp(4px, 1.8vw, 8px);
    justify-content: center;
    align-items: center;
  }

  .code-box {
    width: clamp(32px, 10vw, 44px);
    height: clamp(42px, 13vw, 54px);
    text-align: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(17px, 5vw, 22px);
    font-weight: 700;
    color: var(--ink);
    background: var(--stat-box-bg);
    border: 1.5px solid var(--paper-line);
    border-radius: 8px;
    padding: 0;
    text-transform: uppercase;
    transition: border-color 0.12s ease;
  }

  .code-box:focus {
    outline: none;
    border-color: var(--stamp-red);
  }

  .code-box-letter {
    color: var(--stamp-red);
    border-color: var(--stamp-red);
    background: var(--margin-red-subtle);
  }

  .code-box.filled {
    border-color: var(--ink);
    background: var(--paper-card);
  }

  .mark-status {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 20px;
    padding: 12px;
    border-radius: 8px;
  }

  .mark-status.show {
    display: flex;
  }

  .mark-status.error {
    color: var(--stamp-red);
    background: var(--low-red-bg);
    border: 1px solid var(--low-red-border);
  }

  .mark-status.success {
    color: var(--good-green);
    background: var(--good-green-bg);
    border: 1px solid var(--good-green-border);
  }

  .today-attendance-status {
    margin-top: 20px;
  }

  .today-attendance-status:empty {
    display: none;
  }

  .today-card {
    background: var(--paper-card);
    border: 1px solid var(--paper-line);
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
  }

  .today-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--paper-line);
  }

  .today-card-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 14.5px;
    letter-spacing: -0.01em;
    color: var(--ink);
  }

  .today-card-dayorder {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-muted);
    background: var(--low-red-bg);
    border: 1px solid var(--low-red-border);
    padding: 3px 9px;
    border-radius: 6px;
    white-space: nowrap;
  }

  .today-card-section {
    padding: 14px 16px;
  }

  .today-card-section + .today-card-section {
    border-top: 1px solid var(--paper-line);
  }

  .today-card-section-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin: 0 0 10px;
  }

  .today-online-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12.5px;
    color: var(--good-green);
    background: var(--good-green-bg);
    border: 1px solid var(--good-green-border);
    border-radius: 6px;
    padding: 8px 10px;
  }

  .today-online-line + .today-online-line {
    margin-top: 8px;
  }

  .today-period-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
  }

  .today-period-card {
    background: var(--paper-card);
    border: 1px solid var(--paper-line);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .today-period-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
  }

  .today-period-hour {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--ink-muted);
  }

  .today-period-subject {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--ink);
    letter-spacing: -0.01em;
  }

  .today-period-status {
    display: inline-block;
    align-self: flex-start;
    font-weight: 700;
    font-size: 11.5px;
    padding: 2px 9px;
    border-radius: 5px;
    white-space: nowrap;
  }

  .today-period-status.present {
    color: var(--good-green);
    background: var(--good-green-bg);
    border: 1px solid var(--good-green-border);
  }

  .today-period-status.absent {
    color: var(--low-red);
    background: var(--low-red-bg);
    border: 1px solid var(--low-red-border);
  }

  .today-card-empty {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: var(--ink-muted);
    text-align: center;
    padding: 20px;
    margin: 0;
  }

  .status-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
  }

  .mark-btn {
    display: block;
    width: 100%;
    border-radius: 999px;
    padding: 14px;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--button-text);
    background: var(--button-bg);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.12s ease, background 0.15s ease;
  }

  .mark-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    background: var(--button-hover);
  }

  .mark-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
  }

  /* ==========================================================================
     TIMETABLE VIEW
     ========================================================================== */
  .day-selector-wrap {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .day-pill-btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11.5px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--stat-box-bg);
    color: var(--ink-muted);
    border: 1px solid var(--paper-line);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
  }

  .day-pill-btn:hover {
    color: var(--ink);
    border-color: var(--ink-muted);
  }

  .day-pill-btn.active {
    background: var(--button-bg);
    color: var(--button-text);
    border-color: var(--button-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  }

  .day-pill-btn.is-today::after {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--stamp-red);
  }

  .day-pill-btn.active.is-today::after {
    background: #fff;
  }

  .timetable-day-block {
    margin-bottom: 20px;
  }

  .timetable-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 2px 10px;
    border-bottom: 1.5px solid var(--paper-line);
    margin-bottom: 12px;
  }

  .timetable-day-title {
    font-family: 'Zilla Slab', Georgia, serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .timetable-day-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: var(--stamp-red);
    background: var(--margin-red-subtle);
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--paper-line);
  }

  .timetable-slots-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
  }

  .slot-card {
    display: flex;
    align-items: stretch;
    background: var(--paper-card);
    border: 1px solid var(--paper-line);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.15s ease, border-color 0.15s ease;
  }

  .slot-card:hover {
    transform: translateY(-1px);
    border-color: var(--ink-muted);
  }

  .slot-time-col {
    width: 86px;
    flex-shrink: 0;
    background: var(--stat-box-bg);
    border-right: 1px solid var(--paper-line);
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .slot-period-num {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-muted);
  }

  .slot-time-range {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink);
    margin-top: 2px;
    line-height: 1.25;
  }

  .slot-info-col {
    flex: 1;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
  }

  .slot-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
  }

  .slot-course-code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--stamp-red);
    background: var(--margin-red-subtle);
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid var(--paper-line);
  }

  .slot-room-tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink);
    background: var(--stat-box-bg);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--paper-line);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
  }

  .slot-course-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.35;
  }

  .slot-card.free-slot {
    opacity: 0.6;
    border-style: dashed;
  }

  .slot-free-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11.5px;
    font-style: italic;
    color: var(--ink-muted);
  }

  /* ==========================================================================
     COURSES & FACULTY VIEW
     ========================================================================== */
  .courses-search-wrap {
    position: relative;
    margin-bottom: 16px;
  }

  .courses-search-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border-radius: 8px;
    border: 1px solid var(--paper-line);
    background: var(--paper-card);
    color: var(--ink);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    transition: border-color 0.15s ease;
  }

  .courses-search-input:focus {
    outline: none;
    border-color: var(--stamp-red);
  }

  .courses-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--ink-muted);
    pointer-events: none;
  }

  .courses-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .course-card {
    background: var(--paper-card);
    border: 1px solid var(--paper-line);
    border-radius: 8px;
    padding: 14px 16px;
    transition: transform 0.15s ease, border-color 0.15s ease;
  }

  .course-card:hover {
    transform: translateY(-1px);
    border-color: var(--ink-muted);
  }

  .course-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
  }

  .course-code-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--stamp-red);
    background: var(--margin-red-subtle);
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid var(--paper-line);
  }

  .course-ltpc-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--ink-muted);
    background: var(--stat-box-bg);
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid var(--paper-line);
  }

  .course-card-title {
    font-family: 'Zilla Slab', Georgia, serif;
    font-size: 15.5px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.35;
    margin-bottom: 10px;
  }

  .course-meta-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px dashed var(--paper-line);
  }

  .course-meta-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12.5px;
    color: var(--ink);
    line-height: 1.4;
  }

  .course-meta-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: var(--stamp-red);
    margin-top: 1px;
  }

  .course-meta-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-muted);
    min-width: 58px;
    flex-shrink: 0;
  }

  .course-meta-val {
    flex: 1;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 500;
  }

  .course-rooms-val {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    color: var(--ink);
  }

  /* ==========================================================================
     LIVE CLASS STATUS WIDGET (NOW & NEXT CLASS)
     ========================================================================== */
  .live-class-widget {
    background: var(--paper-card);
    border: 1.5px solid var(--paper-line);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--panel-shadow);
  }

  .live-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--paper-line);
  }

  .live-widget-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .live-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--good-green);
    box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.4);
    animation: livePulse 2s infinite;
  }

  @keyframes livePulse {
    0% {
      transform: scale(0.95);
      box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.7);
    }
    70% {
      transform: scale(1);
      box-shadow: 0 0 0 6px rgba(46, 125, 50, 0);
    }
    100% {
      transform: scale(0.95);
      box-shadow: 0 0 0 0 rgba(46, 125, 50, 0);
    }
  }

  .live-widget-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink);
  }

  .live-day-tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    background: var(--badge-bg);
    color: var(--ink-muted);
    border: 1px solid var(--paper-line);
  }

  .live-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .live-subcard {
    background: var(--paper);
    border: 1px solid var(--paper-line);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.15s ease, border-color 0.15s ease;
  }

  .live-subcard:hover {
    border-color: var(--ink-muted);
  }

  .live-subcard.is-current {
    border-color: rgba(46, 125, 50, 0.35);
    background: linear-gradient(180deg, var(--paper) 0%, rgba(46, 125, 50, 0.03) 100%);
  }

  .live-subcard.is-next {
    border-color: rgba(184, 51, 42, 0.3);
    background: linear-gradient(180deg, var(--paper) 0%, rgba(184, 51, 42, 0.02) 100%);
  }

  .live-card-badge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
  }

  .live-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2.5px 7px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .live-badge.current {
    background: var(--good-green-bg);
    color: var(--good-green);
    border: 1px solid var(--good-green-border);
  }

  .live-badge.next {
    background: var(--low-red-bg);
    color: var(--low-red);
    border: 1px solid var(--low-red-border);
  }

  .live-slot-period {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: var(--ink-muted);
  }

  .live-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .live-course-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
  }

  .live-course-code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
  }

  .live-course-code.free {
    color: var(--ink-muted);
    font-style: italic;
  }

  .live-room-pill {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    background: var(--paper-dark);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--paper-line);
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 3px;
  }

  .live-course-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .live-course-name.free {
    color: var(--ink-muted);
    font-weight: 400;
    font-style: italic;
  }

  .live-time-foot {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--ink-muted);
    margin-top: 2px;
  }

  .live-time-foot svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
  }

  @media (max-width: 520px) {
    .live-cards-grid {
      grid-template-columns: 1fr;
      gap: 10px;
    }
  }

  /* ==========================================================================
     RESPONSIVE BREAKPOINTS
     ========================================================================== */
  @media (max-width: 500px) {
    .page {
      max-width: 100%;
      gap: 14px;
      padding: 14px;
      padding-top: max(14px, env(safe-area-inset-top));
    }

    .ledger {
      padding: 30px 18px 30px 50px;
    }

    .margin-rule {
      left: 36px;
    }

    .holes {
      left: 12px;
    }

    .hole {
      width: 10px;
      height: 10px;
    }

    .stamp-wrap {
      width: 68px;
      height: 68px;
      top: 18px;
      right: 14px;
    }

    .profile-panel {
      padding: 20px 16px;
    }

    .subject-stats {
      grid-template-columns: repeat(2, 1fr);
      gap: 5px;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation: none !important;
      transition: none !important;
    }
  }

#profileSwitchOverlay{
  position:fixed;
  inset:0;
  z-index:99999;
  display:none;
  align-items:center;
  justify-content:center;
  background:rgba(9,13,20,.6);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  padding:24px;
}
#profileSwitchOverlay.show{display:flex;animation:fadeInDown .2s ease-out}
#profileSwitchCard{
  position:relative;
  width:min(340px,100%);
  padding:34px 28px 28px;
  border-radius:14px;
  text-align:center;
  background:var(--paper);
  color:var(--ink);
  box-shadow:var(--panel-shadow);
  border:1px solid var(--header-border);
  overflow:hidden;
}
#profileSwitchCard::before{
  content:'';
  position:absolute;
  top:0;left:0;right:0;
  height:3px;
  background:var(--stamp-red);
}
#profileSwitchAvatar{
  width:52px;
  height:52px;
  margin:0 auto 16px;
  border-radius:50%;
  background:var(--stamp-red);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family:'IBM Plex Mono',monospace;
  font-weight:700;
  font-size:18px;
  letter-spacing:0.02em;
  box-shadow:0 4px 14px var(--stamp-glow);
}
#profileSwitchSpinner{
  width:26px;
  height:26px;
  margin:0 auto 16px;
  border:3px solid var(--paper-line);
  border-top-color:var(--stamp-red);
  border-radius:50%;
  animation:profileSwitchSpin .7s linear infinite;
}
#profileSwitchTitle{
  margin:0 0 6px;
  font-family:'Zilla Slab',Georgia,serif;
  font-size:18px;
  font-weight:700;
  color:var(--ink);
}
#profileSwitchMessage{
  margin:0;
  font-family:'IBM Plex Mono',monospace;
  font-size:12.5px;
  color:var(--ink-muted);
  line-height:1.5;
}
@keyframes profileSwitchSpin{to{transform:rotate(360deg)}}
body.profile-switching > *:not(#profileSwitchOverlay){pointer-events:none}

#sessionExpiredOverlay{
  position:fixed;
  inset:0;
  z-index:999999;
  display:none;
  align-items:center;
  justify-content:center;
  background:rgba(9,13,20,.6);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  padding:24px;
}
#sessionExpiredOverlay.show{
  display:flex;
  animation:fadeInDown .2s ease-out;
}
#sessionExpiredCard{
  position:relative;
  width:min(380px,100%);
  padding:34px 28px 28px;
  border-radius:14px;
  text-align:center;
  background:var(--paper);
  color:var(--ink);
  box-shadow:var(--panel-shadow);
  border:1px solid var(--header-border);
  overflow:hidden;
}
#sessionExpiredCard::before{
  content:'';
  position:absolute;
  top:0;left:0;right:0;
  height:3px;
  background:var(--stamp-red);
}
#sessionExpiredIcon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:54px;
  height:54px;
  border-radius:50%;
  background:rgba(219,68,85,0.1);
  color:var(--stamp-red);
  margin-bottom:20px;
}
#sessionExpiredTitle{
  margin:0 0 10px;
  font-family:'Plus Jakarta Sans', sans-serif;
  font-size:18px;
  font-weight:700;
  color:var(--ink);
}
#sessionExpiredMessage{
  margin:0 0 24px;
  font-family:'IBM Plex Mono', monospace;
  font-size:12.5px;
  color:var(--ink-muted);
  line-height:1.5;
}
#sessionExpiredActionArea{
  display:flex;
  flex-direction:column;
  gap:10px;
}
#sessionExpiredBtn {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--button-text);
  background: var(--button-bg);
  border: none;
  border-radius: 6px;
  padding: 12px 26px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.12s ease, background 0.15s ease;
}
#sessionExpiredBtn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--button-hover);
}
#sessionExpiredBtn:active:not(:disabled) {
  transform: translateY(0);
}
#sessionExpiredBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
#sessionExpiredLogoutBtn {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
  color: var(--ink-muted);
  border: 1px solid var(--header-border);
  border-radius: 6px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
}
#sessionExpiredLogoutBtn:hover {
  background: var(--hover-bg);
  color: var(--ink);
}
body.session-expired-active > *:not(#sessionExpiredOverlay){
  pointer-events:none;
}
