  /* ==========================================================================
     THEME. Dark is the default; light is opt-in via data-theme="light".
     The tint vars below are the pale wash colours used behind callouts, badges
     and selected states - they have to flip with the theme or dark mode ends up
     with pastel blocks glowing out of the page.
     ========================================================================== */
  :root, :root[data-theme="dark"] {
    --brand-red: #ef4444;
    --brand-red-dark: #b91c1c;
    --brand-red-light: #f87171;
    --surface: #16181c;
    --surface-2: #0b0c0e;
    --surface-3: #202329;
    --border: #2a2d33;
    --border-strong: #3c4046;
    --text-primary: #f2f2f2;
    --text-secondary: #c7c9cc;
    --text-muted: #8b8e94;
    --text-on-red: #ffffff;
    --success: #34d399;
    --success-strong: #10b981;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;

    --tint-red: rgba(239,68,68,0.14);
    --tint-red-border: rgba(239,68,68,0.35);
    --tint-green: rgba(52,211,153,0.14);
    --tint-blue: rgba(96,165,250,0.14);
    --tint-amber: rgba(251,191,36,0.14);

    --shadow-sm: 0 1px 4px rgba(0,0,0,0.35);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.45);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.55);
    --radius: 8px;
    --radius-lg: 12px;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.15s ease;
  }

  :root[data-theme="light"] {
    --brand-red: #dc2626;
    --brand-red-dark: #991b1b;
    --brand-red-light: #f87171;
    --surface: #ffffff;
    --surface-2: #f5f5f5;
    --surface-3: #eeeeee;
    --border: #e3e3e3;
    --border-strong: #c4c4c4;
    --text-primary: #0a0a0a;
    --text-secondary: #3a3a3a;
    --text-muted: #6b6b6b;
    --text-on-red: #ffffff;
    --success: #15803d;
    --success-strong: #15803d;
    --warning: #b45309;
    --danger: #dc2626;
    --info: #2563eb;

    --tint-red: #fef2f2;
    --tint-red-border: #fecaca;
    --tint-green: #ecfdf5;
    --tint-blue: #eff6ff;
    --tint-amber: #fffbeb;

    --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  }

  html { color-scheme: dark; }
  :root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  html { font-size: 16px; scroll-behavior: smooth; }

  body {
    font-family: var(--font-sans);
    background: var(--surface-2);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
  }

  .screen { display: none; min-height: 100vh; }
  .screen.active { display: flex; flex-direction: column; }

  #auth-screen {
    background: var(--surface-2);
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
  }

  #auth-screen::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--brand-red);
  }

  #institution-screen {
    background: var(--surface-2);
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
  }

  #institution-screen::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--brand-red);
  }

  #reset-password-screen {
    background: var(--surface-2);
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
  }

  #reset-password-screen::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--brand-red);
  }

  .institution-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; margin-bottom: 4px; }

  .institution-item {
    display: flex; align-items: center; justify-content: space-between; padding: 13px 16px;
    border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
  }

  .institution-item:hover { border-color: var(--brand-red); background: var(--tint-red); }
  :root:not([data-theme="light"]) .institution-item:hover { background: rgba(220,38,38,0.14); }
  .institution-item .name { font-size: 14.5px; font-weight: 600; color: var(--text-primary); }

  /* Drawn chevron rather than a text arrow character */
  .institution-item .chevron {
    width: 7px; height: 7px; flex-shrink: 0; margin-right: 3px;
    border-top: 2px solid var(--text-muted);
    border-right: 2px solid var(--text-muted);
    transform: rotate(45deg);
    transition: border-color var(--transition);
  }
  .institution-item:hover .chevron { border-color: var(--brand-red); }

  .institution-empty { font-size: 13.5px; color: var(--text-muted); text-align: center; padding: 22px 12px; line-height: 1.5; }

  .auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 44px;
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 1;
  }

  .auth-logo { text-align: center; margin-bottom: 36px; }
  .auth-logo img { height: 64px; object-fit: contain; }
  .auth-logo .institution-logo-img,
  .auth-logo img#auth-logo-img { max-height: 72px; }

  .auth-logo-fallback {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
  }

  .auth-logo-fallback .flame { color: var(--brand-red); font-size: 22px; }

  .auth-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
  }

  .auth-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 36px;
    font-weight: 400;
  }

  .form-group { margin-bottom: 20px; }

  .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
    letter-spacing: 0.1px;
  }

  .form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    font-weight: 400;
  }

  .form-group input:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(220,38,38,0.10);
  }

  .btn-primary {
    width: 100%;
    padding: 13px 24px;
    background: var(--brand-red);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    letter-spacing: 0.1px;
    margin-top: 6px;
  }

  .btn-primary:hover { background: var(--brand-red-dark); box-shadow: 0 4px 14px rgba(220,38,38,0.3); }
  .btn-primary:active { transform: scale(0.98); }
  .btn-primary:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }

  .auth-error {
    background: var(--tint-red);
    border: 1px solid var(--tint-red-border);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13.5px;
    margin-bottom: 16px;
    display: none;
    font-weight: 500;
  }

  .auth-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.6;
  }

  /* ==================== HOME (MARKETING) SCREEN ==================== */
  #home-screen { background: var(--surface-2); }

  .home-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 36px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .home-nav-brand { display: flex; align-items: center; gap: 10px; }
  .home-nav-brand img { height: 26px; object-fit: contain; }
  .home-nav-brand-text { font-size: 18px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.4px; }
  .home-nav-brand-text span { color: var(--brand-red); }

  .home-nav-links { display: flex; align-items: center; gap: 28px; }
  .home-nav-links a { font-size: 14px; font-weight: 600; color: var(--text-secondary); text-decoration: none; transition: color var(--transition); }
  .home-nav-links a:hover { color: var(--brand-red); }

  /* ---- Hero, with a layered graphic backdrop ---- */
  .home-stage { position: relative; overflow: hidden; }

  /* Dot grid, fading out towards the bottom */
  .home-stage::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--border-strong) 1.1px, transparent 1.1px);
    background-size: 28px 28px;
    -webkit-mask-image: radial-gradient(ellipse 85% 70% at 50% 18%, #000 35%, transparent 100%);
    mask-image: radial-gradient(ellipse 85% 70% at 50% 18%, #000 35%, transparent 100%);
    opacity: 0.9;
    pointer-events: none;
  }

  /* Soft brand-coloured wash behind the headline */
  .home-stage::after {
    content: '';
    position: absolute;
    top: -220px; left: 50%;
    width: 900px; height: 620px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(220,38,38,0.16), rgba(220,38,38,0.04) 45%, transparent 70%);
    pointer-events: none;
  }

  :root:not([data-theme="light"]) .home-stage::after {
    background: radial-gradient(ellipse at center, rgba(220,38,38,0.26), rgba(220,38,38,0.06) 45%, transparent 70%);
  }

  .home-hero { position: relative; z-index: 1; padding: 104px 40px 60px; text-align: center; max-width: 780px; margin: 0 auto; }

  .home-hero .eyebrow {
    display: inline-block; padding: 6px 15px; border-radius: 20px;
    background: var(--surface); border: 1px solid var(--border-strong);
    color: var(--brand-red); font-size: 12px; font-weight: 700; letter-spacing: 0.8px;
    text-transform: uppercase; margin-bottom: 24px; box-shadow: var(--shadow-sm);
  }

  .home-hero h1 {
    font-size: 52px; font-weight: 800; letter-spacing: -1.8px; color: var(--text-primary);
    margin: 0 auto 20px; line-height: 1.08; max-width: 620px; text-wrap: balance;
  }
  .home-hero h1 span { color: var(--brand-red); }
  .home-hero p { font-size: 17px; color: var(--text-secondary); margin: 0 auto 34px; line-height: 1.7; max-width: 560px; text-wrap: pretty; }

  /* ---- Abstract product mock sitting under the hero ---- */
  .home-mock {
    position: relative; z-index: 1;
    max-width: 760px; margin: 0 auto; padding: 0 40px 104px;
  }

  .home-mock-frame {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }

  .home-mock-bar { height: 38px; background: #0a0a0a; display: flex; align-items: center; padding: 0 14px; gap: 6px; }
  .home-mock-dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,0.18); }
  .home-mock-dot:first-child { background: var(--brand-red); }

  .home-mock-body { padding: 22px; display: flex; flex-direction: column; gap: 12px; }

  .home-mock-row { display: flex; align-items: center; gap: 14px; }
  .home-mock-line { height: 9px; border-radius: 6px; background: var(--surface-3); }
  .home-mock-line.w-lg { width: 46%; }
  .home-mock-line.w-md { width: 30%; }
  .home-mock-line.w-sm { width: 18%; }
  .home-mock-line.accent { background: var(--brand-red); opacity: 0.85; }

  .home-mock-track { flex: 1; height: 9px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
  .home-mock-track > span { display: block; height: 100%; border-radius: 6px; background: var(--brand-red); }

  .home-mock-tile {
    flex: 1; border: 1px solid var(--border); border-radius: 10px; padding: 14px;
    display: flex; flex-direction: column; gap: 9px; background: var(--surface-2);
  }

  /* ---- Features ---- */
  .home-features { max-width: 1080px; margin: 0 auto; padding: 0 40px 104px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

  .home-feature-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 30px 28px; box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  }

  .home-feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--border-strong); }

  .home-feature-card .icon {
    width: 44px; height: 44px; border-radius: 11px; margin-bottom: 18px;
    display: flex; align-items: center; justify-content: center;
    background: var(--tint-red); color: var(--brand-red);
  }
  :root:not([data-theme="light"]) .home-feature-card .icon { background: rgba(220,38,38,0.16); }
  .home-feature-card .icon svg { width: 22px; height: 22px; }

  .home-feature-card h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 9px; letter-spacing: -0.2px; }
  .home-feature-card p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.65; }

  .home-section,
  .home-process,
  .home-detail-grid,
  .home-cta { width: min(1080px, calc(100% - 80px)); margin: 0 auto 104px; }

  .home-section-split {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
    gap: 70px; align-items: center;
  }
  .home-kicker {
    color: var(--brand-red); font-size: 12px; font-weight: 800;
    letter-spacing: 0.9px; text-transform: uppercase; margin-bottom: 10px;
  }
  .home-section h2,
  .home-process h2,
  .home-cta h2,
  .privacy-header h1 {
    color: var(--text-primary); font-size: clamp(28px, 4vw, 42px);
    line-height: 1.12; letter-spacing: -1px; margin-bottom: 16px;
  }
  .home-section > div > p,
  .home-section-heading > p,
  .home-cta p { color: var(--text-secondary); font-size: 16px; line-height: 1.75; }
  .home-check-list { display: flex; flex-direction: column; gap: 12px; }
  .home-check-list > div {
    display: grid; grid-template-columns: 28px 1fr; column-gap: 12px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-sm);
  }
  .home-check-list span { color: var(--success); font-weight: 900; grid-row: 1 / span 2; }
  .home-check-list strong { color: var(--text-primary); font-size: 15px; }
  .home-check-list small { color: var(--text-muted); font-size: 13px; line-height: 1.55; }

  .home-section-heading { text-align: center; max-width: 680px; margin: 0 auto 36px; }
  .home-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .home-steps article,
  .home-detail-grid article {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow-sm);
  }
  .home-step-number { color: var(--brand-red); font-size: 13px; font-weight: 900; letter-spacing: 1px; margin-bottom: 28px; }
  .home-steps h3,
  .home-detail-grid h3 { color: var(--text-primary); font-size: 17px; margin-bottom: 8px; }
  .home-steps p,
  .home-detail-grid p { color: var(--text-secondary); font-size: 13.5px; line-height: 1.65; }
  .home-detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
  .home-cta {
    display: flex; align-items: center; justify-content: space-between; gap: 40px;
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand-red);
    border-radius: var(--radius-lg); padding: 38px 42px; box-shadow: var(--shadow-md);
  }
  .home-cta h2 { font-size: clamp(25px, 3vw, 34px); margin-bottom: 10px; }
  .home-cta .btn-primary { width: auto; min-width: 170px; margin: 0; }

  .home-footer {
    background: #0a0a0a; color: rgba(255,255,255,0.6); padding: 32px 40px; margin-top: auto;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  }

  .home-footer-brand { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; color: #fff; }
  .home-footer-brand img { width: 28px; height: 28px; object-fit: contain; display: block; }
  .home-footer-links { display: flex; gap: 22px; }
  .home-footer-links a { color: rgba(255,255,255,0.55); text-decoration: none; font-size: 13px; }
  .home-footer-links a:hover { color: #fff; }
  .home-footer-copy { font-size: 12px; color: rgba(255,255,255,0.35); }

  /* Privacy page */
  .privacy-nav .home-nav-brand { text-decoration: none; }
  .privacy-back { text-decoration: none; }
  .privacy-page { width: min(1040px, calc(100% - 48px)); margin: 0 auto; padding: 76px 0 100px; }
  .privacy-header { max-width: 760px; margin-bottom: 50px; }
  .privacy-header p { color: var(--text-secondary); font-size: 17px; line-height: 1.7; max-width: 680px; }
  .privacy-updated { color: var(--text-muted); font-size: 13px; margin-top: 18px; }
  .privacy-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 54px; align-items: start; }
  .privacy-summary {
    position: sticky; top: 92px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm);
  }
  .privacy-summary h2 { color: var(--text-primary); font-size: 17px; margin-bottom: 14px; }
  .privacy-summary ul { padding-left: 18px; color: var(--text-secondary); font-size: 13px; line-height: 1.65; }
  .privacy-summary li + li { margin-top: 9px; }
  .privacy-content section { padding-bottom: 30px; margin-bottom: 30px; border-bottom: 1px solid var(--border); }
  .privacy-content section:last-child { border-bottom: none; }
  .privacy-content h2 { color: var(--text-primary); font-size: 21px; line-height: 1.3; margin-bottom: 12px; }
  .privacy-content p,
  .privacy-content li { color: var(--text-secondary); font-size: 14.5px; line-height: 1.75; }
  .privacy-content p + p { margin-top: 12px; }
  .privacy-content ul { padding-left: 22px; margin: 12px 0; }
  .privacy-content li + li { margin-top: 5px; }
  .privacy-content a { color: var(--brand-red); }

  @media (max-width: 900px) {
    .home-nav-links { gap: 14px; }
    .home-nav-links a:not(.btn-ghost) { display: none; }
    .home-features { grid-template-columns: 1fr; padding-bottom: 72px; }
    .home-hero { padding: 68px 24px 44px; }
    .home-hero h1 { font-size: 34px; letter-spacing: -1px; }
    .home-hero p { font-size: 15.5px; }
    .home-mock { padding: 0 24px 72px; }
    .home-footer { flex-direction: column; align-items: flex-start; }
    .home-section,
    .home-process,
    .home-detail-grid,
    .home-cta { width: min(100% - 48px, 680px); margin-bottom: 72px; }
    .home-section-split { grid-template-columns: 1fr; gap: 30px; }
    .home-steps { grid-template-columns: 1fr; }
    .home-detail-grid { grid-template-columns: 1fr; }
    .privacy-layout { grid-template-columns: 1fr; gap: 30px; }
    .privacy-summary { position: static; }
  }

  .layout { display: flex; flex-direction: column; min-height: 100vh; }

  .topbar {
    background: #0a0a0a;
    border-bottom: none;
    padding: 0 36px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .topbar-left { display: flex; align-items: center; gap: 20px; }
  /* Institution artwork is shown exactly as supplied, with no added tile. */
  .topbar-logo img {
    height: 42px; object-fit: contain; display: block;
    background: transparent; border-radius: 0; padding: 0;
  }

  .topbar-logo-text { font-size: 17px; font-weight: 800; color: #ffffff; letter-spacing: -0.3px; }

  .topbar-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.15); }

  .topbar-label { font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.55); letter-spacing: 0.2px; }

  /* Learnby attribution sitting beside the customer's own branding */
  .topbar-platform {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 2px 9px;
  }

  .platform-attribution {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 11.5px;
    color: var(--text-muted);
    letter-spacing: 0.2px;
  }

  .platform-attribution strong { color: var(--brand-red); font-weight: 700; }

  .topbar-right { display: flex; align-items: center; gap: 16px; }

  .topbar-user { font-size: 13.5px; color: rgba(255,255,255,0.6); font-weight: 500; }

  .btn-ghost {
    padding: 7px 18px;
    background: transparent;
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-sans);
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
    letter-spacing: 0.1px;
  }

  .btn-ghost:hover { border-color: rgba(255,255,255,0.5); color: #ffffff; background: rgba(255,255,255,0.08); }

  .page-content { flex: 1; padding: 44px 40px; max-width: 1180px; width: 100%; margin: 0 auto; }

  .page-header { margin-bottom: 36px; }
  .page-header h1 { font-size: 30px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.6px; margin-bottom: 6px; }
  .page-header p { font-size: 15px; color: var(--text-muted); font-weight: 400; }

  .welcome-banner {
    background: #0a0a0a;
    border-radius: var(--radius-lg);
    padding: 36px 44px;
    color: #fff;
    margin-bottom: 36px;
    position: relative;
    overflow: hidden;
  }

  .welcome-banner::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--brand-red);
    border-radius: 4px 0 0 4px;
  }

  .welcome-banner::after {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(220,38,38,0.08);
  }

  .welcome-banner h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.4px; }
  .welcome-banner p { font-size: 14px; opacity: 0.6; font-weight: 400; }

  .stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 36px; }

  .stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
  }

  .stat-card:hover { box-shadow: var(--shadow-md); }
  .stat-card .stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 10px; }
  .stat-card .stat-value { font-size: 32px; font-weight: 800; color: var(--text-primary); letter-spacing: -1px; }
  .stat-card .stat-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; font-weight: 400; }

  .section-title { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 20px; letter-spacing: -0.3px; }

  .courses-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin-bottom: 40px; }

  .course-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
    cursor: pointer;
  }

  .course-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--border-strong); }
  .course-card.locked { opacity: 0.6; cursor: not-allowed; }
  .course-card.locked:hover { box-shadow: var(--shadow-sm); transform: none; border-color: var(--border); }

  .course-card-image { width: 100%; height: 168px; object-fit: cover; display: block; background: var(--surface-3); }

  .course-card-image-placeholder {
    width: 100%;
    height: 168px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-muted);
    background: linear-gradient(135deg, var(--surface-3) 0%, var(--surface-2) 100%);
    padding: 0 20px;
  }

  .course-card-body { padding: 24px 26px 26px; }

  .course-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 14px;
  }

  /* Required is deliberately the loudest thing on the card - solid fill, white
     text and a leading dot, so it reads as "do this" at a glance rather than
     as one more pastel chip. */
  .course-tag.required {
    background: var(--brand-red); color: #ffffff;
    box-shadow: 0 2px 8px rgba(239,68,68,0.35);
    display: inline-flex; align-items: center; gap: 7px;
    padding-left: 9px;
  }
  .course-tag.required::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: #ffffff; box-shadow: 0 0 0 3px rgba(255,255,255,0.28);
  }
  .course-tag.assessment { background: var(--tint-blue); color: var(--info); border: 1px solid var(--tint-blue); }
  .course-tag.complete {
    background: transparent; color: var(--success);
    border: 1.5px solid var(--success);
  }
  .course-tag.locked { background: var(--surface-3); color: var(--text-muted); }

  .course-card-title { font-size: 17px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; letter-spacing: -0.3px; }
  .course-card-desc { font-size: 13.5px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 20px; font-weight: 400; }

  .course-meta { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--text-muted); }
  .course-duration { font-weight: 600; color: var(--text-secondary); }

  .course-status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; background: var(--border-strong); }
  .course-status-dot.passed { background: var(--success); }
  .course-status-dot.failed { background: var(--danger); }
  .course-status-dot.in-progress { background: var(--warning); }

  .progress-bar-wrap { background: var(--surface-3); border-radius: 10px; height: 4px; margin-top: 16px; overflow: hidden; }
  .progress-bar-fill { height: 100%; background: var(--success); border-radius: 10px; transition: width 0.5s ease; }

  #course-screen { background: var(--surface-2); }

  .course-layout { display: grid; grid-template-columns: 280px 1fr; gap: 0; flex: 1; min-height: calc(100vh - 64px); }

  .course-sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 24px 0; overflow-y: auto; }

  .course-sidebar-title {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 0 20px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
  }

  .sidebar-module { padding: 0 12px; margin-bottom: 4px; }

  .sidebar-module-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    padding: 10px 8px 6px;
  }

  .sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    position: relative;
  }

  .sidebar-item:hover { background: var(--surface-3); color: var(--text-primary); }
  .sidebar-item.active { background: var(--tint-red); color: var(--brand-red); font-weight: 600; }
  .sidebar-item.completed .sidebar-check { color: var(--success); }
  .sidebar-item.locked { opacity: 0.5; cursor: not-allowed; }
  .sidebar-item.locked:hover { background: transparent; color: var(--text-secondary); }

  .sidebar-check {
    width: 18px; height: 18px; border-radius: 50%;
    border: 1.5px solid var(--border-strong);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 10px; color: var(--text-muted); background: var(--surface);
  }

  .sidebar-item.completed .sidebar-check { background: var(--success); border-color: var(--success); color: #fff; }
  .sidebar-item.active .sidebar-check { border-color: var(--brand-red); color: var(--brand-red); }

  .course-main { padding: 36px 40px; overflow-y: auto; max-height: calc(100vh - 64px); }

  .lesson-header { margin-bottom: 28px; }
  .lesson-breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; font-weight: 500; }
  .lesson-breadcrumb span { color: var(--brand-red); }
  .lesson-title { font-size: 24px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.4px; margin-bottom: 8px; }
  .lesson-meta { font-size: 13px; color: var(--text-muted); }

  .lesson-body {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
    margin-bottom: 24px;
    font-size: 14.5px;
    line-height: 1.75;
    color: var(--text-primary);
  }

  .lesson-body h2 { font-size: 18px; font-weight: 700; margin: 28px 0 12px; color: var(--text-primary); letter-spacing: -0.2px; }
  .lesson-body h2:first-child { margin-top: 0; }
  .lesson-body h3 { font-size: 15.5px; font-weight: 700; margin: 22px 0 10px; color: var(--text-primary); }
  .lesson-body p { margin-bottom: 14px; }
  .lesson-body ul, .lesson-body ol { padding-left: 22px; margin-bottom: 14px; }
  .lesson-body li { margin-bottom: 6px; }

  .lesson-body .callout {
    background: var(--tint-red);
    border-left: 3px solid var(--brand-red);
    padding: 14px 18px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 20px 0;
    font-size: 14px;
  }

  .lesson-body .callout.info { background: var(--tint-blue); border-color: var(--info); }
  .lesson-body .callout.warning { background: var(--tint-amber); border-color: var(--warning); }
  .lesson-body .callout.success { background: var(--tint-green); border-color: var(--success); }

  .lesson-body .callout-title {
    font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 6px; color: var(--brand-red);
  }

  .callout.info .callout-title { color: var(--info); }
  .callout.warning .callout-title { color: var(--warning); }
  .callout.success .callout-title { color: var(--success); }

  .lesson-image { width: 100%; border-radius: var(--radius); margin: 20px 0; display: block; background: var(--surface-3); }

  .lesson-image.placeholder-image {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: repeating-linear-gradient(45deg, var(--surface-3), var(--surface-3) 10px, var(--surface-2) 10px, var(--surface-2) 20px);
    border: 1.5px dashed var(--border-strong);
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
    padding: 20px;
  }

  .placeholder-inner strong { display: block; color: var(--text-secondary); font-size: 13.5px; margin-bottom: 4px; }

  .contacts-table { width: 100%; border-collapse: collapse; margin: 16px 0 20px; }
  .contacts-table th {
    text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted); padding: 8px 10px; border-bottom: 1.5px solid var(--border);
  }
  .contacts-table td { padding: 10px 10px; font-size: 13.5px; border-bottom: 1px solid var(--border); vertical-align: top; }
  .contacts-table td.role { font-weight: 600; color: var(--text-primary); }

  .lesson-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 8px; }

  .btn-lesson-nav {
    padding: 11px 22px; border-radius: var(--radius); font-size: 14px; font-weight: 600;
    font-family: var(--font-sans); cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
    border: 1.5px solid var(--border); color: var(--text-secondary); background: var(--surface);
  }

  .btn-lesson-nav:hover { border-color: var(--brand-red); color: var(--brand-red); }

  .btn-lesson-next {
    padding: 11px 22px; background: var(--brand-red); color: #fff; border: none;
    border-radius: var(--radius); font-size: 14px; font-weight: 600; font-family: var(--font-sans);
    cursor: pointer; transition: background var(--transition);
  }

  .btn-lesson-next:hover { background: var(--brand-red-dark); }
  .btn-lesson-next:disabled { opacity: 0.5; cursor: not-allowed; }

  .quiz-container { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px 36px 28px; margin-bottom: 24px; box-shadow: var(--shadow-sm); }

  /* Progress panel - deliberately heavy. The old 4px bar on a pale track was
     invisible on bright screens, so this has a real groove, a border and a label. */
  .quiz-progress-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px 18px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
  }

  .quiz-progress-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
  .quiz-progress-step { font-size: 13.5px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.1px; }
  .quiz-progress-pct { font-size: 14px; font-weight: 800; color: var(--success); letter-spacing: -0.2px; }

  .quiz-progress-track {
    height: 12px;
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.10);
  }

  .quiz-progress-fill {
    height: 100%;
    min-width: 10px;
    background: linear-gradient(90deg, var(--success-strong), var(--success));
    border-radius: 20px;
    transition: width 0.35s ease;
  }

  .quiz-progress-sections { display: flex; gap: 4px; margin-bottom: 7px; }
  .quiz-progress-sections span {
    flex-basis: 0; color: var(--text-muted); font-size: 10.5px; font-weight: 800;
    letter-spacing: 0.5px; text-transform: uppercase; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
  }
  .quiz-segmented-progress { display: flex; gap: 4px; width: 100%; }
  .quiz-progress-segment {
    flex: 1 1 0; height: 10px; min-width: 8px;
    background: var(--surface-3); border: 1px solid var(--border-strong);
    border-radius: 3px; transition: background var(--transition), border-color var(--transition);
  }
  .quiz-progress-segment.current { background: var(--brand-red-light); border-color: var(--brand-red-light); }
  .quiz-progress-segment.done { background: var(--success); border-color: var(--success); }

  .question-text { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 24px; line-height: 1.45; letter-spacing: -0.2px; }

  .quiz-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; }

  .quiz-option {
    display: flex; align-items: center; gap: 14px;
    padding: 15px 18px; border: 1.5px solid var(--border); border-radius: var(--radius);
    cursor: pointer; font-size: 14.5px; color: var(--text-secondary);
    transition: border-color var(--transition), background var(--transition), color var(--transition), transform var(--transition);
    background: var(--surface); font-family: var(--font-sans); text-align: left; line-height: 1.5; width: 100%;
  }

  .quiz-option-key {
    width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-3); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 12.5px; font-weight: 800;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
  }

  .quiz-option-text { flex: 1; }

  .quiz-option:hover:not(:disabled) { border-color: var(--brand-red); background: var(--tint-red); color: var(--text-primary); }
  :root:not([data-theme="light"]) .quiz-option:hover:not(:disabled) { background: rgba(220,38,38,0.12); }

  .quiz-option.selected { border-color: var(--brand-red); background: var(--tint-red); color: var(--brand-red); font-weight: 600; }
  :root:not([data-theme="light"]) .quiz-option.selected { background: rgba(220,38,38,0.16); }
  .quiz-option.selected .quiz-option-key { background: var(--brand-red); border-color: var(--brand-red); color: #fff; }

  .quiz-option.correct { border-color: var(--success); background: var(--tint-green); color: var(--success); font-weight: 600; }
  .quiz-option.incorrect { border-color: var(--danger); background: var(--tint-red); color: var(--danger); font-weight: 600; }
  .quiz-option:disabled { cursor: not-allowed; }

  .quiz-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

  .quiz-score { text-align: center; padding: 28px 0 22px; }
  .quiz-score-value { font-size: 56px; font-weight: 800; letter-spacing: -1.5px; line-height: 1; }
  .quiz-score-value.pass { color: var(--success); }
  .quiz-score-value.fail { color: var(--brand-red); }
  .quiz-score-count { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-top: 12px; }
  .quiz-score-hint { font-size: 13.5px; color: var(--text-muted); margin-top: 8px; }

  .result-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 48px 40px; text-align: center; max-width: 560px; margin: 0 auto; box-shadow: var(--shadow-sm);
  }

  .result-icon {
    width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; margin: 0 auto 24px; font-size: 28px;
  }

  .result-icon.pass { background: var(--tint-green); color: var(--success); }
  .result-icon.fail { background: var(--tint-red); color: var(--danger); }

  .result-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.3px; }
  .result-score { font-size: 52px; font-weight: 800; letter-spacing: -1px; margin: 16px 0; }
  .result-score.pass { color: var(--success); }
  .result-score.fail { color: var(--danger); }
  .result-card p { font-size: 14.5px; color: var(--text-secondary); margin-bottom: 28px; line-height: 1.6; }

  .result-breakdown { background: var(--surface-3); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 28px; text-align: left; }
  .result-breakdown-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 5px 0; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
  .result-breakdown-row:last-child { border: none; }
  .result-breakdown-row strong { color: var(--text-primary); font-weight: 600; }

  .admin-tabs { display: flex; gap: 4px; background: var(--surface-3); padding: 4px; border-radius: var(--radius); margin-bottom: 28px; width: fit-content; }

  .admin-tab {
    padding: 8px 20px; border-radius: calc(var(--radius) - 2px); font-size: 13.5px; font-weight: 600;
    cursor: pointer; color: var(--text-secondary); background: transparent; border: none;
    font-family: var(--font-sans); transition: background var(--transition), color var(--transition);
  }

  .admin-tab.active { background: var(--surface); color: var(--brand-red); box-shadow: var(--shadow-sm); }

  .admin-panel { display: none; }
  .admin-panel.active { display: block; }

  .admin-table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); margin-bottom: 24px; }
  .admin-table { width: 100%; border-collapse: collapse; }

  .admin-table th {
    background: var(--surface-3); font-size: 11.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.6px; color: var(--text-muted); padding: 12px 18px; text-align: left; border-bottom: 1px solid var(--border);
  }

  .admin-table td { padding: 14px 18px; font-size: 13.5px; color: var(--text-secondary); border-bottom: 1px solid var(--border); vertical-align: middle; }
  .admin-table tr:last-child td { border-bottom: none; }
  .admin-table tr:hover td { background: var(--surface-2); }

  .badge {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px;
    font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
  }

  .badge.pass { background: var(--tint-green); color: var(--success); }
  .badge.fail { background: var(--tint-red); color: var(--danger); }
  .badge.pending { background: var(--surface-3); color: var(--text-muted); }
  .badge.in-progress { background: var(--tint-amber); color: var(--warning); }

  .admin-search {
    padding: 9px 14px; border: 1.5px solid var(--border); border-radius: var(--radius);
    font-size: 13.5px; font-family: var(--font-sans); color: var(--text-primary); outline: none;
    width: 280px; margin-bottom: 16px; transition: border-color var(--transition);
  }

  .admin-search:focus { border-color: var(--brand-red); }

  .admin-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }

  .admin-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; box-shadow: var(--shadow-sm); }
  .admin-stat .label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 8px; }
  .admin-stat .value { font-size: 28px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }

  .btn-sm {
    padding: 5px 12px; border-radius: 4px; font-size: 12px; font-weight: 600; font-family: var(--font-sans);
    cursor: pointer; border: 1.5px solid var(--border); background: var(--surface); color: var(--text-secondary); transition: all var(--transition);
  }

  .btn-sm:hover { border-color: var(--brand-red); color: var(--brand-red); }
  .btn-sm.danger:hover { border-color: var(--danger); color: var(--danger); }

  .modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; display: none;
    align-items: center; justify-content: center; padding: 20px;
  }

  .modal-overlay.active { display: flex; }

  .modal { background: var(--surface); border-radius: var(--radius-lg); padding: 36px; max-width: 480px; width: 100%; box-shadow: var(--shadow-lg); }
  .modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.2px; }
  .modal p { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; }
  .modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

  .course-assign-list { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }

  .course-assign-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
  }

  .course-assign-item.selected { border-color: var(--brand-red); background: var(--tint-red); }
  .course-assign-item input[type=checkbox] { accent-color: var(--brand-red); width: 16px; height: 16px; }
  .course-assign-item label { font-size: 14px; font-weight: 500; color: var(--text-primary); cursor: pointer; }

  .loading-overlay {
    position: fixed; inset: 0; background: var(--surface); z-index: 9999; display: flex;
    align-items: center; justify-content: center; flex-direction: column; gap: 16px;
  }

  .spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--brand-red); border-radius: 50%; animation: spin 0.7s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .loading-text { font-size: 13.5px; color: var(--text-muted); font-weight: 500; }

  .toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9000; display: flex; flex-direction: column; gap: 10px; }

  .toast {
    background: #1a1a1a; color: #fff; padding: 12px 18px; border-radius: var(--radius);
    font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-md); animation: slideIn 0.2s ease;
    min-width: 240px; max-width: 340px;
  }

  .toast.success { background: var(--success); }
  .toast.error { background: var(--danger); }

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

  .hidden { display: none !important; }
  .flex-center { display: flex; align-items: center; justify-content: center; }
  hr.divider { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
  .text-success { color: var(--success); }
  .text-danger { color: var(--danger); }
  .text-muted { color: var(--text-muted); }
  .font-bold { font-weight: 700; }

  @media (max-width: 900px) {
    .course-layout { grid-template-columns: 1fr; }
    .course-sidebar { display: none; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .admin-stats-grid { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 24px 16px; }
    .topbar { padding: 0 16px; }
    .auth-card { padding: 36px 24px; }
  }

  @media (max-width: 560px) {
    .stats-row { grid-template-columns: 1fr; }
    .admin-stats-grid { grid-template-columns: 1fr 1fr; }
    .courses-grid { grid-template-columns: 1fr; }
  }

  /* ==================== INTAKE FORM (ONBOARDING) ==================== */
  #intake-screen { background: var(--surface-2); align-items: stretch; }

  .intake-header { width: 100%; max-width: 640px; margin: 0 auto; padding: 32px 24px 0; }
  .intake-header-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
  .intake-header-top img {
    height: 40px; object-fit: contain;
    background: transparent; border-radius: 0; padding: 0;
  }
  .intake-audience-note {
    color: var(--text-muted); font-size: 12px; font-weight: 700;
    letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 10px;
  }
  .intake-step-count { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }

  .intake-progress-track { height: 6px; background: var(--surface-3); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
  .intake-progress-fill { height: 100%; background: var(--success); border-radius: 10px; transition: width 0.3s ease; }
  .intake-section-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--brand-red); margin-bottom: 10px; }

  .intake-body { width: 100%; max-width: 640px; margin: 0 auto; padding: 8px 24px 60px; flex: 1; display: flex; flex-direction: column; justify-content: center; }

  .intake-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 36px; box-shadow: var(--shadow-md); }
  .intake-question-label { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; line-height: 1.4; }
  .intake-question-label .req-star { color: var(--brand-red); }
  .intake-question-desc { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; margin-bottom: 22px; }

  .intake-text-input, .intake-textarea {
    width: 100%; padding: 13px 16px; border: 1.5px solid var(--border); border-radius: var(--radius);
    font-size: 15px; font-family: var(--font-sans); color: var(--text-primary); background: var(--surface);
    outline: none; transition: border-color var(--transition);
  }
  .intake-text-input:focus, .intake-textarea:focus { border-color: var(--brand-red); box-shadow: 0 0 0 3px rgba(220,38,38,0.10); }
  .intake-textarea { min-height: 120px; resize: vertical; line-height: 1.6; font-family: var(--font-sans); }

  .intake-option-list { display: flex; flex-direction: column; gap: 10px; }
  .intake-option-pill {
    display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 1.5px solid var(--border);
    border-radius: var(--radius); cursor: pointer; transition: border-color var(--transition), background var(--transition);
  }
  .intake-option-pill:hover { border-color: var(--brand-red); }
  .intake-option-pill.selected { border-color: var(--brand-red); background: var(--tint-red); }
  :root:not([data-theme="light"]) .intake-option-pill.selected { background: rgba(220,38,38,0.16); }
  .intake-option-pill input { accent-color: var(--brand-red); width: 17px; height: 17px; flex-shrink: 0; }
  .intake-option-pill label { font-size: 14.5px; font-weight: 500; color: var(--text-primary); cursor: pointer; }

  .intake-grid-table { width: 100%; border-collapse: collapse; }
  .intake-grid-table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); padding: 8px 6px; text-align: center; }
  .intake-grid-table th:first-child { text-align: left; }
  .intake-grid-table td { padding: 10px 6px; text-align: center; border-top: 1px solid var(--border); }
  .intake-grid-table td:first-child { text-align: left; font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
  .intake-grid-table input[type=checkbox] { accent-color: var(--brand-red); width: 18px; height: 18px; cursor: pointer; }

  .intake-conduct-image { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 18px; display: block; max-height: 420px; object-fit: contain; background: var(--surface-3); }

  .intake-error { color: var(--danger); font-size: 13px; font-weight: 500; margin-top: 12px; display: none; }

  .intake-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; }

  /* ==================== STEPPED PROGRESS ====================
     One component used by both the intake form and quizzes. A circle per
     section sits on the rail; the ticks between them are individual questions,
     so you can see both "which part am I in" and "how far through it". */
  .step-progress { margin-bottom: 14px; }

  .step-rail {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 10px;
    padding: 0 2px;
  }

  /* The rail itself, drawn behind the circles */
  .step-rail::before {
    content: '';
    position: absolute;
    left: 13px; right: 13px; top: 50%;
    height: 3px; margin-top: -1.5px;
    background: var(--surface-3);
    border-radius: 3px;
  }
  .step-rail-fill {
    position: absolute;
    left: 13px; top: 50%;
    height: 3px; margin-top: -1.5px;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.35s ease;
    max-width: calc(100% - 26px);
  }

  .step-node {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
  }

  .step-dot {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--surface);
    border: 2.5px solid var(--border-strong);
    color: var(--text-muted);
    font-size: 11.5px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
  }
  .step-node.done .step-dot {
    background: var(--success); border-color: var(--success); color: #ffffff;
  }
  .step-node.current .step-dot {
    background: var(--surface); border-color: var(--success); color: var(--success);
    box-shadow: 0 0 0 4px rgba(52,211,153,0.18);
  }
  .step-label {
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.3px;
    text-transform: uppercase; color: var(--text-muted);
    white-space: nowrap;
  }
  .step-node.current .step-label { color: var(--success); }

  /* Per-question ticks for the section you're actually in */
  .step-ticks { display: flex; gap: 5px; margin-top: 4px; }
  .step-tick {
    flex: 1 1 0; height: 6px; min-width: 10px;
    border-radius: 20px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    transition: background var(--transition), border-color var(--transition);
  }
  .step-tick.done { background: var(--success); border-color: var(--success); }
  .step-tick.current { background: var(--success); border-color: var(--success); opacity: 0.55; }
  .step-caption {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 12px; color: var(--text-muted); font-weight: 600; margin-top: 8px;
  }
  .step-caption .pct { color: var(--success); font-weight: 800; font-size: 13px; }

  @media (max-width: 560px) {
    .step-label { display: none; }
    .step-dot { width: 22px; height: 22px; font-size: 10.5px; }
  }

  /* ==================== PROFILE MENU ==================== */
  .profile-wrap { position: relative; }

  .profile-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.10);
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 14px; font-weight: 800; letter-spacing: 0.2px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color var(--transition), background var(--transition);
  }
  .profile-btn:hover { border-color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.18); }

  .profile-menu {
    position: absolute;
    top: calc(100% + 10px); right: 0;
    min-width: 236px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    display: none;
    z-index: 300;
  }
  .profile-menu.open { display: block; }

  .profile-menu-head {
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
  }
  .profile-menu-name { font-size: 14.5px; font-weight: 700; color: var(--text-primary); }
  .profile-menu-email { font-size: 12.5px; color: var(--text-muted); word-break: break-all; margin-top: 2px; }
  .profile-menu-role {
    display: inline-block; margin-top: 8px;
    font-size: 10.5px; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase;
    padding: 2px 8px; border-radius: 20px;
    background: var(--tint-red); color: var(--brand-red);
  }

  .profile-menu-item {
    display: block; width: 100%; text-align: left;
    padding: 10px 12px;
    background: transparent; border: none;
    border-radius: var(--radius);
    font-family: var(--font-sans); font-size: 14px; font-weight: 500;
    color: var(--text-secondary); cursor: pointer;
    transition: background var(--transition), color var(--transition);
  }
  .profile-menu-item:hover { background: var(--surface-3); color: var(--text-primary); }
  .profile-menu-item.danger { color: var(--danger); }
  .profile-menu-item.danger:hover { background: var(--tint-red); }

  /* ==================== DEADLINES ==================== */
  .course-deadline {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 700;
    padding: 3px 10px; border-radius: 20px;
    background: var(--surface-3); color: var(--text-secondary);
    margin-bottom: 14px; margin-left: 8px;
  }
  .course-deadline.soon { background: var(--tint-amber); color: var(--warning); }
  .course-deadline.overdue { background: var(--brand-red); color: #ffffff; }
  .course-deadline.met { background: var(--tint-green); color: var(--success); }

  .course-card-head { display: flex; align-items: center; flex-wrap: wrap; }

  /* Administrator course editor */
  .lesson-edit-block {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 10px;
    background: var(--surface-2);
  }
  .lesson-edit-block > label {
    display: block; font-size: 12.5px; font-weight: 700;
    color: var(--text-primary); margin-bottom: 6px;
  }
  .lesson-edit-block textarea {
    width: 100%; min-height: 110px; resize: vertical;
    padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.6;
    background: var(--surface); color: var(--text-primary); outline: none;
  }
  .lesson-edit-block textarea:focus { border-color: var(--brand-red); }
  .lesson-edit-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

  .question-edit-block {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
    background: var(--surface-2);
  }
  .question-edit-block > label {
    display: block; margin-bottom: 8px; color: var(--text-primary);
    font-size: 12.5px; font-weight: 700;
  }
  .question-edit-block textarea,
  .question-option-edit input[type="text"] {
    width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
    border-radius: var(--radius); background: var(--surface); color: var(--text-primary);
    font-family: var(--font-sans); font-size: 13.5px; outline: none;
  }
  .question-edit-block textarea { resize: vertical; margin-bottom: 9px; }
  .question-edit-block textarea:focus,
  .question-option-edit input[type="text"]:focus { border-color: var(--brand-red); }
  .question-option-edit { display: flex; align-items: center; gap: 9px; margin-top: 7px; }
  .question-option-edit input[type="radio"] { accent-color: var(--brand-red); flex: 0 0 auto; }

  /* Labels and controls use compact corners instead of pill shapes. */
  .home-hero .eyebrow,
  .topbar-platform,
  .btn-ghost,
  .course-tag,
  .quiz-progress-track,
  .quiz-progress-fill,
  .badge,
  .step-tick,
  .profile-menu-role,
  .course-deadline { border-radius: 4px; }

  /* ==================== MOBILE ====================
     The topbar was the worst of it: four controls on a fixed-height bar with
     no wrapping meant the sign-out button fell off the right edge on a phone.
     The profile menu replaces those buttons, and everything non-essential in
     the bar is dropped below 600px. */
  @media (max-width: 760px) {
    html, body { overflow-x: hidden; }
    button, a, input, select, textarea { max-width: 100%; }
    button, .btn-primary, .btn-ghost, .btn-sm, .btn-lesson-nav, .btn-lesson-next { min-height: 44px; }

    .home-nav { height: 60px; padding: 0 14px; }
    .home-nav-brand { min-width: 0; }
    .home-nav-brand img { height: 28px !important; }
    .home-nav-links { gap: 8px; }
    .home-nav-links .btn-ghost { padding: 7px 12px; }
    .home-hero { padding: 54px 18px 38px; }
    .home-hero h1 { font-size: clamp(32px, 10vw, 42px); }
    .home-hero p { font-size: 15px; }
    .home-hero .btn-primary { width: 100% !important; padding: 13px 18px !important; }
    .home-mock { padding: 0 14px 58px; }
    .home-mock-body { padding: 16px; }
    .home-mock-tiles { display: grid; grid-template-columns: 1fr; }
    .home-features { padding: 0 18px 64px; }
    .home-section,
    .home-process,
    .home-detail-grid,
    .home-cta { width: calc(100% - 36px); margin-bottom: 64px; }
    .home-steps article,
    .home-detail-grid article { padding: 22px 20px; }
    .home-cta { align-items: stretch; flex-direction: column; gap: 22px; padding: 28px 22px; }
    .home-cta .btn-primary { width: 100%; }
    .home-footer { padding: 28px 20px; }
    .home-footer-links { flex-wrap: wrap; }

    .topbar { padding: 0 14px; height: 60px; }
    .topbar { overflow: visible; }
    .topbar-left { gap: 12px; min-width: 0; }
    .topbar-right { gap: 10px; }
    .topbar-logo img { height: 34px; }
    .topbar-label { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 38vw; }
    .topbar-user { display: none; }
    .topbar-platform { display: none; }
    .page-content { padding: 22px 14px 40px; }
    .page-header h1 { font-size: 24px; }
    .welcome-banner h2 { font-size: 22px; }
    .welcome-banner { padding: 24px 20px; margin-bottom: 22px; }
    .welcome-banner::after { display: none; }
    .stat-card, .admin-stat { padding: 18px; }
    .stats-row, .admin-stats-grid { gap: 10px; margin-bottom: 22px; }
    .courses-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .course-card-body { padding: 20px; }
    .course-card-image, .course-card-image-placeholder { height: 145px; }
    .course-card-head, .course-meta { gap: 8px; }
    .course-main { padding: 22px 14px 34px; max-height: calc(100vh - 60px); }
    .lesson-body { padding: 22px 18px; }
    .lesson-title { font-size: 22px; }
    .lesson-nav, .quiz-actions { align-items: stretch; flex-direction: column-reverse; }
    .lesson-nav > div, .quiz-actions > div { display: none; }
    .lesson-nav button, .quiz-actions button { width: 100%; }
    .quiz-progress-panel { padding: 14px; }
    .quiz-progress-head { gap: 12px; }
    .quiz-progress-pct { font-size: 12.5px; text-align: right; }
    .quiz-option { padding: 13px 12px; gap: 10px; }
    .quiz-option-key { width: 26px; height: 26px; }
    .result-card { padding: 34px 20px; }
    .contacts-table { display: block; overflow-x: auto; white-space: nowrap; }

    .admin-tabs, .dash-tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .admin-tab, .dash-tab { white-space: nowrap; padding: 8px 14px; }
    .admin-search { width: 100%; }
    .admin-table-wrap { overflow-x: auto; }
    .admin-table { min-width: 620px; }
    #panel-users > div:first-child,
    #panel-schedule > div:first-child { align-items: stretch !important; flex-direction: column; }
    #panel-users > div:first-child > div { display: grid !important; grid-template-columns: 1fr; width: 100%; }
    #panel-users > div:first-child button,
    #panel-schedule > div:first-child button { width: 100% !important; }

    .modal-overlay { align-items: flex-end; padding: 10px; }
    .modal { padding: 24px 18px; max-height: 90vh; overflow-y: auto; border-radius: var(--radius-lg); }
    .modal-actions { flex-wrap: wrap; gap: 8px; }
    .modal-actions button { flex: 1 1 100%; width: 100% !important; }

    .intake-header { padding: 22px 14px 0; }
    .intake-body { padding: 8px 14px 34px; }
    .intake-card { padding: 24px 18px; }
    .intake-grid-table { min-width: 480px; }
    .intake-card { overflow-x: auto; }
    .quiz-container { padding: 22px 18px 20px; }
    .toast-container { left: 12px; right: 12px; bottom: 12px; }
    .toast { min-width: 0; max-width: none; width: 100%; }
    .profile-wrap { z-index: 600; }
    .profile-menu { position: fixed; top: 64px; right: 12px; min-width: 0; width: min(300px, calc(100vw - 24px)); z-index: 1200; }

    .privacy-page { width: calc(100% - 36px); padding: 50px 0 70px; }
    .privacy-header { margin-bottom: 34px; }
    .privacy-header p { font-size: 15px; }
    .privacy-summary { padding: 20px; }
    .privacy-content h2 { font-size: 19px; }
    .privacy-content p, .privacy-content li { font-size: 14px; }
  }

  @media (max-width: 600px) {
    .topbar-divider { display: none; }
    .topbar-label { max-width: 46vw; }
  }

  @media (max-width: 440px) {
    .stats-row, .admin-stats-grid { grid-template-columns: 1fr; }
    .home-nav-brand-text { font-size: 17px; }
    .home-hero .eyebrow { font-size: 10.5px; padding: 5px 9px; }
    .topbar-left > .btn-ghost { padding: 7px 10px; margin-right: 0 !important; }
    .topbar-label { max-width: 40vw; }
    .privacy-back { padding: 7px 10px; font-size: 12px; }
  }
