/* ==========================================================================
   UPPEN — design system  v3
   Clean, professional, course-platform grade.
   Teal primary · burgundy accent · light & dark tuned separately.

   Class inventory is frozen: every hook used by app.js, build_pages.py and
   build_pages_catalogue.py is styled here. If you add a class to a generator,
   add it here too.
   ========================================================================== */

/* ------------------------------------------------------------------ tokens */
:root {
  --bg:            #FFFFFF;
  --bg-alt:        #F6F8FA;
  --surface:       #FFFFFF;
  --surface-2:     #F8FAFC;
  --surface-3:     #EFF3F7;
  --text:          #0E1726;
  --text-body:     #374357;
  --muted:         #55647A;
  --faint:         #607285;
  --border:        #E3E8EF;
  --border-strong: #CBD3DE;

  --teal-900:#0A1F5C; --teal-800:#0A33C8; --teal-700:#0A55E8;
  --teal-600:#0B66F0; --teal-500:#0A9BF6;
  --teal-100:#DCE9FF; --teal-50:#EEF4FF;

  --burg-900:#000C30; --burg-800:#0A1A5C; --burg-700:#1B2D7A;
  --burg-600:#2B44A0; --burg-100:#E6EAF7; --burg-50:#F2F4FB;

  --ok-700:#0F7A3D;   --ok-50:#E8F7EE;
  --info-700:#6D28D9;
  --warn-700:#96600A; --warn-50:#FDF4E4;
  --bad-700:#B02319;  --bad-50:#FCEBE9;

  --primary:   var(--teal-700);
  --primary-hi:var(--teal-600);
  --primary-lo:var(--teal-50);
  --accent:    var(--burg-700);
  --accent-lo: var(--burg-50);

  --grad:      linear-gradient(135deg, #0A2EC2 0%, #0A69FB 55%, #06D2F9 140%);
  --grad-soft: linear-gradient(135deg, var(--teal-50) 0%, var(--burg-50) 100%);

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --maxw: 1180px;
  --header-h: 62px;

  --r: 10px;  --r-lg: 14px;  --r-xl: 18px;
  --sh-1: 0 1px 2px rgba(14,23,38,.04), 0 1px 3px rgba(14,23,38,.04);
  --sh-2: 0 2px 6px rgba(14,23,38,.05), 0 8px 22px -8px rgba(14,23,38,.10);
  --sh-3: 0 4px 12px rgba(14,23,38,.06), 0 18px 42px -14px rgba(14,23,38,.16);
  --ring: 0 0 0 3px color-mix(in srgb, var(--teal-500) 30%, transparent);

  --ease: cubic-bezier(.22,.68,.36,1);
}

[data-theme="dark"] {
  --bg:#0A0F16; --bg-alt:#0D141D; --surface:#121A24; --surface-2:#0F1722;
  --surface-3:#18222F;
  --text:#EDF2F8; --text-body:#C2CFDD; --muted:#8B9CB0; --faint:#75879E;
  --border:#22303F; --border-strong:#31465B;

  --teal-900:#D6E6FF; --teal-800:#A9CCFF; --teal-700:#6FA8FF;
  --teal-600:#4D8BFF; --teal-500:#2E7BF6; --teal-100:#0F2552; --teal-50:#0B1B3D;

  --burg-900:#E3E8FF; --burg-800:#BFC9F5; --burg-700:#9EAEEB;
  --burg-600:#7C90D8; --burg-100:#1A2347; --burg-50:#121A38;

  --ok-700:#5FD48A;   --ok-50:#0C2417;
  --info-700:#B79CFF;
  --warn-700:#F0B25B; --warn-50:#241A0C;
  --bad-700:#F18A80;  --bad-50:#2A1110;

  --sh-1: 0 1px 2px rgba(0,0,0,.32);
  --sh-2: 0 2px 8px rgba(0,0,0,.36), 0 10px 26px -10px rgba(0,0,0,.5);
  --sh-3: 0 6px 16px rgba(0,0,0,.4), 0 22px 48px -16px rgba(0,0,0,.58);
}

/* -------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--sans); font-size: 16px; line-height: 1.65;
  color: var(--text-body); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4, h5 {
  font-family: var(--serif); color: var(--text); line-height: 1.2;
  letter-spacing: -.4px; margin: 0 0 .5em;
}
h1 { font-size: 34px; font-weight: 800; letter-spacing: -.9px; }
h2 { font-size: 24px; font-weight: 750; letter-spacing: -.6px; }
h3 { font-size: 19px; font-weight: 700; letter-spacing: -.4px; }
h4 { font-size: 16px; font-weight: 750; letter-spacing: -.2px; margin-bottom: .4em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin-bottom: .35em; }
code, .mono { font-family: var(--mono); font-size: .88em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 30px 0; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ------------------------------------------------------------------ layout */
.wrap { max-width: var(--maxw); margin: auto; padding: 0 24px; }
section.band { padding: 52px 0; }
section.band.alt { background: var(--bg-alt); }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }

/* ------------------------------------------------------------------- shell */
.topbar {
  position: sticky; top: 0; z-index: 60; height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .topbar { background: color-mix(in srgb, #0A0F16 88%, transparent); }
.topbar-in {
  max-width: var(--maxw); margin: auto; padding: 0 24px;
  height: var(--header-h);
  display: flex; align-items: center; gap: 20px; min-width: 0; overflow: hidden;
}
.brand {
  font-family: var(--serif); font-weight: 800; font-size: 21px;
  letter-spacing: -.7px; display: flex; align-items: center; gap: 9px;
  color: var(--text); flex-shrink: 0;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand .dot {
  width: 10px; height: 10px; border-radius: 4px; background: var(--grad);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal-600) 16%, transparent);
}
.brand small {
  font-family: var(--sans); font-size: 10.5px; font-weight: 700;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted);
  margin-left: 2px;
}
.topnav { display: flex; gap: 2px; margin-left: auto; align-items: center;
          min-width: 0; flex-shrink: 0; }
.topnav a {
  color: var(--muted); font-size: 13.5px; font-weight: 600;
  padding: 7px 13px; border-radius: 999px; transition: .16s var(--ease);
}
.topnav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.topnav a.on { background: var(--primary-lo); color: var(--primary); }
[data-theme="dark"] .topnav a.on { color: var(--teal-700); }

.iconbtn {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-body); font-size: 15px; cursor: pointer;
  display: grid; place-items: center; transition: .16s var(--ease);
}
.iconbtn:hover { background: var(--surface-3); color: var(--text);
  border-color: var(--border-strong); }

.footer { border-top: 1px solid var(--border); background: var(--bg-alt);
          padding: 44px 0 34px; margin-top: 60px; }
.footer .cols { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 30px; }
.footer h5 {
  font-family: var(--sans); font-size: 11px; font-weight: 800;
  letter-spacing: 1.1px; text-transform: uppercase; color: var(--muted);
  margin-bottom: 12px;
}
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: 7px; font-size: 14px; }
.footer li a { color: var(--text-body); }
.footer li a:hover { color: var(--primary); }
.footer .legal {
  margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted); line-height: 1.7; max-width: 92ch;
}

.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { margin: 0 7px; color: var(--faint); }
.breadcrumb .cur { color: var(--text); font-weight: 600; }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-size: 14px; font-weight: 650;
  padding: 10px 18px; border-radius: var(--r); border: 1px solid transparent;
  background: var(--surface-3); color: var(--text); cursor: pointer;
  transition: .16s var(--ease); text-decoration: none;
}
.btn:hover { background: var(--border); text-decoration: none; }
.btn-primary, .btn-accent {
  background: var(--primary); color: #fff;
  box-shadow: var(--sh-1);
}
.btn-primary:hover, .btn-accent:hover { background: var(--primary-hi); color: #fff; }
[data-theme="dark"] .btn-primary, [data-theme="dark"] .btn-accent { color: #04120F; }
[data-theme="dark"] .btn-primary:hover, [data-theme="dark"] .btn-accent:hover { color: #04120F; }
.btn-outline { background: transparent; border-color: var(--border-strong);
               color: var(--text-body); }
.btn-outline:hover { background: var(--surface-3); border-color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-body); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-lg { font-size: 15.5px; padding: 13px 24px; border-radius: 12px; }
.btn-sm { font-size: 13px; padding: 6px 12px; }
.btn-block { display: flex; width: 100%; }

/* -------------------------------------------------------------------- tags */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 650; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.tag-teal  { background: var(--teal-50);  color: var(--teal-700); }
.tag-burg  { background: var(--burg-50);  color: var(--burg-700); }
.tag-ok    { background: var(--ok-50);    color: var(--ok-700); }
.tag-warn  { background: var(--warn-50);  color: var(--warn-700); }
.tag-bad   { background: var(--bad-50);   color: var(--bad-700); }
.tag-info  { background: var(--surface-3); color: var(--text-body); }
.tag-mono  { font-family: var(--mono); font-size: 11.5px; letter-spacing: .3px; }
.tagrow { display: flex; gap: 7px; flex-wrap: wrap; }

/* ------------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px; box-shadow: var(--sh-1);
}
.card-hover { transition: .18s var(--ease); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--sh-2);
  border-color: var(--border-strong); }
.cardgrid { display: grid; gap: 18px;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.tile {
  display: block; padding: 20px 22px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  transition: .18s var(--ease); color: inherit; text-decoration: none;
}
.tile:hover { text-decoration: none; transform: translateY(-2px);
  border-color: var(--border-strong); box-shadow: var(--sh-2); }
.tile h3 { margin: 8px 0 6px; font-size: 17.5px; }
.tile p { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.tile .t-code {
  font-family: var(--mono); font-size: 11.5px; font-weight: 700;
  letter-spacing: .8px; color: var(--primary);
}
.tile .meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 4px; }

.callout {
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--primary); border-radius: var(--r);
  padding: 15px 18px; font-size: 14.5px; line-height: 1.65;
}
.callout.warn { border-left-color: var(--warn-700); }
.callout b { color: var(--text); }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ------------------------------------------------------------ stats, rails */
.stat-strip {
  display: grid; gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.stat-strip > div { background: var(--surface); padding: 18px 20px; }
.stat-strip b {
  display: block; font-family: var(--serif); font-size: 27px; font-weight: 800;
  letter-spacing: -1px; color: var(--text); line-height: 1.1;
}
.stat-strip span { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.statrow { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px;
           color: var(--muted); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--serif); font-size: 22px; color: var(--text); }

.progress-line { height: 6px; border-radius: 999px; background: var(--surface-3);
                 overflow: hidden; }
.progress-line > i, .progress-line > div {
  display: block; height: 100%; border-radius: 999px; background: var(--grad);
}
.bar { height: 8px; border-radius: 999px; background: var(--surface-3);
       overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); }

/* ------------------------------------------------------------------ tables */
.tablewrap { overflow-x: auto; margin: 14px 0; border: 1px solid var(--border);
             border-radius: var(--r); }
.tablewrap.md { border: 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
thead th {
  text-align: left; font-family: var(--sans); font-size: 11.5px; font-weight: 800;
  letter-spacing: .8px; text-transform: uppercase; color: var(--muted);
  background: var(--surface-2); padding: 11px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border);
           vertical-align: top; color: var(--text-body); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }

/* ------------------------------------------------------------------- forms */
.searchbox {
  flex: 1; min-width: 220px; max-width: 420px;
  font-size: 14px; padding: 10px 14px; border: 1px solid var(--border-strong);
  border-radius: var(--r); background: var(--surface); color: var(--text);
}
.searchbox:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.searchbox::placeholder { color: var(--faint); }
.filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
             margin-bottom: 18px; }
.filterbar select, .filterbar input {
  font-size: 14px; padding: 9px 12px; border-radius: var(--r);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}

/* ------------------------------------------------------- course-platform UI */
.course-hero {
  position: relative; padding: 34px 0 30px;
  border-bottom: 1px solid var(--border); margin-bottom: 28px;
}
.course-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--grad-soft); opacity: .8;
}
.eyebrow {
  font-size: 11.5px; font-weight: 800; letter-spacing: 1.3px;
  text-transform: uppercase; color: var(--primary); margin-bottom: 8px;
}
.course-hero h1 { font-size: 38px; margin-bottom: 10px; }
.course-hero .plead { font-size: 16.5px; color: var(--text-body); max-width: 68ch; }

.syllabus { margin-top: 8px; }
.module {
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); margin-bottom: 12px; overflow: hidden;
}
.module + .module { margin-top: 0; }
.mod-head {
  display: flex; align-items: center; gap: 14px; padding: 15px 18px;
  cursor: pointer; user-select: none;
}
.mod-head:hover { background: var(--surface-2); }
.mod-no {
  flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-lo); color: var(--primary);
  font-family: var(--mono); font-size: 12.5px; font-weight: 700;
}
.mod-head h3 { margin: 0; font-size: 16.5px; flex: 1; min-width: 0; }
.mod-head .count { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.mod-body { border-top: 1px solid var(--border); padding: 6px 0; }
.module[open] .mod-body, .module.open .mod-body { display: block; }
.mod-body[hidden] { display: none; }
.lesson {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 18px 10px 62px; font-size: 14.5px;
  /* filenames are long and unbreakable — wrap them rather than overflow */
  min-width: 0; overflow-wrap: anywhere; word-break: break-word;
}
.lesson > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.lesson a { overflow-wrap: anywhere; }
.lesson:hover { background: var(--surface-2); }
.lesson-icon { flex: 0 0 18px; text-align: center; color: var(--faint); }
.lesson a { color: var(--text-body); }
.lesson a:hover { color: var(--primary); }
.lesson .kind { font-size: 11.5px; color: var(--faint); margin-left: 6px; }

.chiprow { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-body); cursor: pointer;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
[data-theme="dark"] .chip.on { color: #04120F; }

.rail { position: sticky; top: calc(var(--header-h) + 18px); }
.rail .card + .card { margin-top: 16px; }

.kv { display: grid; grid-template-columns: minmax(96px, auto) 1fr; gap: 8px 16px;
      margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; color: var(--text-body); }

/* ------------------------------------------------ catalogue: list & topics */
.topic-list { list-style: none; margin: 0; padding: 0; }
.topic-list li {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 12px;
  align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 14.5px;
}
.topic-list li:last-child { border-bottom: 0; }
.topic-list .no { font-family: var(--mono); font-size: 12px; color: var(--faint);
                  font-weight: 700; }
.topic-list .hrs { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.topic-list .sub { grid-column: 2 / -1; font-size: 13px; color: var(--muted);
                   margin-top: 2px; }

.unit-row {
  display: grid; grid-template-columns: 92px 1fr 60px; gap: 12px;
  align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--border);
  font-size: 14.5px;
}
.unit-row:last-child { border-bottom: 0; }
.unit-row .code { font-family: var(--mono); font-size: 12.5px; font-weight: 700;
                  color: var(--primary); white-space: nowrap; }
.unit-row .nm { min-width: 0; overflow-wrap: anywhere; }
.unit-row .nm a { color: var(--text); font-weight: 600; }
.unit-row .cu { text-align: right; font-size: 13px; color: var(--muted);
                font-variant-numeric: tabular-nums; white-space: nowrap; }
.unit-row .sub { font-size: 12.5px; color: var(--muted); }

.sem-card { margin-bottom: 18px; }
.sem-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
            margin-bottom: 4px; }
.sem-head h3 { margin: 0; font-size: 17px; }
.sem-head .cu { margin-left: auto; font-size: 13px; color: var(--muted); }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
              margin-right: 6px; vertical-align: 1px; }
.status-ready { background: var(--ok-700); }
.status-part  { background: var(--warn-700); }
.status-gap   { background: var(--border-strong); }

.source-card { border-left: 3px solid var(--primary); }
.source-card.restricted { border-left-color: var(--warn-700); }
.source-card h4 { font-family: var(--sans); font-size: 15px; }

.crumbs-lg { font-size: 13px; color: var(--muted); }
.crumbs-lg i { color: var(--faint); font-style: normal; margin: 0 6px; }

/* -------------------------------------------------------------- exam & quiz */
.exam-bar {
  position: sticky; top: var(--header-h); z-index: 40;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.exam-bar-in {
  max-width: var(--maxw); margin: auto; padding: 10px 24px;
  display: flex; align-items: center; gap: 14px;
}
.timer { font-family: var(--mono); font-size: 14px; font-weight: 700;
         color: var(--text); }

.q { border: 1px solid var(--border); border-radius: var(--r-lg);
     background: var(--surface); padding: 20px; margin-bottom: 18px; }
.q-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.q-no { font-family: var(--mono); font-size: 12px; font-weight: 700;
        color: var(--primary); }
.q-prompt { font-size: 15.5px; color: var(--text); line-height: 1.6; }
.q-concept { margin-left: auto; font-size: 12px; color: var(--faint); }
.opts { list-style: none; margin: 14px 0 0; padding: 0; }
.opt {
  display: flex; gap: 11px; align-items: flex-start; padding: 10px 13px;
  border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 8px;
  cursor: pointer; font-size: 14.5px; transition: .14s var(--ease);
}
.opt:hover { border-color: var(--primary); background: var(--surface-2); }
.opt .key { flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid;
            place-items: center; background: var(--surface-3);
            font-size: 12px; font-weight: 700; color: var(--muted); }
.opt.sel { border-color: var(--primary); background: var(--primary-lo); }
.opt.sel .key { background: var(--primary); color: #fff; }
[data-theme="dark"] .opt.sel .key { color: #04120F; }
.opt.correct { border-color: var(--ok-700); background: var(--ok-50); }
.opt.wrong { border-color: var(--bad-700); background: var(--bad-50); }
.verdict { font-size: 13px; font-weight: 750; margin-left: auto; }
.verdict.ok { color: var(--ok-700); }
.verdict.no { color: var(--bad-700); }
.write-space, textarea.write-space {
  width: 100%; min-height: 96px; font-family: var(--sans); font-size: 14.5px;
  padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); color: var(--text); resize: vertical;
}
.written { white-space: pre-wrap; }
.answer-box { border-top: 1px dashed var(--border-strong); margin-top: 14px;
              padding-top: 14px; font-size: 14.5px; }
.answer-box h5, .answer-box h4 {
  font-family: var(--sans); font-size: 11.5px; font-weight: 800;
  letter-spacing: .9px; text-transform: uppercase; color: var(--muted);
  margin-bottom: 8px;
}
.exp { font-size: 14px; color: var(--text-body); }
.kws { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.kws .kw { font-size: 12px; padding: 2px 9px; border-radius: 999px;
           background: var(--surface-3); color: var(--muted); }

.qnav { display: flex; gap: 6px; flex-wrap: wrap; }
.qnav button {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: 13px;
  font-weight: 650; cursor: pointer;
}
.qnav button.done { background: var(--primary-lo); color: var(--primary);
                    border-color: var(--primary); }
.qnav button.cur { border-color: var(--text); color: var(--text); }

.score-hero { background: var(--grad); color: #fff; border-radius: var(--r-xl);
              padding: 34px; text-align: center; }
.score-hero .big { font-family: var(--serif); font-size: 56px; font-weight: 800;
                   line-height: 1; letter-spacing: -2px; }
.score-hero p { color: rgba(255,255,255,.9); margin: 8px 0 0; }
.ring { display: grid; place-items: center; }
.skeleton { background: var(--surface-3); border-radius: var(--r); }

/* ------------------------------------------------------------ notes, prose */
.prose { font-size: 15.5px; line-height: 1.75; color: var(--text-body); }
.prose h4 { margin-top: 1.4em; }
.prose > :last-child { margin-bottom: 0; }
.lead { font-size: 17px; color: var(--text-body); }
.plead { font-size: 16px; color: var(--muted); line-height: 1.65; }
.phead { margin-bottom: 22px; }
.phead h1 { margin: 8px 0 0; }
.sec-head { margin: 34px 0 16px; }
.sec-head h2 { margin: 0; }
.sec-sub { font-size: 14.5px; color: var(--muted); margin: 6px 0 0; }
.sec { margin-top: 34px; }
.qgroup { font-size: 19px; margin: 30px 0 12px; }

.callout b { color: var(--text); }
.formula {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 15px; margin-bottom: 10px;
  font-family: var(--mono); font-size: 14px;
  /* keep the spacing of matrix layouts and aligned working */
  white-space: pre-wrap; line-height: 1.55; overflow-x: auto;
}
.formula b { font-family: var(--sans); }
.fnote { font-family: var(--sans); font-size: 13px; color: var(--muted);
         margin-top: 5px; }
.def-list { margin: 0; }
.def { padding: 10px 0; border-bottom: 1px solid var(--border); }
.def:last-child { border-bottom: 0; }
.def dt { font-weight: 700; color: var(--text); }
.def dd { margin: 4px 0 0; font-size: 14.5px; }
.obj { margin: 0; padding-left: 1.1em; }
.obj li { margin-bottom: 6px; font-size: 14.5px; }
.diagram { margin: 16px 0; text-align: center; }
.diagram svg { max-width: 100%; height: auto; }
.diagram iframe.ig-frame { display:block; width:100%; height:clamp(360px, 62vh, 560px);
  border:1px solid var(--line); border-radius:12px; background:var(--card); }
.blank { color: var(--faint); font-style: italic; }
.nowrap { white-space: nowrap; }
.sm { font-size: 13px; }
.muted { color: var(--muted); }
.sub { color: var(--muted); }
.alt { background: var(--bg-alt); }
.of { color: var(--faint); }

/* ------------------------------------------------------- static page layout */
.playout { display: grid; grid-template-columns: 250px minmax(0, 1fr);
           max-width: var(--maxw); margin: auto; padding: 0 24px; gap: 34px; }
.pside { position: sticky; top: calc(var(--header-h) + 20px);
         align-self: start; max-height: calc(100vh - var(--header-h) - 40px);
         overflow-y: auto; padding: 22px 0 40px; }
.pside-title { font-family: var(--serif); font-size: 15px; font-weight: 800;
               color: var(--text); margin-bottom: 2px; }
.pside-code { font-family: var(--mono); font-size: 11.5px; color: var(--muted);
              margin-bottom: 14px; }
.pside-in { display: flex; flex-direction: column; gap: 2px; }
.pside-nav a {
  display: block; padding: 7px 10px; border-radius: 8px; font-size: 13.5px;
  color: var(--muted); border-left: 2px solid transparent;
}
.pside-nav a:hover { background: var(--surface-3); color: var(--text);
  text-decoration: none; }
.pside-nav a.sub { font-size: 12.5px; padding-left: 20px; }
.pside-nav a.cur { background: var(--primary-lo); color: var(--primary);
  font-weight: 650; border-left-color: var(--primary); }
.navgrp {
  font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: var(--muted); margin: 18px 0 6px; padding-left: 10px;
}
.pmain { padding: 26px 0 90px; min-width: 0; }
.pmain.solo { grid-column: 1 / -1; max-width: 940px; margin: 0 auto; }
.pmeta, .topicmeta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
                     margin-bottom: 18px; }
.pnav { display: flex; justify-content: space-between; gap: 14px;
        margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--border); }
.paper-head { border-bottom: 2px solid var(--text); padding-bottom: 10px;
              margin-bottom: 22px; }
.paper-sec { margin-top: 28px; }
.bank-sec { margin-bottom: 34px; }
.rev-card { border: 1px solid var(--border); border-radius: var(--r-lg);
            padding: 18px; background: var(--surface); margin-bottom: 14px; }
.rev-head h3 { margin: 0; font-size: 18px; }
.gloss-letter { font-family: var(--serif); font-size: 22px; font-weight: 800;
                color: var(--primary); margin: 26px 0 10px; }
.gloss-jump { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 18px; }
.gloss-jump a { min-width: 28px; text-align: center; padding: 4px 7px;
                border-radius: 7px; border: 1px solid var(--border);
                font-size: 12.5px; font-weight: 650; color: var(--muted); }
.gloss-jump a:hover { border-color: var(--primary); color: var(--primary);
  text-decoration: none; }
.cat-hero { padding: 8px 0 4px; }
.key { font-family: var(--mono); }

/* ------------------------------------------------------------------- utils */
.wrap > :last-child, .pmain > :last-child { margin-bottom: 0; }
.on { }
.static { position: static; }
.no-print { }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1024px) {
  .playout { grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  h1 { font-size: 29px; }
  .course-hero h1 { font-size: 30px; }
  section.band { padding: 38px 0; }
  .hero { padding: 44px 0 36px; }
  .q { padding: 17px; }
  .tile { padding: 17px 19px; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .playout { grid-template-columns: minmax(0, 1fr); padding: 0 18px; }
  .pside { position: static; max-height: none; padding: 16px 0 0;
           border-bottom: 1px solid var(--border); }
  .lesson { padding-left: 18px; }
}
@media (max-width: 720px) {
  .topbar-in { gap: 10px; padding: 0 14px; }
  .brand { font-size: 19px; gap: 7px; }
  .brand small { display: none; }
  .topnav {
    gap: 0; flex-shrink: 1; min-width: 0; overflow-x: auto;
    scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 18px), transparent);
  }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { padding: 6px 9px; font-size: 12.5px; flex: 0 0 auto; white-space: nowrap; }
  .score-hero { padding: 26px 20px; }
  .score-hero .big { font-size: 46px; }
  .exam-bar-in { gap: 10px; padding: 10px 14px; }
  .wrap { padding: 0 16px; }
  .unit-row { flex-wrap: wrap; gap: 4px 12px; }
  .unit-row .code { flex: 0 0 auto; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .footer .cols { grid-template-columns: 1fr 1fr; gap: 26px; }
  .course-hero { padding: 24px 0 20px; }
}
@media (max-width: 520px) {
  .topbar-in { gap: 4px; padding: 0 10px; }
  .brand { font-size: 18px; }
  .topnav a { padding: 6px 5px; font-size: 12px; letter-spacing: -.2px; }
  .iconbtn { width: 32px; height: 32px; flex-basis: 32px; font-size: 14px; }
  .wrap { padding: 0 14px; }
  .rev-head h3 { font-size: 17px; }
  .gloss-jump a { min-width: 26px; padding: 4px 5px; font-size: 11.5px; }
  .unit-row { grid-template-columns: 84px 1fr; }
  .unit-row .cu { grid-column: 2; text-align: left; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}
@media (max-width: 380px) {
  .brand .dot { display: none; }
  .topnav a { padding: 6px 4px; font-size: 11.5px; }
}
@media (max-width: 620px) {
  .footer .cols { grid-template-columns: 1fr; gap: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ------------------------------------------------------------------- print */

/* ------------------------------------------- late additions (v3, inventory) */
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.ab-in { max-width: var(--maxw); margin: auto; padding: 10px 24px;
         display: flex; align-items: center; gap: 14px; }
.accent { color: var(--accent); }
.stats { display: grid; gap: 1px; background: var(--border);
         border: 1px solid var(--border); border-radius: var(--r-lg);
         overflow: hidden; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stats > div { background: var(--surface); padding: 18px 20px; }
.stats b { display: block; font-family: var(--serif); font-size: 27px;
           font-weight: 800; letter-spacing: -1px; color: var(--text); line-height: 1.1; }
.stats span { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.next { display: flex; align-items: center; gap: 8px; }
.mod-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px;
           font-size: 14.5px; border-bottom: 1px solid var(--border); }
.mod-row:last-child { border-bottom: 0; }
.built-card { border-left: 3px solid var(--primary); background: var(--primary-lo); }
[data-theme="dark"] .built-card { background: var(--teal-50); }

/* ------------------------------------------------- split layout (unit page)
   A class, not an inline style, so the mobile breakpoint can collapse it. */
.split {
  display: grid; gap: 26px; align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(258px, 300px);
}
@media (max-width: 860px) {
  .split { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}

/* the skip link sits on a light-teal bar in dark mode — invert the text so it
   keeps its contrast when it is focused into view */
[data-theme="dark"] .skip { color: #04120F; }

/* Uppen V2 student workspace */
.narrow { max-width: 720px; }
.card label { display:block; font-size:13px; font-weight:750; color:var(--text); margin:0 0 16px; }
.card input, .card select { display:block; width:100%; margin-top:7px; padding:12px 13px; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--text); font:inherit; }
.card input:focus, .card select:focus { outline:none; border-color:var(--teal-500); box-shadow:var(--ring); }
.mono { font-family:var(--mono); font-size:12px; }
@media (max-width: 760px) {
  .topbar-in { padding:0 12px; gap:8px; }
  .brand small { display:none; }
  .topnav { overflow-x:auto; scrollbar-width:none; }
  .topnav::-webkit-scrollbar { display:none; }
  .topnav a { padding:7px 9px; font-size:12px; white-space:nowrap; }
  .iconbtn { display:none; }
  h1 { font-size:29px; }
}


/* --- Brand logo (light/dark swap follows the app theme) --- */
.brand-logo { display: block; height: 34px; width: auto; }
.brand .logo-dark { display: none; }
[data-theme="dark"] .brand .logo-light { display: none; }
[data-theme="dark"] .brand .logo-dark { display: block; }
@media (max-width: 520px) { .brand-logo { height: 30px; } }


/* --- Payment modal --- */
.pay-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0,12,48,.55); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(3px); }
.pay-card { background: var(--surface); color: var(--text); width: min(420px, 100%); border-radius: var(--r-xl); padding: 24px; box-shadow: var(--sh-3); text-align: center; }
.pay-card h3 { margin: 0 0 6px; font-size: 20px; }
.pay-amt { font-size: 30px; font-weight: 800; margin: 4px 0 8px; color: var(--primary); }
.pay-sub { color: var(--text-body); font-size: 14.5px; line-height: 1.5; margin: 8px 0; }
.pay-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.pay-row .btn { padding: 14px 10px; font-weight: 800; border: 0; }
.pay-mtn { background: #FFCB05; color: #000; }
.pay-airtel { background: #E40000; color: #fff; }
.pay-ref { font-family: var(--mono); font-weight: 700; background: var(--surface-3); border-radius: 8px; padding: 8px 10px; word-break: break-all; }
.pay-spin { width: 38px; height: 38px; margin: 14px auto; border-radius: 50%; border: 4px solid var(--border-strong); border-top-color: var(--primary); animation: payspin 0.9s linear infinite; }
@keyframes payspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pay-spin { animation-duration: 3s; } }

/* Utility used by the app to show/hide error callouts and panels */
.hidden { display: none !important; }

/* Topic page: notes + side panel; side panel drops below the notes on phones */
.topic-grid { grid-template-columns: minmax(0, 2.6fr) minmax(240px, 1fr); }
@media (max-width: 860px) { .topic-grid { grid-template-columns: minmax(0, 1fr); } }
.prose table, .card table { display: block; overflow-x: auto; max-width: 100%; }
@media (max-width: 520px) {
  .prose table th, .prose table td, .card table th, .card table td { padding: 8px 7px; font-size: 13.5px; }
  .prose table th, .card table th { white-space: normal; letter-spacing: .02em; }
  .tablewrap table, .prose table { display: table; }
}

/* ===================================================== organised UI (v3) */
.menu-btn { display: inline-flex !important; align-items: center; justify-content: center; }
.topbar-in { gap: 10px; }
.drawer-scrim { position: fixed; inset: 0; background: rgba(8, 15, 25, .45); z-index: 90; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 84vw); z-index: 100;
  background: var(--surface, #fff); border-right: 1px solid var(--border); box-shadow: 0 10px 40px rgba(0,0,0,.18);
  transform: translateX(-102%); transition: transform .22s ease; display: flex; flex-direction: column;
  padding: 0 0 16px; overflow-y: auto; }
.drawer.open { transform: none; }
.drawer-head { padding: 22px 20px 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
  display: flex; flex-direction: column; gap: 2px; }
.drawer-head b { font-size: 16.5px; }
.drawer-head span { font-size: 13px; color: var(--muted); }
.drawer a { display: block; padding: 12px 20px; font-size: 15.5px; font-weight: 600; color: var(--text); text-decoration: none; }
.drawer a:hover, .drawer a.on { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); }
.drawer-sec { padding: 14px 20px 4px; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.drawer-foot { margin-top: auto; padding: 16px 20px 0; font-size: 12.5px; color: var(--muted); }
.drawer-foot a { display: inline; padding: 0; font-size: 12.5px; font-weight: 500; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }

.home { padding-top: 26px; }
.home-h { font-size: 27px; margin: 0 0 4px; }
.home-sub { color: var(--muted); margin: 0 0 18px; font-size: 14.5px; }
.sec-t { font-size: 19px; margin: 26px 0 12px; }
.continue { display: flex; flex-direction: column; gap: 3px; padding: 16px 18px; border-radius: 14px; text-decoration: none;
  color: var(--text); background: color-mix(in srgb, var(--accent) 9%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.continue b { font-size: 16.5px; }
.continue span:last-child { font-size: 13px; color: var(--muted); }

.sem { border: 1px solid var(--border); border-radius: 14px; margin-bottom: 12px; background: var(--surface, #fff); }
[data-theme="dark"] .sem { background: transparent; }
.sem > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  padding: 15px 18px; font-weight: 750; font-size: 16px; }
.sem > summary::-webkit-details-marker { display: none; }
.sem > summary::after { content: "▾"; margin-left: 10px; color: var(--muted); transition: transform .2s; }
.sem[open] > summary::after { transform: rotate(180deg); }
.sem-count { margin-left: auto; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.sem[open] > summary { border-bottom: 1px solid var(--border); }
.cc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 14px; }
.sem .cc-grid { padding: 14px 14px 4px; }
.cc { display: block; padding: 15px 16px; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text);
  background: var(--surface, #fff); transition: border-color .15s, box-shadow .15s; }
[data-theme="dark"] .cc { background: #111A25; }
a.cc:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.cc-code { font-family: var(--mono); font-size: 12px; font-weight: 800; color: var(--accent); }
.cc-title { font-size: 16px; font-weight: 750; margin: 3px 0 6px; line-height: 1.3; }
.cc-meta { font-size: 13px; color: var(--muted); }
.cc-bar { height: 6px; border-radius: 6px; background: var(--border); margin-top: 12px; overflow: hidden; }
.cc-bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.cc-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.soon { margin: 6px 18px 16px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.sem:not([open]) .soon { display: none; }
.back { display: inline-block; font-size: 14px; font-weight: 650; margin-bottom: 12px; text-decoration: none; }
.ch { padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.ch-t { font-size: 24px; line-height: 1.25; margin: 4px 0 6px; }
.ch-s { color: var(--text-body); font-size: 14.5px; margin: 0 0 8px; }
.ch-m { font-size: 13px; color: var(--muted); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0 4px; }
.tools::-webkit-scrollbar { display: none; }
.tools a { flex: 0 0 auto; padding: 9px 13px; border: 1px solid var(--border); border-radius: 999px; font-size: 13.5px;
  font-weight: 650; text-decoration: none; color: var(--text); background: var(--surface); white-space: nowrap; }
.tools a:first-child { background: var(--accent); color: #fff; border-color: var(--accent); }
.tlist { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.tmod { padding: 12px 16px 6px; font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.trow { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; color: var(--text); border-top: 1px solid var(--border); }
.tmod + .trow { border-top: 0; }
.trow:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.trow-n { flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.trow-b { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.trow-b b { font-size: 15px; font-weight: 700; line-height: 1.3; }
.trow-b small { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.trow-m { font-size: 13px; font-weight: 800; color: var(--accent); }
.more { margin-top: 18px; border: 1px solid var(--border); border-radius: 14px; padding: 0 16px; background: var(--surface); }
.more > summary { cursor: pointer; padding: 14px 0; font-weight: 700; }
.more p, .more li { font-size: 14px; color: var(--text-body); }
/* v4 picker + course drawer */
.picker{display:grid;gap:12px;background:var(--surface,#fff);border:1px solid var(--line,#ddd);border-radius:14px;padding:16px;max-width:520px}
.picker label{display:grid;gap:6px;font-weight:600;font-size:.9rem}
.picker select{padding:11px;border-radius:10px;border:1px solid var(--line,#ccc);font:inherit;background:var(--bg,#fff);color:inherit}
.picker-note{margin:0;font-size:.82rem;opacity:.7}
.pick-line{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:18px 0 8px;font-size:.9rem;opacity:.85}
.drawer a.dt{display:flex;gap:10px;font-size:.9rem;padding-top:8px;padding-bottom:8px}
.drawer a.dt span{min-width:22px;opacity:.6}
.drawer-sec{font-size:.72rem;letter-spacing:.08em;text-transform:uppercase;opacity:.6;padding:14px 18px 4px}
.ch-act{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin:14px 0}
.ch-hint{font-size:.85rem;opacity:.7}
.picker select{width:100%;box-sizing:border-box;max-width:100%}.picker{box-sizing:border-box}
