/* ============================================================================
   Learning portal design system
   Tokens -> base -> layout shell -> components -> pages -> dark theme.
   Mobile-first; breakpoints 640 / 1024 / 1280. WCAG 2.2 AA colour pairs.
   ========================================================================== */

/* ---- 1. Tokens ----------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Brand (override with <style>:root:root:root{--brand:#hex;--on-brand:#fff}) */
  --brand: #1e40af;
  --on-brand: #ffffff;
  --brand-ink: var(--brand);                                   /* brand as text/link colour on surfaces */
  --brand-hover: color-mix(in srgb, var(--brand) 86%, #000);
  --brand-soft: color-mix(in srgb, var(--brand) 9%, var(--surface));
  --brand-soft-2: color-mix(in srgb, var(--brand) 16%, var(--surface));
  --accent: #0f766e;                                           /* teal accent, 5.5:1 on white */
  --accent-soft: #ccfbf1;

  /* Neutrals (slate) */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  --border: #d5dde8;
  --border-2: #e6ebf2;
  --line: var(--border);
  --text: #0f172a;
  --muted: #475569;
  --faint: #56657a;

  /* Status (text on tinted background, all >= 4.5:1) */
  --ok: #166534;     --ok-bg: #dcfce7;
  --warn: #92400e;   --warn-bg: #fef3c7;
  --danger: #b91c1c; --danger-bg: #fee2e2;
  --info: #1e40af;   --info-bg: #dbeafe;
  --danger-solid: #b91c1c;

  /* Type scale */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --fs-xs: .75rem; --fs-sm: .875rem; --fs-base: 1rem; --fs-lg: 1.125rem; --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem; --fs-3xl: 1.875rem; --fs-4xl: 2.25rem; --fs-5xl: 3rem;

  /* Spacing (4/8px) */
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.5rem; --s-6: 2rem; --s-7: 3rem; --s-8: 4rem; --s-9: 6rem;

  /* Shape, depth, motion */
  --r-sm: 6px; --r: 10px; --r-lg: 14px; --r-xl: 20px; --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 4px 16px rgba(15,23,42,.08);
  --shadow-lg: 0 16px 40px rgba(15,23,42,.14);
  --focus: #1d4ed8;
  --ring: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent);
  --t: 160ms cubic-bezier(.2,.6,.2,1);

  --sidebar: 264px;
  --topbar: 64px;
  --maxw: 1200px;
  --overlay: rgba(15,23,42,.55);
}

/* Dark theme: values shared by the OS preference and the manual toggle */
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #3b63d6;
  --brand-ink: color-mix(in srgb, var(--brand) 45%, #fff);
  --brand-hover: color-mix(in srgb, var(--brand) 85%, #fff);
  --accent: #5eead4; --accent-soft: #0f2f2c;
  --bg: #0b1220; --surface: #111a2e; --surface-2: #17223a; --surface-3: #22304c;
  --border: #2d3b57; --border-2: #223049;
  --text: #e8edf6; --muted: #aab6ca; --faint: #93a1b8;
  --ok: #86efac; --ok-bg: #12301f;
  --warn: #fcd34d; --warn-bg: #3a2a0c;
  --danger: #fca5a5; --danger-bg: #3a1618;
  --info: #a5c1ff; --info-bg: #17284f;
  --danger-solid: #dc2626;
  --focus: #93b4ff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 6px 22px rgba(0,0,0,.4);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.55);
  --overlay: rgba(2,6,16,.7);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand: #3b63d6;
    --brand-ink: color-mix(in srgb, var(--brand) 45%, #fff);
    --brand-hover: color-mix(in srgb, var(--brand) 85%, #fff);
    --accent: #5eead4; --accent-soft: #0f2f2c;
    --bg: #0b1220; --surface: #111a2e; --surface-2: #17223a; --surface-3: #22304c;
    --border: #2d3b57; --border-2: #223049;
    --text: #e8edf6; --muted: #aab6ca; --faint: #93a1b8;
    --ok: #86efac; --ok-bg: #12301f;
    --warn: #fcd34d; --warn-bg: #3a2a0c;
    --danger: #fca5a5; --danger-bg: #3a1618;
    --info: #a5c1ff; --info-bg: #17284f;
    --danger-solid: #dc2626;
    --focus: #93b4ff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 6px 22px rgba(0,0,0,.4);
    --shadow-lg: 0 20px 50px rgba(0,0,0,.55);
    --overlay: rgba(2,6,16,.7);
  }
}

/* ---- 2. Base ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar) + 16px); }
body {
  margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
  font-size: var(--fs-base); line-height: 1.6; -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--font); line-height: 1.2; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-base); }
p { margin: 0 0 1em; }
a { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; transition: color var(--t); }
a:hover { text-decoration-thickness: 2px; }
img, svg, video { max-width: 100%; }
img { height: auto; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: var(--r-sm); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-5) 0; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s-4); }
@media (min-width: 640px) { .container { padding: 0 var(--s-5); } }

/* Focus: visible 3px ring on everything interactive */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }

.skip-link {
  position: absolute; left: var(--s-3); top: -80px; z-index: 300; background: var(--text); color: var(--bg);
  padding: .75rem 1rem; border-radius: var(--r); font-weight: 600; text-decoration: none; transition: top var(--t);
}
.skip-link:focus { top: var(--s-3); color: var(--bg); }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Utilities (names relied on by views) */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--fs-sm); }
.center { text-align: center; }
.mono { font-family: var(--mono); }
.row { display: flex; gap: var(--s-4); flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.gap { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.row.gap { gap: var(--s-3); }
.divider { height: 1px; background: var(--border-2); margin: var(--s-5) 0; border: 0; }
.hide-sm { display: none !important; }
@media (min-width: 640px) { .hide-sm { display: inline-flex !important; } .show-sm-only { display: none !important; } }
.gradient-text { color: var(--brand-ink); }
.lead { font-size: var(--fs-lg); color: var(--muted); max-width: 62ch; line-height: 1.6; }
@media (min-width: 1024px) { .lead { font-size: var(--fs-xl); } }
.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand-ink); margin-bottom: var(--s-3);
}
.prose { line-height: 1.7; overflow-wrap: anywhere; }
.prose img, .lesson-content img { border-radius: var(--r); }
.prose :is(h2,h3,h4), .lesson-content :is(h2,h3,h4) { margin-top: 1.4em; }
.lesson-content { line-height: 1.75; overflow-wrap: anywhere; }
.lesson-content pre { overflow-x: auto; background: var(--surface-2); padding: var(--s-4); border-radius: var(--r); }
.lesson-content table { border-collapse: collapse; max-width: 100%; display: block; overflow-x: auto; }
.lesson-content td, .lesson-content th { border: 1px solid var(--border); padding: .4rem .7rem; }

/* ---- 3. Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px;
  padding: .6rem 1.15rem; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: 600 var(--fs-sm)/1.2 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--t), border-color var(--t), box-shadow var(--t), color var(--t), transform var(--t);
}
.btn:hover { text-decoration: none; background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--on-brand); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--faint); }
.btn-soft { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.btn-soft:hover { background: var(--brand-soft-2); }
.btn-danger { background: var(--danger-solid); color: #fff; border-color: var(--danger-solid); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger-solid) 85%, #000); border-color: transparent; }
.btn-ok { background: #15803d; color: #fff; border-color: #15803d; }
.btn-ok:hover { background: #166534; border-color: #166534; }
.btn-sm { min-height: 44px; padding: .4rem .85rem; font-size: var(--fs-sm); }
.btn-lg { min-height: 52px; padding: .8rem 1.6rem; font-size: var(--fs-base); }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.icon-btn {
  width: 44px; height: 44px; border-radius: var(--r); border: 1px solid transparent; background: transparent; color: var(--muted);
  display: inline-grid; place-items: center; cursor: pointer; font-size: 1.2rem; position: relative; text-decoration: none;
  transition: background var(--t), color var(--t), border-color var(--t); flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn .count {
  position: absolute; top: 4px; right: 2px; background: var(--danger-solid); color: #fff; font-size: .65rem; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: var(--r-pill); display: grid; place-items: center; padding: 0 4px; line-height: 1;
}

/* ---- 4. Cards, stats, badges ---------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: var(--s-4); min-width: 0;
}
@media (min-width: 640px) { .card { padding: var(--s-5); } }
.card-pad { padding: var(--s-5); }
.card-glass { background: var(--surface); }
a.card { color: inherit; text-decoration: none; display: block; }
.card-hover { transition: box-shadow var(--t), border-color var(--t), transform var(--t); }
.card-hover:hover { box-shadow: var(--shadow); border-color: var(--border); transform: translateY(-2px); text-decoration: none; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-3); }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s-4); } }
.stat {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-lg);
  padding: var(--s-4); box-shadow: var(--shadow-sm); min-width: 0;
}
a.stat { color: inherit; text-decoration: none; transition: box-shadow var(--t), border-color var(--t); }
a.stat:hover { box-shadow: var(--shadow); border-color: var(--border); }
.card .stat { border: 0; box-shadow: none; padding: 0; background: none; }
.stat .stat-ico {
  width: 40px; height: 40px; border-radius: var(--r); display: grid; place-items: center; font-size: 1.15rem;
  color: var(--brand-ink); background: var(--brand-soft); margin-bottom: var(--s-3);
}
.stat .stat-num { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .stat-label { color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.count-up { font-variant-numeric: tabular-nums; }

.badge, .chip {
  display: inline-flex; align-items: center; gap: .3rem; font-size: var(--fs-xs); font-weight: 600; line-height: 1.2;
  padding: .25rem .6rem; border-radius: var(--r-pill); background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-2);
}
.chip { font-size: var(--fs-sm); padding: .3rem .7rem; white-space: nowrap; }
.lesson-bar > .lesson-aids { order: 5; }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge-info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

/* ---- 5. Forms ------------------------------------------------------------ */
label { font-weight: 600; font-size: var(--fs-sm); display: block; margin-bottom: .35rem; color: var(--text); }
.field { margin-bottom: var(--s-4); }
.input, input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=search], input[type=url], input[type=tel], select, textarea {
  width: 100%; min-height: 44px; padding: .6rem .85rem; border: 1px solid var(--faint); border-radius: var(--r);
  background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-base); line-height: 1.4;
  transition: border-color var(--t), box-shadow var(--t);
}
input[type=file] { max-width: 100%; font: inherit; font-size: var(--fs-sm); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; accent-color: var(--brand); vertical-align: middle; margin: 0 .35rem 0 0; }
input[type=range] { accent-color: var(--brand); }
textarea { min-height: 110px; resize: vertical; }
::placeholder { color: var(--faint); opacity: 1; }
.input:focus, input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
input[aria-invalid="true"], .is-invalid { border-color: var(--danger-solid); }
.hint { font-size: var(--fs-sm); color: var(--faint); margin-top: .35rem; }
.hint-inline { color: var(--faint); font-size: var(--fs-sm); }
.field-error { color: var(--danger); font-size: var(--fs-sm); margin-top: .35rem; display: flex; gap: .35rem; align-items: center; }
.input-group { position: relative; }
.input-group input { padding-right: 3.2rem; }
.input-group .toggle-pw {
  position: absolute; right: 2px; top: 0; height: 100%; width: 44px; display: grid; place-items: center; background: none; border: 0;
  color: var(--muted); cursor: pointer; border-radius: var(--r);
}
.input-group .toggle-pw:hover { color: var(--text); }
.captcha-row { display: flex; align-items: stretch; gap: var(--s-2); flex-wrap: wrap; }
.captcha-box { flex: 0 0 auto; display: grid; place-items: center; padding: 4px 8px; background: #fff; border: 1px solid var(--border); border-radius: var(--r); }
.captcha-svg { display: block; user-select: none; }
.captcha-row input { flex: 1; min-width: 140px; letter-spacing: .18em; text-transform: uppercase; font-family: var(--mono); }
.captcha-row input::placeholder { letter-spacing: normal; text-transform: none; font-family: var(--font); }
.grid-2, .grid-3 { display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
fieldset { border: 1px solid var(--border); border-radius: var(--r); padding: var(--s-4); margin: 0 0 var(--s-4); min-width: 0; }
legend { font-weight: 600; padding: 0 .4rem; font-size: var(--fs-sm); }
details > summary { cursor: pointer; min-height: 32px; }

/* ---- 6. Tables ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border-2); background: var(--surface); -webkit-overflow-scrolling: touch; }
table.data, table.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); background: var(--surface); }
table.data caption { text-align: left; padding: var(--s-3) var(--s-4); font-weight: 600; color: var(--muted); }
table.data th, table.data td, table.table th, table.table td { padding: .7rem 1rem; text-align: left; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
table.data th, table.table th {
  background: var(--surface-2); font-weight: 600; color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase;
  letter-spacing: .05em; white-space: nowrap;
}
table.data tr:last-child td, table.table tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }

/* ---- 7. Alerts / flash --------------------------------------------------- */
.alert {
  display: flex; gap: var(--s-3); align-items: flex-start; padding: .8rem 1rem; border-radius: var(--r);
  margin-bottom: var(--s-4); font-size: var(--fs-sm); border: 1px solid transparent; line-height: 1.5;
}
.alert > i { margin-top: .15rem; flex: none; }
.alert-success, .alert-ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert-warning { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert a { color: inherit; font-weight: 600; }
.flash-stack { position: fixed; top: calc(var(--topbar) + 12px); right: var(--s-4); left: var(--s-4); z-index: 200; max-width: 380px; margin-left: auto; }
.flash-stack .alert { box-shadow: var(--shadow-lg); animation: slideIn 240ms ease; }

/* ---- 8. Progress --------------------------------------------------------- */
.progress { height: 8px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); transition: width 500ms cubic-bezier(.4,0,.2,1); }

/* ---- 9. Top bar ---------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 100; min-height: var(--topbar); display: flex; align-items: center; gap: var(--s-2);
  padding: .5rem var(--s-3); background: var(--surface); border-bottom: 1px solid var(--border-2);
}
@media (min-width: 640px) { .topbar { padding: .5rem var(--s-5); gap: var(--s-3); } }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-size: var(--fs-lg); letter-spacing: -.02em; color: var(--text); text-decoration: none; min-height: 44px; }
.brand:hover { text-decoration: none; color: var(--text); }
.brand-mark { width: 32px; height: 32px; flex: none; color: var(--brand-ink); }
:root[data-theme="dark"] .brand-mark { --mark-fg: #0b1220; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-mark { --mark-fg: #0b1220; } }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
@media (min-width: 640px) { .brand-name { max-width: 240px; } }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 0; }
@media (min-width: 640px) { .topbar-actions { gap: var(--s-1); } }
.topbar-search { display: none; position: relative; flex: 1; max-width: 420px; margin-left: var(--s-3); }
.topbar-search input { padding-left: 2.4rem; background: var(--surface-2); border-color: var(--border); border-radius: var(--r-pill); }
.topbar-search > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
@media (min-width: 640px) { .topbar-search { display: block; } .topbar-search-link { display: none !important; } }
@media (max-width: 479.98px) { .topbar-search-link { display: none !important; } }

.topbar-nav { display: none; align-items: center; gap: var(--s-1); margin-left: var(--s-3); }
.topbar-nav a { padding: .55rem .8rem; border-radius: var(--r); color: var(--muted); font-weight: 600; font-size: var(--fs-sm); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.topbar-nav a:hover { background: var(--surface-2); color: var(--text); }
.topbar-nav a[aria-current="page"] { color: var(--brand-ink); background: var(--brand-soft); }
@media (min-width: 1024px) { .topbar-nav { display: flex; } .nav-toggle { display: none !important; } }
@media (max-width: 1023.98px) {
  .topbar-nav.open {
    display: flex; flex-direction: column; align-items: stretch; position: absolute; top: 100%; left: 0; right: 0; margin: 0;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: var(--s-3); box-shadow: var(--shadow-lg);
  }
}

.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: inline-grid; place-items: center; font-weight: 700; font-size: var(--fs-sm); border: 0; cursor: pointer; font-family: inherit; flex: none; }
button.avatar { width: 44px; height: 44px; }
.avatar-lg { width: 72px; height: 72px; font-size: var(--fs-2xl); }
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: var(--s-2); opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity var(--t), transform var(--t), visibility var(--t); z-index: 130;
}
.menu.open .menu-pop { opacity: 1; visibility: visible; transform: none; }
.menu-pop a, .menu-pop button {
  display: flex; align-items: center; gap: .65rem; width: 100%; min-height: 44px; padding: .5rem .7rem; border-radius: var(--r); color: var(--text);
  font-size: var(--fs-sm); background: none; border: 0; cursor: pointer; font-family: inherit; text-align: left; text-decoration: none;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); }
.menu-divider { height: 1px; background: var(--border-2); margin: var(--s-2) 0; }
.menu-head { padding: .5rem .7rem; overflow-wrap: anywhere; }
.menu-head strong { display: block; }

/* ---- 10. App shell (sidebar + main) ------------------------------------- */
.shell { display: block; min-height: calc(100vh - var(--topbar)); }
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 150; width: min(86vw, 300px); background: var(--surface);
  border-right: 1px solid var(--border); padding: var(--s-4) var(--s-3) 0; overflow: hidden; display: flex; flex-direction: column; transform: translateX(-102%);
  visibility: hidden; transition: transform 220ms ease, visibility 220ms; box-shadow: var(--shadow-lg);
}
.sidebar.open { transform: none; visibility: visible; }
.sidebar-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: var(--s-3); scrollbar-width: thin; }
.side-foot { flex: none; border-top: 1px solid var(--border); background: var(--surface); padding: var(--s-3) var(--s-1) var(--s-3); display: grid; gap: var(--s-2); }
.side-user { display: flex; align-items: center; gap: .65rem; min-width: 0; padding: 0 .35rem; }
.side-avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--brand); color: var(--on-brand, #fff); font-weight: 700; font-size: var(--fs-sm); }
.side-user-text { display: grid; min-width: 0; line-height: 1.25; }
.side-user-text strong, .side-user-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-4); }
.sidebar-scrim { display: none; position: fixed; inset: 0; background: var(--overlay); z-index: 140; }
.sidebar-scrim.show { display: block; }
.side-group { margin-bottom: var(--s-5); }
.side-group h2, .side-group h6 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 0 .75rem var(--s-2); font-weight: 700; }
.side-link {
  display: flex; align-items: center; gap: .75rem; min-height: 44px; padding: .5rem .75rem; border-radius: var(--r); color: var(--muted);
  font-weight: 600; font-size: var(--fs-sm); margin-bottom: 2px; text-decoration: none; transition: background var(--t), color var(--t);
}
.side-link i { font-size: 1.1rem; width: 22px; text-align: center; flex: none; }
.side-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-link.active, .side-link[aria-current="page"] { background: var(--brand-soft-2); color: var(--brand-ink); box-shadow: inset 3px 0 0 var(--brand-ink); }
.side-link .side-badge { margin-left: auto; background: var(--danger-solid); color: #fff; font-size: var(--fs-xs); font-weight: 700; padding: .05rem .45rem; border-radius: var(--r-pill); }
.main { min-width: 0; padding: var(--s-5) var(--s-4) var(--s-7); max-width: 1400px; }
@media (min-width: 640px) { .main { padding: var(--s-6) var(--s-5) var(--s-7); } }
@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: var(--topbar); z-index: 10; width: auto; height: calc(100vh - var(--topbar)); transform: none; visibility: visible;
    box-shadow: none; transition: none;
  }
  .sidebar-head, .sidebar-scrim, .sidebar-scrim.show { display: none; }
  .hamburger { display: none !important; }
  .main { padding: var(--s-6) var(--s-6) var(--s-8); }
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-5); flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-2xl); margin: 0; }
.page-head p { margin: .3rem 0 0; color: var(--muted); max-width: 70ch; }
@media (min-width: 640px) { .page-head h1 { font-size: var(--fs-3xl); } }

/* ---- 11. Public sections -------------------------------------------------- */
.section { padding: var(--s-7) 0; }
@media (min-width: 1024px) { .section { padding: var(--s-8) 0; } }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-5); }
.section-head h2 { margin: 0; font-size: var(--fs-2xl); }
@media (min-width: 1024px) { .section-head h2 { font-size: var(--fs-3xl); } }
.section-alt { background: var(--surface); border-block: 1px solid var(--border-2); }

.hero { position: relative; overflow: hidden; padding: var(--s-7) 0 var(--s-6); isolation: isolate; }
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 70% at 85% 0%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%),
    radial-gradient(45% 60% at 0% 100%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
}
.hero h1 { font-size: clamp(2rem, 6vw, 3.25rem); line-height: 1.1; letter-spacing: -.03em; margin-bottom: var(--s-4); }
.hero-grid { display: grid; gap: var(--s-6); align-items: center; }
@media (min-width: 1024px) { .hero { padding: var(--s-9) 0 var(--s-8); } .hero-grid { grid-template-columns: 1.15fr .85fr; gap: var(--s-8); } }
.hero-art { display: none; }
@media (min-width: 1024px) { .hero-art { display: block; } }
.search-hero { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-5); max-width: 560px; }
.search-hero .sh-input { position: relative; flex: 1; }
.search-hero .sh-input i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-hero input { min-height: 52px; padding-left: 2.6rem; border-radius: var(--r); box-shadow: var(--shadow-sm); }
@media (min-width: 640px) { .search-hero { flex-direction: row; } }
.hero-grid > * { min-width: 0; }
.trust-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--border); max-width: 560px; }
.trust-item strong { display: block; font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.trust-item span { color: var(--muted); font-size: var(--fs-sm); }
.cat-chips { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.cat-chip {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .4rem 1rem; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: var(--fs-sm); text-decoration: none;
  transition: background var(--t), border-color var(--t), color var(--t);
}
.cat-chip:hover { background: var(--brand-soft); border-color: var(--brand-ink); color: var(--brand-ink); text-decoration: none; }
.cat-chip[aria-current="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

.feature-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
@media (min-width: 640px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .feature-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }
.feature { padding: var(--s-5); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border-2); box-shadow: var(--shadow-sm); }
.feature .fico { width: 48px; height: 48px; border-radius: var(--r); display: grid; place-items: center; font-size: 1.4rem; color: var(--brand-ink); background: var(--brand-soft); margin-bottom: var(--s-3); }
.steps { display: grid; gap: var(--s-4); list-style: none; padding: 0; margin: 0; }
@media (min-width: 1024px) { .steps { grid-template-columns: repeat(3, 1fr); gap: var(--s-5); } }
.step-card { position: relative; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--shadow-sm); }
.step-card .num { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-weight: 800; margin-bottom: var(--s-3); }
.step-card h3 { margin-bottom: .3rem; }
.step-card p { margin: 0; color: var(--muted); }
.callout { display: grid; gap: var(--s-5); padding: var(--s-5); border-radius: var(--r-xl); background: var(--brand-soft); border: 1px solid var(--brand-soft-2); }
@media (min-width: 1024px) { .callout { grid-template-columns: 1.2fr 1fr; padding: var(--s-7); align-items: center; } }
.callout .ico { width: 52px; height: 52px; border-radius: var(--r); background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-size: 1.5rem; margin-bottom: var(--s-3); }
.cta-band { background: var(--brand); color: var(--on-brand); border-radius: var(--r-xl); padding: var(--s-6) var(--s-5); text-align: center; }
.cta-band h2 { color: var(--on-brand); }
.cta-band p { color: var(--on-brand); margin-bottom: var(--s-4); }
.cta-band .btn-light { background: var(--on-brand); color: var(--brand); border-color: var(--on-brand); }
.cta-band .btn-light:hover { background: color-mix(in srgb, var(--on-brand) 90%, var(--brand)); }
.cta-band .btn-outline { background: transparent; color: var(--on-brand); border-color: var(--on-brand); }
.cta-band .btn-outline:hover { background: color-mix(in srgb, var(--on-brand) 14%, transparent); }

/* ---- 12. Course cards ----------------------------------------------------- */
.grid-cards { display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
@media (min-width: 640px) { .grid-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-cards { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .grid-cards.cols-4 { grid-template-columns: repeat(4, 1fr); } }
.course-card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-lg);
  overflow: hidden; color: inherit; text-decoration: none; box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), border-color var(--t), transform var(--t);
}
.course-card:hover { box-shadow: var(--shadow); border-color: var(--border); transform: translateY(-2px); text-decoration: none; color: inherit; }
.cc-thumb {
  position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; color: #fff; font-size: 2.2rem; overflow: hidden;
  background: linear-gradient(135deg, hsl(var(--h, 222) 62% 32%), hsl(calc(var(--h, 222) + 38) 60% 24%));
}
.cc-thumb::after { content: ""; position: absolute; inset: 0; background: radial-gradient(70% 90% at 90% 0%, rgba(255,255,255,.18), transparent 60%); }
.cc-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.cc-thumb i { position: relative; z-index: 2; opacity: .92; }
.cc-body { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-4); flex: 1; }
.cc-meta { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.cc-cat { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand-ink); }
.cc-title { font-size: var(--fs-lg); font-weight: 700; line-height: 1.3; margin: 0; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-sub { color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.cc-summary { color: var(--muted); font-size: var(--fs-sm); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-foot { margin-top: auto; padding-top: var(--s-3); display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); border-top: 1px solid var(--border-2); font-size: var(--fs-sm); color: var(--muted); }
.price { font-weight: 800; font-size: var(--fs-lg); color: var(--text); }
.price s { font-weight: 500; font-size: var(--fs-sm); color: var(--faint); margin-right: .25rem; }
.price-free { font-weight: 800; color: var(--ok); }
.filters { display: grid; gap: var(--s-3); grid-template-columns: 1fr; align-items: end; }
.filters .field { margin: 0; }
@media (min-width: 640px) { .filters { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .filters { grid-template-columns: 2fr 1fr 1fr auto; } }
.result-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin: var(--s-5) 0 var(--s-4); color: var(--muted); font-size: var(--fs-sm); }
.pager { display: flex; justify-content: center; gap: var(--s-2); margin-top: var(--s-6); flex-wrap: wrap; }

/* ---- 13. Course detail ---------------------------------------------------- */
.course-hero { background: #0f1b3d; color: #fff; padding: var(--s-6) 0; position: relative; overflow: hidden; isolation: isolate; }
.course-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(60% 100% at 100% 0%, color-mix(in srgb, var(--brand) 60%, transparent), transparent 70%); }
.course-hero h1 { color: #fff; font-size: clamp(1.75rem, 4.5vw, 2.5rem); line-height: 1.15; }
.course-hero .lead, .course-hero .small { color: #dbe4f3; }
.course-hero a { color: #c7d8ff; }
.course-hero .chip { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25); }
.course-hero .avatar { background: #fff; color: #0f172a; }
.hero-facts { display: flex; gap: var(--s-5); flex-wrap: wrap; align-items: center; margin-top: var(--s-5); }
.hero-facts .fact strong { display: block; font-size: var(--fs-xl); line-height: 1.2; }
.hero-facts .fact span { color: #dbe4f3; font-size: var(--fs-sm); }
.detail-layout { display: grid; gap: var(--s-5); align-items: start; padding: var(--s-5) 0 var(--s-7); }
.enrol-card { order: -1; }
@media (min-width: 1024px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s-6); }
  .enrol-card { order: 0; position: sticky; top: calc(var(--topbar) + 16px); }
}
.enrol-card .stat-num { font-size: var(--fs-3xl); }
.learn-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-3); }
@media (min-width: 640px) { .learn-list { grid-template-columns: 1fr 1fr; } }
.learn-list li { display: flex; gap: .6rem; align-items: flex-start; }
.learn-list i { color: var(--accent); margin-top: .2rem; flex: none; }
.accordion { border: 1px solid var(--border-2); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.accordion details { border-bottom: 1px solid var(--border-2); }
.accordion details:last-child { border-bottom: 0; }
.accordion summary {
  list-style: none; display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); min-height: 52px; cursor: pointer; font-weight: 700;
  background: var(--surface-2); transition: background var(--t);
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary:hover { background: var(--surface-3); }
.accordion summary .chev { margin-left: auto; transition: transform var(--t); color: var(--muted); flex: none; }
.accordion details[open] summary .chev { transform: rotate(180deg); }
.accordion .acc-count { font-weight: 500; color: var(--muted); font-size: var(--fs-sm); }
.acc-topic { padding: var(--s-3) var(--s-4) 0; font-weight: 600; font-size: var(--fs-sm); color: var(--muted); }
.lesson-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: .65rem var(--s-4); border-top: 1px solid var(--border-2); font-size: var(--fs-sm); }
.lesson-row .l-main { display: flex; align-items: center; gap: .6rem; min-width: 0; flex-wrap: wrap; }
.lesson-row:first-child { border-top: 0; }
a.lesson-row { color: inherit; text-decoration: none; min-height: 44px; transition: background var(--t); }
a.lesson-row:hover { background: var(--surface-2); }
.instructor { display: flex; gap: var(--s-4); align-items: center; }

/* ---- 14. Auth ------------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; }
@media (min-width: 1024px) { .auth-wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.auth-aside {
  display: none; position: relative; overflow: hidden; color: #fff; padding: var(--s-8) var(--s-7); flex-direction: column; justify-content: space-between;
  background: linear-gradient(150deg, color-mix(in srgb, var(--brand) 88%, #000), color-mix(in srgb, var(--brand) 50%, #0b1220));
}
@media (min-width: 1024px) { .auth-aside { display: flex; } }
.auth-aside::after { content: ""; position: absolute; inset: 0; background: radial-gradient(70% 60% at 100% 0%, rgba(255,255,255,.16), transparent 60%); pointer-events: none; }
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside .brand, .auth-aside .brand:hover { color: #fff; }
.auth-aside .brand-mark { color: #fff; --mark-fg: #1e3a8a; }
.auth-aside h2 { color: #fff; font-size: var(--fs-3xl); line-height: 1.2; max-width: 16ch; }
.auth-aside p { color: #e6edf8; }
.auth-aside ul { list-style: none; padding: 0; margin: var(--s-5) 0 0; display: grid; gap: var(--s-3); color: #fff; }
.auth-aside li { display: flex; gap: .6rem; align-items: flex-start; }
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: var(--s-5) var(--s-4) var(--s-6); }
.auth-card { width: 100%; max-width: 440px; }
.auth-card .brand { margin-bottom: var(--s-5); }
@media (min-width: 1024px) { .auth-card .brand { display: none; } }
.auth-card h1 { font-size: var(--fs-2xl); margin-bottom: .3rem; }
.auth-top { width: 100%; display: flex; justify-content: flex-end; padding: var(--s-3) var(--s-4) 0; }

/* ---- 15. Learner pages ----------------------------------------------------- */
.continue-card {
  display: grid; gap: var(--s-4); padding: var(--s-5); border-radius: var(--r-xl); color: #fff; text-decoration: none; margin-bottom: var(--s-5);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 92%, #000), color-mix(in srgb, var(--brand) 55%, #0b1220));
}
.continue-card:hover { color: #fff; text-decoration: none; box-shadow: var(--shadow-lg); }
.continue-card .eyebrow, .continue-card .small, .continue-card h2 { color: #fff; }
.continue-card h2 { margin: 0 0 .25rem; font-size: var(--fs-xl); }
.continue-card .progress { background: rgba(255,255,255,.28); }
.continue-card .progress > span { background: #fff; }
.continue-card .btn { background: #fff; color: #0f172a; border-color: #fff; }
@media (min-width: 640px) { .continue-card { grid-template-columns: 1fr auto; align-items: center; } }
.empty { text-align: center; padding: var(--s-7) var(--s-4); color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--r-lg); }
.empty > i { font-size: 2.5rem; color: var(--faint); display: block; margin-bottom: var(--s-3); }
.empty p { margin: 0 auto var(--s-4); max-width: 46ch; }
.cert-card { border-left: 4px solid var(--accent); }
.cert-card .cert-ico { width: 44px; height: 44px; border-radius: var(--r); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 1.4rem; margin-bottom: var(--s-3); }
:root:not([data-theme="dark"]) .cert-card .cert-ico { color: #0f766e; }
.lesson-nav { display: grid; gap: var(--s-3); margin-top: var(--s-5); }
@media (min-width: 640px) { .lesson-nav { grid-template-columns: auto 1fr auto; align-items: center; } }
.stack > * + * { margin-top: var(--s-4); }

.timeline { position: relative; padding: 0; margin: 0; list-style: none; }
.tl-item { position: relative; padding: 0 0 var(--s-4) 2.2rem; }
.tl-item::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: -6px; width: 2px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-item:not(:has(.tl-dot))::after { content: ""; position: absolute; left: 4px; top: 7px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand-ink); }
.tl-dot { position: absolute; left: 0; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--faint); display: grid; place-items: center; font-size: .65rem; color: var(--faint); z-index: 1; }
.tl-item.done .tl-dot { background: var(--ok); border-color: var(--ok); color: var(--ok-bg); }
.tl-item.current .tl-dot { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 0 0 4px var(--brand-soft-2); }
.tl-item.current .tl-title { color: var(--brand-ink); }
.tl-title { font-weight: 700; }
.tl-time { font-size: var(--fs-sm); color: var(--faint); }

.chat { display: flex; flex-direction: column; gap: var(--s-3); max-height: 460px; overflow-y: auto; padding: var(--s-2); }
.msg { max-width: 86%; padding: .65rem .9rem; border-radius: var(--r-lg); font-size: var(--fs-sm); line-height: 1.5; overflow-wrap: anywhere; }
.msg .msg-meta { font-size: var(--fs-xs); color: var(--faint); margin-bottom: .2rem; }
.msg.them { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border-2); border-bottom-left-radius: 4px; }
.msg.me, .msg.mine { align-self: flex-end; background: var(--brand); color: var(--on-brand); border-bottom-right-radius: 4px; }
.msg.me .msg-meta, .msg.mine .msg-meta { color: var(--on-brand); opacity: .85; }
@media (min-width: 640px) { .msg { max-width: 76%; } }

.dropzone { border: 2px dashed var(--border); border-radius: var(--r-lg); padding: var(--s-6) var(--s-4); text-align: center; background: var(--surface-2); cursor: pointer; transition: border-color var(--t), background var(--t); }
.dropzone:hover, .dropzone.drag { border-color: var(--brand-ink); background: var(--brand-soft); }
.dropzone .dz-ico { font-size: 2.2rem; color: var(--brand-ink); }
.file-list { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-4); }
.file-item { display: flex; align-items: center; gap: var(--s-3); padding: .6rem .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); font-size: var(--fs-sm); }
.file-item .fi-ico { color: var(--brand-ink); font-size: 1.2rem; }
.file-item .fi-rm { margin-left: auto; color: var(--muted); cursor: pointer; background: none; border: 0; font-size: 1rem; min-width: 44px; min-height: 44px; }

.stepper { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-5); overflow-x: auto; padding-bottom: var(--s-2); }
.step { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; }
.step .step-n { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--faint); display: grid; place-items: center; font-size: var(--fs-sm); background: var(--surface); flex: none; }
.step.active { color: var(--brand-ink); }
.step.active .step-n { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }
.step.complete .step-n { background: #15803d; border-color: #15803d; color: #fff; }
.step-sep { flex: 1; min-width: 16px; height: 2px; background: var(--border); }
.wizard-panel { display: none; animation: fadeUp 240ms ease; }
.wizard-panel.active { display: block; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }
.choice { border: 2px solid var(--border); border-radius: var(--r); padding: var(--s-4); cursor: pointer; text-align: center; background: var(--surface); transition: border-color var(--t), background var(--t); font-weight: 600; }
.choice:hover { border-color: var(--brand-ink); }
.choice.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: var(--ring); }
.choice .ch-ico { font-size: 1.5rem; color: var(--brand-ink); display: block; margin-bottom: .4rem; }

.price-box { background: var(--brand); color: var(--on-brand); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--shadow); }
.price-box .pb-total { font-size: var(--fs-4xl); font-weight: 800; letter-spacing: -.03em; }
.price-row { display: flex; justify-content: space-between; padding: .35rem 0; font-size: var(--fs-sm); }
.price-row.total { border-top: 1px solid color-mix(in srgb, var(--on-brand) 30%, transparent); margin-top: .5rem; padding-top: .7rem; font-weight: 700; }
.qr-card { text-align: center; }
.qr-card img { width: 240px; height: 240px; border-radius: var(--r); border: 1px solid var(--border); background: #fff; padding: 8px; }

footer.site { border-top: 1px solid var(--border-2); background: var(--surface); color: var(--muted); font-size: var(--fs-sm); padding: var(--s-7) 0 var(--s-5); margin-top: var(--s-7); }
.footer-grid { display: grid; gap: var(--s-5); grid-template-columns: 1fr 1fr; }
.footer-grid .footer-brand { grid-column: 1 / -1; }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } .footer-grid .footer-brand { grid-column: auto; } }
footer.site h2 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--text); margin-bottom: var(--s-2); }
footer.site ul { list-style: none; margin: 0; padding: 0; display: grid; }
footer.site li a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-decoration: none; }
footer.site li a:hover { color: var(--brand-ink); text-decoration: underline; }
.footer-bottom { border-top: 1px solid var(--border-2); margin-top: var(--s-5); padding-top: var(--s-4); color: var(--faint); }

.wb-wrap { padding: .6rem; }
.wb-toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .3rem .4rem .7rem; }
.wb-colors { display: flex; gap: .35rem; }
.wb-color { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; }
.wb-color.on { border-color: var(--text); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--focus); }
.wb-tbtn { width: 44px; height: 44px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text); font-size: 1.05rem; }
.wb-tbtn.on { background: var(--brand-soft-2); border-color: var(--brand-ink); color: var(--brand-ink); }
.wb-size { display: flex; align-items: center; gap: .4rem; font-size: var(--fs-sm); color: var(--muted); }
.wb-size input { width: 110px; min-height: 0; }
.wb-canvas-wrap { position: relative; width: 100%; height: 60vh; background: #fff; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; touch-action: none; }
#wb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.wb-chat { margin-top: .7rem; }
.wb-chat-box { height: 130px; overflow-y: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: .5rem .7rem; font-size: var(--fs-sm); margin-bottom: .5rem; }
.wb-chat-line { margin-bottom: .25rem; }

.overdue { color: var(--danger); font-weight: 600; }
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 500ms ease, transform 500ms ease; }
.reveal.in { opacity: 1; transform: none; }
.hw-summary, .hw-form, .hw-actions { min-width: 0; }
td, th, .card, .main { overflow-wrap: anywhere; }
table.data td, table.data th { overflow-wrap: normal; }

/* ---- 16. Motion & preferences --------------------------------------------- */
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .card-hover:hover, .course-card:hover { transform: none; }
}
@media (forced-colors: active) {
  .btn, .card, .badge, .chip { border: 1px solid CanvasText; }
  .side-link.active { outline: 2px solid Highlight; }
}
@media print { .topbar, .sidebar, footer.site, .skip-link, .flash-stack { display: none !important; } .shell { display: block; } }
/* ---- Course cover art (generated per subject; an uploaded thumbnail replaces it) ---- */
.cc-thumb img { transition: transform 400ms ease; }
.course-card:hover .cc-thumb img { transform: scale(1.05); }
.course-hero-grid { display: grid; gap: var(--s-5); align-items: center; }
.course-hero-cover { margin: 0; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: rgba(255,255,255,.08); box-shadow: 0 28px 54px -20px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.2); }
.course-hero-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 900px) { .course-hero-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: var(--s-7); } }
@media (max-width: 899px) { .course-hero-cover { max-width: 560px; } }
.card-cover { display: block; width: calc(100% + 2 * var(--s-4)); max-width: none; margin: calc(-1 * var(--s-4)) calc(-1 * var(--s-4)) var(--s-3); aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.mini-cover { flex: none; width: 84px; aspect-ratio: 16 / 9; height: auto; object-fit: cover; border-radius: 8px; margin-right: .9rem; box-shadow: 0 0 0 1px rgba(15,23,42,.08); }
.course-banner { display: block; width: 100%; height: clamp(110px, 17vw, 200px); object-fit: cover; object-position: center; border-radius: var(--r-lg); margin: 0 0 var(--s-4); box-shadow: var(--shadow-sm); }
@media (prefers-reduced-motion: reduce) { .cc-thumb img { transition: none; } .course-card:hover .cc-thumb img { transform: none; } }
