  :root {
    /* School theme — set live via applyTheme() in js/auth.js; these are just
       the pre-JS/neutral fallback values (kept in sync with SCHOOL_THEMES.default
       so there's no flash before the script runs). */
    --color-primary: #EA580C;
    --color-primary-dark: #C2410C;
    --color-primary-light: #FFF7ED;
    --color-sidebar: #1A1A2E;
    --color-sidebar-text: #ffffff;
    --color-gradient: linear-gradient(135deg, #EA580C, #C2410C);
    --color-accent: #EA580C;

    --bg: #f7f7f5;
    --surface: #ffffff;
    --border: rgba(0,0,0,0.08);
    --border-mid: rgba(0,0,0,0.14);
    --text: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-tertiary: #a0a0a0;
    /* Every purple/button/accent in the app reads from these three — they
       alias the school-theme variables above, so applyTheme() repaints
       the whole app the instant it changes them. */
    --purple: var(--color-primary);
    --purple-light: var(--color-primary-light);
    --purple-mid: var(--color-accent);
    --info-bg: #EEF3FF;
    --info-text: #3B4EC8;
    --success-bg: #E8F5EE;
    --success-text: #1a7a45;
    --warning-bg: #FEF3E2;
    --warning-text: #92530a;
    --danger-bg: #FEECEC;
    --danger-text: #c0392b;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  }
  [data-theme="dark"] {
    --bg: #111113;
    --surface: #1c1c1f;
    --border: rgba(255,255,255,0.07);
    --border-mid: rgba(255,255,255,0.13);
    --text: #f0f0f0;
    --text-secondary: #9a9a9a;
    --text-tertiary: #575757;
    --purple: var(--color-primary);
    /* Dark mode wants a translucent tint rather than the flat light-mode
       swatch a school configures for --color-primary-light, so derive it
       from the primary color itself — still theme-reactive either way. */
    --purple-light: color-mix(in srgb, var(--color-primary) 16%, transparent);
    --purple-mid: var(--color-accent);
    --info-bg: rgba(59,78,200,0.16);
    --info-text: #8b9ef0;
    --success-bg: rgba(15,110,86,0.18);
    --success-text: #52d490;
    --warning-bg: rgba(146,83,10,0.18);
    --warning-text: #f0ad40;
    --danger-bg: rgba(192,57,43,0.18);
    --danger-text: #e07878;
    --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  }
  [data-theme="dark"] .toast { background: #e8e8e8; color: #111; }
  [data-theme="dark"] .notif-dot { border-color: var(--surface); }
  * { box-sizing: border-box; margin: 0; padding: 0; transition: background-color 0.2s, color 0.2s, border-color 0.2s; }
  html { height: 100%; overflow: hidden; }
  body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; height: 100vh; height: 100dvh; overflow: hidden; position: fixed; inset: 0; width: 100%; overscroll-behavior: none; }

  /* LAYOUT */
  .app { display: flex; height: 100vh; height: 100dvh; }
  .sidebar { width: 220px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
  .main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

  /* SIDEBAR — neutral white/dark surface per the app's light/dark toggle;
     only the accents (logo mark, active nav, badges, avatar) carry the
     school color via var(--purple)/var(--purple-light), which applyTheme()
     drives through --color-primary/--color-primary-light. */
  .sidebar-logo { padding: 20px 16px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; cursor: pointer; }
  .identity-click { cursor: pointer; }
  .profile-view-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); cursor: pointer; margin-bottom: 14px; }
  .profile-view-back:hover { color: var(--text); }
  .logo-mark { width: 30px; height: 30px; background: var(--purple); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .logo-mark i { font-size: 16px; color: white; }
  .logo-name { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -0.3px; }
  .logo-tag { font-size: 10px; color: var(--text-tertiary); }
  .nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
  .nav-label { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; padding: 10px 8px 4px; }
  .nav-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; margin-bottom: 1px; font-size: 13px; color: var(--text-secondary); transition: all 0.12s; user-select: none; }
  .nav-item:hover { background: var(--bg); color: var(--text); }
  .nav-item.active { background: var(--purple-light); color: var(--purple); font-weight: 500; }
  .nav-item i { font-size: 16px; flex-shrink: 0; }
  .nav-drag-handle { font-size: 13px; color: var(--text-tertiary); opacity: 0; cursor: grab; margin-right: -4px; margin-left: -4px; transition: opacity 0.12s; }
  .nav-item:hover .nav-drag-handle { opacity: 1; }
  .nav-item.nav-dragging { opacity: 0.4; }
  .nav-item.nav-drop-above { box-shadow: 0 -2px 0 var(--purple); border-radius: 0; }
  .nav-item.nav-drop-below { box-shadow: 0 2px 0 var(--purple); border-radius: 0; }
  .nav-badge { margin-left: auto; background: var(--purple); color: white; font-size: 10px; padding: 1px 6px; border-radius: 99px; font-weight: 500; }
  .nav-coming-soon { margin-left: auto; background: #FEE2E2; color: #B91C1C; font-size: 9px; padding: 2px 6px; border-radius: 99px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; }
  .course-pill { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--radius); cursor: pointer; font-size: 12px; color: var(--text-secondary); margin-bottom: 1px; transition: background 0.12s; }
  .course-pill:hover { background: var(--bg); }
  .cdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .sidebar-user { padding: 12px 10px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 9px; cursor: pointer; }
  .user-ava { width: 30px; height: 30px; border-radius: 50%; background: var(--purple-light); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--purple); flex-shrink: 0; }

  /* TOPBAR */
  .topbar { padding: 13px 22px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
  .topbar-title { font-size: 15px; font-weight: 600; color: var(--text); flex: 1; letter-spacing: -0.2px; }
  .search { display: flex; align-items: center; gap: 7px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 12px; font-size: 12px; color: var(--text-tertiary); width: 200px; cursor: text; }
  .icon-btn { width: 34px; height: 34px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); cursor: pointer; border: 1px solid var(--border); background: var(--surface); font-size: 16px; position: relative; transition: background 0.12s; }
  .icon-btn:hover { background: var(--bg); }
  .notif-dot { position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: #E24B4A; border: 1.5px solid white; }

  /* PAGES */
  .page-wrap { flex: 1; overflow: hidden; position: relative; }
  .page { display: none; height: 100%; overflow-y: auto; padding: 20px 22px; }
  .page.active { display: block; }

  /* Chat/feed/AI tutor feel like fixed app screens — the page itself never
     scrolls, only the message list / post list scrolls inside it. */
  #page-chats.active, #page-ai-tutor.active { overflow: hidden; }
  #page-feed.active { display: flex; flex-direction: column; overflow: hidden; }
  #page-feed.active .feed-compose { flex-shrink: 0; }
  #page-feed.active #feed-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  #page-feed.active .ftabs { flex-shrink: 0; }
  #page-feed.active .fsec.active { flex: 1; min-height: 0; overflow-y: auto; }

  /* CARDS */
  .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
  .card + .card { margin-top: 12px; }
  .sec-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 12px; letter-spacing: -0.1px; }

  /* HOME GRID */
  .home-grid { display: grid; grid-template-columns: 1fr 260px; gap: 16px; }
  .welcome { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; margin-bottom: 14px; }
  .welcome-name { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -0.3px; }
  .welcome-sub { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
  .stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-top: 14px; }
  .stat { background: var(--bg); border-radius: var(--radius); padding: 12px; }
  .stat-n { font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -0.5px; }
  .stat-l { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

  /* ── NEW HOME PAGE ────────────────────────────────────────────────────────── */
  .home-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
  .home-greeting { font-size: 17px; font-weight: 600; color: var(--text); letter-spacing: -0.3px; }
  .home-next-dl-pill { display: flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 99px; background: var(--purple-light); color: var(--purple); font-size: 12px; font-weight: 500; border: none; cursor: pointer; font-family: 'Inter', sans-serif; transition: opacity 0.12s; white-space: nowrap; }
  .home-next-dl-pill:hover { opacity: 0.8; }
  .home-stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 20px; }
  .home-stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
  .home-stat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
  .home-stat-lbl { font-size: 10.5px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .06em; }
  .home-stat-val { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; line-height: 1.1; }
  .home-eye-btn { background: none; border: none; cursor: pointer; color: var(--text-tertiary); padding: 2px; font-size: 15px; display: flex; align-items: center; transition: color 0.1s; }
  .home-eye-btn:hover { color: var(--text); }
  .home-body { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }
  .home-col-main { display: flex; flex-direction: column; gap: 12px; }
  .home-col-side { display: flex; flex-direction: column; gap: 12px; }
  .home-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
  .home-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .home-empty { font-size: 13px; color: var(--text-secondary); padding: 4px 0; }
  .home-loading-msg { font-size: 13px; color: var(--text-tertiary); padding: 4px 0; }
  /* Today's schedule */
  .home-today-row { display: flex; align-items: flex-start; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
  .home-today-row:last-child { border-bottom: none; }
  .home-today-time { font-size: 11px; color: var(--text-tertiary); width: 58px; flex-shrink: 0; padding-top: 2px; }
  .home-today-title { font-size: 13px; font-weight: 500; color: var(--text); }
  .home-today-tag { display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 99px; background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); margin-top: 3px; }
  /* Upcoming deadlines */
  .home-dl-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s; }
  .home-dl-row:last-child { border-bottom: none; }
  .home-dl-row:hover { background: var(--bg); margin: 0 -4px; padding: 8px 4px; border-radius: var(--radius); }
  .home-dl-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .home-dl-body { flex: 1; min-width: 0; }
  .home-dl-title { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .home-dl-code { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }
  .home-dl-days { font-size: 11px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; }
  .home-dl-days.urgent { color: var(--danger-text, #c62828); }
  /* Grade tracker */
  .home-gr-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; border-bottom: 1px solid var(--border); }
  .home-gr-row:last-child { border-bottom: none; }
  .home-gr-row:hover { opacity: 0.75; }
  .home-gr-code { font-size: 12px; font-weight: 600; color: var(--text); width: 76px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .home-gr-bar-wrap { flex: 1; height: 5px; background: var(--bg); border-radius: 99px; overflow: hidden; }
  .home-gr-bar { height: 100%; border-radius: 99px; transition: width 0.4s; }
  .home-gr-pct { font-size: 12px; font-weight: 600; width: 40px; text-align: right; flex-shrink: 0; }
  /* Needs action */
  .home-act-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .home-act-row:last-child { border-bottom: none; }
  .home-act-icon { font-size: 16px; color: var(--warning-text, #e65100); flex-shrink: 0; }
  .home-act-text { flex: 1; font-size: 13px; color: var(--text); }
  .home-act-btn { font-size: 12px; padding: 5px 11px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--surface); color: var(--text-secondary); cursor: pointer; font-family: 'Inter', sans-serif; white-space: nowrap; transition: all 0.12s; flex-shrink: 0; }
  .home-act-btn:hover { background: var(--bg); color: var(--text); }
  /* Chat activity */
  .home-chat-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
  .home-chat-row:last-child { border-bottom: none; }
  .home-chat-row:hover { opacity: 0.75; }
  .home-chat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .home-chat-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
  .home-chat-code { font-size: 13px; font-weight: 600; color: var(--text); }
  .home-chat-sub { font-size: 11.5px; color: var(--text-secondary); }
  .home-chat-badge { background: var(--purple); color: white; font-size: 10px; padding: 1px 7px; border-radius: 99px; font-weight: 600; flex-shrink: 0; }
  /* Scratchpad */
  .home-scratchpad { position: fixed; right: 24px; bottom: 90px; width: 230px; background: #fffef0; border: 1px solid rgba(0,0,0,0.12); border-radius: var(--radius-lg); box-shadow: 0 4px 20px rgba(0,0,0,0.12); z-index: 150; overflow: hidden; }
  [data-theme="dark"] .home-scratchpad { background: #252410; border-color: rgba(255,255,255,0.1); }
  .home-scratchpad-handle { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; background: rgba(0,0,0,0.05); cursor: grab; user-select: none; }
  [data-theme="dark"] .home-scratchpad-handle { background: rgba(255,255,255,0.04); }
  .home-scratchpad-handle:active { cursor: grabbing; }
  .home-scratchpad-lbl { font-size: 12px; font-weight: 600; color: rgba(0,0,0,0.55); }
  [data-theme="dark"] .home-scratchpad-lbl { color: rgba(255,255,255,0.55); }
  .home-scratchpad-clear { background: none; border: none; cursor: pointer; color: rgba(0,0,0,0.35); font-size: 14px; display: flex; align-items: center; padding: 2px; transition: color 0.1s; }
  .home-scratchpad-clear:hover { color: rgba(0,0,0,0.7); }
  [data-theme="dark"] .home-scratchpad-clear { color: rgba(255,255,255,0.35); }
  [data-theme="dark"] .home-scratchpad-clear:hover { color: rgba(255,255,255,0.7); }
  .home-scratchpad-area { width: 100%; padding: 10px 12px; border: none; background: transparent; font-family: 'DM Sans', 'Inter', sans-serif; font-size: 13px; color: rgba(0,0,0,0.72); resize: none; outline: none; line-height: 1.55; display: block; }
  [data-theme="dark"] .home-scratchpad-area { color: rgba(255,255,255,0.72); }

  /* POSTS */
  .post { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 15px 17px; margin-bottom: 12px; cursor: pointer; transition: border-color 0.12s; overflow: hidden; }
  .post:hover { border-color: var(--border-mid); }
  .post-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; min-width: 0; }
  .pava { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 600; flex-shrink: 0; }
  .pname { font-size: 12px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex-shrink: 1; }
  .ptag { font-size: 10px; padding: 2px 7px; border-radius: 99px; background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); max-width: 38%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 1; }
  .ptime { font-size: 11px; color: var(--text-tertiary); margin-left: auto; flex-shrink: 0; white-space: nowrap; }
  .pbody { font-size: 13px; color: var(--text); line-height: 1.55; overflow-wrap: anywhere; }
  .pacts { display: flex; gap: 14px; margin-top: 10px; }
  .pact { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-tertiary); cursor: pointer; transition: color 0.1s; }
  .pact:hover { color: var(--purple); }
  .pact i { font-size: 14px; }

  /* FEED COMPOSE (real accounts only) */
  .feed-compose { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 12px; margin-bottom: 14px; min-width: 0; }
  .feed-compose-subject-row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
  .feed-compose-subject { flex: 1; min-width: 80px; padding: 9px 13px; border-radius: var(--radius-lg); border: 1px solid var(--border-mid); background: var(--bg); font-size: 13px; font-family: 'Inter', sans-serif; color: var(--text); outline: none; }
  .feed-compose-subject:focus { border-color: var(--purple-mid); }
  .feed-compose-subject-select { padding: 9px 10px; border-radius: var(--radius-lg); border: 1px solid var(--border-mid); background: var(--bg); font-size: 12px; font-family: 'Inter', sans-serif; color: var(--text-secondary); outline: none; flex-shrink: 0; max-width: 140px; }
  .feed-compose-body-row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
  .feed-compose-input { flex: 1; min-width: 80px; padding: 10px 14px; border-radius: var(--radius-lg); border: 1px solid var(--border-mid); background: var(--bg); font-size: 13px; font-family: 'Inter', sans-serif; color: var(--text); outline: none; }
  .feed-compose-input:focus { border-color: var(--purple-mid); }
  .feed-anon-toggle { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary); cursor: pointer; white-space: nowrap; flex-shrink: 0; }
  .feed-compose-btn { padding: 10px 18px; border-radius: var(--radius-lg); background: var(--purple); border: none; color: white; font-size: 13px; font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer; flex-shrink: 0; transition: opacity 0.1s; }
  .feed-compose-btn:hover { opacity: 0.85; }

  /* FEED POST ACTIONS / MENU / COMMENTS (real accounts only) */
  .post-menu-btn { background: none; border: none; cursor: pointer; color: var(--text-tertiary); padding: 2px 5px; border-radius: var(--radius); flex-shrink: 0; }
  .post-menu-btn:hover { background: var(--bg); color: var(--text); }
  .post-menu-btn i { font-size: 15px; }
  .pact.active { color: var(--purple); font-weight: 600; }
  .post-comments { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); min-width: 0; }
  .pc-item { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; min-width: 0; }
  .pc-item .pava { width: 20px; height: 20px; font-size: 8px; }
  .pc-item-body { flex: 1; min-width: 0; }
  .pc-item-name { font-size: 11px; font-weight: 600; color: var(--text); }
  .pc-item-text { font-size: 12px; color: var(--text-secondary); overflow-wrap: anywhere; }
  .pc-compose { display: flex; gap: 7px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
  .pc-input { flex: 1; min-width: 80px; padding: 7px 11px; border-radius: var(--radius-lg); border: 1px solid var(--border-mid); background: var(--bg); font-size: 12px; font-family: 'Inter', sans-serif; color: var(--text); outline: none; }
  .pc-anon { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-tertiary); cursor: pointer; white-space: nowrap; flex-shrink: 0; }
  .pc-submit { padding: 7px 13px; border-radius: var(--radius-lg); background: var(--purple); border: none; color: white; font-size: 12px; font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer; flex-shrink: 0; }
  .pc-submit:hover { opacity: 0.85; }

  /* FEED TABS */
  .ftabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
  .ftab { font-size: 12px; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border); cursor: pointer; color: var(--text-secondary); background: var(--surface); transition: all 0.12s; user-select: none; }
  .ftab:hover { border-color: var(--border-mid); color: var(--text); }
  .ftab.active { background: var(--purple-light); border-color: var(--purple-mid); color: var(--purple); font-weight: 500; }
  .fsec { display: none; }
  .fsec.active { display: block; }

  /* DEADLINES */
  .dl { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
  .dl:last-child { border-bottom: none; padding-bottom: 0; }
  .dl-date { width: 38px; height: 38px; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
  .dl-day { font-size: 15px; font-weight: 600; line-height: 1; }
  .dl-mon { font-size: 9px; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 1px; }
  .dl-name { font-size: 12px; font-weight: 500; color: var(--text); }
  .dl-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }
  .dl-chip { margin-left: auto; font-size: 10px; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }

  /* GRADES */
  .gi { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
  .gi:last-child { border-bottom: none; }
  .gi-course { font-size: 12px; color: var(--text); flex: 1; font-weight: 500; }
  .bw { width: 64px; height: 5px; background: var(--bg); border-radius: 99px; overflow: hidden; }
  .bf { height: 100%; border-radius: 99px; }
  .gv { font-size: 12px; font-weight: 600; width: 34px; text-align: right; }

  /* AI CARD */
  .ai-card { background: var(--surface); border: 1.5px solid var(--purple-mid); border-radius: var(--radius-lg); padding: 15px 17px; margin-bottom: 14px; }
  .ai-lbl { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--purple); font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.06em; }
  .ai-p { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 10px; }
  .ai-btn { width: 100%; padding: 9px; border-radius: var(--radius); border: 1px solid var(--purple-mid); background: var(--purple-light); color: var(--purple); font-size: 12px; cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; transition: opacity 0.1s; }
  .ai-btn:hover { opacity: 0.8; }

  /* CALENDAR PAGE */
  .cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
  .cal-nav { display: flex; align-items: center; gap: 12px; }
  .cal-nav-btn { width: 30px; height: 30px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); transition: background 0.1s; }
  .cal-nav-btn:hover { background: var(--bg); }
  .cal-month { font-size: 15px; font-weight: 600; color: var(--text); letter-spacing: -0.2px; }
  .cal-upload-btn { display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--purple-mid); background: var(--purple-light); color: var(--purple); font-size: 12px; cursor: pointer; font-weight: 500; font-family: 'Inter', sans-serif; transition: opacity 0.1s; }
  .cal-upload-btn:hover { opacity: 0.8; }
  .cal-grid { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 16px; }
  .cal-days-header { display: grid; grid-template-columns: repeat(7,1fr); border-bottom: 1px solid var(--border); }
  .cal-day-lbl { padding: 10px 0; text-align: center; font-size: 11px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; }
  .cal-cells { display: grid; grid-template-columns: repeat(7,1fr); }
  .cal-cell { min-height: 80px; min-width: 0; overflow: hidden; padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s; }
  .cal-cell:hover { background: var(--bg); }
  .cal-cell:nth-child(7n) { border-right: none; }
  .cal-cell.empty { background: var(--bg); opacity: 0.5; }
  .cal-cell.today .cal-cell-num { background: var(--purple); color: white; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
  .cal-cell-num { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
  .cal-event { font-size: 10px; padding: 2px 5px; border-radius: 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
  .cal-legend { display: flex; gap: 14px; flex-wrap: wrap; }
  .cal-leg-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
  .cal-leg-dot { width: 8px; height: 8px; border-radius: 2px; }

  @keyframes sb-spin { to { transform: rotate(360deg); } }

  /* STUDY BLOCKS */
  .sb-mode-row { display: flex; gap: 4px; margin-bottom: 10px; background: var(--bg); padding: 3px; border-radius: var(--radius); border: 1px solid var(--border); }
  .sb-mode-btn { flex: 1; padding: 7px 10px; border-radius: 8px; border: none; background: transparent; font-size: 12px; font-weight: 500; color: var(--text-secondary); cursor: pointer; font-family: 'Inter', sans-serif; transition: all 0.12s; }
  .sb-mode-btn.sb-mode-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
  .sb-settings { margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
  .sb-settings-summary { font-size: 12px; font-weight: 500; color: var(--text-secondary); cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; padding: 9px 14px; background: var(--surface); user-select: none; }
  .sb-settings-summary:hover { color: var(--text); background: var(--bg); }
  .sb-settings-summary::marker, .sb-settings-summary::-webkit-details-marker { display: none; }
  .sb-settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px 14px 14px; background: var(--surface); border-top: 1px solid var(--border); }
  .sb-empty-msg { font-size: 13px; color: var(--text-secondary); padding: 24px 16px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-top: 4px; }
  /* Single plan cards */
  .sb-plans-label { font-size: 11px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
  .sb-plan-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 10px; overflow: hidden; }
  .sb-plan-card-head { display: flex; align-items: flex-start; gap: 14px; padding: 16px; }
  .sb-plan-card-body { flex: 1; min-width: 0; }
  .sb-plan-card-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
  .sb-plan-card-meta { font-size: 11.5px; color: var(--text-tertiary); margin-bottom: 6px; }
  .sb-plan-card-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.55; }
  .sb-plan-card-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
  .sb-plan-add-btn { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius); border: none; background: var(--purple); color: white; font-size: 12px; font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer; white-space: nowrap; transition: opacity 0.12s; }
  .sb-plan-add-btn:hover { opacity: 0.85; }
  .sb-plan-add-btn:disabled { cursor: not-allowed; opacity: 0.65; }
  .sb-plan-add-btn.sb-plan-added { background: var(--success-bg); color: var(--success-text); }
  .sb-plan-expand-btn { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 12px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: transparent; color: var(--text-secondary); font-size: 12px; font-family: 'Inter', sans-serif; cursor: pointer; white-space: nowrap; transition: all 0.12s; }
  .sb-plan-expand-btn:hover { background: var(--bg); color: var(--text); }
  /* Session list inside expanded plan */
  .sb-plan-sessions { border-top: 1px solid var(--border); }
  .sb-session-row { display: flex; align-items: center; gap: 10px; padding: 9px 16px; transition: background 0.1s; }
  .sb-session-row:hover { background: var(--bg); }
  .sb-sess-info { flex: 1; min-width: 0; }
  .sb-sess-date { font-size: 13px; font-weight: 500; color: var(--text); }
  .sb-sess-time { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }
  .sb-sess-dur { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); white-space: nowrap; flex-shrink: 0; }
  .sb-sess-btns { display: flex; gap: 4px; flex-shrink: 0; }
  .sb-sess-btn { width: 28px; height: 28px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--surface); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--text-secondary); transition: all 0.12s; }
  .sb-sess-add:hover { background: var(--purple-light); color: var(--purple); border-color: var(--purple-mid); }
  .sb-sess-del:hover { background: rgba(192,57,43,0.08); color: var(--danger-text); border-color: var(--danger-text); }
  .sb-sess-added { font-size: 11px; color: var(--success-text); font-weight: 600; padding: 0 4px; white-space: nowrap; }
  .sb-sess-course { font-size: 10.5px; font-weight: 600; margin-left: 6px; }
  .sb-session-empty { font-size: 12px; color: var(--text-tertiary); padding: 14px 16px; }
  /* Full plan add-all button */
  .sb-add-all-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px 16px; margin-top: 14px; border-radius: var(--radius-lg); border: none; background: var(--purple); color: white; font-size: 13px; font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer; transition: opacity 0.12s; }
  .sb-add-all-btn:hover { opacity: 0.88; }
  .sb-add-all-btn:disabled { cursor: not-allowed; opacity: 0.6; }
  .sb-add-all-btn.sb-add-all-done { background: var(--success-bg); color: var(--success-text); }
  .study-gen-card { background: var(--surface); border: 1.5px solid var(--purple-mid); border-radius: var(--radius-lg); padding: 18px; margin-bottom: 16px; }
  .study-gen-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
  .study-gen-sub { font-size: 12px; color: var(--text-secondary); margin-bottom: 14px; line-height: 1.5; }
  .study-gen-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 10px; align-items: end; }
  .form-group { display: flex; flex-direction: column; gap: 5px; }
  .form-label { font-size: 11px; font-weight: 500; color: var(--text-secondary); }
  .form-group select, .form-group input { padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--bg); font-size: 12px; font-family: 'Inter', sans-serif; color: var(--text); outline: none; }
  .form-group select:focus, .form-group input:focus { border-color: var(--purple-mid); }
  .gen-btn { padding: 9px 16px; border-radius: var(--radius); border: none; background: var(--purple); color: white; font-size: 12px; cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; white-space: nowrap; display: flex; align-items: center; gap: 6px; transition: opacity 0.1s; }
  .gen-btn:hover { opacity: 0.85; }
  .study-blocks { display: flex; flex-direction: column; gap: 8px; }
  .sblock { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; display: flex; align-items: flex-start; gap: 14px; transition: border-color 0.12s; }
  .sblock:hover { border-color: var(--border-mid); }
  .sblock-time { background: var(--purple-light); border-radius: var(--radius); padding: 8px 10px; text-align: center; flex-shrink: 0; min-width: 72px; }
  .sblock-t { font-size: 13px; font-weight: 600; color: var(--purple); }
  .sblock-d { font-size: 10px; color: var(--purple-mid); margin-top: 1px; }
  .sblock-info { flex: 1; }
  .sblock-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
  .sblock-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
  .sblock-tags { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
  .sbtag { font-size: 10px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
  .sblock-add { padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--purple-mid); background: var(--purple-light); color: var(--purple); font-size: 11px; cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; align-self: center; white-space: nowrap; transition: opacity 0.1s; }
  .sblock-add:hover { opacity: 0.8; }
  .sblock-add.added { background: var(--success-bg); border-color: #7cc9a0; color: var(--success-text); }

  /* CHATS */
  .chat-wrap { display: grid; grid-template-columns: 210px 1fr; height: calc(100vh - 60px); margin: -20px -22px; }
  .chat-list { border-right: 1px solid var(--border); overflow-y: auto; padding: 10px 6px; background: var(--surface); }
  .chat-sec-lbl { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; padding: 8px 8px 5px; }
  .chat-item { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: var(--radius); cursor: pointer; margin-bottom: 1px; transition: background 0.1s; }
  .chat-item:hover { background: var(--bg); }
  .chat-item.active { background: var(--purple-light); }
  .cava { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; flex-shrink: 0; }
  .cname { font-size: 12px; font-weight: 500; color: var(--text); }
  .chat-item.active .cname { color: var(--purple); }
  .cprev { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
  .chat-main { display: flex; flex-direction: column; padding: 16px 18px; background: var(--bg); min-height: 0; }
  .chat-top { font-size: 14px; font-weight: 600; color: var(--text); padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
  .chat-sub { font-size: 12px; color: var(--text-tertiary); font-weight: 400; }
  .chat-msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
  .msg { max-width: 72%; }
  .msg.me { align-self: flex-end; }
  .mbubble { padding: 9px 12px; border-radius: var(--radius-lg); font-size: 13px; line-height: 1.5; }
  .msg.them .mbubble { background: var(--surface); color: var(--text); border-radius: 4px var(--radius-lg) var(--radius-lg) var(--radius-lg); border: 1px solid var(--border); }
  .msg.me .mbubble { background: var(--purple); color: white; border-radius: var(--radius-lg) 4px var(--radius-lg) var(--radius-lg); }
  .mmeta { font-size: 10px; color: var(--text-tertiary); margin-top: 4px; }
  .msg.me .mmeta { text-align: right; }
  /* Real-account messages only (scoped to #chat-msgs.with-avatars so the
     demo account's identical .msg/.mbubble/.mmeta markup is unaffected). */
  #chat-msgs.with-avatars .msg { display: flex; align-items: flex-end; gap: 6px; }
  #chat-msgs.with-avatars .msg.me { flex-direction: row-reverse; }
  #chat-msgs.with-avatars .mstack { display: flex; flex-direction: column; min-width: 0; }
  #chat-msgs.with-avatars .cava-sm { width: 22px; height: 22px; font-size: 9px; }
  .mseen { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; }
  .msg.me .mseen { text-align: right; }
  .mreply-quote { font-size: 11px; padding: 5px 9px; border-radius: var(--radius) var(--radius) 0 0; margin-bottom: -3px; background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); border-bottom: none; }
  .mreply-quote-name { font-weight: 600; color: var(--text); margin-right: 4px; }
  .msg-reply-btn { opacity: 0; flex-shrink: 0; align-self: center; background: none; border: none; cursor: pointer; color: var(--text-tertiary); padding: 5px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: opacity 0.12s, color 0.12s; }
  #chat-msgs.with-avatars .msg:hover .msg-reply-btn { opacity: 1; }
  .msg-reply-btn:hover { color: var(--purple); }

  .chat-members-btn { display: flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); font-size: 11px; font-weight: 500; color: var(--text-secondary); cursor: pointer; flex-shrink: 0; }
  .chat-members-btn:hover { background: var(--bg); }
  .chat-members-btn i { font-size: 13px; }

  .msg-ctx-menu { position: fixed; z-index: 1600; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 8px 28px rgba(0,0,0,0.18); padding: 4px; min-width: 140px; }
  .msg-ctx-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: none; background: none; font-size: 13px; font-family: 'Inter', sans-serif; color: var(--text); text-align: left; border-radius: var(--radius); cursor: pointer; }
  .msg-ctx-item:hover { background: var(--bg); }
  .msg-ctx-item.msg-ctx-danger { color: var(--danger-text, #b3261e); }
  .msg-ctx-item i { font-size: 14px; }

  .chat-reply-preview { display: flex; align-items: stretch; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 7px 9px; margin-bottom: 10px; }
  .crp-bar { width: 3px; border-radius: 2px; background: var(--purple); flex-shrink: 0; }
  .crp-body { flex: 1; min-width: 0; }
  .crp-label { font-size: 11px; font-weight: 600; color: var(--purple); }
  .crp-text { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .crp-close { background: none; border: none; cursor: pointer; color: var(--text-tertiary); flex-shrink: 0; align-self: center; }
  .crp-close i { font-size: 15px; }

  .chat-members-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 1500; padding: 20px; }
  .chat-members-modal { background: var(--surface); border-radius: var(--radius-xl); border: 1px solid var(--border); width: 100%; max-width: 380px; padding: 18px 20px; box-shadow: 0 12px 48px rgba(0,0,0,0.16); max-height: 80vh; overflow-y: auto; }
  .cmem-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .cmem-title { font-size: 15px; font-weight: 700; color: var(--text); }
  .cmem-close { background: none; border: none; cursor: pointer; color: var(--text-tertiary); }
  .cmem-close i { font-size: 16px; }
  .cmem-item { display: flex; align-items: center; gap: 10px; padding: 7px 4px; }
  .cmem-name { font-size: 13px; color: var(--text); }
  .chat-input-row { display: flex; gap: 9px; align-items: center; }
  .chat-input { flex: 1; padding: 10px 14px; border-radius: var(--radius-lg); border: 1px solid var(--border-mid); background: var(--surface); font-size: 13px; font-family: 'Inter', sans-serif; color: var(--text); outline: none; }
  .chat-input:focus { border-color: var(--purple-mid); }
  .send-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--purple); border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: opacity 0.1s; }
  .send-btn:hover { opacity: 0.85; }
  .send-btn i { font-size: 16px; color: white; }

  /* NOTES */
  .notes-main-header-wrap { display: flex; align-items: flex-start; gap: 8px; padding: 16px 18px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
  .notes-sidebar-toggle-btn { background: none; border: 1px solid var(--border); border-radius: var(--radius); width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-tertiary); font-size: 15px; flex-shrink: 0; transition: all 0.12s; }
  .notes-sidebar-toggle-btn:hover { background: var(--bg); color: var(--text); border-color: var(--border-mid); }
  .notes-action-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--surface); color: var(--text); font-size: 12.5px; font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer; transition: background 0.12s; white-space: nowrap; }
  .notes-action-btn:hover { background: var(--bg); }
  .notes-action-btn i { font-size: 14px; }
  .notes-action-primary { background: var(--purple); border-color: var(--purple); color: #fff; }
  .notes-action-primary:hover { opacity: 0.9; background: var(--purple); }
  .notes-action-danger { color: var(--danger-text); border-color: var(--danger-text); }
  .notes-action-danger:hover { background: rgba(192,57,43,0.08); }

  .notes-wrap { display: grid; grid-template-columns: 250px 1fr; height: calc(100vh - 60px); margin: -20px -22px -20px; border-top: 1px solid var(--border); transition: grid-template-columns 0.2s ease; }
  .notes-wrap.sidebar-collapsed { grid-template-columns: 0 1fr; }
  .notes-tree-col { border-right: 1px solid var(--border); overflow: hidden; padding: 10px 6px; background: var(--surface); position: relative; transition: padding 0.2s ease; min-width: 0; }
  .notes-wrap.sidebar-collapsed .notes-tree-col { padding: 0; border-right: none; }

  /* Program-level course grid */
  .notes-course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .notes-course-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 14px 12px; cursor: pointer; transition: border-color 0.12s, box-shadow 0.12s; }
  .notes-course-card:hover { border-color: var(--border-mid); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
  .notes-course-card-dot { width: 24px; height: 24px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
  .notes-course-card-code { font-size: 13px; font-weight: 600; color: var(--text); }
  .notes-course-card-count { font-size: 11px; color: var(--text-tertiary); }
  .notes-course-card-badge { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--purple); background: var(--purple-light); padding: 2px 6px; border-radius: 99px; }
  .notes-program-notes-card { display: flex; align-items: center; gap: 8px; background: var(--purple-light); border: 1px solid var(--purple-mid); border-radius: var(--radius-lg); padding: 12px 14px; cursor: pointer; transition: opacity 0.12s; }
  .notes-program-notes-card:hover { opacity: 0.85; }
  .notes-program-notes-card i { font-size: 16px; color: var(--purple); flex-shrink: 0; }
  .notes-program-notes-card-text { font-size: 12.5px; font-weight: 600; color: var(--purple); }
  .notes-program-notes-card-count { font-size: 11px; color: var(--purple-mid); margin-top: 1px; }
  .notes-course-divider { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin: 4px 0 0; }
  .notes-course-divider span { font-size: 10px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.07em; white-space: nowrap; }
  .notes-course-divider hr { flex: 1; border: none; border-top: 1px solid var(--border); }
  .notes-main-col { display: flex; flex-direction: column; padding: 0; background: var(--bg); min-height: 0; }
  #notes-main-body { flex: 1; padding: 16px 18px; overflow-y: auto; }
  .notes-mobile-back { position: static; margin: 4px 4px 8px; }

  .ntree-row { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: var(--radius); cursor: pointer; font-size: 12.5px; color: var(--text); transition: background 0.1s; user-select: none; }
  .ntree-row:hover { background: var(--bg); }
  .ntree-row.active { background: var(--purple-light); color: var(--purple); font-weight: 600; }
  .ntree-program-row { font-weight: 600; }
  .ntree-chevron { font-size: 13px; color: var(--text-tertiary); flex-shrink: 0; width: 13px; }
  .ntree-icon { font-size: 14px; color: var(--text-tertiary); flex-shrink: 0; }
  .ntree-icon-sm { font-size: 12px; }
  .ntree-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ntree-children { padding-left: 14px; }
  .ntree-children-sub { padding-left: 22px; }
  .ntree-course-row .cdot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
  .ntree-enrolled-badge { margin-left: auto; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--purple); background: var(--purple-light); padding: 2px 6px; border-radius: 99px; flex-shrink: 0; }
  .ntree-divider { height: 1px; background: var(--border); margin: 6px 8px; }

  .notes-main-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; flex: 1; min-width: 0; }
  .notes-breadcrumb { font-size: 13px; font-weight: 600; color: var(--text); }
  .crumb-link { cursor: pointer; color: var(--text-secondary); font-weight: 500; }
  .crumb-link:hover { color: var(--purple); text-decoration: underline; }
  .notes-main-actions { display: flex; gap: 8px; }
  .notes-empty-state { font-size: 13px; color: var(--text-secondary); padding: 30px 10px; text-align: center; }

  .notes-folder-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
  .notes-folder-card { display: flex; align-items: center; gap: 7px; padding: 9px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; color: var(--text); cursor: pointer; transition: border-color 0.12s; }
  .notes-folder-card:hover { border-color: var(--border-mid); }
  .notes-folder-card i { color: var(--text-tertiary); font-size: 14px; }
  .notes-folder-count { color: var(--text-tertiary); font-size: 11px; }

  .notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 18px; }
  .ncard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; cursor: pointer; transition: border-color 0.12s; }
  .ncard:hover { border-color: var(--border-mid); }
  .ncard-icon { font-size: 22px; color: var(--text-tertiary); margin-bottom: 9px; }
  .ncard-title { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 4px; overflow-wrap: anywhere; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ncard-snippet { font-size: 11.5px; color: var(--text-secondary); margin-bottom: 8px; overflow-wrap: anywhere; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; }
  .ncard-meta { font-size: 11px; color: var(--text-tertiary); display: flex; align-items: center; gap: 5px; }
  .ncard-pinned { border-color: var(--purple-mid); background: var(--purple-light); }
  .ncard-pinned .ncard-icon { color: var(--purple); }

  /* note compose/view modals */
  .notes-compose-modal, .notes-view-modal { max-width: 520px; }
  .notes-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
  .notes-form-row.single-col { grid-template-columns: 1fr; }
  .notes-form-field { margin-bottom: 12px; }
  .notes-form-field .auth-label { display: block; margin-bottom: 5px; }
  .notes-optional-lbl { color: var(--text-tertiary); font-weight: 400; }
  .notes-editor { background: var(--bg); border-radius: var(--radius); }
  .notes-editor .ql-toolbar { border-radius: var(--radius) var(--radius) 0 0; border-color: var(--border-mid); }
  .notes-editor .ql-container { border-radius: 0 0 var(--radius) var(--radius); border-color: var(--border-mid); font-family: 'Inter', sans-serif; font-size: 13px; min-height: 120px; max-height: 280px; overflow-y: auto; }
  .notes-attach-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
  .notes-attach-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-secondary); background: var(--bg); border-radius: var(--radius); padding: 6px 9px; }
  .notes-attach-item i:first-child { color: var(--text-tertiary); }
  .notes-attach-remove { margin-left: auto; cursor: pointer; color: var(--text-tertiary); }
  .notes-attach-remove:hover { color: var(--danger-text); }
  .notes-form-err { font-size: 12px; color: var(--danger-text); margin-bottom: 10px; }
  .notes-submit-btn { width: 100%; justify-content: center; padding: 10px; }

  .notes-view-meta { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }
  .notes-view-body { font-size: 13px; color: var(--text); line-height: 1.6; margin-bottom: 14px; overflow-wrap: anywhere; }
  .notes-view-body p { margin: 0 0 10px; }
  .notes-view-body ul, .notes-view-body ol { margin: 0 0 10px; padding-left: 22px; }
  .notes-view-attach { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
  .notes-view-attach a.notes-attach-item { text-decoration: none; cursor: pointer; }
  .notes-view-attach a.notes-attach-item:hover { background: var(--purple-light); color: var(--purple); }
  .notes-view-actions { display: flex; gap: 8px; }

  /* CALENDAR — new event UI */
  .cal-day-modal { max-width: 440px; }
  .cal-compose-modal { max-width: 480px; }
  .cal-event-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .cal-event-row:last-child { border-bottom: none; }
  .cal-event-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
  .cal-event-row-body { flex: 1; min-width: 0; }
  .cal-event-row-title { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cal-event-row-time { font-size: 11.5px; color: var(--text-secondary); margin-top: 1px; }
  .cal-event-row-desc { font-size: 11.5px; color: var(--text-tertiary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cal-event-row-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
  .cal-event-tag { font-size: 10px; padding: 2px 7px; border-radius: 99px; background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
  .cal-event-row-actions { display: flex; gap: 4px; flex-shrink: 0; }
  .cal-event-action-btn { background: none; border: none; cursor: pointer; color: var(--text-tertiary); padding: 4px; border-radius: var(--radius); font-size: 14px; transition: color 0.1s, background 0.1s; }
  .cal-event-action-btn:hover { color: var(--text); background: var(--bg); }
  .cal-event-action-btn.danger:hover { color: var(--danger-text); }
  .cal-day-empty { font-size: 13px; color: var(--text-secondary); padding: 20px 0; text-align: center; }
  .cal-course-checkboxes { display: flex; flex-direction: column; gap: 6px; max-height: 150px; overflow-y: auto; padding: 4px 0; }
  .cal-course-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; color: var(--text); }
  .cal-course-check input[type=checkbox] { accent-color: var(--purple); width: 14px; height: 14px; }
  .cal-event-overflow { font-size: 10px; color: var(--text-tertiary); padding: 2px 5px; cursor: pointer; }
  .cal-event.clickable { cursor: pointer; }

  /* GRADE LOG */
  .glog { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 8px; }
  .glog-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
  .glog-score { margin-left: auto; font-size: 14px; font-weight: 600; }
  .glog-note { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }
  .glog-tags { display: flex; gap: 5px; margin-top: 9px; flex-wrap: wrap; }
  .gtag { font-size: 10px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }

  /* GRADE TABS */
  .grade-tabs { display:flex; gap:2px; background:var(--bg); border-radius:var(--radius); padding:3px; margin-bottom:16px; border:1px solid var(--border); }
  .grade-tab { flex:1; padding:7px; border-radius:8px; border:none; background:transparent; font-size:12px; font-weight:500; color:var(--text-secondary); cursor:pointer; font-family:'Inter',sans-serif; transition:all 0.12s; }
  .grade-tab.active { background:var(--surface); color:var(--text); box-shadow:var(--shadow); }

  /* GRADE CALCULATOR */
  .calc-gpa-bar { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:16px 20px; margin-bottom:14px; display:flex; align-items:center; gap:20px; flex-wrap:wrap; }
  .calc-gpa-num { font-size:30px; font-weight:700; color:var(--purple); letter-spacing:-1px; line-height:1; }
  .calc-gpa-label { font-size:10px; color:var(--text-tertiary); font-weight:600; text-transform:uppercase; letter-spacing:.06em; margin-bottom:2px; }
  .calc-gpa-avg { font-size:16px; font-weight:600; }
  .calc-gpa-divider { width:1px; height:36px; background:var(--border); flex-shrink:0; }
  .calc-course { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); margin-bottom:10px; overflow:hidden; }
  .calc-course-head { display:flex; align-items:center; gap:10px; padding:13px 15px; }
  .calc-course-dot { width:9px; height:9px; border-radius:50%; flex-shrink:0; }
  .calc-course-name { font-size:13px; font-weight:600; color:var(--text); flex:1; }
  .calc-course-grade { font-size:13px; font-weight:700; }
  .calc-course-meta { font-size:11px; color:var(--text-tertiary); margin-left:3px; }
  .calc-course-body { border-top:1px solid var(--border); padding:12px 15px 14px; }
  .calc-syllabus-lbl { font-size:10px; font-weight:600; color:var(--text-tertiary); text-transform:uppercase; letter-spacing:.07em; margin-bottom:9px; display:flex; align-items:center; gap:6px; }
  .calc-syllabus-src { font-size:10px; padding:2px 7px; border-radius:99px; background:var(--success-bg); color:var(--success-text); font-weight:500; text-transform:none; letter-spacing:0; }
  .calc-cat-header { display:grid; grid-template-columns:1fr 56px 90px 54px; gap:8px; margin-bottom:5px; padding:0 2px; }
  .calc-col-lbl { font-size:10px; font-weight:600; color:var(--text-tertiary); text-transform:uppercase; letter-spacing:.05em; }
  .calc-col-lbl.right { text-align:right; }
  .calc-col-lbl.center { text-align:center; }
  .calc-cat-row { display:grid; grid-template-columns:1fr 56px 90px 54px; gap:8px; align-items:center; padding:6px 2px; border-bottom:1px solid var(--border); }
  .calc-cat-row:last-of-type { border-bottom:none; }
  .calc-cat-name { font-size:12px; color:var(--text); }
  .calc-cat-weight { font-size:12px; color:var(--text-secondary); text-align:center; }
  .calc-cat-input { padding:5px 8px; border-radius:var(--radius); border:1px solid var(--border-mid); background:var(--bg); font-size:12px; font-family:'Inter',sans-serif; color:var(--text); text-align:center; outline:none; width:100%; transition:border-color 0.12s; }
  .calc-cat-input:focus { border-color:var(--purple-mid); background:var(--surface); }
  .calc-cat-contrib { font-size:12px; color:var(--text-secondary); text-align:right; font-weight:500; }
  .calc-result-row { display:flex; align-items:center; justify-content:space-between; margin-top:11px; padding-top:11px; border-top:1px solid var(--border); }
  .calc-result-meta { font-size:11px; color:var(--text-tertiary); }
  .calc-result-grade { font-size:14px; font-weight:700; }
  .calc-empty-syllabus { text-align:center; padding:22px 16px; color:var(--text-tertiary); font-size:12px; }

  /* CAREER OVERVIEW */
  .career-bar { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:14px; }
  .career-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:14px 16px; }
  .career-card-lbl { font-size:10px; font-weight:600; color:var(--text-tertiary); text-transform:uppercase; letter-spacing:.07em; margin-bottom:10px; display:flex; align-items:center; gap:5px; }
  .career-avg { font-size:28px; font-weight:700; letter-spacing:-0.5px; line-height:1; }
  .career-letter { font-size:13px; font-weight:600; color:var(--text-secondary); margin-top:4px; }
  .career-gpa { font-size:12px; color:var(--text-tertiary); margin-top:1px; }
  .career-meta { font-size:11px; color:var(--text-tertiary); margin-top:10px; padding-top:10px; border-top:1px solid var(--border); display:flex; gap:10px; }
  .career-meta-item { display:flex; flex-direction:column; gap:1px; }
  .career-meta-num { font-size:13px; font-weight:600; color:var(--text); }
  .career-meta-lbl { font-size:10px; color:var(--text-tertiary); }

  /* MY GRADES LOG */
  .my-grade-entry { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:12px 14px; margin-bottom:8px; display:flex; align-items:center; gap:12px; }
  .my-grade-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; margin-top:1px; }
  .my-grade-info { flex:1; min-width:0; }
  .my-grade-course-lbl { font-size:11px; color:var(--text-tertiary); margin-bottom:2px; }
  .my-grade-label { font-size:13px; font-weight:500; color:var(--text); }
  .my-grade-cat { display:inline-block; font-size:10px; padding:2px 7px; border-radius:99px; background:var(--bg); color:var(--text-secondary); border:1px solid var(--border); margin-top:4px; }
  .my-grade-score { font-size:15px; font-weight:700; }
  .my-grade-raw { font-size:11px; color:var(--text-tertiary); text-align:right; margin-top:2px; }

  /* GRADE LOG — real Supabase implementation */
  .calc-course-head-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
  .calc-credit-select { font-size: 11px; padding: 3px 6px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg); color: var(--text-secondary); font-family: 'Inter', sans-serif; cursor: pointer; }
  .calc-credit-select:focus { outline: none; border-color: var(--purple-mid); }
  .calc-weight-warn { font-size: 11px; color: var(--warning-text, #8a5200); background: var(--warning-bg, #FEF3E2); border-radius: var(--radius); padding: 5px 10px; margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }
  .calc-grade-row { display: grid; grid-template-columns: 1fr 64px 80px 32px; gap: 7px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); }
  .calc-grade-row:last-of-type { border-bottom: none; }
  .calc-grade-row input { padding: 5px 8px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--bg); font-size: 12px; font-family: 'Inter', sans-serif; color: var(--text); outline: none; width: 100%; }
  .calc-grade-row input:focus { border-color: var(--purple-mid); }
  .calc-grade-row input.center { text-align: center; }
  .calc-grade-del { background: none; border: none; cursor: pointer; color: var(--text-tertiary); font-size: 14px; padding: 2px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }
  .calc-grade-del:hover { color: var(--danger-text); background: rgba(192,57,43,0.08); }
  .calc-add-row-btn { font-size: 12px; color: var(--text-secondary); background: none; border: 1px dashed var(--border-mid); border-radius: var(--radius); padding: 6px 10px; cursor: pointer; width: 100%; text-align: center; margin-top: 8px; transition: all 0.12s; font-family: 'Inter', sans-serif; }
  .calc-add-row-btn:hover { border-color: var(--purple-mid); color: var(--purple); }
  .calc-syllabus-btn { font-size: 11px; color: var(--text-tertiary); background: none; border: none; border-radius: var(--radius); padding: 4px 6px; cursor: pointer; width: 100%; text-align: center; margin-top: 4px; font-family: 'Inter', sans-serif; display: flex; align-items: center; justify-content: center; gap: 5px; transition: color 0.12s; }
  .calc-syllabus-btn:hover { color: var(--purple); }
  .syllabus-drop-zone { border: 2px dashed var(--border-mid); border-radius: var(--radius-lg); padding: 28px 20px; text-align: center; cursor: pointer; transition: border-color 0.15s; margin-top: 6px; }
  .syllabus-drop-zone:hover, .syllabus-drop-zone.dragging { border-color: var(--purple); }
  .syllabus-browse-link { color: var(--purple); cursor: pointer; font-weight: 500; }

  /* Multi-course syllabus upload — one fixed slot per enrolled course, no
     filename matching needed since the course is already labeled. */
  .syllabus-entry { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 13px; margin-top: 10px; }
  .syllabus-entry.done { background: var(--success-bg); border-color: transparent; }
  .syllabus-entry-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
  .syllabus-entry-icon { width: 26px; height: 26px; border-radius: var(--radius); background: var(--purple-light); color: var(--purple); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 13px; }
  .syllabus-entry.done .syllabus-entry-icon { background: var(--success-text); color: white; }
  .syllabus-entry-course-label { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); }
  .syllabus-entry-mode-toggle { display: flex; gap: 5px; flex-shrink: 0; }
  .syllabus-entry-mode-btn { font-size: 11px; padding: 5px 9px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--bg); color: var(--text-secondary); cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; transition: all 0.12s; }
  .syllabus-entry-mode-btn.active { background: var(--purple-light); border-color: var(--purple-mid); color: var(--purple); }
  .syllabus-entry-reupload-btn { flex-shrink: 0; font-size: 11px; padding: 5px 10px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--surface); color: var(--text-secondary); cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; transition: all 0.12s; }
  .syllabus-entry-reupload-btn:hover { border-color: var(--purple-mid); color: var(--purple); background: var(--purple-light); }
  .syllabus-entry-dropzone { border: 1.5px dashed var(--border-mid); border-radius: var(--radius); padding: 14px 10px; text-align: center; cursor: pointer; transition: border-color 0.15s; }
  .syllabus-entry-dropzone:hover, .syllabus-entry-dropzone.dragging { border-color: var(--purple); }
  .syllabus-entry-dropzone-txt { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
  .syllabus-entry-file { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); padding: 8px 10px; background: var(--bg); border-radius: var(--radius); }
  .syllabus-entry-file i { color: var(--text-tertiary); font-size: 15px; flex-shrink: 0; }
  .syllabus-entry-file span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .syllabus-entry-file-clear { flex-shrink: 0; background: none; border: none; cursor: pointer; color: var(--text-tertiary); font-size: 14px; padding: 2px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius); }
  .syllabus-entry-file-clear:hover { color: var(--danger-text); }
  .syllabus-entry-textarea { width: 100%; padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--bg); font-size: 12px; font-family: 'Inter', sans-serif; color: var(--text); outline: none; resize: vertical; min-height: 80px; }
  .syllabus-entry-textarea:focus { border-color: var(--purple-mid); }
  .syllabus-entry-status { font-size: 11px; margin-top: 8px; }
  .syllabus-entry-status.success { color: #2e7d32; }
  .syllabus-entry-status.error { color: var(--danger-text); }
  .syllabus-mode-toggle { display: flex; gap: 6px; margin-bottom: 4px; }
  .syllabus-mode-btn { flex: 1; font-size: 12px; padding: 7px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--bg); color: var(--text-secondary); cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; transition: all 0.12s; }
  .syllabus-mode-btn.active { background: var(--purple-light); border-color: var(--purple-mid); color: var(--purple); }
  .gmine-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 15px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; }
  .gmine-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .gmine-course { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }
  .gmine-credit { font-size: 10px; padding: 2px 7px; border-radius: 99px; background: var(--bg); color: var(--text-tertiary); border: 1px solid var(--border); margin-left: 5px; }
  .gmine-avg { font-size: 15px; font-weight: 700; text-align: right; }
  .gmine-letter { font-size: 11px; color: var(--text-tertiary); text-align: right; margin-top: 1px; }
  .gfeed-compose { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
  .gfeed-post { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; margin-bottom: 8px; }
  .gfeed-post-header { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
  .gfeed-post-meta { font-size: 11px; color: var(--text-tertiary); margin-left: auto; }
  .gfeed-post-course { font-size: 10px; padding: 2px 7px; border-radius: 99px; background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
  .gfeed-post-body { font-size: 13px; color: var(--text); line-height: 1.55; }
  /* COMING SOON */
  .coming-soon-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 24px; text-align: center; gap: 16px; }
  .coming-soon-icon { font-size: 48px; color: var(--purple); background: var(--purple-light); width: 80px; height: 80px; border-radius: 20px; display: flex; align-items: center; justify-content: center; }
  .coming-soon-title { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
  .coming-soon-badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--purple); background: var(--purple-light); padding: 4px 12px; border-radius: 99px; }
  .coming-soon-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.65; max-width: 420px; }

  /* STUDY TOOLS */
  /* New deck dropdown */
  .study-new-menu { position: relative; flex-shrink: 0; }
  .study-new-dropdown { position: absolute; top: calc(100% + 6px); right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 4px 20px rgba(0,0,0,0.12); min-width: 180px; overflow: hidden; z-index: 500; }
  .study-new-option { display: flex; align-items: center; gap: 9px; width: 100%; padding: 11px 14px; border: none; background: none; font-size: 13px; font-family: 'Inter', sans-serif; color: var(--text); cursor: pointer; text-align: left; transition: background 0.1s; }
  .study-new-option:hover { background: var(--bg); }
  .study-new-option i { font-size: 16px; color: var(--text-secondary); }
  /* Compose: section header rows */
  .sd-section-row { display: flex; align-items: center; gap: 7px; padding: 6px 0; border-bottom: 1px solid var(--border); }
  .sd-section-row input { flex: 1; }
  .sd-section-lbl { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-tertiary); white-space: nowrap; padding: 0 4px; }
  .sd-move-btn { background: none; border: none; cursor: pointer; color: var(--text-tertiary); font-size: 14px; padding: 2px 4px; border-radius: 4px; transition: color 0.1s; }
  .sd-move-btn:hover { color: var(--text); background: var(--bg); }
  /* Formula cheat sheet view */
  .sd-formula-view-modal { background: var(--surface); border-radius: var(--radius-xl); border: 1px solid var(--border); width: 100%; max-width: 860px; max-height: 90dvh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 48px rgba(0,0,0,0.16); }
  .sd-formula-view-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
  .sd-formula-view-title { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -0.2px; }
  .sd-formula-view-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 3px; }
  .sd-formula-view-body { overflow-y: auto; padding: 20px; -webkit-overflow-scrolling: touch; }
  .sd-cheatsheet { columns: 2; column-gap: 22px; }
  .sd-cs-section { column-span: all; border-bottom: 1.5px solid var(--text); margin: 14px 0 7px; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text); padding-bottom: 3px; }
  .sd-cs-item { break-inside: avoid; margin-bottom: 10px; }
  .sd-cs-name { font-size: 12px; font-weight: 600; color: var(--text); }
  .sd-cs-eq { font-family: 'Courier New', Courier, monospace; font-size: 13px; color: var(--text); margin: 2px 0; }
  .sd-cs-desc { font-size: 10.5px; color: var(--text-secondary); margin-top: 2px; }
  .sd-cs-units { font-size: 10px; color: var(--text-tertiary); }
  .study-sidebar-col { background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; display: flex; flex-direction: column; }
  .study-sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
  .study-sidebar-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-tertiary); }
  .study-new-deck-btn { background: none; border: 1px solid var(--border-mid); border-radius: var(--radius); width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); font-size: 16px; transition: all 0.12s; }
  .study-new-deck-btn:hover { background: var(--purple-light); color: var(--purple); border-color: var(--purple-mid); }
  .study-sidebar-section-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-tertiary); padding: 10px 12px 4px; }
  .sd-sidebar-divider { height: 1px; background: var(--border); margin: 6px 12px; }
  .study-sidebar-item { display: flex; align-items: center; gap: 9px; padding: 7px 10px; cursor: pointer; border-radius: var(--radius); margin: 0 4px 1px; transition: background 0.12s; }
  .study-sidebar-item:hover { background: var(--bg); }
  .study-sidebar-item-icon { width: 28px; height: 28px; border-radius: var(--radius); background: var(--purple-light); color: var(--purple); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
  .study-sidebar-item-icon.formula { background: var(--success-bg); color: var(--success-text); }
  .study-sidebar-item-body { flex: 1; min-width: 0; }
  .study-sidebar-item-name { font-size: 12.5px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .study-sidebar-item-meta { display: flex; align-items: center; gap: 4px; margin-top: 1px; font-size: 11px; color: var(--text-tertiary); }
  .study-sidebar-item-type-lbl { font-weight: 600; }
  .study-sidebar-item-course { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .study-sidebar-item-lock { font-size: 11px; color: var(--text-tertiary); flex-shrink: 0; }
  .sd-sidebar-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--text-tertiary); padding: 24px 16px; text-align: center; line-height: 1.5; }
  .sd-sidebar-empty i { font-size: 22px; opacity: 0.4; }
  .study-main-col { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
  .study-tabs-row { display: flex; align-items: center; gap: 10px; padding: 14px 18px 0; border-bottom: 1px solid var(--border); flex-shrink: 0; }
  .study-tabs { display: flex; gap: 2px; }
  .study-tab { padding: 7px 14px; border: none; background: none; font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; font-family: 'Inter', sans-serif; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.12s; border-radius: var(--radius) var(--radius) 0 0; }
  .study-tab.active { color: var(--purple); border-bottom-color: var(--purple); background: var(--purple-light); }
  .study-library-filters { display: flex; gap: 8px; margin-left: auto; padding-bottom: 12px; }
  #study-mine-panel, #study-library-panel { flex: 1; overflow-y: auto; padding: 16px 18px; }
  .sd-deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
  .sd-deck-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
  .sd-deck-card-top { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
  .sd-deck-type-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 99px; background: var(--purple-light); color: var(--purple); display: inline-flex; align-items: center; gap: 4px; }
  .sd-deck-type-badge.formula { background: var(--success-bg); color: var(--success-text); }
  .sd-deck-private-badge { font-size: 11px; color: var(--text-tertiary); }
  .sd-deck-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
  .sd-deck-tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); align-self: flex-start; }
  .sd-deck-meta { font-size: 11px; color: var(--text-tertiary); display: flex; gap: 8px; }
  .sd-deck-creator { font-size: 11px; color: var(--text-secondary); }
  .sd-deck-forks { font-size: 11px; color: var(--text-tertiary); display: flex; align-items: center; gap: 3px; }
  .sd-stars { display: flex; gap: 2px; }
  .sd-star { font-size: 14px; cursor: pointer; color: var(--text-tertiary); transition: color 0.1s; }
  .sd-star:hover, .sd-star.rated { color: #f5a623; }
  .sd-deck-actions { display: flex; gap: 6px; margin-top: 4px; }
  .sd-btn { font-size: 12px; padding: 5px 10px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--surface); color: var(--text); cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; transition: background 0.1s; }
  .sd-btn:hover { background: var(--bg); }
  .sd-btn-study { background: var(--purple); border-color: var(--purple); color: white; }
  .sd-btn-study:hover { opacity: 0.9; background: var(--purple); }
  .sd-btn-danger { color: var(--danger-text); border-color: var(--danger-text); }
  .sd-btn-danger:hover { background: rgba(192,57,43,0.08); }
  .sd-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; gap: 8px; color: var(--text-tertiary); text-align: center; font-size: 13px; }
  .sd-empty-state i { font-size: 32px; margin-bottom: 4px; }

  /* Compose modal */
  .study-compose-modal { max-width: 640px; max-height: 80vh; display: flex; flex-direction: column; }
  .study-compose-modal .cmem-head { flex-shrink: 0; }
  .study-compose-modal > .notes-form-field,
  .study-compose-modal > .notes-form-row { flex-shrink: 0; }
  .study-type-toggle { display: flex; border: 1px solid var(--border-mid); border-radius: var(--radius); overflow: hidden; }
  .study-type-btn { flex: 1; padding: 7px 10px; border: none; background: var(--bg); color: var(--text-secondary); font-size: 12px; font-weight: 500; cursor: pointer; font-family: 'Inter', sans-serif; transition: all 0.12s; }
  .study-type-btn.active { background: var(--purple); color: white; }
  #study-compose-cards-wrap { flex: 1; overflow-y: auto; margin: 0 -2px; padding: 0 2px; }
  .sd-cards-header { display: grid; grid-template-columns: 1fr 1fr 24px; gap: 7px; padding: 4px 0; margin-bottom: 4px; }
  .sd-formula-header { grid-template-columns: 1fr 1fr 1.2fr 0.7fr 24px; }
  .sd-cards-header span { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); }
  .sd-card-row { display: grid; grid-template-columns: 1fr 1fr 24px; gap: 7px; margin-bottom: 6px; align-items: center; }
  .sd-formula-row { grid-template-columns: 1fr 1fr 1.2fr 0.7fr 24px; }
  .sd-card-input { padding: 6px 8px !important; font-size: 12px !important; }
  .study-add-card-btn { font-size: 12px; color: var(--text-secondary); background: none; border: 1px dashed var(--border-mid); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; width: 100%; margin-top: 6px; font-family: 'Inter', sans-serif; transition: all 0.12s; display: flex; align-items: center; justify-content: center; gap: 5px; }
  .study-add-card-btn:hover { border-color: var(--purple-mid); color: var(--purple); }
  .sd-card-del { font-size: 13px !important; width: 24px !important; height: 24px !important; padding: 0 !important; }

  /* Flip mode */
  #study-flip-overlay { position: fixed; inset: 0; background: var(--surface); z-index: 2000; display: flex; flex-direction: column; align-items: center; }
  .study-flip-header { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
  .study-flip-close-btn { background: none; border: 1px solid var(--border); border-radius: var(--radius); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); font-size: 16px; }
  .study-flip-title { font-size: 14px; font-weight: 600; color: var(--text); }
  .study-flip-progress-text { font-size: 13px; color: var(--text-tertiary); }
  .study-flip-progress-bar-wrap { width: 100%; height: 3px; background: var(--border); flex-shrink: 0; }
  .study-flip-bar { height: 100%; background: var(--purple); transition: width 0.3s ease; width: 0; }
  .study-flip-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 16px; min-height: 0; }
  .study-flip-card { width: min(520px, 90vw); height: min(320px, 50vh); perspective: 1000px; cursor: pointer; }
  .study-flip-card-inner { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.4s ease; }
  .study-flip-card-inner.flipped { transform: rotateY(180deg); }
  .study-flip-front, .study-flip-back { position: absolute; inset: 0; backface-visibility: hidden; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-xl); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; overflow-y: auto; text-align: center; }
  .study-flip-back { transform: rotateY(180deg); }
  .sd-flip-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-tertiary); margin-bottom: 12px; }
  .sd-flip-sublabel { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-tertiary); margin-top: 10px; margin-bottom: 4px; }
  .sd-flip-content { font-size: 18px; font-weight: 600; color: var(--text); line-height: 1.4; }
  .sd-flip-subcontent { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
  .study-flip-hint { font-size: 12px; color: var(--text-tertiary); }
  .study-flip-actions { display: flex; gap: 14px; flex-shrink: 0; padding-bottom: 24px; }
  .study-flip-btn { font-size: 14px; font-weight: 600; padding: 12px 28px; border-radius: var(--radius-lg); border: none; cursor: pointer; font-family: 'Inter', sans-serif; display: flex; align-items: center; gap: 7px; transition: opacity 0.1s; }
  .study-flip-unknown { background: var(--bg); color: var(--text); border: 1.5px solid var(--border-mid); }
  .study-flip-known   { background: var(--purple); color: white; }
  .study-flip-btn:hover { opacity: 0.85; }
  .study-flip-complete { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 24px; }
  .study-flip-complete-icon { font-size: 40px; color: var(--purple); }
  .study-flip-complete-title { font-size: 22px; font-weight: 700; color: var(--text); }
  .study-flip-complete-stats { font-size: 14px; color: var(--text-secondary); }

  /* HACKATHONS */
  .hk { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 8px; display: flex; align-items: flex-start; gap: 13px; }
  .hk-icon { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
  .hk-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
  .hk-meta { font-size: 11px; color: var(--text-tertiary); }
  .hk-tags { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
  .hk-btn { margin-left: auto; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--purple-mid); background: var(--purple-light); color: var(--purple); font-size: 12px; cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; flex-shrink: 0; align-self: center; transition: opacity 0.1s; }
  .hk-btn:hover { opacity: 0.8; }

  /* CLUBS */
  /* CLUBS — WesternLink integration */
  .clubs-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
  .clubs-page-title { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
  .clubs-page-sub { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
  .clubs-browse-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius); background: var(--purple); color: white; font-size: 13px; font-weight: 500; font-family: 'Inter', sans-serif; text-decoration: none; white-space: nowrap; flex-shrink: 0; transition: opacity 0.1s; }
  .clubs-browse-btn:hover { opacity: 0.88; }
  .clubs-search-wrap { display: flex; gap: 8px; }
  .clubs-search-inner { flex: 1; position: relative; }
  .clubs-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 15px; color: var(--text-tertiary); pointer-events: none; }
  .clubs-search-input { width: 100%; padding: 10px 12px 10px 36px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--surface); font-size: 13px; font-family: 'Inter', sans-serif; color: var(--text); outline: none; }
  .clubs-search-input:focus { border-color: var(--purple-mid); }
  .clubs-search-btn { padding: 10px 18px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer; white-space: nowrap; flex-shrink: 0; transition: background 0.12s; }
  .clubs-search-btn:hover { background: var(--bg); }
  .clubs-cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .clubs-cat-card { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 16px; text-decoration: none; transition: border-color 0.12s, box-shadow 0.12s; cursor: pointer; }
  .clubs-cat-card:hover { border-color: var(--purple-mid); box-shadow: 0 2px 10px rgba(83,74,183,0.1); }
  .clubs-cat-icon { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
  .clubs-cat-name { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }
  .clubs-cat-cta { font-size: 12px; font-weight: 500; color: var(--purple); }
  .clubs-westernlink-note { display: flex; align-items: center; gap: 7px; margin-top: 28px; font-size: 12px; color: var(--text-tertiary); }
  .clubs-westernlink-note i { font-size: 14px; flex-shrink: 0; }
  /* Keep legacy classes in case anything references them */
  .clubs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
  .club { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
  .club-icon { width: 38px; height: 38px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 10px; }
  .club-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
  .club-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.45; margin-bottom: 10px; }
  .club-btn { width: 100%; padding: 7px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: transparent; font-size: 12px; color: var(--text-secondary); cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; transition: all 0.12s; }
  .club-btn:hover { border-color: var(--purple-mid); color: var(--purple); background: var(--purple-light); }
  .club-btn.joined { background: var(--success-bg); border-color: #7cc9a0; color: var(--success-text); }

  /* MODAL */
  .modal-overlay { display: none; position: absolute; inset: 0; background: rgba(0,0,0,0.35); border-radius: var(--radius-lg); align-items: center; justify-content: center; z-index: 50; }
  .modal-overlay.open { display: flex; }
  .modal { background: var(--surface); border-radius: var(--radius-xl); border: 1px solid var(--border); width: 360px; max-width: calc(100vw - 28px); padding: 22px; box-shadow: 0 8px 30px rgba(0,0,0,0.12); }
  #grade-modal-inner { width: 400px; }
  .modal-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
  .modal-sub { font-size: 12px; color: var(--text-secondary); margin-bottom: 18px; line-height: 1.5; }
  .frow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
  .fgroup { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
  .flabel { font-size: 11px; font-weight: 500; color: var(--text-secondary); }
  .fgroup select, .fgroup input, .fgroup textarea { padding: 9px 11px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--bg); font-size: 13px; font-family: 'Inter', sans-serif; color: var(--text); outline: none; width: 100%; }
  .fgroup select:focus, .fgroup input:focus, .fgroup textarea:focus { border-color: var(--purple-mid); }
  .fgroup textarea { resize: none; height: 75px; line-height: 1.5; }
  .share-row { display: flex; align-items: center; gap: 10px; padding: 11px 13px; background: var(--bg); border-radius: var(--radius); margin-bottom: 16px; cursor: pointer; }
  .toggle { width: 32px; height: 18px; border-radius: 99px; background: var(--border-mid); position: relative; transition: background 0.15s; flex-shrink: 0; }
  .toggle.on { background: var(--purple); }
  .toggle-k { width: 14px; height: 14px; border-radius: 50%; background: white; position: absolute; top: 2px; left: 2px; transition: left 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
  .toggle.on .toggle-k { left: 16px; }
  .share-lbl { font-size: 13px; font-weight: 500; color: var(--text); }
  .share-sub { font-size: 11px; color: var(--text-tertiary); }
  .mactions { display: flex; gap: 9px; }
  .btn-cancel { flex: 1; padding: 9px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: transparent; font-size: 13px; color: var(--text-secondary); cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; transition: background 0.1s; }
  .btn-cancel:hover { background: var(--bg); }
  .btn-submit { flex: 1; padding: 9px; border-radius: var(--radius); border: none; background: var(--purple); color: white; font-size: 13px; cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; transition: opacity 0.1s; }
  .btn-submit:hover { opacity: 0.85; }

  /* TOAST */
  .toast { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1a1a1a; color: white; font-size: 12px; padding: 9px 18px; border-radius: 99px; opacity: 0; transition: opacity 0.2s; pointer-events: none; white-space: nowrap; z-index: 100; font-weight: 500; }
  .toast.show { opacity: 1; }

  /* SYLLABUS BANNER */
  .syllabus-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--warning-bg); border: 1px solid #f0c060; border-radius: var(--radius-lg); margin-bottom: 16px; cursor: pointer; transition: opacity 0.1s; }
  .syllabus-banner:hover { opacity: 0.85; }
  .syllabus-banner i { font-size: 20px; color: var(--warning-text); }
  .sb-title { font-size: 13px; font-weight: 600; color: var(--warning-text); }
  .sb-sub { font-size: 11px; color: #92530a; margin-top: 1px; }
  .sb-btn { margin-left: auto; padding: 6px 12px; border-radius: var(--radius); border: 1px solid #d4860a; background: white; color: var(--warning-text); font-size: 11px; cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; white-space: nowrap; }

  /* AI TUTOR PAGE */
  .ai-tutor-wrap { display: grid; grid-template-columns: 262px 1fr; height: calc(100vh - 60px); margin: -20px -22px; }
  .ait-left { border-right: 1px solid var(--border); overflow-y: auto; background: var(--surface); padding: 10px 8px; display: flex; flex-direction: column; }
  .ait-sec-lbl { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; padding: 8px 8px 5px; font-weight: 600; }
  .ait-subject { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: var(--radius); cursor: pointer; margin-bottom: 1px; transition: all 0.12s; border: 1.5px solid transparent; }
  .ait-subject:hover { background: var(--bg); }
  .ait-subject.active { background: var(--purple-light); border-color: var(--purple-mid); }
  .ait-subj-icon { width: 30px; height: 30px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
  .ait-subj-name { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.3; }
  .ait-subject.active .ait-subj-name { color: var(--purple); }
  .ait-subj-course { font-size: 10px; color: var(--text-tertiary); margin-top: 1px; }
  .ait-divider { height: 1px; background: var(--border); margin: 8px 4px; flex-shrink: 0; }
  .ait-material-item { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-radius: var(--radius); cursor: pointer; margin-bottom: 1px; transition: background 0.1s; }
  .ait-material-item:hover { background: var(--bg); }
  .ait-material-item.selected { background: var(--purple-light); }
  .ait-mat-check { width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid var(--border-mid); background: var(--surface); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.12s; }
  .ait-material-item.selected .ait-mat-check { background: var(--purple); border-color: var(--purple); }
  .ait-mat-check i { font-size: 9px; color: white; display: none; }
  .ait-material-item.selected .ait-mat-check i { display: block; }
  .ait-mat-info { min-width: 0; }
  .ait-mat-name { font-size: 11px; color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ait-mat-meta { font-size: 10px; color: var(--text-tertiary); }
  .ait-upload-btn { margin: 8px 4px 4px; padding: 8px; border-radius: var(--radius); border: 1.5px dashed var(--border-mid); background: transparent; font-size: 11px; color: var(--text-secondary); cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; transition: all 0.12s; display: flex; align-items: center; justify-content: center; gap: 5px; flex-shrink: 0; }
  .ait-upload-btn:hover { border-color: var(--purple-mid); color: var(--purple); background: var(--purple-light); }
  .ait-right { display: flex; flex-direction: column; background: var(--bg); min-height: 0; }
  .ait-top { background: var(--surface); border-bottom: 1px solid var(--border); padding: 11px 18px; display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
  .ait-top-info { flex: 1; min-width: 0; }
  .ait-current-subj { font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: -0.2px; }
  .ait-current-desc { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
  .ait-mode-tabs { display: flex; gap: 3px; flex-shrink: 0; }
  .ait-mode { font-size: 12px; padding: 6px 13px; border-radius: 99px; border: 1px solid var(--border); cursor: pointer; color: var(--text-secondary); background: var(--surface); transition: all 0.12s; font-weight: 500; user-select: none; }
  .ait-mode:hover { border-color: var(--border-mid); color: var(--text); }
  .ait-mode.active { background: var(--purple); border-color: var(--purple); color: white; }
  .ait-pane { display: none; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }
  .ait-pane.active { display: flex; }
  .ait-msgs { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
  .ait-msg { display: flex; gap: 9px; max-width: 84%; }
  .ait-msg.me { align-self: flex-end; flex-direction: row-reverse; }
  .ait-msg-ava { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 600; flex-shrink: 0; margin-top: 2px; }
  .ait-bubble { padding: 10px 13px; border-radius: var(--radius-lg); font-size: 13px; line-height: 1.58; }
  .ait-msg.them .ait-bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 4px var(--radius-lg) var(--radius-lg) var(--radius-lg); color: var(--text); }
  .ait-msg.me .ait-bubble { background: var(--purple); color: white; border-radius: var(--radius-lg) 4px var(--radius-lg) var(--radius-lg); }
  .ait-msg-typing .ait-bubble { display: flex; gap: 4px; align-items: center; padding: 13px 15px; }
  .ait-msg-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-tertiary); animation: aitbounce 1.2s infinite; }
  .ait-msg-typing span:nth-child(2) { animation-delay: .18s; }
  .ait-msg-typing span:nth-child(3) { animation-delay: .36s; }
  @keyframes aitbounce { 0%,80%,100%{transform:translateY(0)} 40%{transform:translateY(-5px)} }
  .ait-quick-btns { padding: 6px 18px 10px; display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
  .ait-quick { font-size: 11px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--border-mid); background: var(--surface); color: var(--text-secondary); cursor: pointer; font-family: 'Inter',sans-serif; transition: all 0.1s; }
  .ait-quick:hover { border-color: var(--purple-mid); color: var(--purple); background: var(--purple-light); }
  .ait-input-row { padding: 12px 18px; background: var(--surface); border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
  .ait-input { flex: 1; padding: 10px 14px; border-radius: var(--radius-lg); border: 1px solid var(--border-mid); background: var(--bg); font-size: 13px; font-family: 'Inter', sans-serif; color: var(--text); outline: none; }
  .ait-input:focus { border-color: var(--purple-mid); background: var(--surface); }
  .ait-quiz-wrap { flex: 1; overflow-y: auto; padding: 28px; display: flex; flex-direction: column; align-items: center; }
  .ait-quiz-header { width: 100%; max-width: 580px; display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
  .ait-quiz-bar { flex: 1; height: 4px; background: var(--border); border-radius: 99px; overflow: hidden; }
  .ait-quiz-fill { height: 100%; background: var(--purple); border-radius: 99px; transition: width 0.4s; }
  .ait-quiz-counter { font-size: 12px; color: var(--text-tertiary); font-weight: 500; white-space: nowrap; }
  .ait-quiz-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 26px; width: 100%; max-width: 580px; }
  .ait-quiz-q { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.5; margin-bottom: 20px; }
  .ait-choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
  .ait-choice { padding: 11px 14px; border-radius: var(--radius); border: 1.5px solid var(--border); background: var(--bg); font-size: 13px; color: var(--text); cursor: pointer; transition: all 0.12s; display: flex; align-items: center; gap: 10px; user-select: none; }
  .ait-choice:not(.locked):hover { border-color: var(--purple-mid); background: var(--purple-light); color: var(--purple); }
  .ait-choice.correct { border-color: #7cc9a0; background: var(--success-bg); color: var(--success-text); }
  .ait-choice.wrong { border-color: #e8a0a0; background: var(--danger-bg); color: var(--danger-text); }
  .ait-choice.locked { cursor: default; }
  .ait-choice-ltr { width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,0.06); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
  .ait-explain { font-size: 12px; color: var(--info-text); line-height: 1.6; padding: 11px 13px; background: var(--info-bg); border-radius: var(--radius); margin-bottom: 14px; display: none; border-left: 3px solid var(--info-text); }
  .ait-next-btn { width: 100%; padding: 10px; border-radius: var(--radius); border: none; background: var(--purple); color: white; font-size: 13px; cursor: pointer; font-family: 'Inter',sans-serif; font-weight: 500; transition: opacity 0.1s; display: none; }
  .ait-next-btn:hover { opacity: 0.85; }
  .ait-quiz-done { text-align: center; padding: 52px 20px; width: 100%; max-width: 580px; }
  .ait-quiz-score-n { font-size: 58px; font-weight: 700; color: var(--purple); letter-spacing: -3px; line-height: 1; }
  .ait-quiz-score-l { font-size: 14px; color: var(--text-secondary); margin-top: 8px; }
  .ait-quiz-retry { margin-top: 20px; padding: 10px 24px; border-radius: var(--radius); border: 1px solid var(--purple-mid); background: var(--purple-light); color: var(--purple); font-size: 13px; cursor: pointer; font-family: 'Inter',sans-serif; font-weight: 500; }
  .ait-fc-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 30px 28px; overflow-y: auto; }
  .ait-fc-progress { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
  .ait-fc-nav { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); transition: all 0.1s; font-size: 15px; }
  .ait-fc-nav:hover { border-color: var(--purple-mid); color: var(--purple); background: var(--purple-light); }
  .ait-fc-count { font-size: 13px; color: var(--text-secondary); font-weight: 500; min-width: 60px; text-align: center; }
  .ait-fc-scene { width: 100%; max-width: 500px; height: 230px; perspective: 1200px; cursor: pointer; margin-bottom: 16px; }
  .ait-fc-inner { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.5s cubic-bezier(.4,0,.2,1); }
  .ait-fc-inner.flipped { transform: rotateY(180deg); }
  .ait-fc-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--radius-xl); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 26px 30px; text-align: center; border: 1px solid var(--border); }
  .ait-fc-front { background: var(--surface); }
  .ait-fc-back { background: var(--purple); border-color: var(--purple); transform: rotateY(180deg); }
  .ait-fc-side-lbl { font-size: 9px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; margin-bottom: 12px; }
  .ait-fc-front .ait-fc-side-lbl { color: var(--text-tertiary); }
  .ait-fc-back .ait-fc-side-lbl { color: rgba(255,255,255,0.55); }
  .ait-fc-q { font-size: 17px; font-weight: 600; color: var(--text); line-height: 1.45; }
  .ait-fc-a { font-size: 13px; color: white; line-height: 1.65; font-weight: 400; }
  .ait-fc-hint { font-size: 11px; color: var(--text-tertiary); margin-top: 12px; }
  .ait-fc-btns { display: flex; gap: 10px; margin-top: 2px; }
  .ait-fc-btn { padding: 8px 22px; border-radius: var(--radius); font-size: 12px; cursor: pointer; font-family: 'Inter',sans-serif; font-weight: 500; border: 1px solid var(--border-mid); background: var(--surface); color: var(--text-secondary); transition: all 0.1s; }
  .ait-fc-btn.know { border-color: #7cc9a0; color: var(--success-text); background: var(--success-bg); }
  .ait-fc-btn.again { border-color: #e8a0a0; color: var(--danger-text); background: var(--danger-bg); }

  /* AUTH */
  /* Pre-login is always the clean white + orange look, regardless of the
     post-login light/dark toggle — overriding the app tokens here means every
     existing rule below (var(--surface), var(--text), var(--border), ...)
     just inherits this palette for free. */
  .auth-overlay, .landing-page {
    --bg: #FFFFFF;
    --surface: #F9FAFB;
    --border: #E5E7EB;
    --border-mid: #D1D5DB;
    --text: #111827;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
  }
  .auth-overlay { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 20px; overflow-y: auto; }
  .auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 36px 40px; width: 100%; max-width: 440px; box-shadow: 0 12px 48px rgba(0,0,0,0.1); margin: auto; }
  .auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
  .auth-logo-mark { width: 34px; height: 34px; background: var(--purple); border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .auth-logo-mark i { font-size: 18px; color: white; }
  .auth-logo-name { font-size: 18px; font-weight: 600; color: var(--text); letter-spacing: -0.4px; }
  .auth-title { font-size: 20px; font-weight: 600; color: var(--text); letter-spacing: -0.5px; margin-bottom: 4px; }
  .auth-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.5; }
  .auth-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
  .auth-label { font-size: 11px; font-weight: 500; color: var(--text-secondary); }
  .auth-input { padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--bg); font-size: 13px; font-family: 'Inter', sans-serif; color: var(--text); outline: none; width: 100%; }
  .auth-input:focus { border-color: var(--purple); background: var(--surface); box-shadow: 0 0 0 3px var(--purple-light); }
  .auth-input.err { border-color: var(--danger-text); }
  .auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .auth-field-err { font-size: 11px; color: var(--danger-text); display: none; margin-top: 2px; }
  .auth-field-err.show { display: block; }
  .auth-btn { width: 100%; padding: 11px; border-radius: var(--radius); border: none; background: var(--purple); color: white; font-size: 13px; font-weight: 600; font-family: 'Inter', sans-serif; cursor: pointer; margin-top: 6px; letter-spacing: -0.1px; transition: opacity 0.1s; }
  .auth-btn:hover { opacity: 0.87; }
  .auth-switch { text-align: center; font-size: 12px; color: var(--text-secondary); margin-top: 18px; }
  .auth-switch a { color: var(--purple); font-weight: 500; cursor: pointer; text-decoration: none; }
  .auth-switch a:hover { text-decoration: underline; }
  .auth-test-btn { width: 100%; padding: 11px; border-radius: var(--radius); border: 1.5px solid var(--purple-mid); background: var(--surface); color: var(--purple); font-size: 13px; font-weight: 600; font-family: 'Inter', sans-serif; cursor: pointer; margin-top: 8px; letter-spacing: -0.1px; transition: background 0.15s; display: flex; align-items: center; justify-content: center; gap: 7px; }
  .auth-test-btn:hover { background: var(--purple-light); }
  .auth-test-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; font-size: 11px; color: var(--text-tertiary); }
  .auth-test-divider::before, .auth-test-divider::after { content:''; flex:1; height:1px; background: var(--border); }
  /* progress bar */
  .auth-progress-wrap { height: 3px; background: var(--border); border-radius: 99px; margin-bottom: 26px; overflow: hidden; }
  .auth-progress-fill { height: 100%; background: var(--purple); border-radius: 99px; transition: width 0.4s cubic-bezier(.4,0,.2,1); }
  /* step header */
  .auth-step-top { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
  .auth-back { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border-mid); background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); flex-shrink: 0; transition: all 0.12s; padding: 0; }
  .auth-back:hover { background: var(--bg); color: var(--text); }
  .auth-step-lbl { font-size: 11px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; }
  /* course chips */
  .auth-add-row { display: flex; gap: 8px; }
  .auth-add-btn { padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--purple-mid); background: var(--purple-light); color: var(--purple); font-size: 13px; font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer; white-space: nowrap; flex-shrink: 0; transition: opacity 0.1s; }
  .auth-add-btn:hover { opacity: 0.8; }
  .course-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-height: 28px; }
  .course-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; background: var(--purple-light); color: var(--purple); border-radius: 99px; font-size: 12px; font-weight: 600; border: 1px solid var(--purple-mid); }
  .chip-x { cursor: pointer; font-size: 15px; line-height: 1; opacity: 0.55; margin-left: 1px; }
  .chip-x:hover { opacity: 1; }
  .auth-course-hint { font-size: 11px; color: var(--text-tertiary); margin-top: 8px; }
  .auth-course-results { position: absolute; top: calc(100% + 2px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border-mid); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,0.12); z-index: 200; max-height: 220px; overflow-y: auto; }
  .auth-course-result { padding: 9px 12px; cursor: pointer; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border); }
  .auth-course-result:last-child { border-bottom: none; }
  .auth-course-result:hover { background: var(--bg); }
  .auth-course-result-code { font-weight: 600; }
  .auth-course-result-name { color: var(--text-secondary); margin-left: 6px; }
  /* verify */
  .auth-verify-icon { width: 58px; height: 58px; border-radius: 50%; background: var(--purple-light); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
  .auth-verify-icon i { font-size: 26px; color: var(--purple); }
  .auth-resend { background: transparent; border: 1px solid var(--border-mid); border-radius: var(--radius); padding: 8px 16px; font-size: 12px; color: var(--text-secondary); cursor: pointer; font-family: 'Inter', sans-serif; transition: all 0.12s; }
  .auth-resend:not(:disabled):hover { border-color: var(--purple-mid); color: var(--purple); }
  .auth-resend:disabled { opacity: 0.45; cursor: default; }
  /* fade-in animation */
  @keyframes authFade { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
  .auth-fade { animation: authFade 0.22s ease both; }
  /* dashboard fade-in */
  @keyframes dashFade { from { opacity:0; } to { opacity:1; } }
  .dash-fade { animation: dashFade 0.3s ease both; }
  .sidebar-user { cursor: pointer; }
  .sidebar-user:hover { background: var(--bg); border-radius: var(--radius); }
  @media (max-width: 500px) { .auth-card { padding: 28px 22px; } .auth-row { grid-template-columns: 1fr; } }

  /* PROFILE */
  .profile-header { display: flex; align-items: flex-start; gap: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 14px; }
  .profile-ava-wrap { position: relative; flex-shrink: 0; cursor: pointer; }
  .profile-ava { width: 80px; height: 80px; border-radius: 50%; background: var(--purple-light); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: var(--purple); overflow: hidden; user-select: none; }
  .profile-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .profile-ava-overlay { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.15s; }
  .profile-ava-wrap:hover .profile-ava-overlay { opacity: 1; }
  .profile-ava-overlay i { font-size: 20px; color: white; }
  .profile-header-info { flex: 1; min-width: 0; }
  .profile-display-name { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; margin-bottom: 3px; }
  .profile-display-email { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
  .profile-display-tags { display: flex; flex-wrap: wrap; gap: 6px; }
  .profile-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; padding: 4px 10px; border-radius: 99px; }
  .profile-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; margin-bottom: 12px; }
  .profile-section-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 16px; letter-spacing: -0.1px; }
  .profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .profile-field { display: flex; flex-direction: column; gap: 5px; }
  .profile-label { font-size: 11px; font-weight: 500; color: var(--text-secondary); }
  .profile-input { padding: 9px 11px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--bg); font-size: 13px; font-family: 'Inter', sans-serif; color: var(--text); outline: none; width: 100%; }
  .profile-input:focus { border-color: var(--purple-mid); background: var(--surface); }
  .profile-textarea { resize: none; height: 80px; line-height: 1.55; }
  .profile-actions { display: flex; align-items: center; justify-content: space-between; }
  .profile-save-btn { padding: 10px 22px; border-radius: var(--radius); border: none; background: var(--purple); color: white; font-size: 13px; font-weight: 600; font-family: 'Inter', sans-serif; cursor: pointer; transition: opacity 0.1s; }
  .profile-save-btn:hover { opacity: 0.87; }
  .profile-signout-btn { padding: 9px 18px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: transparent; font-size: 13px; color: var(--text-secondary); font-family: 'Inter', sans-serif; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.12s; }
  .profile-signout-btn:hover { border-color: var(--danger-text); color: var(--danger-text); background: var(--danger-bg); }

  /* ── SEMESTER SWITCHER ──────────────────────────────────────────────── */
  .sem-switcher { position: relative; }
  .sem-pill { display: flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 99px; border: 1px solid var(--border-mid); background: var(--surface); font-size: 12px; font-weight: 600; color: var(--text); cursor: pointer; user-select: none; transition: all 0.12s; white-space: nowrap; }
  .sem-pill:hover { border-color: var(--purple); color: var(--purple); }
  .sem-pill i { font-size: 11px; transition: transform 0.15s; }
  .sem-pill.open i { transform: rotate(180deg); }
  .sem-dropdown { position: absolute; top: calc(100% + 6px); right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 4px 24px rgba(0,0,0,0.1); min-width: 190px; z-index: 200; overflow: hidden; display: none; }
  .sem-dropdown.open { display: block; }
  .sem-opt { display: flex; align-items: center; gap: 9px; padding: 10px 14px; font-size: 12px; color: var(--text); cursor: pointer; transition: background 0.1s; }
  .sem-opt:hover { background: var(--bg); }
  .sem-opt.active { color: var(--purple); font-weight: 600; }
  .sem-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
  .sem-archived-lbl { font-size: 10px; color: var(--text-tertiary); margin-left: auto; font-weight: 500; }

  /* ── ARCHIVED BANNER ────────────────────────────────────────────────── */
  .archived-banner { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--warning-bg); border: 1px solid #e8b84b; border-radius: var(--radius-lg); margin-bottom: 16px; }
  .archived-banner i { font-size: 15px; color: var(--warning-text); flex-shrink: 0; }
  .archived-banner-text { font-size: 12px; font-weight: 500; color: var(--warning-text); flex: 1; }
  .archived-banner-btn { padding: 5px 12px; border-radius: var(--radius); border: 1px solid var(--warning-text); background: transparent; font-size: 11px; color: var(--warning-text); cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; transition: all 0.12s; white-space: nowrap; }
  .archived-banner-btn:hover { background: var(--warning-text); color: white; }

  /* ── ARCHIVED MODE ──────────────────────────────────────────────────── */
  .archived-mode .chat-input-row { display: none !important; }
  .archived-mode #log-grade-btn { display: none !important; }
  .archived-mode .upload-zone { display: none !important; }
  .archived-mode .syllabus-banner { display: none !important; }
  .archived-mode .gen-btn { display: none !important; }
  .archived-mode .sblock-add { display: none !important; }
  .archived-mode .ait-input-row { display: none !important; }
  .archived-mode .ait-quick-btns { display: none !important; }

  /* ── NEW SEMESTER MODAL ─────────────────────────────────────────────── */
  .nsem-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 1500; padding: 20px; }
  .nsem-modal { background: var(--surface); border-radius: var(--radius-xl); border: 1px solid var(--border); width: 100%; max-width: 460px; padding: 28px 32px; box-shadow: 0 12px 48px rgba(0,0,0,0.16); max-height: 90vh; overflow-y: auto; }
  .nsem-icon { font-size: 26px; margin-bottom: 10px; }
  .nsem-title { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.4px; margin-bottom: 4px; }
  .nsem-sub { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 22px; }
  .nsem-sec-lbl { font-size: 11px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 10px; }
  .nsem-check-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
  .nsem-check-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius); border: 1px solid var(--border); cursor: pointer; transition: all 0.12s; user-select: none; }
  .nsem-check-item:hover { border-color: var(--purple-mid); background: var(--purple-light); }
  .nsem-check-item.checked { border-color: var(--purple-mid); background: var(--purple-light); }
  .nsem-checkbox { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border-mid); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.12s; }
  .nsem-check-item.checked .nsem-checkbox { background: var(--purple); border-color: var(--purple); }
  .nsem-checkbox i { font-size: 10px; color: white; display: none; }
  .nsem-check-item.checked .nsem-checkbox i { display: block; }
  .nsem-check-label { font-size: 13px; font-weight: 500; color: var(--text); }
  .nsem-divider { height: 1px; background: var(--border); margin: 16px 0; }
  .nsem-add-row { display: flex; gap: 8px; margin-bottom: 10px; }
  .nsem-input { flex: 1; padding: 9px 11px; border-radius: var(--radius); border: 1px solid var(--border-mid); background: var(--bg); font-size: 13px; font-family: 'Inter', sans-serif; color: var(--text); outline: none; transition: border-color 0.12s; }
  .nsem-input:focus { border-color: var(--purple-mid); }
  .nsem-add-btn { padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--purple-mid); background: var(--purple-light); color: var(--purple); font-size: 13px; font-weight: 500; font-family: 'Inter', sans-serif; cursor: pointer; white-space: nowrap; }
  .nsem-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; min-height: 20px; }
  .nsem-counter { font-size: 11px; color: var(--text-tertiary); margin-bottom: 18px; }
  .nsem-start-btn { width: 100%; padding: 12px; border-radius: var(--radius); border: none; background: var(--purple); color: white; font-size: 14px; font-weight: 600; font-family: 'Inter', sans-serif; cursor: pointer; transition: opacity 0.1s; letter-spacing: -0.1px; }
  .nsem-start-btn:hover:not(:disabled) { opacity: 0.87; }
  .nsem-start-btn:disabled { opacity: 0.38; cursor: default; }
  .sem-test-btn { display: block; font-size: 10px; color: var(--text-tertiary); background: none; border: 1px dashed var(--border-mid); border-radius: var(--radius); padding: 5px 10px; cursor: pointer; font-family: 'Inter', sans-serif; width: 100%; text-align: left; margin-top: 6px; transition: all 0.12s; }
  .sem-test-btn:hover { color: var(--purple); border-color: var(--purple-mid); background: var(--purple-light); }

  /* ── SEARCH OVERLAY ── */
  .search-overlay { position: fixed; inset: 0; z-index: 9000; display: flex; flex-direction: column; align-items: center; padding-top: 80px; background: rgba(0,0,0,0.45); opacity: 0; pointer-events: none; transition: opacity 0.15s; }
  .search-overlay.open { opacity: 1; pointer-events: all; }
  .search-box { width: 580px; max-width: calc(100vw - 40px); background: var(--surface); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,0.22); overflow: hidden; }
  .search-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
  .search-input-row i { font-size: 18px; color: var(--text-tertiary); flex-shrink: 0; }
  .search-main-input { flex: 1; background: none; border: none; outline: none; font-size: 15px; color: var(--text); font-family: 'Inter', sans-serif; }
  .search-main-input::placeholder { color: var(--text-tertiary); }
  .search-kbd { font-size: 11px; color: var(--text-tertiary); background: var(--bg); border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; flex-shrink: 0; }
  .search-results { max-height: 380px; overflow-y: auto; padding: 10px; }
  .search-section-label { font-size: 10px; font-weight: 600; color: var(--text-tertiary); letter-spacing: 0.5px; text-transform: uppercase; padding: 6px 8px 4px; }
  .search-result-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; cursor: pointer; transition: background 0.1s; }
  .search-result-item:hover, .search-result-item.active { background: var(--bg); }
  .search-result-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
  .search-result-text { flex: 1; min-width: 0; }
  .search-result-title { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .search-result-sub { font-size: 11px; color: var(--text-secondary); }
  .search-empty { padding: 24px; text-align: center; font-size: 13px; color: var(--text-tertiary); }

  /* ── NOTIFICATIONS DROPDOWN ── */
  .notif-dropdown { position: fixed; top: calc(100% + 8px); right: 0; width: 320px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.14); z-index: 8000; opacity: 0; pointer-events: none; transform: translateY(-6px); transition: opacity 0.15s, transform 0.15s; }
  .notif-dropdown.open { opacity: 1; pointer-events: all; transform: translateY(0); }
  .notif-header { padding: 13px 16px 10px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
  .notif-header-title { font-size: 13px; font-weight: 600; color: var(--text); }
  .notif-mark-read { font-size: 11px; color: var(--purple); cursor: pointer; }
  .notif-mark-read:hover { text-decoration: underline; }
  .notif-list { max-height: 320px; overflow-y: auto; }
  .notif-item { display: flex; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s; position: relative; }
  .notif-item:last-child { border-bottom: none; }
  .notif-item:hover { background: var(--bg); }
  .notif-item.unread::before { content:''; position:absolute; left:6px; top:50%; transform:translateY(-50%); width:5px; height:5px; border-radius:50%; background:var(--purple); }
  .notif-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; margin-top: 1px; }
  .notif-text { flex: 1; min-width: 0; }
  .notif-title { font-size: 12px; font-weight: 500; color: var(--text); line-height: 1.4; }
  .notif-time { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
  #notif-btn { position: relative; }

  /* ── SETTINGS MODAL ── */
  .settings-overlay { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.45); opacity: 0; pointer-events: none; transition: opacity 0.15s; }
  .settings-overlay.open { opacity: 1; pointer-events: all; }
  .settings-modal { width: 420px; max-width: calc(100vw - 40px); background: var(--surface); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.22); overflow: hidden; }
  .settings-modal-header { padding: 18px 20px 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
  .settings-modal-title { font-size: 15px; font-weight: 600; color: var(--text); }
  .settings-close { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); font-size: 16px; background: none; border: none; }
  .settings-close:hover { background: var(--bg); }
  .settings-body { padding: 16px 20px 20px; }
  .settings-section-title { font-size: 10px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; margin-top: 16px; }
  .settings-section-title:first-child { margin-top: 0; }
  .settings-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .settings-row:last-child { border-bottom: none; }
  .settings-row-label { font-size: 13px; color: var(--text); }
  .settings-row-sub { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
  .settings-toggle { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
  .settings-toggle input { opacity: 0; width: 0; height: 0; }
  .settings-toggle-track { position: absolute; inset: 0; border-radius: 99px; background: var(--border); cursor: pointer; transition: background 0.2s; }
  .settings-toggle input:checked + .settings-toggle-track { background: var(--purple); }
  .settings-toggle-thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform 0.2s; pointer-events: none; }
  .settings-toggle input:checked ~ .settings-toggle-thumb { transform: translateX(16px); }
  .settings-avatar-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
  .settings-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--purple-light); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600; color: var(--purple); flex-shrink: 0; }
  .settings-user-info .settings-user-name { font-size: 13px; font-weight: 600; color: var(--text); }
  .settings-user-info .settings-user-email { font-size: 11px; color: var(--text-secondary); }
  .settings-signout { width: 100%; margin-top: 14px; padding: 10px; border-radius: var(--radius); border: 1px solid var(--border); background: none; font-size: 13px; font-weight: 500; color: var(--text-secondary); font-family: 'Inter', sans-serif; cursor: pointer; transition: all 0.12s; }
  .settings-signout:hover { background: #FEF2F2; color: #DC2626; border-color: #FECACA; }

  /* ── MOBILE NAV ── */
  .mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); z-index: 300; padding-bottom: env(safe-area-inset-bottom, 0); }
  .mobile-nav-inner { display: flex; }
  .mnav-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 8px 4px 9px; cursor: pointer; color: var(--text-tertiary); font-size: 9.5px; font-weight: 500; transition: color 0.12s; user-select: none; border: none; background: none; font-family: 'Inter', sans-serif; position: relative; }
  .mnav-tab i { font-size: 22px; line-height: 1; }
  .mnav-tab.active { color: var(--purple); }
  .mnav-badge { position: absolute; top: 5px; right: calc(50% - 18px); background: #E24B4A; color: white; font-size: 8px; min-width: 14px; height: 14px; border-radius: 99px; display: flex; align-items: center; justify-content: center; padding: 0 3px; font-weight: 700; border: 1.5px solid var(--surface); }
  .mobile-back-btn { display: none; width: 34px; height: 34px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); font-size: 16px; flex-shrink: 0; transition: background 0.1s; }
  .mobile-back-btn:hover { background: var(--bg); }

  /* ── MORE DRAWER ── */
  .more-drawer { display: none; position: fixed; inset: 0; z-index: 400; }
  .more-drawer.open { display: block; }
  .more-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.38); }
  .more-panel { position: absolute; bottom: 0; left: 0; right: 0; background: var(--surface); border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom, 16px); animation: moreSlideUp 0.22s cubic-bezier(0.32,0.72,0,1); }
  @keyframes moreSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .more-handle { width: 36px; height: 4px; background: var(--border-mid); border-radius: 99px; margin: 12px auto 0; }
  .more-panel-title { font-size: 15px; font-weight: 600; color: var(--text); padding: 14px 20px 10px; letter-spacing: -0.2px; }
  .more-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px 12px 20px; }
  .more-item { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 14px 6px; border-radius: var(--radius-lg); cursor: pointer; transition: background 0.12s; user-select: none; }
  .more-item:active { background: var(--bg); }
  .more-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
  .more-lbl { font-size: 11px; font-weight: 500; color: var(--text); text-align: center; font-family: 'Inter', sans-serif; }

  /* ── RESPONSIVE: MOBILE ── */
  @media (max-width: 767px) {
    .mobile-nav { display: block; }
    .sidebar { display: none; }

    /* Topbar */
    .topbar { padding: 10px 14px; gap: 8px; }
    .search { display: none; }
    .sem-switcher { display: none; }

    /* Back button (shown via JS) */
    .mobile-back-btn { display: flex; }

    /* Pages — extra bottom padding to clear nav bar */
    .page { padding: 16px 14px 80px; }

    /* Home */
    .home-grid { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .home-stats-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .home-stat-val { font-size: 20px; }
    .home-body { grid-template-columns: 1fr; }
    .home-scratchpad { right: 12px; bottom: 76px; width: calc(100vw - 40px); max-width: 260px; }

    /* Chat — list full screen by default, detail on tap */
    .chat-wrap { grid-template-columns: 1fr; grid-template-rows: 1fr; height: calc(100svh - 56px - 58px); margin: -16px -14px 0; }
    .chat-list { height: 100%; max-height: none; overflow-y: auto; border-right: none; padding: 8px; }
    .chat-item { padding: 10px; }
    .cprev { max-width: 100%; }
    .chat-main { display: none; }
    .chat-wrap.mobile-open .chat-list { display: none; }
    .chat-wrap.mobile-open .chat-main { display: flex; flex-direction: column; height: 100%; }
    /* The page's own bottom padding is redundant with the nav-bar gap
       already subtracted in .chat-wrap's height above — left in, it makes
       #page-chats taller than the viewport and able to scroll a few px. */
    #page-chats.active, #page-ai-tutor.active { padding-bottom: 0; }

    /* Notes — tree full screen by default, folder/note contents on tap.
       CRITICAL: override sidebar-collapsed so the tree never goes 0-width on mobile
       (desktop sets grid-template-columns:0 1fr when collapsed; that blanks the page). */
    .notes-main-header-wrap { padding: 10px 14px 10px; }
    .notes-wrap, .notes-wrap.sidebar-collapsed { grid-template-columns: 1fr !important; grid-template-rows: 1fr; height: calc(100svh - 56px - 58px - 110px); margin: 0 -14px; }
    .notes-tree-col { height: 100%; overflow-y: auto; border-right: none; padding: 8px; }
    .notes-main-col { display: none; }
    .notes-wrap.mobile-open .notes-tree-col { display: none; }
    .notes-wrap.mobile-open .notes-main-col { display: flex; flex-direction: column; height: 100%; }

    /* Inputs under 16px make mobile Safari/Chrome zoom the whole page in
       on focus — bump these (and the send button's touch target) up. */
    .chat-input, .ait-input, .feed-compose-subject, .feed-compose-input, .pc-input { font-size: 16px; }
    .send-btn { width: 42px; height: 42px; }

    /* AI Tutor — subject picker as compact pill bar */
    .ai-tutor-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: calc(100svh - 56px - 58px); margin: -16px -14px 0; }
    .ait-left { flex-direction: row; overflow-x: auto; overflow-y: hidden; max-height: 52px; border-right: none; border-bottom: 1px solid var(--border); padding: 7px 10px; gap: 6px; flex-shrink: 0; align-items: center; scrollbar-width: none; }
    .ait-left::-webkit-scrollbar { display: none; }
    .ait-sec-lbl, .ait-divider, .ait-material-item, .ait-upload-btn { display: none; }
    .ait-subject { flex-direction: row; padding: 5px 12px; gap: 6px; flex-shrink: 0; border-radius: 99px; border: 1px solid var(--border-mid); background: var(--surface); min-width: 0; }
    .ait-subject.active { background: var(--purple-light); border-color: var(--purple-mid); }
    .ait-subject.active .ait-subj-name { color: var(--purple); }
    .ait-subj-icon { width: 18px; height: 18px; font-size: 10px; border-radius: 5px; }
    .ait-subj-name { font-size: 11px; white-space: nowrap; }
    .ait-subj-course { display: none; }
    .ait-right { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
    .ait-quiz-wrap { padding: 16px 14px; }
    .ait-quiz-header { max-width: 100%; }

    /* Calendar — compact everything so the full month fits without scrolling */
    #page-calendar.active { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 58px; }
    .syllabus-banner { padding: 7px 10px; gap: 8px; margin-bottom: 8px; flex-shrink: 0; }
    .syllabus-banner i { font-size: 16px; }
    .syllabus-banner .sb-title { font-size: 11.5px; }
    .syllabus-banner .sb-sub, .syllabus-banner .sb-btn { display: none; }
    .cal-header { flex-direction: column; align-items: stretch; gap: 6px; margin-bottom: 8px; flex-shrink: 0; }
    .cal-legend { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; gap: 10px; scrollbar-width: none; }
    .cal-legend::-webkit-scrollbar { display: none; }
    .cal-leg-item { flex-shrink: 0; font-size: 10.5px; }
    .cal-grid { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-bottom: 0; }
    .cal-days-header { flex-shrink: 0; }
    .cal-day-lbl { padding: 5px 0; font-size: 9px; }
    .cal-cells { flex: 1; min-height: 0; grid-auto-rows: 1fr; }
    .cal-cell { min-height: 0; padding: 3px 2px; }
    .cal-cell-num { font-size: 10.5px; width: 18px; height: 18px; margin-bottom: 1px; }
    .cal-event { font-size: 8.5px; padding: 1px 4px; margin-bottom: 1px; }

    /* AI Study Blocks plan cards — stack actions vertically on narrow screens */
    .sb-plan-card-head { flex-direction: column; gap: 10px; }
    .sb-plan-card-actions { flex-direction: row; flex-wrap: wrap; }
    .sb-plan-add-btn, .sb-plan-expand-btn { flex: 1; justify-content: center; }
    /* AI Study Blocks — settings grid 2-col, gen form stacked */
    #page-study { overflow-x: hidden; }
    .study-gen-card { overflow: hidden; }
    .sb-settings-grid { grid-template-columns: 1fr 1fr; }
    .study-gen-row { grid-template-columns: 1fr 1fr; gap: 8px; }
    .gen-btn { grid-column: 1 / -1; width: 100%; justify-content: center; }

    /* Grade calculator */
    .calc-cat-header, .calc-cat-row { grid-template-columns: 1fr 40px 70px 42px; gap: 4px; }
    .calc-gpa-bar { padding: 12px 14px; gap: 12px; }
    .career-bar { grid-template-columns: 1fr; }

    /* Notes */
    .notes-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

    /* Clubs */
    .clubs-grid { grid-template-columns: 1fr 1fr; }
    .clubs-cat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .clubs-header { flex-direction: column; gap: 10px; }
    .clubs-search-wrap { flex-direction: column; }
    .clubs-browse-btn { align-self: flex-start; }

    /* Profile */
    .profile-header { flex-direction: column; align-items: center; text-align: center; padding: 18px; gap: 14px; }

    /* Hackathons */
    .hk { flex-wrap: wrap; }
    .hk-btn { margin-left: 0; width: 100%; text-align: center; margin-top: 8px; }

    /* Modal */
    .modal { width: calc(100vw - 28px); max-width: 420px; }
    .modal-overlay { position: fixed; border-radius: 0; }

    /* Toast */
    .toast { bottom: 76px; }

    /* Grade header buttons */
    #career-stats-btn, #log-grade-btn { font-size: 12px !important; padding: 7px 10px !important; }

    /* ── STUDY TOOLS ──────────────────────────────────────────────────────── */
    #page-study.active { overflow-y: auto; }
    .study-tabs-row { flex-wrap: wrap; gap: 6px; }
    .study-library-filters { margin-left: 0; flex-wrap: wrap; }
    #study-mine-panel, #study-library-panel { overflow: visible; flex: none; padding: 14px; }
    .sd-deck-grid { grid-template-columns: 1fr; gap: 10px; }
    .study-compose-modal { max-width: 100%; max-height: 92svh; }
    .sd-formula-header, .sd-formula-row { grid-template-columns: 1fr 1fr 24px !important; }
    /* Flip mode */
    .study-flip-stage { padding: 14px; }
    .study-flip-card { width: 90vw; height: min(260px, 42vh); }
    .sd-flip-content { font-size: 16px; }
    .study-flip-btn { font-size: 13px; padding: 10px 18px; }
    .study-flip-actions { gap: 10px; padding-bottom: 16px; }
    .study-flip-close-btn { width: 44px; height: 44px; }

    /* ── MODALS: full-screen bottom sheets on mobile ─────────────────────── */
    /* All chat-members-overlay modals (note compose/view, calendar, study,
       syllabus, chat members) become bottom sheets that fill the screen. */
    .chat-members-overlay { align-items: flex-end; padding: 0; }
    .chat-members-modal {
      border-radius: 20px 20px 0 0 !important;
      max-width: 100% !important;
      max-height: 90dvh;
      padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
    }
    .nsem-overlay { align-items: flex-end; padding: 0; }
    .nsem-modal {
      border-radius: 20px 20px 0 0;
      max-width: 100%;
      padding: 20px 20px max(20px, env(safe-area-inset-bottom, 20px));
    }
    /* Grade add/edit modal — full-screen bottom sheet */
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal {
      border-radius: 20px 20px 0 0 !important;
      max-width: 100% !important;
      width: 100% !important;
      max-height: 90dvh;
      overflow-y: auto;
      padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
    }
    #grade-modal-inner { width: 100%; }

    /* ── TOUCH TARGETS: minimum 44 × 44 px ───────────────────────────────── */
    .icon-btn { width: 44px; height: 44px; }
    .cal-nav-btn { width: 44px; height: 44px; }
    .notes-sidebar-toggle-btn { width: 44px; height: 44px; }
    .send-btn { width: 44px; height: 44px; }
    .cal-event-action-btn { min-width: 44px; min-height: 44px; padding: 8px; }
    .notes-action-btn { min-height: 44px; }
    .btn-submit, .btn-cancel { min-height: 44px; }
    .sd-btn { min-height: 44px; padding: 10px 14px; }
    .calc-grade-del { min-width: 40px !important; min-height: 40px; display: flex; align-items: center; justify-content: center; }
    .grade-tab { min-height: 40px; padding: 8px; }
    .mnav-tab { min-height: 52px; }
    .sb-btn { display: none; } /* banner button hidden — tapping the banner itself opens modal */

    /* ── STUDY TOOLS FAB ────────────────────────────────────────────────── */
    .study-mobile-fab {
      display: flex;
      position: fixed;
      bottom: calc(70px + env(safe-area-inset-bottom, 0px));
      right: 16px;
      width: 52px; height: 52px;
      border-radius: 50%;
      background: var(--purple);
      color: white;
      border: none;
      align-items: center; justify-content: center;
      font-size: 24px;
      box-shadow: 0 4px 16px rgba(83,74,183,0.45);
      cursor: pointer;
      z-index: 200;
      transition: opacity 0.15s;
    }
    .study-mobile-fab:active { opacity: 0.85; }

    /* ── GRADE MODAL: single-column form rows ─────────────────────────── */
    .frow { grid-template-columns: 1fr; }
    .fgroup select, .fgroup input, .fgroup textarea { font-size: 16px; }
    .mactions { flex-direction: column; }

    /* ── INPUT FONT SIZE: ≥16px prevents iOS Safari zoom on focus ─────────── */
    .auth-input,
    .calc-grade-row input,
    .notes-form-field input, .notes-form-field select, .notes-form-field textarea,
    .form-group input, .form-group select,
    .sd-card-input,
    input[type="text"], input[type="email"], input[type="password"],
    input[type="number"], input[type="search"],
    select, textarea { font-size: 16px; }

    /* ── GRADE CALC ROW: tighter grid + force 16px on inputs ─────────────── */
    .calc-grade-row { grid-template-columns: 1fr 54px 68px 36px; gap: 4px; }
    .calc-grade-row input { font-size: 16px; }
    .calc-gpa-bar { flex-wrap: wrap; row-gap: 10px; }
    .calc-gpa-divider { display: none; }

    /* ── SCROLL MOMENTUM on all scrollable containers ─────────────────────── */
    .page, .chat-msgs, .chat-list,
    #notes-main-body, .notes-tree-col,
    #study-mine-panel, #study-library-panel,
    .chat-members-modal, .nsem-modal { -webkit-overflow-scrolling: touch; }

    /* ── FEED: compose row wraps on narrow screens ────────────────────────── */
    .feed-compose-subject-select { max-width: 100%; flex-shrink: 1; }

    /* ── NOTES: override already handled above with sidebar-collapsed fix ─── */
    #page-notes.active { overflow: hidden; padding: 0 0 0 0; }

    /* ── TOAST: clear the nav bar + safe area ─────────────────────────────── */
    .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

    /* ── SAFE AREA: page bottom padding respects home indicator ──────────── */
    .page { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
    #page-chats.active, #page-ai-tutor.active { padding-bottom: 0; }

    /* ── GLOBAL: 16px inputs prevent iOS auto-zoom on focus ──────────────── */
    input, textarea, select { font-size: 16px !important; }

    /* ── CALENDAR: Add Event modal — prevent left-side overflow ──────────── */
    .cal-compose-modal, .cal-day-modal { width: 100vw !important; max-width: 100% !important; overflow-x: hidden; }
    .cal-compose-modal input, .cal-compose-modal select, .cal-compose-modal textarea { width: 100%; box-sizing: border-box; }

    /* ── STUDY TOOLS: formula and flashcard form — stack fields vertically ── */
    .sd-formula-row { grid-template-columns: 1fr !important; gap: 6px; }
    .sd-section-row { flex-wrap: wrap; }
    .sd-card-row { grid-template-columns: 1fr !important; gap: 6px; }
    .sd-cards-header { display: none; } /* hide column headers when fields are stacked */
    .study-compose-modal { overflow-x: hidden; }

    /* ── GRADE LOG: class feed composer — stack vertically ───────────────── */
    .gfeed-compose { flex-direction: column; align-items: stretch; }
    .gfeed-compose select, .gfeed-compose input, .gfeed-compose button { width: 100%; max-width: 100%; }

    /* ── CAMPUS FEED: body row — input full width, anon+Post below ───────── */
    .feed-compose-body-row { flex-wrap: wrap; }
    .feed-compose-body-row .feed-compose-input { flex: 0 0 100%; }
    .feed-anon-toggle { flex: 1; }

    /* ── CHATS: members panel — max 50% height so msg input stays visible ── */
    #chat-members-overlay .chat-members-modal { max-height: 50dvh; }
  }

  /* MORE DRAWER — soon badge */
  .more-soon-badge { display: inline-block; background: #FEE2E2; color: #B91C1C; font-size: 7px; padding: 1px 4px; border-radius: 99px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; vertical-align: middle; margin-left: 2px; line-height: 1.4; }

  /* STUDY TOOLS — mobile FAB (hidden on desktop) */
  .study-mobile-fab { display: none; }

  /* ── INTRO.JS TOUR OVERRIDES ─────────────────────────────────────────── */
  .introjs-overlay { background: rgba(0,0,0,0.45) !important; }
  .introjs-helperLayer { border-radius: 12px !important; box-shadow: rgba(0,0,0,0.4) 0 0 1px 2px, rgba(83,74,183,0.25) 0 0 0 5000px !important; }
  .introjs-tooltip { font-family: 'Inter', sans-serif !important; border-radius: 14px !important; border: 1px solid rgba(0,0,0,0.09) !important; box-shadow: 0 8px 32px rgba(0,0,0,0.13) !important; padding: 42px 20px 16px !important; max-width: 290px !important; min-width: 240px !important; }
  .introjs-tooltip-header { position: absolute !important; top: 0 !important; left: 0 !important; right: 0 !important; padding: 12px 16px !important; border-bottom: 1px solid rgba(0,0,0,0.06) !important; display: flex !important; align-items: center !important; justify-content: flex-end !important; }
  .introjs-tooltiptext { font-size: 13px !important; line-height: 1.6 !important; color: #444 !important; padding: 4px 0 12px !important; }
  .introjs-button { font-family: 'Inter', sans-serif !important; font-size: 12px !important; font-weight: 500 !important; border-radius: 8px !important; padding: 7px 14px !important; text-shadow: none !important; background: #f4f4f2 !important; color: #1a1a1a !important; border: 1px solid rgba(0,0,0,0.12) !important; }
  .introjs-button:hover { opacity: 0.85 !important; }
  .introjs-nextbutton { background: var(--purple) !important; color: white !important; border-color: var(--purple) !important; }
  .introjs-donebutton { background: var(--purple) !important; color: white !important; border-color: var(--purple) !important; }
  .introjs-skipbutton { font-family: 'Inter', sans-serif !important; font-size: 12px !important; font-weight: 500 !important; color: #a0a0a0 !important; position: static !important; padding: 0 !important; line-height: 1 !important; }
  .introjs-skipbutton:hover { color: #6b6b6b !important; }
  .introjs-progress { background: var(--purple-light) !important; border-radius: 99px !important; height: 3px !important; margin: 0 0 14px !important; }
  .introjs-progressbar { background: var(--purple) !important; border-radius: 99px !important; }
  .introjs-bullets { display: none !important; }
  .introjs-tooltipbuttons { border-top: 1px solid rgba(0,0,0,0.07) !important; padding-top: 12px !important; }

  /* ── LANDING PAGE ─────────────────────────────────────────────────────── */
  /* Clean white + orange — school-neutral by design, since no school theme
     has been chosen yet at this point in the flow. No gradients, no glow. */
  .landing-page {
    position: fixed; inset: 0; z-index: 2000; overflow-y: auto; -webkit-overflow-scrolling: touch;
    background: var(--bg);
  }

  .landing-deco { position: absolute; z-index: 0; pointer-events: none; }
  .landing-deco-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--purple); top: 86px; right: calc(50% - 210px); opacity: 0.85; }
  .landing-deco-ring { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--purple-light); top: 40px; left: calc(50% - 240px); }

  .landing-nav { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 16px 28px; background: var(--bg); border-bottom: 1px solid var(--border); }
  .landing-nav-logo { display: flex; align-items: center; gap: 10px; }
  .landing-nav-mark { width: 32px; height: 32px; background: var(--purple); border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .landing-nav-mark i { font-size: 17px; color: white; }
  .landing-nav-logo span { font-size: 17px; font-weight: 600; color: var(--text); letter-spacing: -0.4px; }
  .landing-nav-actions { display: flex; align-items: center; gap: 10px; }
  .landing-nav-btn { font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 500; padding: 9px 18px; border-radius: var(--radius); cursor: pointer; transition: opacity 0.12s, background 0.12s; }
  .landing-nav-btn-ghost { background: none; border: 1px solid var(--border-mid); color: var(--text); }
  .landing-nav-btn-ghost:hover { background: var(--surface); }
  .landing-nav-btn-solid { background: var(--purple); border: none; color: white; }
  .landing-nav-btn-solid:hover { opacity: 0.9; }

  .landing-main { position: relative; z-index: 1; max-width: 880px; margin: 0 auto; padding: 0 24px; }

  .landing-hero { position: relative; text-align: center; padding: 72px 0 48px; }
  .landing-hero-badge { display: inline-block; font-size: 12px; font-weight: 500; color: var(--purple); background: var(--purple-light); padding: 6px 14px; border-radius: 99px; margin-bottom: 20px; }
  .landing-hero h1 { font-size: 42px; font-weight: 700; letter-spacing: -1px; color: var(--text); margin: 0 0 16px; line-height: 1.1; }
  .landing-hero h1 .landing-hero-underline { border-bottom: 5px solid var(--purple); padding-bottom: 3px; }
  .landing-hero-sub { font-size: 16px; color: var(--text-secondary); line-height: 1.6; max-width: 560px; margin: 0 auto 32px; }
  .landing-hero-actions { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
  .landing-cta-primary { font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600; color: white; background: var(--purple); border: none; border-radius: var(--radius); padding: 13px 24px; cursor: pointer; transition: opacity 0.12s, transform 0.12s; box-shadow: 0 8px 20px color-mix(in srgb, var(--color-primary) 30%, transparent); }
  .landing-cta-primary:hover { opacity: 0.92; transform: translateY(-1px); }
  .landing-cta-secondary { font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 500; color: var(--text); background: none; border: 1px solid var(--border-mid); border-radius: var(--radius); padding: 13px 24px; cursor: pointer; transition: background 0.12s; }
  .landing-cta-secondary:hover { background: var(--surface); }

  .landing-video-section { padding: 0 0 64px; }
  .landing-video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .landing-video-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 10px; box-shadow: 0 4px 24px rgba(0,0,0,0.06); }
  .landing-video { display: block; width: 100%; aspect-ratio: 16/9; border-radius: var(--radius-lg); background: #000; }
  .landing-video-caption { font-size: 13px; font-weight: 500; color: var(--text-secondary); text-align: center; padding: 10px 4px 4px; }

  .landing-features { padding: 8px 0 64px; }
  .landing-features h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; color: var(--text); text-align: center; margin: 0 0 32px; }
  .landing-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .landing-feature { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
  .landing-feature-icon { width: 36px; height: 36px; border-radius: var(--radius); background: var(--purple-light); color: var(--purple); display: flex; align-items: center; justify-content: center; font-size: 17px; }
  .landing-feature strong { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
  .landing-feature p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin: 0; }

  .landing-about { padding: 8px 0 64px; }
  .landing-about h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; color: var(--text); text-align: center; margin: 0 0 24px; }
  .landing-about p { font-size: 14px; color: var(--text-secondary); line-height: 1.7; max-width: 680px; margin: 0 auto 16px; }
  .landing-team { display: flex; align-items: center; justify-content: center; gap: 32px; margin-top: 32px; flex-wrap: wrap; }
  .landing-team-member { display: flex; align-items: center; gap: 12px; }
  .landing-team-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--purple-light); color: var(--purple); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; flex-shrink: 0; }
  .landing-team-info { display: flex; flex-direction: column; text-align: left; }
  .landing-team-info strong { font-size: 14px; color: var(--text); font-weight: 600; }
  .landing-team-info span { font-size: 12px; color: var(--text-tertiary); }

  .landing-final-cta { text-align: center; padding: 24px 0 80px; }
  .landing-final-cta h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; color: var(--text); margin: 0 0 24px; }

  .landing-footer { position: relative; z-index: 1; text-align: center; font-size: 12px; color: var(--text-tertiary); padding: 24px; border-top: 1px solid var(--border); }

  @media (max-width: 720px) {
    .landing-nav { padding: 14px 18px; }
    .landing-hero { padding: 48px 0 36px; }
    .landing-hero h1 { font-size: 30px; }
    .landing-hero-sub { font-size: 14px; }
    .landing-video-grid { grid-template-columns: 1fr; }
    .landing-feature-grid { grid-template-columns: 1fr 1fr; }
    .landing-team { gap: 20px; }
  }
  @media (max-width: 480px) {
    .landing-nav-btn { padding: 8px 12px; font-size: 12px; }
    .landing-hero-actions { flex-direction: column; width: 100%; }
    .landing-cta-primary, .landing-cta-secondary { width: 100%; }
    .landing-feature-grid { grid-template-columns: 1fr; }
  }
