:root {
      /* Flutter AppColors + Kanchan accents — mirror of lib/config/theme.dart */
      --primary: #E8751A;
      --primary-dark: #C45F10;
      --maroon: #6B1D1D;
      --maroon-deep: #501313;
      --gold: #D4A843;
      --gold-light: #E9C76B;
      --bg: #F5F6FA;
      --bg-cream: #FFF8EC;
      --bg-ivory: #FFFCF4;
      --surface: #FFFFFF;
      --ink: #2d3748;
      --muted: #718096;
      --border: #a0aec0;
      --divider: #EEDFC6;
      --success: #38A169;
      --leaf: #4F7942;
      --danger: #E53E3E;
      --rose: #C64747;
      --warning: #d69e2e;
      --info: #3182CE;
      --radius: 14px;
      --radius-sm: 10px;
      --radius-lg: 18px;
      --shadow-sm: 0 2px 6px rgba(80, 19, 19, 0.06);
      --shadow-md: 0 8px 22px rgba(80, 19, 19, 0.10);
      --shadow-lg: 0 18px 48px rgba(80, 19, 19, 0.18);
      --header-height: 110px;
      --container: 1080px;
    }

    /* ====================================================================
       DARK MODE — temple-at-night aesthetic.
       Activated via [data-theme="dark"] on <html> (set by head bootstrap
       and toggled by the header #themeToggleBtn). Overrides every hex /
       rgba literal that appears in the light stylesheet so no light
       surface leaks through in dark mode.
       ==================================================================== */
    [data-theme="dark"] {
      --primary: #E8751A;
      --primary-dark: #C45F10;
      --maroon: #3A0C0C;
      --maroon-deep: #1F0505;
      --gold: #E7C36A;
      --gold-light: #F2D97A;
      --bg: #0E0606;
      --bg-cream: #120606;
      --bg-ivory: #1A0A0A;
      --surface: #1E0D0D;
      --ink: #F5E9D0;
      --muted: #C8A67C;
      --border: #3A1E1E;
      --divider: #3A1E1E;
      --success: #48BB78;
      --leaf: #8FBF6B;
      --danger: #FC8181;
      --rose: #FEB2B2;
      --warning: #ECC94B;
      --info: #63B3ED;
      --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.45);
      --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.55);
      --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.7);
    }
    /* Parchment → dusk backdrop */
    [data-theme="dark"] body::before {
      background:
        radial-gradient(circle at 10% -10%, rgba(231, 195, 106, .08), transparent 45%),
        radial-gradient(circle at 100% 10%, rgba(122, 24, 24, .22), transparent 50%),
        radial-gradient(circle at 50% 110%, rgba(232, 117, 26, .08), transparent 55%),
        linear-gradient(180deg, #120606 0%, #1A0A0A 100%);
    }
    /* Header */
    [data-theme="dark"] .app-header {
      background: linear-gradient(135deg, #1F0505 0%, #3A0C0C 50%, #501313 100%);
    }
    /* Greeting card retains brand gold but muted against dusk */
    [data-theme="dark"] .greeting {
      background: linear-gradient(135deg, #E7C36A, #C79A2E 60%, #8A6618);
      color: #1F0505;
    }
    /* Button primary shadows tinted black (maroon-alpha is invisible on dusk) */
    [data-theme="dark"] .btn-primary {
      box-shadow: 0 5px 12px rgba(0, 0, 0, 0.55);
    }
    [data-theme="dark"] .btn-primary:hover {
      box-shadow: 0 8px 18px rgba(0, 0, 0, 0.7);
    }
    [data-theme="dark"] .btn-share {
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    }
    [data-theme="dark"] .btn-royal {
      background: linear-gradient(135deg, #145D56, #3A0C0C);
      box-shadow: 0 5px 12px rgba(0, 0, 0, 0.55);
    }
    [data-theme="dark"] .btn-royal:hover {
      box-shadow: 0 8px 18px rgba(0, 0, 0, 0.7);
    }
    [data-theme="dark"] .btn-ghost {
      background: rgba(231, 195, 106, 0.08);
      border-color: rgba(231, 195, 106, 0.45);
    }
    [data-theme="dark"] .btn-ghost:hover {
      background: rgba(231, 195, 106, 0.18);
    }
    /* Status dot glow */
    [data-theme="dark"] .conn-dot.online {
      box-shadow: 0 0 0 3px rgba(231, 195, 106, .22);
    }
    /* Avatar chip (header) */
    [data-theme="dark"] .avatar-chip {
      background: rgba(231, 195, 106, 0.1);
      border-color: rgba(231, 195, 106, 0.45);
    }
    [data-theme="dark"] .avatar-chip:hover {
      background: rgba(231, 195, 106, 0.2);
    }
    /* Card share button overlay */
    [data-theme="dark"] .card-share {
      background: rgba(30, 13, 13, 0.88);
      border-color: rgba(231, 195, 106, 0.6);
    }
    /* :hover states that hard-code #fff in the light stylesheet. Remap
       to a warm dark surface so hover does not flash white. */
    [data-theme="dark"] .card-share:hover {
      background: rgba(30, 13, 13, 1);
    }
    [data-theme="dark"] .btn-share:hover {
      background: #24100F;
      box-shadow: 0 6px 14px rgba(0, 0, 0, 0.55);
    }
    /* Course card image gradient overlay */
    [data-theme="dark"] .course-card .cover.has-image::after {
      display: none;
    }
    [data-theme="dark"] .course-card .title,
    [data-theme="dark"] .teacher-name {
      color: var(--gold-light);
    }
    [data-theme="dark"] .teacher-course {
      color: var(--muted);
    }
    [data-theme="dark"] .course-card .status-pill.open {
      background: rgba(72, 187, 120, .18);
      border-color: rgba(72, 187, 120, .35);
    }
    [data-theme="dark"] .course-card .status-pill.closed {
      background: rgba(252, 129, 129, .16);
      border-color: rgba(252, 129, 129, .35);
      color: #ffd0d0;
    }
    [data-theme="dark"] .course-card .enrolled-badge {
      box-shadow: 0 4px 12px rgba(0, 0, 0, .6);
    }
    /* At-a-glance icon tile */
    [data-theme="dark"] .at-item .at-ic {
      background: rgba(231, 195, 106, 0.12);
    }
    /* Skeleton shimmer */
    [data-theme="dark"] .skeleton {
      background: linear-gradient(90deg, #1A0A0A 0%, #2A1010 50%, #1A0A0A 100%);
    }
    /* Empty-state icon bubble */
    [data-theme="dark"] .empty-state .icon {
      background: rgba(231, 195, 106, 0.1);
    }
    /* Back button on hero */
    [data-theme="dark"] .back-btn {
      background: rgba(30, 13, 13, 0.9);
      border-color: rgba(231, 195, 106, 0.55);
      box-shadow: 0 4px 12px rgba(0, 0, 0, .55);
    }
    /* Hero */
    [data-theme="dark"] .hero {
      border-color: rgba(231, 195, 106, 0.4);
      box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
    }
    /* Scrollbar thumb */
    [data-theme="dark"] .h-scroll::-webkit-scrollbar-thumb {
      background: rgba(231, 195, 106, 0.35);
    }
    /* Gallery / certificate */
    [data-theme="dark"] .gallery-item {
      border-color: rgba(231, 195, 106, 0.25);
    }
    [data-theme="dark"] .cert-card {
      border-color: rgba(231, 195, 106, 0.55);
    }
    [data-theme="dark"] .cert-card img {
      background: #1E0D0D;
    }
    /* Enroll bar (mobile) */
    [data-theme="dark"] .enroll-bar {
      background: var(--surface);
      border-top: 1px solid rgba(231, 195, 106, 0.35);
      box-shadow: 0 -8px 24px rgba(0, 0, 0, .6);
    }
    /* Backdrop + login card */
    [data-theme="dark"] .backdrop {
      background: rgba(0, 0, 0, 0.7);
    }
    [data-theme="dark"] .login-card {
      background: var(--surface);
      box-shadow: 0 16px 48px rgba(0, 0, 0, .7);
    }
    [data-theme="dark"] .login-hero .seal {
      background: linear-gradient(135deg, #145D56, #3A0C0C);
    }
    [data-theme="dark"] .login-hero h2 { color: var(--gold-light); }
    /* Field wrap: invert cream → surface-alt */
    [data-theme="dark"] .field .input-wrap {
      background: #24100F;
      border-color: var(--divider);
    }
    [data-theme="dark"] .field .input-wrap:focus-within {
      background: #2E1817;
    }
    /* User menu dropdown */
    [data-theme="dark"] .user-menu {
      background: var(--surface);
      border-color: var(--divider);
      box-shadow: var(--shadow-md);
    }
    /* Alerts */
    [data-theme="dark"] .alert {
      background: rgba(252, 129, 129, 0.12);
      border: 1px solid rgba(252, 129, 129, 0.35);
    }
    /* Toast shadow */
    [data-theme="dark"] .toast {
      box-shadow: 0 8px 24px rgba(0, 0, 0, .7);
    }
    /* Theme toggle button visual states */
    .theme-toggle {
      position: relative;
      width: 40px;
      height: 40px;
      display: grid;
      place-items: center;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.12);
      border: 1px solid rgba(212, 168, 67, 0.55);
      color: var(--gold-light);
      transition: background .15s ease, transform .15s ease;
    }
    .theme-toggle:hover { background: rgba(255, 255, 255, 0.22); transform: scale(1.04); }
    .theme-toggle .icon-sun { display: none; }
    .theme-toggle .icon-moon { display: inline-block; }
    [data-theme="dark"] .theme-toggle {
      background: rgba(231, 195, 106, 0.12);
      border-color: rgba(231, 195, 106, 0.55);
    }
    [data-theme="dark"] .theme-toggle:hover {
      background: rgba(231, 195, 106, 0.22);
    }
    [data-theme="dark"] .theme-toggle .icon-sun { display: inline-block; }
    [data-theme="dark"] .theme-toggle .icon-moon { display: none; }

    /* ====================================================================
       Text-readability overrides in dark mode.
       The light stylesheet uses `color: var(--maroon)` / `--maroon-deep`
       as the heading / label color across many components. In dark mode
       the maroon tokens remain DARK (because they are also used as
       gradients / backgrounds for `.btn-primary`, `.toast`, `.greeting`
       border, etc.), so dark text on a now-dark surface becomes
       unreadable. The selectors below are every site where the text
       sits on a dark surface in dark mode — remap to gold-light ink.
       Sites where the text sits on a GOLD surface (brand mark, avatar
       chip av, greeting card body) are intentionally NOT listed here —
       dark maroon on gold stays readable.
       ==================================================================== */
    [data-theme="dark"] .btn-share,
    [data-theme="dark"] .card-share,
    [data-theme="dark"] .btn-outline,
    [data-theme="dark"] .user-menu .menu-head .mh-name,
    [data-theme="dark"] .user-menu button.menu-item:hover,
    [data-theme="dark"] .section-header h3,
    [data-theme="dark"] .empty-state h4,
    [data-theme="dark"] .back-btn,
    [data-theme="dark"] .ci-title,
    [data-theme="dark"] .mini-section-header h4,
    [data-theme="dark"] .at-item .at-ic,
    [data-theme="dark"] .at-item .at-value,
    [data-theme="dark"] .lecturer .photo > div,
    [data-theme="dark"] .lecturer .name,
    [data-theme="dark"] .login-close:hover,
    [data-theme="dark"] .field label,
    [data-theme="dark"] .field .eye:hover,
    [data-theme="dark"] .ci-side-title {
      color: var(--gold-light);
    }

    /* The sidebar course title was previously an inline style using
       `color: var(--maroon)`. Promoting it to a class keeps dark-mode
       overrides working while preserving the original typography. */
    .ci-side-title {
      font-family: 'Playfair Display', serif;
      font-size: 20px;
      font-weight: 800;
      color: var(--maroon);
      margin-bottom: 14px;
      line-height: 1.25;
    }

    * { margin: 0; padding: 0; box-sizing: border-box; }
    html, body { height: 100%; }
    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      background: var(--bg-cream);
      color: var(--ink);
      line-height: 1.45;
      -webkit-font-smoothing: antialiased;
      min-height: 100vh;
      position: relative;
    }

    /* Subtle parchment background (mirrors KanchanBackground) */
    body::before {
      content: "";
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: -1;
      pointer-events: none;
      background:
        radial-gradient(circle at 10% -10%, rgba(212, 168, 67, .22), transparent 45%),
        radial-gradient(circle at 100% 10%, rgba(107, 29, 29, .08), transparent 50%),
        radial-gradient(circle at 50% 110%, rgba(232, 117, 26, .10), transparent 55%),
        linear-gradient(180deg, #FFF8EC 0%, #FAF0DB 100%);
    }

    a { color: inherit; text-decoration: none; }
    button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
    button:focus-visible,
    input:focus-visible,
    [role="button"]:focus-visible {
      outline: 2px solid var(--primary);
      outline-offset: 2px;
      border-radius: 6px;
    }

    .sr-only {
      position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
      overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
    }

    img { max-width: 100%; display: block; }

    /* ── Header (temple arch, mirrors home_screen.dart _heritageHeader) ── */
    .app-header {
      position: sticky;
      top: 0;
      z-index: 50;
      height: var(--header-height);
      background: linear-gradient(135deg, #501313 0%, #6B1D1D 50%, #8a2b1f 100%);
      overflow: hidden;
      box-shadow: var(--shadow-md);
    }
    .app-header::before {
      /* Temple arch silhouette overlay */
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 110' preserveAspectRatio='xMidYMid slice'><defs><linearGradient id='g' x1='0' x2='0' y1='0' y2='1'><stop offset='0' stop-color='%23D4A843' stop-opacity='0.18'/><stop offset='1' stop-color='%23D4A843' stop-opacity='0'/></linearGradient></defs><path d='M0 110 L0 70 Q60 40 120 70 L120 110 Z M120 110 L120 50 Q180 10 240 50 L240 110 Z M240 110 L240 70 Q300 40 360 70 L360 110 Z M360 110 L360 30 Q420 -5 480 30 L480 110 Z M480 110 L480 60 Q540 25 600 60 L600 110 Z M600 110 L600 20 Q660 -10 720 20 L720 110 Z M720 110 L720 60 Q780 25 840 60 L840 110 Z M840 110 L840 30 Q900 -5 960 30 L960 110 Z M960 110 L960 70 Q1020 40 1080 70 L1080 110 Z M1080 110 L1080 50 Q1140 10 1200 50 L1200 110 Z' fill='url(%23g)'/></svg>");
      background-size: cover;
      opacity: 0.9;
      pointer-events: none;
    }
    .app-header::after {
      /* Gold bottom hairline */
      content: "";
      position: absolute;
      left: 0; right: 0; bottom: 0;
      height: 2px;
      background: linear-gradient(90deg, transparent, var(--gold) 30%, var(--gold) 70%, transparent);
      opacity: 0.55;
    }

    .header-inner {
      position: relative;
      height: 100%;
      max-width: var(--container);
      margin: 0 auto;
      padding: 0 20px;
      display: flex;
      align-items: center;
      gap: 14px;
    }

    .brand-mark {
      width: 42px; height: 42px;
      display: grid; place-items: center;
      flex-shrink: 0;
    }
    .brand-mark img {
      width: 42px; height: 42px;
      object-fit: contain;
      display: block;
      filter: brightness(0) invert(1);
    }

    .brand-text { flex: 1; min-width: 0; color: #fff; }
    .brand-eyebrow {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.18em;
      color: var(--gold-light);
      text-transform: uppercase;
    }
    .brand-title {
      font-family: 'Playfair Display', serif;
      font-size: 20px;
      font-weight: 800;
      color: #fff;
      line-height: 1.1;
      margin-top: 2px;
      text-shadow: 0 1px 4px rgba(0,0,0,.3);
    }

    .header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
    .header-actions .conn-dot,
    .header-actions .theme-toggle {
      display: none;
    }

    .conn-dot {
      width: 9px; height: 9px; border-radius: 50%;
      background: var(--rose);
      box-shadow: 0 0 0 2px rgba(255,255,255,.15);
      transition: background .3s;
    }
    .conn-dot.online { background: var(--gold-light); box-shadow: 0 0 0 2px rgba(212,168,67,.35); }

    .btn {
      display: inline-flex; align-items: center; justify-content: center; gap: 8px;
      padding: 10px 18px;
      border-radius: var(--radius-sm);
      font-weight: 600;
      font-size: 14px;
      transition: transform .12s ease, box-shadow .2s ease, background .2s ease, color .2s ease, filter .2s ease;
      min-height: 42px;
      white-space: nowrap;
    }
    .btn:active:not(:disabled) { transform: scale(0.97); }
    /* Primary = heritage enroll CTA. Mirrors Flutter KanchanButton:
       maroon gradient + gold 1px border + maroon shadow + uppercase Cinzel. */
    .btn-primary {
      background: linear-gradient(135deg, var(--maroon), var(--maroon-deep));
      color: #fff;
      border: 1px solid var(--gold);
      border-radius: 22px;
      box-shadow: 0 5px 12px rgba(122, 24, 24, 0.32);
      font-family: 'Playfair Display', serif;
      text-transform: uppercase;
      letter-spacing: 0.12em;
      font-weight: 700;
      padding: 12px 22px;
    }
    .btn-primary i { color: var(--gold-light); }
    .btn-primary:hover:not(:disabled) {
      box-shadow: 0 10px 22px rgba(122, 24, 24, 0.45);
      filter: brightness(1.05);
    }
    .btn-primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
    .btn-primary:disabled i { color: rgba(255,255,255,.6); }

    /* Share icon button — companion to enroll CTA. */
    .btn-share {
      width: 46px; min-height: 46px;
      padding: 0;
      border-radius: 50%;
      background: var(--bg-ivory);
      color: var(--maroon);
      border: 1px solid var(--gold);
      box-shadow: 0 4px 10px rgba(122, 24, 24, 0.15);
      flex-shrink: 0;
    }
    .btn-share:hover { background: #fff; box-shadow: 0 6px 14px rgba(122, 24, 24, 0.22); }
    .btn-share i { font-size: 15px; }
    .enroll-row {
      display: flex; align-items: stretch; gap: 10px;
    }
    .enroll-row .btn-primary { flex: 1; }

    /* Course card share overlay (top-right of cover). */
    .course-card { position: relative; }
    .card-share {
      position: absolute;
      top: 8px; right: 8px;
      width: 34px; height: 34px;
      border-radius: 50%;
      background: rgba(255, 248, 236, 0.92);
      color: var(--maroon);
      border: 1px solid rgba(212, 168, 67, 0.7);
      display: grid; place-items: center;
      font-size: 12px;
      backdrop-filter: blur(4px);
      opacity: 0;
      transform: translateY(-4px);
      transition: opacity .2s ease, transform .2s ease, background .2s ease;
      z-index: 3;
      cursor: pointer;
    }
    .card-share:hover { background: #fff; }
    .course-card:hover .card-share,
    .course-card:focus-within .card-share { opacity: 1; transform: translateY(0); }
    @media (hover: none) {
      .card-share { opacity: 1; transform: translateY(0); }
    }

    /* ── Entrance animations ── */
    @keyframes fadeUp {
      from { opacity: 0; transform: translateY(14px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    @keyframes fadeInOnly {
      from { opacity: 0; }
      to   { opacity: 1; }
    }
    @keyframes kenBurns {
      from { transform: scale(1.06); }
      to   { transform: scale(1); }
    }
    @keyframes modalRise {
      from { opacity: 0; transform: translateY(18px) scale(0.96); }
      to   { opacity: 1; transform: translateY(0) scale(1); }
    }
    .course-card { animation: fadeUp .45s ease both; animation-delay: calc(var(--i, 0) * 55ms); }
    .enter-fade { animation: fadeInOnly .28s ease both; }
    .enter-section { animation: fadeUp .4s ease both; }
    .enter-section.delay-1 { animation-delay: 60ms; }
    .enter-section.delay-2 { animation-delay: 120ms; }
    .enter-section.delay-3 { animation-delay: 180ms; }
    .enter-section.delay-4 { animation-delay: 240ms; }
    .hero img { animation: kenBurns 1.4s ease-out both; }
    .lecturer, .gallery-item {
      transition: transform .2s ease, box-shadow .2s ease;
    }
    .lecturer:hover, .gallery-item:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 20px rgba(122, 24, 24, 0.15);
    }
    .btn-royal {
      background: linear-gradient(135deg, #0d524d 0%, var(--maroon) 100%);
      color: #fff;
      box-shadow: 0 6px 16px rgba(13,82,77,.35);
    }
    .btn-royal:hover { box-shadow: 0 10px 22px rgba(13,82,77,.45); }
    .btn-ghost {
      background: rgba(255,255,255,.12);
      color: #fff;
      border: 1px solid rgba(212,168,67,.55);
      backdrop-filter: blur(4px);
    }
    .btn-ghost:hover { background: rgba(255,255,255,.22); }
    .btn-outline {
      background: transparent;
      color: var(--maroon);
      border: 1.5px solid var(--gold);
    }
    .btn-outline:hover { background: rgba(212,168,67,.1); }
    .btn-block { width: 100%; }

    .avatar-chip {
      display: inline-flex; align-items: center; gap: 8px;
      padding: 4px 12px 4px 4px;
      background: rgba(255,255,255,.12);
      border: 1px solid rgba(212,168,67,.55);
      border-radius: 999px;
      color: #fff; font-weight: 600; font-size: 13px;
      min-height: 42px;
      transition: background .2s;
      position: relative;
    }
    .avatar-chip:hover { background: rgba(255,255,255,.22); }
    .avatar-chip .av {
      width: 34px; height: 34px; border-radius: 50%;
      background: linear-gradient(135deg, var(--gold-light), var(--gold));
      color: var(--maroon-deep);
      display: grid; place-items: center;
      font-weight: 800; font-size: 15px;
      border: 1.5px solid var(--maroon-deep);
      overflow: hidden;
    }
    .avatar-chip .av img {
      width: 100%; height: 100%;
      object-fit: cover;
      border-radius: 50%;
    }
    .avatar-chip .name-text { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .user-menu {
      position: absolute;
      top: calc(100% + 8px); right: 0;
      background: #fff;
      border: 1px solid var(--divider);
      border-radius: var(--radius);
      box-shadow: var(--shadow-lg);
      min-width: 220px;
      padding: 8px;
      display: none;
      z-index: 60;
    }
    .user-menu.open { display: block; }
    .user-menu .menu-head {
      padding: 12px; border-bottom: 1px solid var(--divider); margin-bottom: 6px;
    }
    .user-menu .menu-head .mh-name { font-weight: 700; color: var(--maroon); font-size: 14px; }
    .user-menu .menu-head .mh-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
    .user-menu button.menu-item {
      display: flex; align-items: center; gap: 10px;
      width: 100%; padding: 10px 12px; border-radius: 8px;
      color: var(--ink); font-size: 14px; font-weight: 500; text-align: left;
      transition: background .15s;
    }
    .user-menu button.menu-item:hover { background: var(--bg-cream); color: var(--maroon); }
    .user-menu button.menu-item i { width: 18px; color: var(--muted); }
    .user-menu button.menu-item.danger { color: var(--danger); }
    .user-menu button.menu-item.danger i { color: var(--danger); }

    /* ── Main content ── */
    main {
      max-width: var(--container);
      margin: 0 auto;
      padding: 20px 26px 120px;
    }

    /* ── Greeting card ── */
    .greeting {
      position: relative;
      border-radius: 20px;
      background: linear-gradient(135deg, #F2D97A, #D4A843 60%, #B3892D);
      border: 1px solid var(--maroon);
      padding: 20px;
      box-shadow: 0 18px 36px rgba(212,168,67,.3);
      overflow: hidden;
      margin-bottom: 20px;
    }
    .greeting::after {
      content: "";
      position: absolute;
      right: -30px; top: -30px;
      width: 160px; height: 160px;
      background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><g fill='none' stroke='%23501313' stroke-opacity='0.18' stroke-width='1.5'><ellipse cx='50' cy='50' rx='18' ry='45'/><ellipse cx='50' cy='50' rx='18' ry='45' transform='rotate(45 50 50)'/><ellipse cx='50' cy='50' rx='18' ry='45' transform='rotate(90 50 50)'/><ellipse cx='50' cy='50' rx='18' ry='45' transform='rotate(135 50 50)'/></g></svg>");
      background-size: contain;
      pointer-events: none;
    }
    .greeting .namaste {
      font-family: 'Noto Serif Bengali', serif;
      font-size: 13px; font-weight: 600;
      color: var(--maroon-deep);
    }
    .greeting h2 {
      font-family: 'Playfair Display', serif;
      font-size: 22px; font-weight: 800;
      color: var(--maroon-deep);
      margin-top: 6px;
    }
    .greeting p {
      font-family: 'Playfair Display', serif;
      font-style: italic;
      color: var(--maroon-deep);
      font-size: 14px; font-weight: 500;
      margin-top: 6px;
    }

    /* ── Section headers (Kanchan style with gold bar) ── */
    .section-header {
      display: flex; align-items: flex-end; gap: 10px;
      margin: 20px 0 12px;
    }
    .section-header h3 {
      font-family: 'Playfair Display', serif;
      font-size: 18px; font-weight: 800;
      color: var(--maroon);
    }
    .section-header .bn {
      font-family: 'Noto Serif Bengali', serif;
      font-size: 13px; color: var(--muted);
      padding-bottom: 2px;
    }
    .section-header .rule {
      flex: 1;
      height: 2px;
      background: linear-gradient(90deg, transparent, var(--gold) 30%, var(--maroon));
      margin-left: 6px; align-self: center;
    }

    /* ── Course grid + card (mirrors course_card.dart visually) ── */
    .course-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 18px;
    }
    .course-card {
      background: var(--surface);
      border-radius: var(--radius);
      border: 1px solid var(--divider);
      box-shadow: var(--shadow-sm);
      overflow: hidden;
      cursor: pointer;
      transition: transform .2s, box-shadow .25s;
      display: flex;
      flex-direction: column;
      text-align: left;
      width: 100%;
    }
    @media (hover: hover) {
      .course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
    }
    .course-card .cover {
      aspect-ratio: 16/9;
      background: linear-gradient(135deg, var(--maroon) 0%, var(--primary) 100%);
      position: relative;
      overflow: hidden;
    }
    .course-card .cover.has-image::after {
      display: none;
    }
    .course-card .cover-img {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0; object-fit: cover;
      width: 100%; height: 100%;
    }
    .course-card .title {
      color: var(--maroon);
      font-weight: 700;
      font-size: 18px;
      line-height: 1.3;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    .course-card .enrolled-badge {
      position: absolute; top: 8px; right: 8px;
      background: var(--success);
      color: #fff;
      padding: 3px 10px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: .04em;
      z-index: 2;
      display: inline-flex; align-items: center; gap: 4px;
      box-shadow: 0 2px 6px rgba(56,161,105,.4);
    }
    .course-card .body { padding: 16px 16px 18px; }
    .course-card .desc {
      font-size: 14px;
      color: var(--muted);
      display: -webkit-box;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      min-height: 36px;
    }
    .course-card .status-row {
      margin-top: 12px;
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }
    .course-card .status-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 5px 10px;
      border-radius: 999px;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: .03em;
      text-transform: uppercase;
    }
    .course-card .status-pill.open {
      background: rgba(56, 161, 105, .13);
      color: var(--success);
      border: 1px solid rgba(56, 161, 105, .35);
    }
    .course-card .status-pill.closed {
      background: rgba(198, 71, 71, .12);
      color: var(--rose);
      border: 1px solid rgba(198, 71, 71, .32);
    }
    .course-card .timeline {
      margin-top: 8px;
      display: grid;
      gap: 4px;
    }
    .course-card .timeline-item {
      font-size: 12px;
      color: var(--muted);
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .course-card .timeline-item i { color: var(--primary); }
    .course-card .chips {
      display: flex; gap: 14px; margin-top: 10px;
      flex-wrap: wrap;
    }
    .course-card .chip {
      display: inline-flex; align-items: center; gap: 5px;
      font-size: 12px; color: var(--muted);
    }
    .course-card .chip i { color: var(--primary); font-size: 12px; }

    /* Teacher spotlight */
    .teacher-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 14px;
    }
    .teacher-card {
      background: var(--surface);
      border: 1px solid var(--divider);
      border-radius: var(--radius);
      padding: 12px;
      display: flex;
      align-items: center;
      gap: 12px;
      cursor: pointer;
      transition: transform .15s ease, box-shadow .2s ease;
      box-shadow: var(--shadow-sm);
    }
    .teacher-card:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-md);
    }
    .teacher-avatar {
      width: 54px;
      height: 54px;
      border-radius: 50%;
      overflow: hidden;
      border: 2px solid var(--gold);
      background: linear-gradient(135deg, var(--gold-light), var(--gold));
      display: grid;
      place-items: center;
      color: var(--maroon-deep);
      font-weight: 800;
      flex-shrink: 0;
    }
    .teacher-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 50%;
    }
    .teacher-body { min-width: 0; }
    .teacher-name {
      font-family: 'Playfair Display', serif;
      font-size: 15px;
      font-weight: 700;
      color: var(--maroon);
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      -webkit-box-orient: vertical;
      word-break: break-word;
    }
    .teacher-course {
      margin-top: 2px;
      font-size: 12px;
      color: var(--muted);
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 1;
      line-clamp: 1;
      -webkit-box-orient: vertical;
      word-break: break-word;
    }

    /* ── Loading skeleton ── */
    .skeleton {
      background: linear-gradient(90deg, #f0e6d6 25%, #fff4db 50%, #f0e6d6 75%);
      background-size: 200% 100%;
      animation: shimmer 1.4s ease-in-out infinite;
      border-radius: var(--radius);
    }
    @keyframes shimmer {
      0% { background-position: 200% 0; }
      100% { background-position: -200% 0; }
    }
    .skeleton-card { height: 190px; }

    /* ── Empty / error ── */
    .empty-state {
      padding: 60px 20px;
      text-align: center;
      color: var(--muted);
    }
    .empty-state .icon {
      width: 72px; height: 72px;
      margin: 0 auto 16px;
      border-radius: 50%;
      background: rgba(212,168,67,.15);
      display: grid; place-items: center;
      color: var(--gold);
      font-size: 28px;
    }
    .empty-state h4 {
      color: var(--maroon);
      font-family: 'Playfair Display', serif;
      font-size: 20px; font-weight: 700;
      margin-bottom: 6px;
    }
    .empty-state p { font-size: 14px; max-width: 340px; margin: 0 auto 14px; }

    /* ── Course Info view ── */
    .course-info { position: relative; }
    .back-btn {
      position: absolute;
      top: 14px; left: 18px;
      z-index: 4;
      width: 42px; height: 42px;
      background: rgba(255,255,255,.95);
      border: 1px solid rgba(212,168,67,.6);
      border-radius: 50%;
      display: grid; place-items: center;
      color: var(--maroon);
      box-shadow: 0 4px 12px rgba(80,19,19,.18);
      transition: transform .2s;
    }
    .back-btn:hover { transform: scale(1.06); }

    .hero {
      position: relative;
      aspect-ratio: 16/9;
      border-radius: var(--radius-lg);
      border: 1.2px solid rgba(212,168,67,.5);
      overflow: hidden;
      margin: 12px 0 16px;
      box-shadow: 0 12px 32px rgba(107,29,29,.18);
      background: linear-gradient(135deg, var(--maroon) 0%, var(--primary) 100%);
    }
    .hero img {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      width: 100%; height: 100%;
      object-fit: cover;
      z-index: 1;
    }
    .hero .fallback {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      display: grid; place-items: center;
      color: rgba(255,255,255,.8);
      font-size: 64px;
      z-index: 0;
    }

    .ci-title {
      font-family: 'Playfair Display', serif;
      font-size: 26px;
      font-weight: 800;
      color: var(--maroon);
      line-height: 1.2;
      padding: 0 4px;
    }
    .ci-meta-row {
      font-size: 11px;
      letter-spacing: .08em;
      text-transform: uppercase;
      color: var(--muted);
      font-weight: 600;
      margin-top: 6px;
      padding: 0 4px;
    }
    .ci-description {
      font-family: 'Playfair Display', serif;
      font-size: 15px;
      color: var(--ink);
      line-height: 1.7;
      margin-top: 12px;
      padding: 0 4px;
    }

    .mini-section-header {
      display: flex; align-items: center; gap: 8px;
      margin-top: 24px; margin-bottom: 10px;
    }
    .mini-section-header .bar {
      width: 3px; height: 16px; background: var(--gold); border-radius: 2px;
    }
    .mini-section-header h4 {
      font-size: 11px;
      letter-spacing: .12em;
      text-transform: uppercase;
      color: var(--maroon);
      font-weight: 800;
    }

    /* "At a Glance" grid */
    .at-glance {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: 10px;
    }
    .at-item {
      background: var(--surface);
      border: 1px solid var(--divider);
      border-radius: var(--radius-sm);
      padding: 12px 14px;
      display: flex; align-items: center; gap: 12px;
      box-shadow: var(--shadow-sm);
    }
    .at-item .at-ic {
      width: 36px; height: 36px; border-radius: 10px;
      background: rgba(212,168,67,.18);
      color: var(--maroon);
      display: grid; place-items: center;
      font-size: 15px;
    }
    .at-item .at-label {
      font-size: 10px; text-transform: uppercase;
      letter-spacing: .1em; color: var(--muted); font-weight: 700;
    }
    .at-item .at-value {
      font-size: 14px; font-weight: 700; color: var(--maroon); margin-top: 2px;
    }

    /* Lecturers / Gallery horizontal scrollers */
    .h-scroll {
      display: flex;
      gap: 14px;
      overflow-x: auto;
      padding: 4px 2px 10px;
      scroll-snap-type: x mandatory;
      -webkit-overflow-scrolling: touch;
    }
    .h-scroll::-webkit-scrollbar { height: 6px; }
    .h-scroll::-webkit-scrollbar-thumb { background: rgba(212,168,67,.45); border-radius: 3px; }

    .lecturer {
      width: 92px;
      flex-shrink: 0;
      text-align: center;
      scroll-snap-align: start;
    }
    .lecturer .photo {
      width: 72px; height: 72px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--gold-light), var(--gold));
      padding: 2px;
      margin: 0 auto;
      overflow: hidden;
    }
    .lecturer .photo > div {
      position: relative;
      width: 100%; height: 100%; border-radius: 50%;
      background: var(--bg-ivory);
      display: grid; place-items: center;
      overflow: hidden;
      color: var(--maroon);
      font-size: 24px;
    }
    .lecturer .photo img {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      width: 100%; height: 100%;
      object-fit: cover; border-radius: 50%;
      z-index: 1;
    }
    .lecturer .name {
      font-family: 'Playfair Display', serif;
      font-size: 12px; font-weight: 700;
      color: var(--maroon);
      margin-top: 8px;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .gallery-item {
      width: 220px;
      aspect-ratio: 16/10;
      flex-shrink: 0;
      border-radius: var(--radius-sm);
      overflow: hidden;
      background: var(--divider);
      border: 1px solid rgba(212,168,67,.3);
      scroll-snap-align: start;
    }
    .gallery-item img { width: 100%; height: 100%; object-fit: cover; }

    /* ── Student Photos Grid ── */
    .photo-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
    }
    @media (min-width: 640px) {
      .photo-grid { grid-template-columns: repeat(3, 1fr); }
    }
    @media (min-width: 1024px) {
      .photo-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
    }
    .photo-item {
      cursor: pointer;
      transition: transform 0.2s ease;
    }
    .photo-item:hover { transform: translateY(-2px); }
    .photo-image-wrapper {
      position: relative;
      aspect-ratio: 1;
      border-radius: var(--radius-sm);
      overflow: hidden;
      background: var(--divider);
      border: 1px solid rgba(212,168,67,.3);
    }
    .photo-image-wrapper img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    .photo-badge {
      position: absolute;
      top: 8px;
      left: 8px;
      padding: 4px 8px;
      border-radius: 4px;
      font-size: 10px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .photo-badge.certified {
      background: linear-gradient(135deg, #38A169, #2F855A);
      color: white;
    }
    .photo-badge.distribution {
      background: linear-gradient(135deg, #E8751A, #C45F10);
      color: white;
    }
    .photo-caption {
      font-size: 12px;
      color: var(--ink);
      margin-top: 6px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    /* ── Photo Lightbox ── */
    .photo-lightbox {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 1000;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .photo-lightbox-backdrop {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0,0,0,0.9);
      backdrop-filter: blur(4px);
    }
    .photo-lightbox-content {
      position: relative;
      z-index: 1;
      max-width: 90vw;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    .photo-lightbox-content img {
      max-width: 100%;
      max-height: 80vh;
      object-fit: contain;
      border-radius: var(--radius-sm);
    }
    .photo-lightbox-close {
      position: absolute;
      top: -40px;
      right: 0;
      background: rgba(255,255,255,0.1);
      border: none;
      color: white;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      transition: background 0.2s;
    }
    .photo-lightbox-close:hover { background: rgba(255,255,255,0.2); }
    .photo-lightbox-caption {
      color: white;
      margin-top: 12px;
      font-size: 14px;
      text-align: center;
      max-width: 100%;
      padding: 0 20px;
    }

    .cert-card {
      background: var(--surface);
      border: 1px dashed rgba(212,168,67,.65);
      border-radius: var(--radius);
      padding: 12px;
      display: block;
      overflow: hidden;
    }
    .cert-card img {
      display: block;
      width: 100%;
      height: auto;
      max-height: 520px;
      object-fit: contain;
      border-radius: calc(var(--radius) - 4px);
      background: #fff;
    }
    .cert-card .cert-caption {
      font-family: 'Playfair Display', serif;
      font-size: 12px;
      color: var(--muted);
      text-align: center;
      margin-top: 8px;
      font-style: italic;
    }

    /* ── Sticky enroll bar (mobile only; hidden on desktop below) ── */
    /* On mobile (< 1024px) only the sticky bottom bar is shown; the
       desktop sidebar (.ci-side) is hidden so the user never sees two
       competing Enroll buttons. */
    .ci-side { display: none; }
    .enroll-bar {
      position: fixed;
      left: 0; right: 0; bottom: 0;
      background: var(--bg-cream);
      border-top: 1px solid rgba(212,168,67,.35);
      box-shadow: 0 -8px 24px rgba(80,19,19,.1);
      padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px));
      z-index: 40;
    }
    .enroll-bar-inner {
      max-width: var(--container);
      margin: 0 auto;
      display: flex; flex-direction: column; align-items: center; gap: 8px;
    }
    .enroll-bar .enroll-btn { max-width: 420px; width: 100%; }
    .enroll-bar .help-text {
      font-family: 'Playfair Display', serif;
      font-size: 12px;
      color: var(--muted);
      font-style: italic;
      text-align: center;
    }

    /* ── Login modal ── */
    .backdrop {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(50,15,15,.55);
      backdrop-filter: blur(4px);
      display: none;
      align-items: center; justify-content: center;
      z-index: 100;
      padding: 20px;
      animation: fadeIn .2s;
    }
    .backdrop.open { display: flex; }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

    .login-card {
      width: 100%;
      max-width: 420px;
      background: var(--surface);
      border-radius: 18px;
      padding: 28px 24px 24px;
      box-shadow: 0 30px 70px rgba(0,0,0,.3);
      position: relative;
      animation: modalRise .32s cubic-bezier(0.2, 0.9, 0.3, 1);
    }
    @keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

    .login-close {
      position: absolute; top: 12px; right: 12px;
      width: 36px; height: 36px; border-radius: 50%;
      display: grid; place-items: center;
      color: var(--muted);
      transition: background .2s;
    }
    .login-close:hover { background: var(--bg-cream); color: var(--maroon); }

    .login-hero {
      text-align: center;
      margin-bottom: 20px;
    }
    .login-hero .seal {
      width: 64px; height: 64px; border-radius: 50%;
      margin: 0 auto 12px;
      background: linear-gradient(135deg, #0d524d, var(--maroon));
      border: 2px solid var(--gold);
      display: grid; place-items: center;
      color: var(--gold-light);
      font-size: 26px;
    }
    .login-hero h2 {
      font-family: 'Playfair Display', serif;
      font-size: 22px;
      font-weight: 800;
      color: var(--maroon-deep);
    }
    .login-hero p { font-size: 13px; color: var(--muted); margin-top: 4px; }

    .field { margin-bottom: 14px; }
    .field label {
      display: block;
      font-size: 12px;
      font-weight: 600;
      color: var(--maroon);
      margin-bottom: 6px;
      letter-spacing: .02em;
    }
    .field .input-wrap {
      position: relative;
      display: flex; align-items: center;
      background: var(--bg-cream);
      border: 1.5px solid var(--divider);
      border-radius: var(--radius-sm);
      padding: 0 12px;
      transition: border-color .2s, background .2s;
    }
    .field .input-wrap:focus-within {
      border-color: var(--primary);
      background: #fff;
    }
    .field .input-wrap i.lead { color: var(--muted); margin-right: 10px; font-size: 14px; }
    .field input {
      flex: 1;
      padding: 12px 0;
      border: none;
      background: transparent;
      outline: none;
      font-size: 14px;
      color: var(--ink);
      width: 100%;
    }
    .field .eye {
      padding: 8px;
      color: var(--muted);
    }
    .field .eye:hover { color: var(--maroon); }

    .alert {
      display: none;
      padding: 10px 12px;
      border-radius: 8px;
      font-size: 13px;
      margin-bottom: 12px;
      background: rgba(229,62,62,.08);
      color: var(--danger);
      border: 1px solid rgba(229,62,62,.25);
    }
    .alert.show { display: block; }

    .help-line {
      text-align: center;
      font-size: 12px;
      color: var(--muted);
      margin-top: 16px;
      line-height: 1.5;
    }

    /* ── Toasts ── */
    .toast-stack {
      position: fixed;
      bottom: 24px; left: 50%;
      transform: translateX(-50%);
      z-index: 200;
      display: flex; flex-direction: column; gap: 8px;
      pointer-events: none;
    }
    .toast {
      background: var(--maroon-deep);
      color: #fff;
      padding: 12px 18px;
      border-radius: 10px;
      font-size: 13px; font-weight: 500;
      box-shadow: 0 12px 28px rgba(0,0,0,.35);
      animation: toastIn .25s;
      max-width: 380px;
    }
    .toast.success { background: var(--success); }
    .toast.error { background: var(--danger); }
    @keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

    /* ── Views ── */
    .view { display: none; }
    .view.active { display: block; }

    .spinner {
      display: inline-block;
      width: 16px; height: 16px;
      border: 2.5px solid rgba(255,255,255,.35);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin .7s linear infinite;
      vertical-align: middle;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* ── Responsive ─────────────────────────────────────── */
    /* Tablet */
    @media (min-width: 640px) {
      .course-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
      }
      .course-card .cover { aspect-ratio: 16/9; }
      .teacher-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }

    /* Desktop / admin-panel density */
    @media (min-width: 1024px) {
      :root { --header-height: 110px; }
      main { padding: 30px 54px 120px; }
      .course-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 22px;
      }
      .course-card .cover { aspect-ratio: 16/9; }
      .greeting h2 { font-size: 26px; }
      .hero { margin-left: 0; margin-right: 0; }
      .teacher-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

      .ci-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 380px;
        gap: 32px;
        align-items: start;
      }
      .ci-side {
        display: block;
        position: sticky;
        top: calc(var(--header-height) + 20px);
        background: var(--surface);
        border: 1px solid var(--divider);
        border-radius: var(--radius-lg);
        padding: 24px;
        box-shadow: var(--shadow-md);
      }
      .enroll-bar { display: none; }
      .back-btn { top: 20px; left: 4px; }
    }
    /* Full-width grid @ very wide */
    @media (min-width: 1400px) {
      .course-grid { grid-template-columns: repeat(3, 1fr); }
    }

    /* Tiny phones */
    @media (max-width: 420px) {
      .brand-eyebrow { display: none; }
      .brand-title { font-size: 17px; }
      .header-inner { padding: 0 14px; gap: 10px; }
      .avatar-chip .name-text { display: none; }
      .btn { padding: 8px 14px; font-size: 13px; }
      main { padding: 14px 16px 140px; }
      .course-card .cover { aspect-ratio: 16/9; }
      .teacher-grid { grid-template-columns: 1fr; }
    }

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

    /* ── Course Detail (enrolled) ── */
    .cd-header {
      display: flex; align-items: center; gap: 12px;
      margin-bottom: 16px; flex-wrap: wrap;
    }
    .cd-header h1 {
      font-family: 'Playfair Display', serif;
      font-size: 22px; font-weight: 800;
      color: var(--maroon); flex: 1; min-width: 0;
    }
    .cd-enrolled-chip {
      display: inline-flex; align-items: center; gap: 5px;
      background: var(--leaf); color: #fff;
      padding: 5px 12px; border-radius: 999px;
      font-size: 10px; font-weight: 700;
      letter-spacing: .08em; flex-shrink: 0;
    }
    .cd-desc {
      font-family: 'Playfair Display', serif;
      font-size: 14px; color: var(--muted);
      line-height: 1.6; margin-bottom: 16px;
    }
    .cd-stat-row {
      display: flex; gap: 16px; flex-wrap: wrap;
      margin-bottom: 20px;
    }
    .cd-stat {
      display: flex; align-items: center; gap: 10px;
    }
    .cd-stat .ic {
      width: 40px; height: 40px; border-radius: 10px;
      background: rgba(212,168,67,.18); color: var(--maroon);
      display: grid; place-items: center; font-size: 16px;
    }
    .cd-stat .val { font-weight: 700; font-size: 15px; color: var(--maroon); }
    .cd-stat .lbl { font-size: 9px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }

    /* Tab bar for course detail */
    .cd-tabs {
      display: flex; gap: 0; padding: 4px;
      background: var(--bg-ivory);
      border: 1px solid rgba(212,168,67,.4);
      border-radius: 18px; margin-bottom: 16px;
    }
    .cd-tab {
      flex: 1; padding: 10px 0; border-radius: 14px;
      text-align: center; font-size: 11px;
      font-weight: 700; letter-spacing: .06em;
      color: var(--muted); cursor: pointer;
      transition: background .18s, color .18s;
    }
    .cd-tab.active {
      background: linear-gradient(135deg, #0d524d, var(--maroon));
      color: #fff;
    }

    /* Exam tile in course detail */
    .exam-tile {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 14px;
      display: flex; align-items: center; gap: 12px;
      margin-bottom: 10px;
      cursor: pointer;
      transition: transform .15s, box-shadow .2s;
    }
    .exam-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
    .exam-tile .et-icon {
      width: 48px; height: 48px; border-radius: 50%;
      background: linear-gradient(135deg, var(--gold-light), var(--gold));
      border: 1px solid var(--maroon);
      display: grid; place-items: center;
      color: var(--maroon-deep); font-size: 18px;
      flex-shrink: 0;
    }
    .exam-tile .et-body { flex: 1; min-width: 0; }
    .exam-tile .et-title {
      font-weight: 700; font-size: 14px;
      color: var(--ink); margin-bottom: 4px;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .exam-tile .et-chips {
      display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
    }
    .et-chip {
      display: inline-flex; align-items: center; gap: 4px;
      padding: 2px 8px; border-radius: 4px;
      font-size: 10px; font-weight: 700;
      text-transform: uppercase; letter-spacing: .04em;
    }
    .et-chip.status-live { background: var(--rose); color: #fff; }
    .et-chip.status-published { background: var(--leaf); color: #fff; }
    .et-chip.status-ended { background: var(--muted); color: #fff; }
    .et-chip.status-draft { background: var(--warning); color: #fff; }
    .et-chip.duration { background: rgba(107,29,29,.1); color: var(--maroon); }
    .et-chip.passed { background: var(--leaf); color: #fff; }
    .et-chip.failed { background: var(--rose); color: #fff; }
    .exam-tile .et-action {
      flex-shrink: 0; color: var(--maroon); font-size: 18px;
    }
    .exam-tile .et-result-link {
      padding: 6px 10px; border-radius: 8px;
      background: rgba(107,29,29,.1);
      font-size: 9px; font-weight: 700;
      text-transform: uppercase; letter-spacing: .06em;
      color: var(--maroon); cursor: pointer;
    }

    /* ── Exam Start screen ── */
    .es-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 16px;
      margin-bottom: 14px;
      box-shadow: var(--shadow-sm);
    }
    .es-title-area {
      text-align: center; margin-bottom: 6px;
    }
    .es-type-chip {
      display: inline-flex; align-items: center; gap: 5px;
      padding: 4px 12px; border-radius: 999px;
      font-size: 10px; font-weight: 700;
      letter-spacing: .08em; margin-top: 10px;
    }
    .es-type-chip.closed { background: var(--rose); color: #fff; }
    .es-type-chip.open { background: var(--leaf); color: #fff; }
    .es-type-chip.shlok { background: var(--gold); color: var(--maroon-deep); }
    .es-stat-row {
      display: flex; align-items: center; gap: 10px;
      padding: 8px 0;
    }
    .es-stat-row + .es-stat-row { border-top: 1px solid var(--divider); }
    .es-stat-row .ic { color: var(--maroon); font-size: 16px; width: 18px; text-align: center; }
    .es-stat-row .lbl { flex: 1; font-family: 'Playfair Display', serif; font-size: 13px; color: var(--muted); }
    .es-stat-row .val { font-weight: 700; font-size: 14px; color: var(--maroon); }
    .es-rules {
      background: #FFEED2;
      border-radius: 14px; padding: 16px;
      margin-bottom: 14px;
    }
    [data-theme="dark"] .es-rules { background: rgba(212,168,67,.12); }
    .es-rules h4 {
      display: flex; align-items: center; gap: 6px;
      font-size: 14px; font-weight: 700;
      color: var(--maroon); margin-bottom: 10px;
    }
    .es-rules h4 i { color: var(--rose); }
    .es-rules ul {
      list-style: none; padding: 0;
    }
    .es-rules li {
      display: flex; gap: 8px; margin-bottom: 6px;
      font-family: 'Playfair Display', serif;
      font-size: 13px; color: var(--ink); line-height: 1.4;
    }
    .es-rules li::before { content: '•'; color: var(--maroon); font-weight: 700; flex-shrink: 0; }
    .es-countdown {
      text-align: center; padding: 16px;
      background: var(--bg-ivory);
      border-radius: 14px; margin-bottom: 14px;
    }
    .es-countdown .time {
      font-family: 'Playfair Display', serif;
      font-size: 28px; font-weight: 800;
      color: var(--maroon);
    }
    .es-countdown .label {
      font-size: 10px; text-transform: uppercase;
      letter-spacing: .1em; color: var(--muted);
      font-weight: 700; margin-top: 4px;
    }
    .es-admit-pending {
      text-align: center; padding: 20px;
    }
    .es-admit-pending .spinner-lg {
      width: 36px; height: 36px;
      border: 3px solid rgba(107,29,29,.2);
      border-top-color: var(--maroon);
      border-radius: 50%;
      animation: spin .7s linear infinite;
      margin: 0 auto 12px;
    }
    .es-admit-rejected {
      text-align: center; padding: 20px;
    }
    .es-admit-rejected i { font-size: 40px; color: var(--rose); }
    .es-max-attempts {
      text-align: center; padding: 20px;
    }
    .es-max-attempts i { font-size: 40px; color: var(--rose); }

    /* ── Exam Result summary ── */
    .er-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 28px; text-align: center;
      margin-bottom: 16px;
      box-shadow: var(--shadow-sm);
    }
    .er-percentage {
      font-size: 56px; font-weight: 800;
      line-height: 1;
    }
    .er-percentage.pass { color: var(--leaf); }
    .er-percentage.fail { color: var(--rose); }
    .er-score {
      font-size: 13px; color: var(--muted); margin-top: 6px;
    }
    .er-badge {
      display: inline-block;
      padding: 5px 16px; border-radius: 8px;
      font-weight: 700; text-transform: uppercase;
      font-size: 12px; margin-top: 12px;
    }
    .er-badge.pass { background: var(--leaf); color: #fff; }
    .er-badge.fail { background: var(--rose); color: #fff; }

    /* ── Profile ── */
    .profile-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 24px;
      margin-bottom: 16px;
      box-shadow: var(--shadow-sm);
    }
    .profile-avatar {
      width: 72px; height: 72px; border-radius: 50%;
      background: linear-gradient(135deg, var(--gold-light), var(--gold));
      border: 2px solid var(--maroon-deep);
      display: grid; place-items: center;
      color: var(--maroon-deep); font-size: 28px;
      font-weight: 800; margin: 0 auto 14px;
    }
    .profile-name {
      font-family: 'Playfair Display', serif;
      font-size: 20px; font-weight: 800;
      color: var(--maroon); text-align: center;
    }
    .profile-username {
      font-size: 13px; color: var(--muted);
      text-align: center; margin-top: 2px;
    }
    .profile-row {
      display: flex; align-items: center; gap: 12px;
      padding: 12px 0;
    }
    .profile-row + .profile-row { border-top: 1px solid var(--divider); }
    .profile-row .ic {
      width: 36px; height: 36px; border-radius: 10px;
      background: rgba(212,168,67,.15); color: var(--maroon);
      display: grid; place-items: center; font-size: 14px;
    }
    .profile-row .lbl { font-size: 13px; color: var(--muted); }
    .profile-row .val { font-weight: 700; font-size: 14px; color: var(--ink); }

    /* ── Profile Modal ── */
    .profile-modal-card {
      background: var(--surface);
      border-radius: 20px;
      box-shadow: var(--shadow-lg);
      width: 100%; max-width: 440px;
      max-height: 90vh;
      overflow-y: auto;
      position: relative;
      padding: 28px;
      margin: 20px;
    }
    .profile-close {
      position: absolute; top: 16px; right: 16px;
      width: 36px; height: 36px;
      border-radius: 50%;
      border: none;
      background: rgba(212,168,67,.15);
      color: var(--maroon);
      cursor: pointer;
      display: grid; place-items: center;
      font-size: 16px;
      transition: background .2s;
    }
    .profile-close:hover { background: rgba(212,168,67,.3); }
    .pm-header {
      text-align: center;
      margin-bottom: 24px;
    }
    .pm-avatar-wrap {
      position: relative;
      width: 110px; height: 110px;
      margin: 0 auto 16px;
    }
    .pm-avatar {
      width: 110px; height: 110px;
      border-radius: 50%;
      object-fit: cover;
      border: 3px solid var(--gold);
      box-shadow: 0 4px 20px rgba(0,0,0,.15);
      background: linear-gradient(135deg, var(--gold-light), var(--gold));
    }
    .pm-avatar-initial {
      width: 110px; height: 110px;
      border-radius: 50%;
      border: 3px solid var(--gold);
      box-shadow: 0 4px 20px rgba(0,0,0,.15);
      background: linear-gradient(135deg, var(--gold-light), var(--gold));
      display: grid; place-items: center;
      font-size: 44px; font-weight: 800;
      color: var(--maroon-deep);
    }
    .pm-upload-btn {
      position: absolute; bottom: 0; right: 0;
      width: 38px; height: 38px;
      border-radius: 50%;
      border: 2px solid var(--surface);
      background: var(--maroon);
      color: #fff;
      cursor: pointer;
      display: grid; place-items: center;
      font-size: 14px;
      transition: transform .2s, background .2s;
    }
    .pm-upload-btn:hover { transform: scale(1.05); background: var(--maroon-deep); }
    .pm-upload-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
    .pm-upload-btn.spinning::after {
      content: '';
      width: 16px; height: 16px;
      border: 2px solid rgba(255,255,255,.3);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin .7s linear infinite;
    }
    .pm-name { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 700; color: var(--maroon); }
    .pm-username { font-size: 13px; color: var(--muted); margin-top: 4px; }
    .pm-role {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 4px 12px; border-radius: 999px;
      background: rgba(107,29,29,.1);
      font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
      color: var(--maroon); margin-top: 10px;
    }
    .pm-section {
      background: var(--bg-ivory);
      border-radius: 14px;
      /* increased padding for breathing room inside sections */
      padding: 22px;
      margin-bottom: 14px;
    }
    .pm-section-title {
      font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
      color: var(--muted); margin-bottom: 12px;
    }
    .pm-stat { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
    .pm-stat + .pm-stat { border-top: 1px solid var(--divider); }
    .pm-stat-label { font-size: 13px; color: var(--muted); }
    .pm-stat-value { font-weight: 700; font-size: 14px; color: var(--ink); }
    /* Password grid: more vertical spacing and gentler field layout */
    .pm-pwd-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
    .pm-pwd-grid .field { margin: 0; }
    /* small top offset before the first password field for breathing room */
    .pm-pwd-grid .field:first-child { padding-top: 6px; }
    .pm-pwd-note { font-size: 12px; color: var(--muted); margin-top: 12px; }

    /* Slightly larger hit targets inside profile sections */
    .pm-section .field .input-wrap { padding: 8px 14px; }
    .pm-section .field input { padding: 14px 0; font-size: 15px; }

    /* Add spacing above the Update Password button so it doesn't feel cramped */
    #pmChangePasswordBtn { margin-top: 12px; }

    /* Make sure the update button doesn't feel cramped on small screens */
    @media (max-width: 480px) {
      .profile-modal-card { padding: 18px; margin: 12px; }
      .pm-avatar-wrap { width: 96px; height: 96px; margin-bottom: 12px; }
      .pm-avatar, .pm-avatar-initial { width: 96px; height: 96px; font-size: 36px; }
      .pm-section { padding: 18px; }
      .pm-section .field input { padding: 12px 0; }
      #jitsiProctorFrame,
      #jitsiProctorContainer {
        height: 75vh !important;
      }
    }
    .pm-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
    .pm-actions .btn { width: 100%; justify-content: center; }
    #avatarInput { display: none; }
    [data-theme="dark"] .pm-section { background: rgba(231,195,106,.08); }

    /* 5-min warning overlay */
    .five-min-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0,0,0,.6);
      z-index: 300;
      display: flex; align-items: center; justify-content: center;
      padding: 20px;
    }
    .five-min-dialog {
      background: var(--surface);
      border: 2px solid var(--warning);
      border-radius: 18px;
      padding: 28px; text-align: center;
      max-width: 380px; width: 100%;
      box-shadow: 0 20px 60px rgba(0,0,0,.4);
    }
    .five-min-dialog i { font-size: 48px; color: var(--warning); margin-bottom: 12px; }
    .five-min-dialog h3 {
      font-family: 'Playfair Display', serif;
      font-size: 20px; font-weight: 800;
      color: var(--maroon); margin-bottom: 6px;
    }
    .five-min-dialog p { font-size: 14px; color: var(--muted); }

    /* Confirm dialog */
    .confirm-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0,0,0,.55);
      z-index: 250;
      display: flex; align-items: center; justify-content: center;
      padding: 20px;
    }
    .confirm-card {
      background: var(--bg-ivory);
      border: 1.5px solid var(--gold);
      border-radius: 22px;
      padding: 22px; text-align: center;
      max-width: 360px; width: 100%;
      box-shadow: 0 20px 60px rgba(0,0,0,.35);
    }
    .confirm-card i { font-size: 48px; color: var(--maroon); margin-bottom: 10px; }
    .confirm-card h3 {
      font-family: 'Playfair Display', serif;
      font-size: 18px; font-weight: 800;
      color: var(--maroon); margin-bottom: 6px;
    }
    .confirm-card p { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
    .confirm-actions {
      display: flex; gap: 10px;
    }
    .confirm-actions .btn { flex: 1; }

    /* Material items */
    .material-item {
      display: flex; align-items: center; gap: 12px;
      padding: 12px 14px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 10px;
      margin-bottom: 8px;
      cursor: pointer;
      transition: transform .15s, box-shadow .2s;
    }
    .material-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
    .material-item .mi-icon {
      width: 40px; height: 40px; border-radius: 10px;
      background: rgba(212,168,67,.18); color: var(--maroon);
      display: grid; place-items: center; font-size: 16px;
      flex-shrink: 0;
    }
    .material-item .mi-title {
      font-weight: 600; font-size: 14px; color: var(--ink);
    }
    .material-item .mi-type {
      font-size: 10px; text-transform: uppercase;
      letter-spacing: .08em; color: var(--muted); font-weight: 700;
    }

    /* Dark mode overrides for new components */
    [data-theme="dark"] .es-rules { background: rgba(212,168,67,.1); }
    [data-theme="dark"] .cd-tab { color: var(--muted); }
    [data-theme="dark"] .cd-tab.active { color: #fff; }
    [data-theme="dark"] .es-card,
    [data-theme="dark"] .er-card,
    [data-theme="dark"] .profile-card,
    [data-theme="dark"] .exam-tile,
    [data-theme="dark"] .material-item {
      background: var(--surface);
      border-color: var(--border);
    }
    [data-theme="dark"] .confirm-card {
      background: var(--bg-ivory);
      border-color: rgba(231,195,106,.55);
    }
    [data-theme="dark"] .five-min-dialog {
      background: var(--surface);
      border-color: var(--warning);
    }
    [data-theme="dark"] .cd-tabs {
      background: var(--bg-ivory);
      border-color: rgba(231,195,106,.4);
    }

    /* ── Camera Scan Overlay ── */
    .camera-scan-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0; z-index: 2000;
      background: #000;
      display: none;
      flex-direction: column;
    }
    .camera-scan-overlay.open { display: flex; }
    .camera-scan-overlay .cso-header {
      position: absolute; top: 0; left: 0; right: 0;
      z-index: 10;
      display: flex; align-items: center; justify-content: space-between;
      padding: 16px 20px;
      background: linear-gradient(180deg, rgba(0,0,0,.7), transparent);
    }
    .camera-scan-overlay .cso-instructions {
      position: absolute;
      top: 72px;
      left: 16px;
      right: 16px;
      background: rgba(0, 0, 0, 0.75);
      color: #fff;
      padding: 12px 16px;
      border-radius: 10px;
      font-size: 14px;
      line-height: 1.5;
      z-index: 5;
      font-family: 'Noto Serif Bengali', serif;
      text-align: center;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }
    .camera-scan-overlay .cso-instructions i {
      color: var(--gold-light);
      font-size: 16px;
    }
    .camera-scan-overlay .cso-header select {
      padding: 8px 12px;
      border-radius: 8px;
      background: rgba(0,0,0,.6);
      color: #fff;
      border: 1px solid rgba(255,255,255,.3);
      font-size: 13px;
      max-width: 160px;
    }
    .camera-scan-overlay .cso-header button {
      width: 40px; height: 40px;
      border-radius: 50%;
      background: rgba(255,255,255,.15);
      border: none;
      color: #fff;
      font-size: 18px;
      cursor: pointer;
      display: grid; place-items: center;
      transition: background .2s;
    }
    .camera-scan-overlay .cso-header button:hover { background: rgba(255,255,255,.25); }
    .camera-scan-overlay .cso-header button.focus-active {
      background: rgba(255,200,0,.5);
      animation: focusPulse 0.6s ease-out;
    }
    @keyframes focusPulse {
      0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,200,0,0.7); }
      50% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255,200,0,0); }
      100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,200,0,0); }
    }
    .camera-scan-overlay video {
      flex: 1;
      width: 100%;
      object-fit: contain;
    }
    .camera-scan-overlay .cso-footer {
      position: absolute; bottom: 0; left: 0; right: 0;
      z-index: 10;
      display: flex; align-items: center; justify-content: center;
      gap: 24px;
      padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
      background: linear-gradient(0deg, rgba(0,0,0,.7), transparent);
    }
    .cso-capture-btn {
      width: 72px; height: 72px;
      border-radius: 50%;
      border: 4px solid rgba(255,255,255,.8);
      background: transparent;
      cursor: pointer;
      display: grid; place-items: center;
      transition: transform .15s;
    }
    .cso-capture-btn:active { transform: scale(0.92); }
    .cso-capture-btn .inner {
      width: 56px; height: 56px;
      border-radius: 50%;
      background: #fff;
      transition: background .2s;
    }
    .cso-capture-btn .inner.capturing { background: #dc2626; border-radius: 6px; width: 28px; height: 28px; }
    .cso-capture-btn .inner.captured { background: #22c55e; }

    /* Scan preview overlay */
    .scan-preview-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0; z-index: 2001;
      background: rgba(0,0,0,.95);
      display: none;
      align-items: center; justify-content: center;
      flex-direction: column;
      padding: 20px;
    }
    .scan-preview-overlay.open { display: flex; }
    .scan-preview-overlay img {
      max-width: 94vw;
      max-height: 75vh;
      border-radius: 12px;
      margin-bottom: 20px;
      box-shadow: 0 8px 30px rgba(0,0,0,.5);
    }
    .scan-preview-overlay .spo-actions {
      display: flex; gap: 16px;
    }
    .scan-preview-overlay .spo-actions button {
      padding: 12px 28px;
      border-radius: 12px;
      font-weight: 700;
      font-size: 14px;
      cursor: pointer;
      transition: transform .15s, opacity .2s;
    }
    .scan-preview-overlay .spo-actions button:active { transform: scale(0.96); }

    /* ── Upload zone ── */
    .upload-zone {
      display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
    }
    .upload-required-pill {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 3px 9px;
      border-radius: 999px;
      background: rgba(232,117,26,.14);
      color: var(--primary-dark);
      font-size: 11px;
      font-weight: 700;
      letter-spacing: .04em;
      text-transform: uppercase;
    }
    .upload-zone .uz-btn {
      display: inline-flex; align-items: center; gap: 8px;
      padding: 10px 18px;
      border-radius: var(--radius-sm);
      font-weight: 600; font-size: 13px;
      cursor: pointer;
      transition: transform .12s, box-shadow .2s;
    }
    .upload-zone .uz-btn:active { transform: scale(0.97); }
    .upload-zone .uz-btn.primary {
      background: var(--primary); color: #fff;
      border: none;
    }
    .upload-zone .uz-btn.outline {
      background: transparent;
      color: var(--ink);
      border: 1.5px solid var(--border);
    }
    .upload-zone .uz-btn.outline:hover { background: var(--bg-cream); }
    .upload-helper {
      margin: -2px 0 12px;
      font-size: 12px;
      color: var(--muted);
    }
    .upload-helper.pending { color: var(--warning); }
    .upload-helper.ready {
      color: var(--leaf);
      font-weight: 600;
    }
    .upload-helper.not-ready {
      color: var(--danger);
      font-weight: 600;
    }
    .btn:disabled,
    .upload-zone .uz-btn:disabled {
      opacity: .55;
      cursor: not-allowed;
      box-shadow: none;
      filter: saturate(.7);
    }

    /* ── Upload progress bar ── */
    .upload-progress {
      display: none; margin-bottom: 12px;
    }
    .upload-progress.active { display: block; }
    .upload-progress .up-row {
      display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
    }
    .upload-progress .up-row .up-spinner {
      width: 16px; height: 16px;
      border: 2.5px solid var(--border);
      border-top-color: var(--primary);
      border-radius: 50%;
      animation: spin .7s linear infinite;
      flex-shrink: 0;
    }
    .upload-progress .up-row .up-text {
      font-size: 13px; color: var(--muted); flex: 1;
    }
    .upload-progress .up-track {
      height: 4px;
      background: var(--border);
      border-radius: 2px;
      overflow: hidden;
    }
    .upload-progress .up-track .up-bar {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, var(--primary), var(--gold));
      border-radius: 2px;
      transition: width .4s ease;
    }

    /* ── Button spinner (uploading state) ── */
    .btn-spinner {
      display: inline-block; width: 16px; height: 16px;
      border: 2px solid rgba(255,255,255,0.3);
      border-top-color: #fff;
      border-radius: 50%;
      animation: btn-spin .6s linear infinite;
      vertical-align: middle; margin-right: 4px;
    }
    @keyframes btn-spin { to { transform: rotate(360deg); } }

    /* ── Retake button ── */
    .retake-btn {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 8px 14px; border-radius: 8px;
      font-size: 13px; font-weight: 600; cursor: pointer;
      background: var(--surface); border: 1px solid var(--border);
      color: var(--text); transition: opacity .2s;
    }
    .retake-btn:hover { opacity: .8; }

    /* ── Upload progress variant for video ── */
    .upload-progress-video { margin-bottom: 12px; }
    .upload-progress-video .up-status-text {
      font-size: 12px; color: var(--muted); margin-bottom: 4px;
    }

    /* ── Preview gallery ── */
    .preview-gallery {
      display: flex; flex-wrap: wrap; gap: 8px;
    }
    .preview-gallery .pg-item {
      position: relative;
      width: 80px; height: 80px;
      border-radius: 8px;
      overflow: hidden;
      cursor: pointer;
      border: 2px solid var(--border);
      background: var(--divider);
      transition: border-color .2s, transform .15s;
    }
    .preview-gallery .pg-item:hover { border-color: var(--primary); transform: translateY(-2px); }
    .preview-gallery .pg-item img {
      width: 100%; height: 100%;
      object-fit: cover;
    }
    .preview-gallery .pg-item .pg-badge {
      position: absolute; bottom: 2px; left: 2px;
      font-size: 9px; font-weight: 700;
      background: rgba(0,0,0,.7);
      color: #fff;
      padding: 1px 6px;
      border-radius: 4px;
    }
    .preview-gallery .pg-item .pg-status {
      position: absolute;
      top: 2px;
      right: 2px;
      font-size: 9px;
      font-weight: 700;
      color: #fff;
      padding: 1px 6px;
      border-radius: 4px;
      text-transform: uppercase;
      letter-spacing: .04em;
      background: rgba(0,0,0,.72);
    }
    .preview-gallery .pg-item.uploading { border-color: var(--primary); animation: pgPulse 1s infinite; }
    .preview-gallery .pg-item.done { border-color: var(--leaf); }
    .preview-gallery .pg-item.error { border-color: var(--rose); }
    .preview-gallery .pg-item.uploading .pg-status { background: rgba(232,117,26,.94); }
    .preview-gallery .pg-item.done .pg-status { background: rgba(56,161,105,.94); }
    .preview-gallery .pg-item.error .pg-status { background: rgba(198,71,71,.96); }

    @keyframes pgPulse {
      0%, 100% { border-color: var(--primary); }
      50% { border-color: var(--gold); }
    }

    /* ── Page preview lightbox ── */
    .page-lightbox {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0; z-index: 2100;
      background: rgba(0,0,0,.92);
      display: none;
      align-items: center; justify-content: center;
      padding: 20px;
    }
    .page-lightbox.open { display: flex; }
    .page-lightbox .pl-close {
      position: absolute; top: 20px; right: 20px;
      width: 40px; height: 40px;
      border-radius: 50%;
      background: rgba(255,255,255,.12);
      border: none;
      color: #fff;
      font-size: 18px;
      cursor: pointer;
      display: grid; place-items: center;
    }
    .page-lightbox .pl-close:hover { background: rgba(255,255,255,.22); }
    .page-lightbox img {
      max-width: 95vw;
      max-height: 92vh;
      object-fit: contain;
      border-radius: 8px;
    }
    .page-lightbox .pl-counter {
      position: absolute; bottom: 20px;
      color: rgba(255,255,255,.7);
      font-size: 13px;
      font-weight: 600;
    }
    .page-lightbox .pl-nav {
      position: absolute; top: 50%; transform: translateY(-50%);
      width: 44px; height: 44px;
      border-radius: 50%;
      background: rgba(255,255,255,.1);
      border: none;
      color: #fff;
      font-size: 20px;
      cursor: pointer;
      display: grid; place-items: center;
      transition: background .2s;
    }
    .page-lightbox .pl-nav:hover { background: rgba(255,255,255,.2); }
    .page-lightbox .pl-nav.prev { left: 16px; }
    .page-lightbox .pl-nav.next { right: 16px; }

    /* ── Pre-registration Popup ── */
    .pr-modal {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0; z-index: 200;
      display: none; align-items: center; justify-content: center;
      padding: 20px;
      background: rgba(0,0,0,0.55);
      backdrop-filter: blur(4px);
    }
    .pr-modal.open { display: flex; }
    .pr-card {
      background: var(--surface);
      border-radius: 20px;
      padding: 28px 24px 24px;
      max-width: 420px;
      width: 100%;
      box-shadow: 0 20px 60px rgba(0,0,0,.3);
      position: relative;
      animation: modalRise .32s cubic-bezier(0.2, 0.9, 0.3, 1);
      max-height: 90vh;
      overflow-y: auto;
    }
    .pr-card .pr-close {
      position: absolute; top: 12px; right: 12px;
      width: 36px; height: 36px; border-radius: 50%;
      display: grid; place-items: center;
      color: var(--muted); cursor: pointer;
      transition: background .2s;
      background: none; border: none; font-size: 18px;
    }
    .pr-card .pr-close:hover { background: var(--bg-cream); color: var(--maroon); }
    .pr-card h3 {
      font-family: 'Playfair Display', serif;
      font-size: 20px; font-weight: 800;
      color: var(--maroon); margin-bottom: 4px;
    }
    .pr-card .pr-sub {
      font-size: 13px; color: var(--muted);
      margin-bottom: 20px;
    }
    .pr-card .field { margin-bottom: 14px; }
    .pr-card .field label {
      display: block; font-size: 12px; font-weight: 600;
      color: var(--maroon); margin-bottom: 6px;
    }
    .pr-card .field .input-wrap {
      position: relative;
      display: flex; align-items: center;
      background: var(--bg-cream);
      border: 1.5px solid var(--divider);
      border-radius: var(--radius-sm);
      padding: 0 12px;
      transition: border-color .2s, background .2s;
    }
    .pr-card .field .input-wrap:focus-within {
      border-color: var(--primary);
      background: #fff;
    }
    .pr-card .field .input-wrap i.lead { color: var(--muted); margin-right: 10px; font-size: 14px; }
    .pr-card .field input, .pr-card .field textarea {
      flex: 1;
      padding: 12px 0;
      border: none;
      background: transparent;
      outline: none;
      font-size: 14px;
      color: var(--ink);
      width: 100%;
      font-family: inherit;
    }
    .pr-card .field textarea { min-height: 60px; resize: vertical; }
    .pr-card .pr-note {
      font-size: 11px; color: var(--muted);
      margin-top: 10px; text-align: center;
    }
    .pr-success {
      text-align: center; padding: 20px 0;
    }
    .pr-success i {
      font-size: 48px; color: var(--success);
      margin-bottom: 12px;
    }
    .pr-success h4 {
      font-family: 'Playfair Display', serif;
      font-size: 18px; font-weight: 700;
      color: var(--maroon); margin-bottom: 6px;
    }
    .pr-success p {
      font-size: 13px; color: var(--muted);
      margin-bottom: 16px;
    }
    .pr-btn-waitlist {
      display: inline-flex; align-items: center; gap: 8px;
      padding: 10px 18px;
      background: var(--bg-ivory);
      color: var(--maroon);
      border: 1.5px dashed var(--gold);
      border-radius: var(--radius-sm);
      font-weight: 600;
      font-size: 13px;
      cursor: pointer;
      transition: all .15s;
      margin-top: 8px;
    }
    .pr-btn-waitlist:hover {
      background: rgba(212,168,67,.1);
      border-style: solid;
    }

    [data-theme="dark"] .upload-zone .uz-btn.outline {
      border-color: var(--divider);
      color: var(--gold-light);
    }
    [data-theme="dark"] .upload-zone .uz-btn.outline:hover { background: rgba(231,195,106,.1); }
    [data-theme="dark"] .pr-card { background: var(--surface); }
    [data-theme="dark"] .pr-card .field .input-wrap { background: #24100F; border-color: var(--divider); }
    [data-theme="dark"] .pr-card .field .input-wrap:focus-within { background: #2E1817; }

    /* ── Inline Question Paper Viewer ── */
    .qp-viewer {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      margin-bottom: 16px;
      overflow: hidden;
    }
    .qp-toolbar {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 14px;
      border-bottom: 1px solid var(--border);
      background: var(--bg-ivory);
      flex-wrap: wrap;
    }
    [data-theme="dark"] .qp-toolbar { background: rgba(231,195,106,.06); }
    .qp-toolbar-title {
      font-weight: 700;
      font-size: 13px;
      color: var(--maroon);
      flex: 1;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .qp-toolbar-title i { color: var(--primary); }
    .qp-btn {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 6px 12px;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition: opacity .15s, transform .12s;
      border: 1px solid var(--border);
      background: var(--surface);
      color: var(--ink);
    }
    .qp-btn:hover { opacity: .85; }
    .qp-btn:active { transform: scale(.97); }
    .qp-btn.primary {
      background: var(--primary);
      color: #fff;
      border-color: var(--primary);
    }
    .qp-btn.primary i { color: #fff; }
    .qp-btn i { font-size: 12px; color: var(--muted); }
    .qp-pages {
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      align-items: center;
      background: #525659;
    }
    [data-theme="dark"] .qp-pages { background: #1a1a1a; }
    .qp-page-wrap {
      width: 100%;
      max-width: 800px;
      background: #fff;
      border-radius: 4px;
      overflow: hidden;
      box-shadow: 0 2px 8px rgba(0,0,0,.25);
    }
    .qp-page-wrap img {
      display: block;
      width: 100%;
      height: auto;
    }
    .qp-page-num {
      text-align: center;
      font-size: 10px;
      color: rgba(255,255,255,.5);
      margin-top: 2px;
      padding-bottom: 4px;
    }
    .qp-image-full {
      width: 100%;
      border-radius: 0;
      display: block;
    }
    .qp-loading {
      text-align: center;
      padding: 40px 20px;
      color: rgba(255,255,255,.6);
      font-size: 14px;
    }
    .qp-loading .spinner {
      width: 28px;
      height: 28px;
      border: 3px solid rgba(255,255,255,.2);
      border-top-color: var(--gold-light);
      margin: 0 auto 12px;
      display: block;
    }
    .qp-pdf-list { display: flex; flex-direction: column; gap: 16px; }
    .qp-pdf-doc { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
    .qp-pdf-doc { border-top-left-radius: 0; border-top-right-radius: 0; }
    .qp-pdf-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: rgba(0,0,0,.2); border-bottom: 1px solid var(--border); }
    .qp-pdf-name { font-size: 13px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
    .qp-pdf-name i { color: var(--danger); }
    [data-theme="dark"] .qp-pdf-doc { background: var(--bg); border-color: var(--border); }
    [data-theme="dark"] .qp-pdf-header { background: rgba(0,0,0,.3); border-color: var(--border); }
    [data-theme="dark"] .qp-pdf-name { color: var(--gold-light); }
    [data-theme="dark"] .qp-viewer { background: var(--surface); border-color: var(--border); }
    [data-theme="dark"] .qp-btn { background: rgba(231,195,106,.1); border-color: rgba(231,195,106,.35); color: var(--gold-light); }
    [data-theme="dark"] .qp-btn i { color: var(--muted); }
    [data-theme="dark"] .qp-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
    [data-theme="dark"] .qp-btn.primary i { color: #fff; }
    [data-theme="dark"] .qp-toolbar-title { color: var(--gold-light); }