/* The school sites: Modern UI V2 (spec §5, B-06 WCAG 2.2 AA).
   Quiet by default: one primary action per task, useful contrast, restrained
   decoration. No web fonts (system fonts load instantly and Android ships Noto
   Sinhala/Tamil), no icon font (icons are inline SVG), no framework. */

/* 1.1.1: a darker, warmer, more confident palette. Neutral surfaces carry the
   school's own colour as the only accent, and base.html supplies the per-school
   values (--brand, --brand-rgb, the tints and link shades, all computed in
   apps/core/branding.py so every school's colour stays AA in both themes). */
:root {
  --brand: #4355d9;
  --brand-rgb: 67, 85, 217;
  --brand-text: #ffffff;
  --link: var(--link-light, #3042b3);
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --text: #121214;
  --muted: #5b5d64;
  --border: #e4e4df;
  /* The edge of a field or button: 3:1 or more against every surface, so a
     text box can be found without relying on its placeholder (WCAG 1.4.11). */
  --edge: #82838a;
  --soft: var(--tint-light, #eceefb);
  --soft-text: var(--link);
  --structure: #0b0b0d;
  --structure-2: #1a1a1e;
  --structure-text: #f4f4f5;
  --structure-muted: #b4b4bc;
  --ok: #0b6e66;
  --ok-bg: #e3f4ef;
  --warn: #7d5220;
  --warn-bg: #fdf0da;
  --error: #ad3a45;
  --error-bg: #fcebed;
  --focus: #f59e0b;
  --shadow: 0 1px 2px rgba(16, 16, 20, 0.04), 0 4px 14px -6px rgba(16, 16, 20, 0.08);
  --shadow-lift: 0 2px 6px rgba(16, 16, 20, 0.05), 0 18px 40px -16px rgba(16, 16, 20, 0.22);
  --glow: 0 10px 30px -10px rgba(var(--brand-rgb), 0.55);
  --radius: 20px;
  --radius-small: 12px;
  --tap: 48px;
  --pad: 20px;
  --gap: 16px;
  color-scheme: light;
}

/* Dark is its own palette: near-black layers with hairline edges, the school's
   colour glowing through rather than an inverted page. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --link: var(--link-dark, #b7cbff);
    --bg: #0a0a0c;
    --surface: #141416;
    --surface-2: #1c1c20;
    --text: #f4f4f5;
    --muted: #a8a8b1;
    --border: #2a2a30;
    --edge: #74747e;
    --soft: var(--tint-dark, #22253a);
    --structure: #060607;
    --structure-2: #18181c;
    --ok: #8fe0d3;
    --ok-bg: #12302d;
    --warn: #f5cf8e;
    --warn-bg: #33291a;
    --error: #ffb3bc;
    --error-bg: #3a1c23;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
    --shadow-lift: 0 18px 40px -18px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.04);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --link: var(--link-dark, #b7cbff);
  --bg: #0a0a0c;
  --surface: #141416;
  --surface-2: #1c1c20;
  --text: #f4f4f5;
  --muted: #a8a8b1;
  --border: #2a2a30;
  --edge: #74747e;
  --soft: var(--tint-dark, #22253a);
  --structure: #060607;
  --structure-2: #18181c;
  --ok: #8fe0d3;
  --ok-bg: #12302d;
  --warn: #f5cf8e;
  --warn-bg: #33291a;
  --error: #ffb3bc;
  --error-bg: #3a1c23;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --shadow-lift: 0 18px 40px -18px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.04);
  color-scheme: dark;
}

/* The person's own text size and spacing (Preferences). Rem-based, so the
   phone's text setting still applies on top. */
:root[data-text="larger"] { font-size: 112.5%; }
:root[data-text="largest"] { font-size: 125%; }
:root[data-density="compact"] { --pad: 14px; --gap: 10px; --tap: 44px; }

/* Links in the school's colour, at a shade that reads in the current theme. */
/* :where() keeps this at zero specificity, so any class (.btn, .card) still wins. */
:where(a, a:visited) { color: var(--link); }

/* Things that exist in one theme only: logos drawn for a light or a dark page. */
.only-dark { display: none; }
:root[data-theme="dark"] .only-light { display: none; }
:root[data-theme="dark"] .only-dark { display: inline-block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .only-light { display: none; }
  :root:not([data-theme="light"]) .only-dark { display: inline-block; }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Sinhala",
    "Iskoola Pota", "Noto Sans Tamil", "Latha", sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 { line-height: 1.25; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--surface); color: var(--text); padding: 12px 16px; z-index: 30;
}
.skip-link:focus { left: 16px; top: 16px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Line icons drawn with the text colour; always beside a text label. */
.icon {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* --- The shell: sidebar on a computer, header and bottom bar on a phone --- */
.shell { min-height: 100vh; }
.frame { min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-crumb { display: none; margin: 0; color: var(--muted); font-size: 0.875rem; }
.topbar-tools { display: flex; align-items: center; gap: 8px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; text-decoration: none; min-width: 0; }
.brand-mark {
  display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px;
  border-radius: 10px; background: var(--brand); color: var(--brand-text); font-weight: 800;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { font-size: 0.75rem; font-weight: 500; color: var(--muted); }
.brand-logo { max-height: 40px; max-width: 200px; width: auto; height: auto; vertical-align: middle; }
/* A logo drawn for a light page, shown on the dark theme: give it a light plate
   so a dark logo does not vanish (a school can upload a dark-mode logo instead). */
.brand-logo.on-plate { background: #ffffff; padding: 4px 8px; border-radius: 8px; }

.lang-form { display: flex; gap: 6px; align-items: center; }
.lang-form select { width: auto; min-height: 40px; padding: 4px 8px; }

.icon-button {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border-radius: 12px; color: var(--text); border: 1px solid var(--border); background: var(--surface);
}

.sidebar { display: none; }
.topbar { flex-wrap: wrap; }
.topbar-brand { min-width: 0; flex: 1 1 12rem; }
/* On a phone with a menu, the language is changed on Preferences instead:
   the header keeps the school's name readable at 360px. */
@media (max-width: 959px) { .has-nav .lang-form { display: none; } }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; border-radius: 12px; color: var(--muted); text-decoration: none;
  font-size: 0.75rem; font-weight: 600;
}
.tab[aria-current="page"] { background: var(--soft); color: var(--soft-text); }
.has-nav .frame { padding-bottom: 72px; }

@media (min-width: 960px) {
  .has-nav .shell {
    display: grid; grid-template-columns: 248px minmax(0, 1fr);
    background: linear-gradient(to right, var(--structure) 248px, transparent 248px);
  }
  .has-nav .frame { padding-bottom: 0; }
  .has-nav .tabbar, .has-nav .topbar-brand { display: none; }
  .has-nav .topbar-crumb { display: block; }
  .has-nav .topbar { padding: 12px 28px; }

  .sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 12px; padding: 20px 14px;
    background: var(--structure); color: var(--structure-text);
  }
  .sidebar .brand, .sidebar .brand-sub { color: var(--structure-text); }
  .sidebar .brand-sub { display: none; }
  .workspace-chip {
    margin: 4px 0 0; padding: 8px 12px; border-radius: 10px;
    background: var(--structure-2); font-size: 0.8125rem; font-weight: 600;
  }
  .side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
  .side-link {
    display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px;
    border-radius: 10px; color: var(--structure-muted); text-decoration: none; font-size: 0.9375rem;
  }
  .side-link:hover { color: var(--structure-text); background: var(--structure-2); }
  .side-link[aria-current="page"] { color: #ffffff; background: var(--structure-2); font-weight: 700; box-shadow: inset 3px 0 0 var(--brand-light, #8fa2ff); }
  .side-foot { margin-top: auto; border-top: 1px solid var(--structure-2); padding-top: 12px; display: grid; gap: 4px; }
  .side-person { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--structure-text); text-decoration: none; }
  .side-person:hover { background: var(--structure-2); }
  .side-person-name { display: block; font-weight: 700; font-size: 0.9375rem; }
  .side-person-sub { display: block; font-size: 0.75rem; color: var(--structure-muted); }
}

.avatar {
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px;
  border-radius: 50%; background: var(--soft); color: var(--soft-text); font-size: 0.8125rem; font-weight: 800;
}

.page { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 24px 16px 32px; }
.no-nav .page { max-width: 960px; }
@media (min-width: 960px) { .has-nav .page { padding: 28px 28px 40px; } }

.greeting { font-size: 1.75rem; margin: 0 0 4px; }

/* --- Components ------------------------------------------------------------ */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px;
  min-height: 120px; padding: var(--pad);
  background: var(--surface); color: var(--text); text-decoration: none;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card:hover { border-color: var(--edge); }
.card-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--soft); color: var(--soft-text); }
.card-label { font-size: 1.0625rem; font-weight: 700; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--pad); margin: 0 0 var(--gap); box-shadow: var(--shadow);
}
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.narrow { max-width: 440px; margin: 24px auto; }

label { display: block; font-weight: 600; font-size: 0.9375rem; margin: 16px 0 6px; }

input[type="email"], input[type="password"], input[type="text"], input[type="search"],
input[type="number"], input[type="datetime-local"], input[type="date"], input[type="tel"],
input[type="url"], input:not([type]), textarea, select {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  font: inherit; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--edge); border-radius: var(--radius-small);
}
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--brand); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 18px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  color: var(--text); background: var(--surface);
  border: 1.5px solid var(--edge); border-radius: 12px;
}
.btn:hover { background: var(--surface-2); }
.btn-primary, .btn-primary:hover { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
.btn-primary:hover { filter: brightness(0.95); }
/* On a dark surface a school's darker colour can sink into the panel; the edge
   takes the colour's readable dark-theme shade so the button is still found. */
:root[data-theme="dark"] .btn-primary { border-color: var(--link); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { border-color: var(--link); } }
/* A choice that is in force: the theme switch, text size, spacing. */
[aria-pressed="true"].btn { border-color: var(--link); box-shadow: inset 0 0 0 1px var(--link); background: var(--soft); color: var(--soft-text); }
.btn-block { width: 100%; margin-top: 20px; }
.btn-small { min-height: 40px; padding: 6px 12px; font-size: 0.9375rem; }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-large { min-height: 54px; font-size: 1.0625rem; padding: 12px 22px; }
button:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

.error { color: var(--error); font-weight: 600; }
.notice { color: var(--muted); }
p.error[role="alert"], p.notice[role="alert"], p.notice[role="status"] {
  padding: 12px 14px; border-radius: var(--radius-small); border: 1px solid var(--border); background: var(--surface);
}
p.error[role="alert"] { background: var(--error-bg); border-color: transparent; }
.notice-warning { color: var(--warn); background: var(--warn-bg); padding: 12px 14px; border-radius: var(--radius-small); }
.notice-box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-small); background: var(--soft); color: var(--soft-text); font-weight: 600; }

.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px;
  padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface); font-size: 0.9375rem;
}
.footer form { margin: 0; }
.theme-form, .choice-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (min-width: 960px) { .has-nav .footer { padding: 12px 28px; } }

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

/* --- Defaults, so every page wears V2 even where a template has no classes -- */
.page h1 { font-size: 1.75rem; letter-spacing: -0.01em; margin: 0 0 12px; }
@media (min-width: 960px) { .page h1 { font-size: 2rem; } }
.panel h2 { font-size: 1.125rem; }
.page table:not([class]) { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.page table:not([class]) th, .page table:not([class]) td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.page table:not([class]) th { font-weight: 600; font-size: 0.8125rem; color: var(--muted); background: var(--surface-2); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-small); padding: 8px 16px 16px; margin: 16px 0; }
legend { font-weight: 700; padding: 0 6px; }
details > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
details.panel > summary { margin: -8px 0; }
.helptext { display: block; color: var(--muted); font-size: 0.875rem; margin-top: 4px; }
ul.errorlist { list-style: none; margin: 6px 0; padding: 10px 14px; border-radius: var(--radius-small); background: var(--error-bg); color: var(--error); font-weight: 600; }
form p:has(> input[type="checkbox"]), form p:has(> label > input[type="checkbox"]) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
form p > input[type="checkbox"] + label, form p > label:has(+ input[type="checkbox"]) { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; padding: 1px 5px; border-radius: 6px; background: var(--surface-2); overflow-wrap: anywhere; }
blockquote { margin: 12px 0; }
.draft-body { padding: 12px 16px; border-radius: var(--radius-small); background: var(--surface-2); white-space: normal; }

/* --- Titles, tags and small text ------------------------------------------ */
.page-title { font-size: 1.75rem; margin: 0 0 8px; letter-spacing: -0.01em; }
@media (min-width: 960px) { .page-title { font-size: 2rem; } }
.section-title { font-size: 1.125rem; margin: 24px 0 12px; }
.panel > .section-title:first-child { margin-top: 0; }
.lead { font-size: 1rem; color: var(--muted); margin: 0 0 20px; }
.crumb { margin: 0 0 6px; font-size: 0.875rem; color: var(--muted); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.875rem; margin: 4px 0 0; }
.eyebrow { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--soft-text); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; font-size: 0.8125rem; font-weight: 600;
  border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--surface-2); white-space: nowrap;
}
.tag-done, .tag-ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.tag-warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.tag-error { color: var(--error); background: var(--error-bg); border-color: transparent; }
.tag-info { color: var(--soft-text); background: var(--soft); border-color: transparent; }

/* A list of places, one tap each: More, Tasks, Preferences. */
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list.panel { padding: 4px var(--pad); }
.link-row {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 2px;
  color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border);
}
.link-list > li:last-child > .link-row, .link-list > li.link-row:last-child { border-bottom: 0; }
.link-row > span:first-of-type { flex: 1; min-width: 0; }
.link-row > .course-badge, .link-row > .avatar { flex: none; }
.link-row > .course-badge + span, .link-row > .avatar + span { flex: 1; min-width: 0; }
.link-row > .icon:first-child { color: var(--link); }
.link-row .chev { color: var(--muted); width: 1.1em; height: 1.1em; }
a.link-row:hover > span:first-of-type { text-decoration: underline; }
.list-group { margin-bottom: 8px; }
.list-group .link-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 var(--pad); }
.more-logout { margin-top: 24px; }

/* Plain lists of things with actions (children, devices, courses, reports). */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list > li.panel { display: block; padding: var(--pad); border: 1px solid var(--border); }
.list > li > p { margin: 0; }
.list > li.device { display: block; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 16px 0; text-align: left; }
.facts dt { color: var(--muted); font-size: 0.9375rem; }
.facts dd { margin: 0; font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 var(--gap); }
.filters a { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; font-weight: 600; }
.filters a.is-current { background: var(--soft); color: var(--soft-text); border-color: transparent; }
.decision { padding: 12px 0; border-bottom: 1px solid var(--border); }
.decision .btn { margin: 4px 8px 4px 0; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.08em; padding: 2px 8px; border-radius: 6px; background: var(--soft); color: var(--soft-text); }
.fact-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.fact-list li { display: flex; align-items: flex-start; gap: 10px; }
.fact-list .icon { color: var(--link); margin-top: 2px; }
.empty { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 8px 0 16px; }
.empty .icon { color: var(--ok); }

.item-head { display: flex; align-items: flex-start; gap: 12px; }
.item-head > div { flex: 1; min-width: 0; }
.item-title { margin: 0; font-size: 1.0625rem; }
.item-icon { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--soft); color: var(--soft-text); }
.item-card .btn { margin-top: 12px; }

.timeline { list-style: none; margin: 0; }
.timeline-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.timeline-row:last-child { border-bottom: 0; }
.timeline-dot { flex: none; width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; background: var(--brand); }
.timeline-title { margin: 0; font-weight: 600; }

/* The one big "do this next" card: a lesson to resume, a class starting. */
.hero {
  padding: 22px; border-radius: 18px; margin: 0 0 var(--gap);
  background: var(--structure); color: var(--structure-text);
}
.hero .eyebrow { background: rgba(255, 255, 255, 0.14); color: #ffffff; }
.hero-title { font-size: 1.75rem; margin: 12px 0 4px; color: #ffffff; }
.hero .hint { color: var(--structure-muted); }
.hero .progress-bar { background: rgba(255, 255, 255, 0.18); margin-top: 14px; }
.hero .btn { margin-top: 16px; }
.hero .btn-primary { border-color: #b7cbff; }
.hero a:not(.btn) { color: #ffffff; }

.split { display: grid; gap: var(--gap); }
@media (min-width: 960px) {
  .split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
  .split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.section-head > * { margin-bottom: 12px; }

/* --- Courses (spec 5: large cards, one primary action, visual progress) ---- */
/* Four large cards on a phone, more as the screen allows. */
.card-grid {
  display: grid; gap: var(--gap); list-style: none; margin: 0; padding: 0;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.course-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: var(--pad); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.course-card-link { text-decoration: none; color: inherit; }
.course-card-title { margin: 0; font-size: 1.125rem; }
.course-card-subject { margin: 4px 0 0; color: var(--muted); font-size: 0.9375rem; }
.course-badge { display: inline-grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 10px; background: var(--soft); color: var(--soft-text); font-weight: 800; }
.course-card-head { display: flex; align-items: center; gap: 12px; }

/* Progress as a bar and a plain count, never a bare percentage (spec 5). */
.progress { margin: 0; }
/* A native <progress>. The CSP allows no inline style attributes, so a div
   sized with style="width" rendered empty; <progress> carries its own value. */
.progress-bar, .bar {
  appearance: none; -webkit-appearance: none;
  display: block; width: 100%; height: 10px; border: 0;
  border-radius: 999px; overflow: hidden; background: var(--border);
}
.bar { height: 10px; }
.progress-bar::-webkit-progress-bar, .bar::-webkit-progress-bar { background: var(--border); border-radius: 999px; }
.progress-bar::-webkit-progress-value, .bar::-webkit-progress-value { background: var(--brand); border-radius: 999px; }
.progress-bar::-moz-progress-bar, .bar::-moz-progress-bar { background: var(--brand); border-radius: 999px; }
.hero .progress-bar::-webkit-progress-bar { background: rgba(255, 255, 255, 0.18); }
.hero .progress-bar::-webkit-progress-value { background: #8fa2ff; }
.hero .progress-bar::-moz-progress-bar { background: #8fa2ff; }
.progress-text { margin: 6px 0 0; font-weight: 600; font-size: 0.9375rem; }
.done-badge { font-weight: 700; color: var(--ok); }

.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  min-height: var(--tap); padding: 12px 0; border-bottom: 1px solid var(--border);
}
.lesson-row:last-child { border-bottom: 0; }
.lesson-row > a:first-child, .lesson-row > span:first-child:not(.lesson-mark) { flex: 1 1 12rem; }
.lesson-row.is-locked { color: var(--muted); }
.lesson-row > .lesson-mark + a, .lesson-row > .lesson-mark + span { flex: 1 1 12rem; }
.lesson-mark {
  display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--soft); color: var(--soft-text);
}
.lesson-row.is-done .lesson-mark { background: var(--ok-bg); color: var(--ok); }
.lesson-row.is-locked .lesson-mark { background: var(--surface-2); color: var(--muted); }
.course-head .page-title { font-size: 1.5rem; margin: 0; }
.course-head .progress { margin: 16px 0 4px; }
.course-head .btn { margin-top: 12px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 0 var(--gap); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 44px; padding: 8px 14px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.9375rem;
}
.chip:hover { border-color: var(--edge); }
.chip[aria-current="page"] { background: var(--soft); color: var(--soft-text); border-color: transparent; }
.lesson-row.is-done a { color: var(--muted); }
.lesson-row.is-current { background: var(--soft); border-radius: var(--radius-small); padding-left: 12px; padding-right: 12px; }

.lesson { max-width: 70ch; }
.lesson-heading { margin: 28px 0 8px; }
.lesson-text { line-height: 1.7; font-size: 1.0625rem; }
.callout {
  margin: 20px 0; padding: 16px; border-left: 4px solid var(--brand);
  background: var(--soft); color: var(--text); border-radius: var(--radius-small);
}
.callout .btn:not(.btn-primary), .notice-box .btn:not(.btn-primary) { border-color: var(--link); }
.callout-warning { border-left-color: var(--warn); background: var(--warn-bg); }

/* --- Sitting a test: focus mode, a sticky clock and a question map -------- */
.is-focus .sidebar, .is-focus .tabbar { display: none; }
.is-focus .shell { display: block !important; }
.is-focus .frame { padding-bottom: 0; }
.is-focus .topbar-brand { display: block !important; }
.exam-head {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 16px; margin: 0 -16px var(--gap); padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.exam-head .page-title { font-size: 1.375rem; margin: 0; }
.exam-timer { display: flex; align-items: baseline; gap: 8px; margin: 0; padding: 6px 12px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); }
.exam-clock { font-size: 1.25rem; }
.exam-status { margin: 0; font-weight: 600; color: var(--ok); min-height: 1.5em; }
.sync-banner { display: grid; gap: 6px; margin: 0 0 var(--gap); padding: 14px 16px; border-radius: var(--radius-small); background: var(--warn-bg); color: var(--warn); }
.sync-banner[hidden] { display: none; }
.sync-banner .hint { color: inherit; }
.sync-banner .btn { justify-self: start; }
.question-number { display: flex; justify-content: space-between; gap: 8px; font-size: 0.8125rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.question-marks { font-weight: 600; }
.question-prompt { font-size: 1.125rem; font-weight: 600; }
.answer-choices { border: 0; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 12px; margin: 0; min-height: var(--tap); padding: 10px 14px; cursor: pointer;
  font-weight: 500; border: 1.5px solid var(--edge); border-radius: var(--radius-small); background: var(--surface);
}
.choice:has(input:checked) { border-color: var(--link); background: var(--soft); color: var(--soft-text); }
.answer-matching, .answer-blanks { padding-left: 1.25rem; display: grid; gap: 10px; }
.qnav-grid { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.qnav-grid a {
  display: grid; place-items: center; min-height: 44px; border-radius: var(--radius-small); font-weight: 700;
  border: 1.5px solid var(--edge); color: var(--text); text-decoration: none; background: var(--surface);
}
.qnav-grid a.is-answered { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
@media (min-width: 960px) { .qnav { position: sticky; top: 88px; } }
@media (max-width: 959px) { .qnav { order: -1; } }

.settings-grid { display: grid; gap: 0 var(--gap); }
@media (min-width: 960px) { .settings-grid { grid-template-columns: 1fr 1fr; } }
.hint.block, .block { display: block; }
.toolbar { padding: 12px var(--pad); margin: 0 0 var(--gap); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.toolbar label { font-size: 0.875rem; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-flush > p, .panel-flush > .actions { padding: 0 var(--pad); }
.person-cell { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
/* Lesson studio: the canvas, with the toolbox and save status beside it. */
.studio { display: grid; gap: var(--gap); }
.studio-canvas { min-width: 0; }
@media (min-width: 1100px) {
  .studio { grid-template-columns: 260px minmax(0, 1fr); grid-template-areas: "tools canvas" "save canvas"; align-items: start; }
  .studio-canvas { grid-area: canvas; margin: 0; }
  .studio-tools { grid-area: tools; position: sticky; top: 16px; }
  .studio-save { grid-area: save; position: sticky; top: 260px; }
}
.bank-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 12px; align-items: end; }
.bank-filters .btn { margin: 12px 0; }
.question-row p:last-child { margin-bottom: 0; }
.question-row-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 0; }
@media (min-width: 960px) { .mark-split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.answer-given { margin: 0 0 12px; padding: 12px 16px; border-left: 4px solid var(--soft); background: var(--surface-2); border-radius: var(--radius-small); }
@media (min-width: 960px) { .studio-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); } }
.register-row { justify-content: space-between; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 0; }
.result-score { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; font-size: 1.125rem; }
.amount { font-size: 1.125rem; font-weight: 800; white-space: nowrap; }

/* Authoring rows: one main action, the rest in a native <details> menu. */
.authoring-row { gap: 10px 12px; }
.authoring-title { flex: 1 1 10rem; font-weight: 600; }
.authoring-row .actions { margin-left: auto; }
.row-menu { position: relative; }
.row-menu > summary { list-style: none; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu[open] > summary { background: var(--soft); color: var(--soft-text); }
.row-menu-body {
  position: absolute; right: 0; z-index: 15; min-width: 11rem; margin-top: 4px; padding: 6px;
  display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-small); box-shadow: 0 8px 24px rgba(20, 34, 57, 0.16);
}
.row-menu-body form { margin: 0; }
.row-menu-body .btn { width: 100%; justify-content: flex-start; }

/* Chapter contents beside a lesson, and any numbered list of steps. */
.step-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.step { display: flex; align-items: flex-start; gap: 12px; padding: 8px; border-radius: var(--radius-small); }
.step > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.step.is-current { background: var(--soft); }
.step-mark {
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--edge); font-size: 0.8125rem; font-weight: 700; color: var(--muted);
}
.step.is-current .step-mark { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
.step.is-done .step-mark { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.step-title { font-weight: 600; }
.step.is-current .step-title { color: var(--soft-text); }
.lesson-file { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--surface); }
@media (min-width: 960px) { .chapter-contents { position: sticky; top: 16px; } }

/* A 16:9 box, so the page does not jump when the iframe loads. */
.lesson-video, .lesson-image, .lesson-audio { margin: 24px 0; }
.video-frame { position: relative; padding-top: 56.25%; background: #000; border-radius: 12px; overflow: hidden; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lesson-image img { max-width: 100%; height: auto; border-radius: 12px; }
.lesson-audio audio { width: 100%; }
figcaption { margin-top: 8px; color: var(--muted); font-size: 0.9375rem; }

/* --- Lesson builder (teacher-facing, desktop-first) ----------------------- */
.builder-add { display: flex; flex-wrap: wrap; gap: 8px; }
.builder-list { list-style: none; margin: 0; padding: 0; counter-reset: block; }
.builder-block { counter-increment: block; }
.builder-block-head strong::before { content: counter(block, decimal-leading-zero) "  "; color: var(--muted); font-size: 0.8125rem; letter-spacing: 0.04em; }
.studio-tools .builder-add { display: grid; grid-template-columns: 1fr 1fr; }
.builder-block {
  margin: 12px 0; padding: 16px; background: var(--surface);
  border: 1px solid var(--border); border-left: 4px solid var(--soft); border-radius: 12px;
}
.builder-block:focus-within { border-left-color: var(--brand); }
.builder-block-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.builder-block-head strong { margin-right: auto; }
.builder-field { display: block; margin: 12px 0; }
.builder-field > span { display: block; margin-bottom: 4px; font-weight: 600; font-size: 0.9375rem; }
.builder-field > span.hint { font-weight: 400; font-size: 0.875rem; margin: 4px 0 0; }
.builder-field > span.error { margin: 4px 0 0; }
.builder-field input, .builder-field textarea, .builder-field select { width: 100%; }
/* Lists of tick boxes (CheckboxSelectMultiple) inside a field. */
.builder-field input[type="checkbox"], .builder-field input[type="radio"] { width: 20px; min-height: 0; flex: none; }
.builder-field label, .builder-field > div label { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-weight: 500; font-size: 1rem; }
.builder-field > div > div { margin: 0; }
/* The file picker's button, in the same shape as every other button. */
input[type="file"] { font: inherit; max-width: 100%; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700; margin-right: 10px; min-height: 40px; padding: 6px 14px; cursor: pointer;
  color: var(--text); background: var(--surface); border: 1.5px solid var(--edge); border-radius: 10px;
}
.stat .tag { white-space: normal; }
/* A tick box sits before its words, not stretched across the page. */
.builder-field:has(> input[type="checkbox"]), .builder-field:has(> input[type="radio"]) { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.builder-field > input[type="checkbox"], .builder-field > input[type="radio"] { order: -1; width: 20px; flex: none; }
.builder-field:has(> input[type="checkbox"]) > span:first-child { margin: 0; flex: 1 1 12rem; }
.builder-field:has(> input[type="checkbox"]) > .hint, .builder-field:has(> input[type="checkbox"]) > .error { flex-basis: 100%; }
.builder-status { font-weight: 600; min-height: 1.5em; }
.builder-status.is-error { color: var(--error); }

/* A-04: a support look must never be mistakable for the student's own session. */
.support-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 10px 16px; background: #fff4e5; color: #7c2d12;
  border-bottom: 3px solid #d97706; font-weight: 600;
}
.support-banner form { margin: 0; }
.support-banner .btn { color: #7c2d12; background: #ffffff; border-color: #b45309; }

/* --- Attendance ----------------------------------------------------------- */
/* A QR shown across a room: as large as the screen allows, on white so a
   camera can read it whatever the theme. */
.qr-frame {
  max-width: 22rem; margin: 0 auto; padding: 16px;
  background: #fff; border-radius: 12px;
}
.qr-frame svg { width: 100%; height: auto; display: block; }
/* An authenticator QR is read from arm's length, not across a room. */
.qr-small { max-width: 16rem; margin: 16px 0; }

.report { width: 100%; border-collapse: collapse; }
.report th, .report td {
  text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border);
}
.report th { font-size: 0.8125rem; color: var(--muted); }

/* --- Certificates (CE-01) --------------------------------------------------
   Designed to print. A certificate is handed to somebody on paper, so the
   screen version is the print version with the site furniture removed rather
   than a separate layout that drifts out of step with it. */
.certificate {
  max-width: 48rem; margin: 1rem auto; padding: 2.5rem 2rem;
  border: 3px double var(--border); border-radius: 4px;
  background: var(--surface); text-align: center;
}
.certificate-issuer { font-size: 1.125rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.certificate-title { font-size: 1.75rem; margin: 1rem 0 2rem; }
.certificate-lead { color: var(--muted); margin: 0.75rem 0 0.25rem; }
.certificate-name { font-size: 2rem; font-weight: 700; margin: 0.25rem 0 1rem; }
.certificate-course { font-size: 1.375rem; font-weight: 600; margin: 0.25rem 0 2rem; }
.certificate-date { color: var(--muted); }
.certificate-signature { margin-top: 2.5rem; border-top: 1px solid var(--border); display: inline-block; padding-top: 0.5rem; }
.certificate-verify { margin-top: 2rem; }
.certificate-verify svg { width: 120px; height: 120px; }

@media print {
  /* Paper is white whatever the screen theme was: without this, a page printed
     in dark mode came out as pale text on white paper. */
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    --bg: #ffffff; --surface: #ffffff; --text: #000000; --muted: #333333; --border: #999999;
    --link: #000000; color-scheme: light;
  }
  /* Everything but the certificate itself is furniture the paper does not need. */
  header, footer, nav, aside, .tabbar, .no-print, .messages { display: none !important; }
  .has-nav .shell { display: block; }
  .certificate { border-color: #000; margin: 0; page-break-inside: avoid; }
  body { background: #fff; color: #000; }
}

/* A certificate as it will look, on the settings page. Paper-coloured in both themes. */
.cert-preview { padding: 20px; border: 1px solid #d8cfb8; border-radius: 8px; background: #fbf7ee; color: #19263d; text-align: center; }
.cert-preview .certificate-issuer { color: #5e6b80; font-size: 0.8125rem; margin: 0; }
.cert-preview .hint { color: #5e6b80; }
.cert-preview-title { font-size: 1.25rem; font-weight: 800; margin: 8px 0; }
.cert-preview-name { font-size: 1.125rem; font-weight: 700; margin: 8px 0 2px; }
.cert-preview-note { border-top: 1px solid #d8cfb8; padding-top: 8px; margin-top: 12px; font-size: 0.75rem; }

/* --- Dashboards (AN-01..06) ------------------------------------------------
   No charting library. The spec's child-first rules mean a phone on a slow
   connection should not download a bundle to draw a bar, and a percentage is a
   length --- it does not need JavaScript to be one. */
.stat-row { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: var(--gap); padding: 0; margin: 0 0 var(--gap); }
.stat {
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  border-radius: var(--radius); padding: 14px 16px; text-align: left;
}
.stat-value { display: block; font-size: 1.75rem; font-weight: 800; line-height: 1.2; }
.stat-label { display: block; font-size: 0.8125rem; color: var(--muted); }
/* Label above the figure on every page (V2), whatever order a template wrote. */
.stat { display: flex; flex-direction: column; }
.stat > .stat-label { order: -1; margin-bottom: 4px; }

.sparkline { display: block; width: 100%; height: 96px; }
.sparkline-grid { stroke: var(--border); stroke-width: 1; }
.sparkline-line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.sparkline-dot { fill: var(--surface); stroke: var(--brand); stroke-width: 2; vector-effect: non-scaling-stroke; }

/* --- Authoring (CL-01..03): rows of small POST buttons ---------------------- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; list-style: none; padding: 0; }
.actions form, .inline-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.inline-form { margin-top: 12px; }
.inline-form label { margin: 0; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 12rem; }
.grow { width: 100%; }

/* Tables: plain, readable on a phone by scrolling sideways inside the panel. */
.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
/* On a phone a wide table scrolls sideways inside its panel instead of the page. */
@media (max-width: 720px) { .table, .page table:not([class]) { display: block; overflow-x: auto; } }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-weight: 600; font-size: 0.8125rem; color: var(--muted); background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }

/* --- The platform's credit, only where an employee turned it on ------------ */
.platform-credit { width: 100%; margin: 4px 0 0; text-align: center; font-size: 0.8125rem; color: var(--muted); }
.platform-credit a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.credit-logo { height: 18px; width: auto; opacity: 0.85; }

/* --- Branding page previews ---------------------------------------------- */
.logo-previews { display: flex; flex-wrap: wrap; gap: 16px; }
.logo-preview { flex: 1 1 14rem; padding: 16px; border-radius: 12px; border: 1px solid var(--border); text-align: center; }
.logo-preview img { max-height: 64px; max-width: 100%; }
.logo-preview-light { background: #f4f6fa; color: #19263d; }
.logo-preview-dark { background: #0a0a0c; color: #eef3fb; }
.logo-preview img.on-plate { background: #ffffff; padding: 4px 8px; border-radius: 8px; }

.theme-preview { flex: 1 1 14rem; padding: 16px; border-radius: 12px; border: 1px solid var(--border); }
.theme-preview-head { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
.theme-preview-light { background: #ffffff; color: #19263d; }
.theme-preview-dark { background: #141416; color: #eef3fb; }
.theme-preview-light .theme-preview-link { color: var(--link-light, #3042b3); text-decoration: underline; }
.theme-preview-dark .theme-preview-link { color: var(--link-dark, #b7cbff); text-decoration: underline; }
.theme-preview-dark .btn-primary { border-color: var(--link-dark, #b7cbff); }

/* --- Sign-in and error pages: centred, with the school's identity ---------- */
.error-page { margin-top: 10vh; text-align: center; }
.auth-split { display: grid; gap: var(--gap); max-width: 960px; margin: 8px auto; }
.auth-form { width: 100%; max-width: 460px; margin: 0 auto; }
.auth-aside { display: none; }
@media (min-width: 860px) {
  .auth-split { grid-template-columns: 1fr 1fr; align-items: stretch; }
  .auth-aside {
    display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; padding: 32px;
    border-radius: 18px; background: var(--structure); color: var(--structure-text);
  }
  .auth-aside .brand-mark { width: 52px; height: 52px; font-size: 1.375rem; border-radius: 14px; margin-bottom: auto; }
  .auth-aside-title { margin: 0; font-size: 2rem; font-weight: 800; line-height: 1.2; color: #ffffff; }
  .auth-aside-text { margin: 0; color: var(--structure-muted); }
}

/* --- Home page ------------------------------------------------------------ */
.more-links { margin-top: 24px; }
.more-links ul { list-style: none; padding: 0; margin: 0; }
.swatch-link { color: var(--link); text-decoration: underline; }


/* --- 1.1.1: modern, and easy to find your way -------------------------------
   Clean surfaces and one accent (the school's colour), but navigation comes
   first: the current place is always marked in the sidebar, the phone's bar
   and the header; every icon keeps its label; tap targets stay 48px; the
   header stays in reach while a long page scrolls. Decoration is limited to
   what helps scanning: a small hexagon marking section titles, and a lift on
   things you can open. Nothing may run out of its box: long names, emails and
   titles wrap inside their card, tag, button or cell. */

/* Nothing overflows. */
body { overflow-wrap: break-word; }
h1, h2, h3, .page-title, .hero-title, .item-title, .course-card-title, .card-label,
.link-row > span, .facts dd, .timeline-title, .step-title, .tab > span,
.crumb, .lead, .hint { overflow-wrap: anywhere; }
.btn { white-space: normal; text-align: center; max-width: 100%; overflow-wrap: anywhere; }
.tag { max-width: 100%; white-space: normal; overflow-wrap: break-word; line-height: 1.35; }
td .tag, th .tag { white-space: nowrap; }
.list > li > *, .item-head > *, .section-head > *, .course-card-head > *, .person-cell > span,
.lesson-row > *, .timeline-row > div, .fact-list li > span, .actions > * { min-width: 0; }
.timeline { padding: 0; }
.facts { grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr); }
.side-person > span:last-child { min-width: 0; }
.side-person-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
input, select, textarea, img, video, iframe { max-width: 100%; }
pre { overflow-x: auto; }

/* Type: a strong page title, calm body text. */
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Sinhala",
  "Iskoola Pota", "Noto Sans Tamil", "Latha", sans-serif; -webkit-font-smoothing: antialiased; }
.page h1, .page-title, .greeting { font-weight: 800; letter-spacing: -0.03em; line-height: 1.12; }
.page h2, .section-title, .panel h2 { font-weight: 700; letter-spacing: -0.015em; }
.greeting { font-size: 1.875rem; }
@media (min-width: 960px) { .greeting { font-size: 2.375rem; } .page h1, .page-title { font-size: 2.125rem; } }
.lead { font-size: 1.0625rem; }

/* The hexagon marks a section title, so a long page scans in blocks. */
.section-title, .panel > h2:first-child { display: flex; align-items: center; gap: 10px; }
.section-title::before, .panel > h2:first-child::before {
  content: ""; flex: none; width: 12px; height: 13px; background: var(--brand);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.eyebrow { background: transparent; padding: 0; color: var(--link); letter-spacing: 0.08em; display: inline-flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ""; width: 10px; height: 11px; background: currentColor; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }

/* Header: stays at the top, says where you are. */
.topbar { position: sticky; top: 0; z-index: 18; border-bottom: 1px solid var(--border); }
.is-focus .topbar { position: static; }
.topbar-crumb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-weight: 600; }
.icon-button { border-radius: 999px; }

/* Sidebar: near-black in both themes; the current page is a filled pill in the
   school's colour, so it cannot be missed. */
@media (min-width: 960px) {
  .has-nav .shell { grid-template-columns: 256px minmax(0, 1fr); background: linear-gradient(to right, var(--structure) 256px, transparent 256px); }
  .sidebar { padding: 22px 14px 16px; border-right: 1px solid rgba(255, 255, 255, 0.06); }
  .sidebar .brand-mark { box-shadow: var(--glow); }
  .workspace-chip { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08); color: var(--structure-muted); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
  .side-list { gap: 4px; }
  .side-link { min-height: 46px; border-radius: 12px; color: var(--structure-muted); font-weight: 600; }
  .side-link:hover { color: #ffffff; background: rgba(255, 255, 255, 0.07); }
  .side-link[aria-current="page"] { color: var(--brand-text); background: var(--brand); box-shadow: var(--glow); font-weight: 700; }
  .side-foot { border-top-color: rgba(255, 255, 255, 0.08); }
  .side-person .avatar { background: var(--brand); color: var(--brand-text); }
}

/* Phone: a floating bar with labels always shown; the current tab is filled. */
.tabbar {
  left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 6px;
  border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lift); background: var(--surface);
}
.tab { min-height: 56px; gap: 3px; border-radius: 16px; font-size: 0.75rem; font-weight: 700; line-height: 1.2; text-align: center; color: var(--muted); }
.tab .icon { width: 1.4em; height: 1.4em; }
.tab[aria-current="page"] { background: var(--brand); color: var(--brand-text); }
.has-nav .frame { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
@media (min-width: 960px) { .has-nav .frame { padding-bottom: 0; } }

/* Surfaces: rounder, softer, a lift only on things you can open. */
.panel { padding: calc(var(--pad) + 4px); }
.card, .course-card, a.link-row, .chip, .btn { transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background 0.15s; }
a.card:hover, .course-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--edge); }
.card-icon, .item-icon { background: var(--soft); color: var(--link); border-radius: 12px; }
.course-badge { background: var(--brand); color: var(--brand-text); border-radius: 12px; }
.course-card { position: relative; overflow: hidden; }
.course-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--brand); }

/* Figures: label on top, a big number, the school's colour as a thin accent. */
/* Two across on a phone (an odd last tile takes the full row), as many as fit on a computer.
   Words are never split: a label or a worded value wraps between words only. */
.stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-row > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (min-width: 720px) {
  .stat-row { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: var(--gap); }
  .stat-row > .stat:last-child:nth-child(odd) { grid-column: auto; }
}
.stat .stat-label, .stat .stat-value { overflow-wrap: normal; word-break: normal; hyphens: manual; }
.stat-value { font-size: clamp(1.375rem, 5.5vw, 2rem); }
.stat { position: relative; overflow: hidden; padding: 16px 18px 18px; border-radius: var(--radius); }
.stat::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.stat > .stat-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 6px; }
.stat-value { letter-spacing: -0.03em; }

/* The "do this next" card: deep, with the school's colour glowing in. */
.hero {
  position: relative; overflow: hidden; padding: 26px; border-radius: 24px; box-shadow: var(--shadow-lift);
  background: radial-gradient(120% 140% at 100% 0%, rgba(var(--brand-rgb), 0.45) 0%, transparent 55%), #0b0b0d;
  color: #f4f4f5; border: 1px solid rgba(255, 255, 255, 0.06);
}
.hero .hint { color: #c4c4cc; }
.hero .eyebrow { color: #ffffff; }
.hero-title { font-size: 1.875rem; letter-spacing: -0.03em; line-height: 1.12; }
.hero .progress-bar::-webkit-progress-value { background: var(--brand); }
.hero .progress-bar::-moz-progress-bar { background: var(--brand); }
.hero .btn-primary { border-color: rgba(255, 255, 255, 0.35); box-shadow: var(--glow); }
@media (min-width: 960px) { .hero { padding: 34px 36px; } .hero-title { font-size: 2.375rem; } }

/* Buttons: pills; the main action glows in the school's colour. */
.btn { border-radius: 999px; padding-left: 20px; padding-right: 20px; }
.btn-small { padding-left: 14px; padding-right: 14px; }
.btn-primary { box-shadow: var(--glow); }
.btn-primary:hover { filter: brightness(1.06); }
input[type="file"]::file-selector-button { border-radius: 999px; }

/* Fields: a clear focus ring in the school's colour. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea { border-radius: 12px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus, select:focus, textarea:focus {
  border-color: var(--link); box-shadow: 0 0 0 4px rgba(var(--brand-rgb), 0.2);
}
label { font-size: 0.875rem; }

/* Tables: a quiet header band, room to read, the row under the pointer marked. */
.table th, .page table:not([class]) th { text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.75rem; font-weight: 700; }
.table td, .page table:not([class]) td { padding-top: 13px; padding-bottom: 13px; }
.table tbody tr:hover td { background: var(--surface-2); }
.panel-flush .table td:first-child, .panel-flush .table th:first-child { padding-left: var(--pad); }
.panel-flush .table td:last-child, .panel-flush .table th:last-child { padding-right: var(--pad); }

/* Lists of places: the whole row answers the pointer, the icon sits in a tile. */
a.link-row { border-radius: 12px; }
a.link-row:hover { background: var(--surface-2); }
a.link-row:hover > span:first-of-type { text-decoration: none; }
.link-list.panel, .list-group .link-list { padding: 6px 10px; }
.link-list.panel .link-row, .list-group .link-row { padding-left: 10px; padding-right: 10px; }
.link-row > .icon:first-child { box-sizing: content-box; padding: 9px; border-radius: 12px; color: var(--link); background: var(--soft); }

/* Chips, filters and tags. */
.chip, .filters a { min-height: 44px; }
.chip[aria-current="page"], .filters a.is-current { background: var(--brand); color: var(--brand-text); border-color: var(--brand); }
.tag { padding: 3px 10px; font-size: 0.75rem; font-weight: 700; }

/* Empty states: a calm box, not a stray line. */
.panel .empty { padding: 14px 16px; border: 1px dashed var(--border); border-radius: 14px; background: var(--surface-2); margin: 4px 0 0; }
.timeline-dot { box-shadow: 0 0 0 4px rgba(var(--brand-rgb), 0.18); }

/* Footer: settings, not content. */
.footer { background: transparent; font-size: 0.875rem; color: var(--muted); }
.footer .btn-small { min-height: 40px; }

/* Sign-in: the side panel carries the school's colour. */
@media (min-width: 860px) {
  .auth-aside { background: radial-gradient(120% 90% at 0% 100%, rgba(var(--brand-rgb), 0.5) 0%, transparent 60%), #0b0b0d; box-shadow: var(--shadow-lift); border-radius: 24px; }
  .auth-aside .brand-mark { box-shadow: var(--glow); }
}
/* A link inside a warning takes the warning's own text colour (always AA on
   its background) rather than the school's colour, which may not be. */
.notice-warning a:not(.btn), .callout-warning a:not(.btn), .sync-banner a:not(.btn), .exam-timer a:not(.btn) { color: inherit; text-decoration: underline; font-weight: 700; }

/* 1.2.0: student details and photos */
.person-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; min-width: 0; }
.person-head > div { min-width: 0; }
.person-name { font-weight: 700; font-size: 1.125rem; margin: 0; overflow-wrap: anywhere; }
.profile-photo { width: 96px; height: 96px; border-radius: 16px; object-fit: cover; flex: none; background: var(--surface-2); }
.avatar-photo { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-large { width: 96px; height: 96px; border-radius: 16px; font-size: 2rem; flex: none; }
.field-list { list-style: none; padding: 0; margin: 0; }
.field-list > li { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.field-list > li:last-child { border-bottom: 0; }
.preset-grid { display: flex; flex-wrap: wrap; gap: 8px; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 12px 0 4px; }
label.check input[type="checkbox"] { flex: none; min-height: 0; }

/* 1.2.0: student ID cards, 85.6 x 54 mm, eight to an A4 sheet. Paper-coloured in both themes. */
.id-sheet { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 85.6mm), 85.6mm)); gap: 6mm; justify-content: start; }
.id-card { width: 85.6mm; max-width: 100%; height: 54mm; border: 1px dashed #9aa3af; border-radius: 3mm; background: #fff; color: #111; padding: 3mm 3.5mm; display: flex; flex-direction: column; overflow: hidden; break-inside: avoid; }
.id-card-head { display: flex; align-items: center; gap: 2mm; border-bottom: 0.6mm solid var(--brand); padding-bottom: 1.5mm; min-width: 0; }
.id-card-logo { height: 6mm; width: auto; max-width: 18mm; object-fit: contain; }
.id-card-school { font-weight: 800; font-size: 3.2mm; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.id-card-body { display: flex; gap: 2.5mm; align-items: center; flex: 1; min-height: 0; padding-top: 2mm; }
.id-card-photo { width: 20mm; height: 25mm; object-fit: cover; border-radius: 1.5mm; background: #eef0f3; flex: none; }
.id-card-nophoto { display: block; border: 0.3mm solid #d1d5db; }
.id-card-text { flex: 1; min-width: 0; }
.id-card-name { font-weight: 700; font-size: 3.4mm; margin: 0 0 1mm; line-height: 1.15; overflow-wrap: anywhere; }
.id-card-number { font: 700 4.2mm/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.3mm; margin: 0 0 1mm; }
.id-card-line { font-size: 2.6mm; margin: 0; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.id-card-qr { width: 19mm; height: 19mm; flex: none; }
.id-card-qr svg { width: 100%; height: 100%; }
.id-card-foot { font-size: 2.2mm; color: #6b7280; text-transform: uppercase; letter-spacing: 0.3mm; }
@media print {
  .id-sheet { gap: 4mm; }
  .id-card { border-color: #9aa3af; }
  @page { size: A4; margin: 10mm; }
}

/* 1.3.0: the bell's floating, see-through panel. */
.bell { position: relative; }
.bell > summary { list-style: none; cursor: pointer; position: relative; }
.bell > summary::-webkit-details-marker { display: none; }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--error); color: var(--surface); font-size: 0.6875rem; font-weight: 700; line-height: 18px; text-align: center; }
.bell-panel { position: absolute; right: 0; top: calc(100% + 10px); z-index: 60; width: min(380px, calc(100vw - 32px)); max-height: min(70vh, 560px); display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--surface) 78%, transparent); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent); border-radius: 18px; box-shadow: var(--shadow-lift); overflow: hidden; }
.bell-head, .bell-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; }
.bell-head { border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.bell-head form { margin: 0; }
.bell-foot { border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); font-size: 0.875rem; }
.bell-list { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; }
.bell-item { display: grid; grid-template-columns: 10px 1fr; gap: 10px; padding: 10px 16px; }
.bell-item + .bell-item { border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.bell-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: transparent; }
.bell-item.is-new .bell-dot { background: var(--brand); }
.bell-title { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.bell-body { margin: 2px 0 0; color: var(--muted); font-size: 0.875rem; overflow-wrap: anywhere; }
.bell-time { margin: 4px 0 0; color: var(--muted); font-size: 0.8125rem; }
.bell-empty { padding: 20px 16px; color: var(--muted); margin: 0; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .bell-panel { background: var(--surface); } }
@media (max-width: 640px) { .bell-panel { position: fixed; top: 64px; right: 16px; left: 16px; width: auto; } }

/* 1.3.0: module tabs (Courses, Orders, Subscriptions, Bundles), list toolbars, row actions and menus. */
.module-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.module-tabs { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.module-tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.9375rem; border-bottom: 2px solid transparent; }
.module-tab:hover { background: var(--surface-2); }
.module-tab[aria-current="page"] { border-bottom-color: var(--brand); color: var(--brand-ink, var(--text)); background: var(--surface-2); }
.module-tab .icon { width: 16px; height: 16px; }
.count-pill { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 0.75rem; font-weight: 700; text-align: center; }
.list-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 16px; border-bottom: 1px solid var(--border); }
.list-toolbar .grow { flex: 1 1 220px; min-width: 0; }
.list-toolbar select, .list-toolbar input { width: auto; margin: 0; }
.bulk-bar { display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.bulk-bar select { width: auto; margin: 0; }
.table-scroll { overflow-x: auto; }
.course-table td, .course-table th { vertical-align: top; }
.course-table .col-check { width: 36px; }
.course-table .col-title { min-width: 240px; }
.course-table .col-actions { white-space: nowrap; text-align: right; }
.course-table .col-actions > * { display: inline-block; vertical-align: middle; }
.col-nowrap { white-space: nowrap; }
.col-muted { color: var(--muted); font-size: 0.9375rem; }
.course-title-link { font-weight: 700; }
.paid-mark .icon { width: 15px; height: 15px; vertical-align: -2px; color: var(--link, var(--brand)); }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 0.875rem; opacity: 0; transition: opacity 0.15s; }
.course-row:hover .row-actions, .course-row:focus-within .row-actions { opacity: 1; }
@media (hover: none) { .row-actions { opacity: 1; } }
.row-actions summary { cursor: pointer; color: var(--link, var(--brand)); list-style: none; }
.row-actions summary::-webkit-details-marker { display: none; }
form.inline { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; margin: 0; color: var(--link, var(--brand)); font: inherit; cursor: pointer; text-decoration: underline; min-height: 0; }
.danger-link, .link-button.danger-link { color: var(--error); }
.person-chip { display: inline-flex; align-items: center; gap: 6px; margin: 0 6px 4px 0; }
.avatar-small { width: 24px; height: 24px; font-size: 0.6875rem; }
details[data-popover] { position: relative; display: inline-block; }
details[data-popover] > summary { list-style: none; }
details[data-popover] > summary::-webkit-details-marker { display: none; }
.popover-panel { position: absolute; z-index: 50; top: calc(100% + 6px); right: 0; min-width: 200px; padding: 8px; border-radius: 14px; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--shadow-lift); text-align: left; }
.quick-edit .popover-panel { left: 0; right: auto; width: min(360px, calc(100vw - 48px)); padding: 16px; }
.menu-panel form { margin: 0; }
.menu-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: var(--text); font: inherit; text-decoration: none; cursor: pointer; min-height: 0; }
.menu-item:hover { background: var(--surface-2); }
.menu-item .icon { width: 16px; height: 16px; }
.check-grid { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 8px 0; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.empty-state { text-align: center; padding: 48px 16px; }
.empty-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); margin-bottom: 8px; }
.pager { padding: 12px 16px; }
.preview-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; margin-bottom: 16px; border-radius: 14px; background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.preview-banner p { margin: 0; }
.h1 { font-size: 1.75rem; margin: 0 0 6px; letter-spacing: -0.01em; }
.h2 { font-size: 1.375rem; margin: 0 0 16px; }
.h3 { font-size: 1.125rem; margin: 0 0 12px; }

/* 1.3.0: Courses → Settings. A section list on the left, switches and pictured choices on the right. */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .settings-layout { grid-template-columns: 1fr; } }
.settings-nav { position: sticky; top: 16px; padding: 12px; border-radius: var(--radius-small); background: var(--surface); border: 1px solid var(--border); }
.settings-nav ul { list-style: none; margin: 0 0 8px; padding: 0; }
.settings-nav a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.9375rem; }
.settings-nav a:hover { background: var(--surface-2); }
.settings-nav a[aria-current="page"] { background: var(--soft); color: var(--soft-text); }
.settings-nav-group { margin: 8px 10px 4px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.settings-form .field { margin: 0 0 18px; }
.settings-form fieldset.field { border: 0; padding: 0; }
.settings-form legend { font-weight: 700; margin-bottom: 8px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.switch-row .hint { margin: 2px 0 0; }
.switch-row-compact { padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; }
.switch-label { font-weight: 600; margin: 0; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--edge); transition: background 0.15s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.component-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.radio-cards { display: flex; flex-wrap: wrap; gap: 10px; }
.radio-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 88px; padding: 10px 14px; border: 2px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 600; background: var(--surface); }
.radio-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--soft); }
.radio-card:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.layout-sketch { display: grid; gap: 3px; width: 96px; height: 64px; padding: 6px; border-radius: 8px; background: var(--surface-2); }
.layout-sketch i { display: block; border-radius: 3px; background: color-mix(in srgb, var(--brand) 45%, var(--surface)); }
.layout-simple { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.layout-simple i:first-child { grid-row: span 2; }
.layout-modern { grid-template-rows: 1.2fr 1fr; grid-template-columns: 2fr 1fr; }
.layout-modern i:first-child { grid-column: span 2; background: var(--brand); }
.layout-minimal { grid-template-rows: 1fr 1fr 1fr; padding: 6px 20px; }
.layout-immersive { grid-template-rows: 2fr 1fr; grid-template-columns: 1fr 1fr; }
.layout-immersive i:first-child { grid-column: span 2; background: var(--structure); }
.layout-overlay { grid-template-columns: 1fr 1fr 1fr; }
.layout-overlay i { background: var(--structure); }
.slider { width: 100%; accent-color: var(--brand); }
.slider-value { display: inline-block; min-width: 2.5em; padding: 0 6px; border-radius: 6px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.code-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.875rem; }
.live-preview { margin: 8px 0 20px; padding: 16px; border: 1px dashed var(--edge); border-radius: 14px; background: var(--bg); }
.live-preview-label { margin: 0 0 10px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.preview-card { max-width: 320px; }

/* Social share buttons: size, style and scheme come from Courses → Settings. */
.share-title { margin: 0 0 10px; font-weight: 700; }
.share-row { --share-size: 35px; display: flex; flex-wrap: wrap; gap: 8px; }
.share-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: var(--share-size); height: var(--share-size); padding: 0; border-radius: 50%; color: #fff; text-decoration: none; font-weight: 600; font-size: 0.875rem; }
.share-btn .icon { width: calc(var(--share-size) * 0.5); height: calc(var(--share-size) * 0.5); }
.share-btn .share-name { display: none; }
.share-square .share-btn { border-radius: 6px; }
.share-rectangle .share-btn { border-radius: 8px; padding: 0 12px; }
.share-rectangle .share-btn .share-name { display: inline; }
.share-facebook { background: #1b5fcf; }
.share-x { background: #111; }
.share-linkedin { background: #0a5a93; }
.share-whatsapp { background: #137a45; }
.share-telegram { background: #1f78b4; }
.share-scheme-dark .share-btn { background: var(--structure); color: var(--structure-text); }
.share-scheme-light .share-btn { background: var(--surface); color: var(--text); border: 1px solid var(--edge); }
.share-btn.is-off { display: none; }

/* 1.3.0: the shop. Card sizes and the enrol button follow Courses → Settings → Styles. */
.shop { --shop-title: 19px; --shop-enrol: 16px; --shop-radius: 10px; --shop-align: left; }
.shop-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.shop-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 20px; padding: 12px; border-radius: var(--radius-small); background: var(--surface); border: 1px solid var(--border); }
.shop-filters .grow { flex: 1 1 220px; min-width: 0; }
.shop-filters select, .shop-filters input { width: auto; margin: 0; }
.shop-group { margin-bottom: 28px; }
.shop-group-title { display: inline-block; margin: 0 0 14px; padding: 8px 16px; border-radius: 10px; background: var(--structure); color: var(--structure-text); font-size: 1.0625rem; }
.shop-grid { display: grid; gap: 16px; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
.shop-cols-1 { --cols: 1; }
.shop-cols-2 { --cols: 2; }
.shop-cols-3 { --cols: 3; }
.shop-cols-4 { --cols: 4; }
@media (max-width: 1100px) { .shop-cols-4 { --cols: 3; } }
@media (max-width: 860px) { .shop-grid { --cols: 2; } }
@media (max-width: 560px) { .shop-grid { --cols: 1; } }
.shop-card { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius-small); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s; }
.shop-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.shop-mode-list .shop-card { flex-direction: row; }
.shop-mode-list .shop-thumb { flex: 0 0 min(260px, 38%); aspect-ratio: auto; }
@media (max-width: 560px) { .shop-mode-list .shop-card { flex-direction: column; } .shop-mode-list .shop-thumb { flex-basis: auto; aspect-ratio: 16 / 9; } }
.shop-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; color: var(--muted); }
.shop-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop-thumb-empty { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 22%, var(--surface)), var(--surface-2)); }
.shop-thumb-empty .icon { width: 40px; height: 40px; }
.shop-badge { position: absolute; top: 10px; left: 10px; padding: 3px 10px; border-radius: 999px; background: var(--brand); color: var(--brand-text); font-size: 0.75rem; font-weight: 800; }
.shop-badge-inline { position: static; display: inline-block; }
.shop-card-body { display: flex; flex-direction: column; gap: 6px; flex: 1; padding: 14px 16px 16px; text-align: var(--shop-align); }
.shop-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; justify-content: var(--shop-align); }
.shop-cat { font-size: 0.75rem; font-weight: 700; color: var(--link, var(--brand)); }
.shop-card-title { margin: 0; font-size: var(--shop-title); line-height: 1.3; }
.shop-card-title a { color: var(--text); text-decoration: none; }
.shop-card-title a:hover { text-decoration: underline; }
.shop-card-summary { margin: 0; color: var(--muted); font-size: 0.9375rem; }
.shop-highlights { margin: 0; padding-left: 18px; font-size: 0.875rem; }
.shop-facts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; color: var(--muted); font-size: 0.8125rem; justify-content: var(--shop-align); }
.shop-facts .icon { width: 14px; height: 14px; vertical-align: -2px; }
.shop-author { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 0.875rem; font-weight: 600; }
.shop-rating { margin: 0; font-size: 0.8125rem; color: var(--muted); }
.shop-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.shop-price { margin: 0; font-size: 1.125rem; font-weight: 800; }
.shop-enroll { font-size: var(--shop-enrol); border-radius: var(--shop-radius); }
.shop-layout-modern .shop-card { border-radius: 18px; }
.shop-layout-modern .shop-card-body { padding: 18px; }
.shop-layout-overlay .shop-card { position: relative; background: var(--structure); color: var(--structure-text); }
.shop-layout-overlay .shop-card-title a, .shop-layout-overlay .shop-price { color: var(--structure-text); }
.shop-layout-overlay .shop-card-summary, .shop-layout-overlay .shop-facts, .shop-layout-overlay .shop-rating { color: var(--structure-muted); }
.shop-layout-overlay .shop-card-foot { border-top-color: var(--structure-2); }
.stars { display: inline-flex; gap: 1px; vertical-align: -2px; }
.stars .icon { width: 14px; height: 14px; fill: none; stroke: var(--edge); }
.stars .star-on { fill: #e0a100; stroke: #e0a100; }

/* A course's own page. */
.course-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.course-hero-media { display: grid; place-items: center; aspect-ratio: 16 / 9; max-height: 360px; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); color: var(--muted); }
.course-hero-media img { width: 100%; height: 100%; object-fit: cover; }
.course-hero-media .icon { width: 56px; height: 56px; }
.course-hero-facts { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; color: var(--muted); margin: 0; }
.course-page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .course-page-grid { grid-template-columns: minmax(0, 1fr); } }
.course-page-main > * + * { margin-top: 16px; }
.course-page-side { position: sticky; top: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.buy-price { margin: 0 0 12px; font-size: 1.75rem; font-weight: 800; }
.buy-box .btn-block { margin-top: 8px; }
.buy-facts { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.buy-facts li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.buy-facts .icon { width: 16px; height: 16px; }
.tick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tick-list li { display: flex; gap: 8px; align-items: flex-start; }
.tick-list .icon { flex: none; width: 18px; height: 18px; color: var(--ok); }
.curriculum { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; }
.curriculum summary { display: flex; justify-content: space-between; gap: 8px; padding: 12px 14px; cursor: pointer; }
.curriculum-list { list-style: none; margin: 0; padding: 0 14px 12px; }
.curriculum-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.curriculum-list li > span:nth-child(2) { flex: 1; }
.curriculum-list .icon { width: 16px; height: 16px; color: var(--muted); }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file-list li { display: flex; gap: 8px; align-items: center; }
.file-list .icon { width: 16px; height: 16px; }
.review { padding: 12px 0; border-bottom: 1px solid var(--border); }
.review p { margin: 6px 0 0; }
.review-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.review-form { margin-top: 16px; }
.rating-pick { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0 0 10px; }
.rating-pick legend { font-weight: 700; margin-bottom: 6px; }
.rating-pick label { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; }
.rating-pick label:has(input:checked) { border-color: var(--brand); background: var(--soft); }
.related { margin-top: 28px; }
.course-layout-modern .course-hero { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; padding: 24px; border-radius: var(--radius); background: var(--structure); color: var(--structure-text); }
.course-layout-modern .course-hero .lead, .course-layout-modern .course-hero-facts { color: var(--structure-muted); }
.course-layout-modern .course-hero-media { order: 2; }
.course-layout-minimal { max-width: 860px; margin: 0 auto; }
.course-layout-minimal .course-page-grid { grid-template-columns: 1fr; }
.course-layout-minimal .course-page-side { position: static; }
.course-layout-minimal .course-hero-media { max-height: 220px; }
.course-layout-immersive .course-hero { position: relative; min-height: 320px; border-radius: var(--radius); overflow: hidden; background: var(--structure); color: #fff; }
.course-layout-immersive .course-hero-media { position: absolute; inset: 0; max-height: none; aspect-ratio: auto; border-radius: 0; opacity: 0.45; }
.course-layout-immersive .course-hero-text { position: relative; align-self: end; padding: 28px; }
.course-layout-immersive .course-hero .lead, .course-layout-immersive .course-hero-facts { color: #e8e8ec; }
@media (max-width: 760px) { .course-layout-modern .course-hero { grid-template-columns: 1fr; } }
.inline-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; margin: 0; }

/* 1.3.0: the school page and profile cards: black title bars on white cards. */
.info-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin: 16px 0; }
.info-card { overflow: hidden; border-radius: var(--radius-small); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.info-card-title { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 16px; background: var(--structure); color: var(--structure-text); font-size: 1rem; }
.info-card-title .icon { width: 18px; height: 18px; }
.info-card > :not(.info-card-title) { margin: 14px 16px; }
.link-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.link-list a { display: block; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-weight: 600; text-decoration: none; }
.link-list a:hover { background: var(--soft); }
.bank-row { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.bank-row:last-child { border-bottom: 0; }
.bank-row dt { color: var(--muted); font-size: 0.875rem; }
.bank-row dd { margin: 0; font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.03em; }
.school-hero { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; padding: 24px; border-radius: var(--radius); background: var(--structure); color: var(--structure-text); }
.school-hero .lead, .school-hero .hint { color: var(--structure-muted); }
.school-hero-mark { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 20px; background: var(--brand); color: var(--brand-text); font-size: 1.5rem; font-weight: 800; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* 1.3.0: free past papers, grouped by year. */
.papers-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 24px; margin-bottom: 20px; border-radius: var(--radius); background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 18%, var(--surface)), var(--surface)); border: 1px solid var(--border); }
.papers-kicker { margin: 0 0 4px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ok); }
.paper-year { margin-bottom: 28px; }
.paper-year-title { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 1.25rem; }
.paper-year-num { padding: 4px 12px; border-radius: 10px; background: var(--structure); color: var(--structure-text); }
.paper-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.paper-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--radius-small); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.paper-card-head { display: flex; gap: 12px; align-items: flex-start; }
.paper-card-head .hint { margin: 2px 0 0; }
.paper-icon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--error-bg); color: var(--error); }
.paper-title { margin: 0; font-size: 1rem; }
.paper-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.paper-admin { display: flex; gap: 12px; font-size: 0.875rem; }
.course-pick { display: grid; gap: 4px 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); max-height: 360px; overflow: auto; padding: 4px; }
.picked-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.picked-list li { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 10px; font-weight: 600; }
.picked-list img, .picked-thumb { width: 56px; height: 36px; flex: none; object-fit: cover; border-radius: 6px; display: grid; place-items: center; background: var(--surface-2); }
.rich-text > :first-child { margin-top: 0; }
.module-tabs-top { margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.order-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.static-field { margin: 4px 0 12px; font-weight: 600; }
.block { display: block; }
.profile-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; padding: 24px; margin-bottom: 8px; border-radius: var(--radius); background: var(--structure); color: var(--structure-text); box-shadow: var(--shadow-lift); }
.profile-hero .page-title { color: var(--structure-text); margin: 0; }
.profile-id { display: flex; align-items: center; gap: 16px; min-width: 0; }
.profile-photo { width: 84px; height: 84px; flex: none; border-radius: 50%; object-fit: cover; border: 3px solid var(--brand); }
.profile-mono { display: grid; place-items: center; background: var(--brand); color: var(--brand-text); font-size: 1.75rem; font-weight: 800; }
.profile-kicker { margin: 0 0 2px; font-size: 0.8125rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--structure-muted); }
.profile-number, .profile-welcome { margin: 4px 0 0; color: var(--structure-muted); }
.profile-number strong { color: var(--structure-text); }
.profile-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-hero .btn:not(.btn-primary) { background: var(--structure-2); color: var(--structure-text); border-color: var(--structure-muted); }
.info-card + .info-card, .info-card + .info-cards, .info-cards + .info-card { margin-top: 16px; }
.info-card form, .info-card > p, .info-card > .actions { margin: 14px 16px; }

/* 1.3.0: a student's subscriptions and a payment's progress. */
.sub-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; margin-bottom: 24px; }
.sub-card { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.sub-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sub-card-head h3 { margin: 0; font-size: 1.0625rem; overflow-wrap: anywhere; }
.sub-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 0; }
.sub-facts div { background: var(--surface-2); border-radius: 12px; padding: 8px 10px; }
.sub-facts dt { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.sub-facts dd { margin: 2px 0 0; font-weight: 700; }
.sub-card .actions { margin: auto 0 0; }
.pay-steps { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 0; margin: 0 0 16px; counter-reset: step; }
.pay-steps li { counter-increment: step; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 0.875rem; overflow-wrap: anywhere; min-width: 0; }
.pay-steps li::before { content: counter(step); flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid currentColor; font-size: 0.75rem; }
.pay-steps li.is-done { color: var(--ok); background: var(--ok-bg); }
.pay-steps li.is-done::before { content: "✓"; background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
.pay-steps li.is-now { color: var(--soft-text); background: var(--soft); }
@media (max-width: 480px) { .pay-steps { grid-template-columns: 1fr; } }
.proof-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; overflow-wrap: anywhere; }

/* 1.4.0: a teacher's choice of student columns. */
.column-picker summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.column-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 6px 16px; margin: 12px 0; }
.student-table td, .student-table th { overflow-wrap: anywhere; }
.locked-content h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 1.4.0: checkout. */
.checkout-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 20px; align-items: start; }
@media (max-width: 900px) { .checkout-grid { grid-template-columns: minmax(0, 1fr); } }
.checkout-summary { position: sticky; top: 16px; }
@media (max-width: 900px) { .checkout-summary { position: static; } }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 0 16px; }
.form-grid .form-wide { grid-column: 1 / -1; }
.pay-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; margin: 8px 0 16px; }
.pay-tile { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 16px; margin: 0; border: 2px solid var(--border); border-radius: 16px; background: var(--surface); cursor: pointer; min-height: 88px; font-weight: 500; }
.pay-tile:hover { border-color: var(--edge); }
.pay-tile input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pay-tile:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.pay-tile.is-chosen, .pay-tile:has(input:checked) { border-color: var(--brand); background: var(--soft); }
.pay-tile-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); }
.pay-tile.is-chosen .pay-tile-icon, .pay-tile:has(input:checked) .pay-tile-icon { background: var(--brand); color: var(--brand-text); }
.pay-tile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.pay-panel, .pay-receipt { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.pay-panel h3, .pay-receipt h3 { margin: 0 0 8px; font-size: 1rem; }
.order-item { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.order-thumb { width: 72px; height: 54px; flex: none; border-radius: 10px; object-fit: cover; }
.order-thumb-empty { display: grid; place-items: center; background: var(--surface-2); }
.order-lines { margin: 0 0 12px; }
.order-lines div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.order-lines dd { margin: 0; text-align: right; }
.order-total { border-top: 1px solid var(--border); font-weight: 800; font-size: 1.125rem; }
/* 1.4.0: the one-time language and theme choice. */
.first-look-form { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; }
.first-look-themes { display: flex; flex-wrap: wrap; gap: 4px 16px; border: 0; padding: 0; margin: 0; }
.first-look-themes legend { font-weight: 600; margin-bottom: 4px; }
.is-focus .first-look { display: none; }

/* 1.4.0: the LMS's own video player. */
.lms-player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 16px; overflow: hidden; color: #fff; user-select: none; -webkit-user-select: none; }
.lms-player:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.lms-player-stage, .lms-player-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lms-player-cover { position: absolute; inset: 0 0 52px 0; cursor: pointer; background: transparent; }
.lms-player:not(.is-started) .lms-player-cover { inset: 0; background: linear-gradient(135deg, #111 0%, #1f2937 100%); }
.lms-player-big { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--brand); color: var(--brand-text); font-size: 1.75rem; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.lms-player.is-playing .lms-player-big, .lms-player.is-started .lms-player-big { display: none; }
.lms-player-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 10px; background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.lms-player:not(.is-started) .lms-player-bar { display: none; }
.lms-player-btn { background: transparent; border: 0; color: #fff; font-size: 1.05rem; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; flex: none; }
.lms-player-btn:hover, .lms-player-btn:focus-visible { background: rgba(255,255,255,.15); }
.lms-player-btn.is-off { opacity: .5; }
.lms-player-seek { flex: 1; min-width: 60px; accent-color: var(--brand); }
.lms-player-time { font-size: .8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lms-player-speed { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 8px; padding: 4px 6px; font-size: .8125rem; min-height: 0; width: auto; }
.lms-player-speed option { color: #000; }
.lms-player-mark { position: absolute; top: 12%; left: 8%; pointer-events: none; font-size: .8125rem; font-weight: 700; color: rgba(255,255,255,.28); text-shadow: 0 1px 2px rgba(0,0,0,.4); white-space: nowrap; animation: lms-mark 36s linear infinite; }
@keyframes lms-mark { 0% { top: 12%; left: 8%; } 25% { top: 70%; left: 60%; } 50% { top: 20%; left: 55%; } 75% { top: 65%; left: 10%; } 100% { top: 12%; left: 8%; } }
@media (prefers-reduced-motion: reduce) { .lms-player-mark { animation: none; } }
.lms-player-note { position: absolute; left: 12px; right: 12px; bottom: 60px; margin: 0; background: rgba(0,0,0,.7); padding: 8px 10px; border-radius: 8px; }
.lms-player:fullscreen { border-radius: 0; }
@media (max-width: 480px) { .lms-player-time { display: none; } }

/* 1.4.0: charts, grades and paper results */
.chart { margin: 8px 0 0; }
.chart-svg { width: 100%; height: auto; max-width: 100%; display: block; }
.chart-bars { width: auto; height: auto; max-width: none; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; }
.chart-average { stroke: var(--text); stroke-width: 2; opacity: 0.7; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8125rem; color: var(--muted); margin-top: 8px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.grade { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 8px; font-weight: 800; font-size: 0.8125rem; color: #fff; background: #6b7385; }
.grade-big { min-width: 52px; height: 52px; font-size: 1.5rem; border-radius: 14px; }
.grade-a { background: #157347; } .grade-b { background: #2f55d4; } .grade-c { background: #8a5a00; }
.grade-s { background: #b04a12; } .grade-f { background: #c0392b; }
.motivation { margin: 10px 0; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); font-weight: 600; }
.mark-input { width: 6.5em; }
.result-card .stat-row { margin: 8px 0; }

/* 1.4.0: the daily planner and master plans */
.hour-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 420px; overflow-y: auto; border-radius: 14px; border: 1px solid var(--border); }
.hour-row { display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.hour-row:last-child { border-bottom: 0; }
.hour-label { font-size: 0.8125rem; font-weight: 700; color: var(--muted); margin: 0; }
.hour-body { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.hour-body input { flex: 1 1 160px; min-width: 0; margin: 0; background: transparent; }
.hour-night { background: color-mix(in srgb, #5b6cc9 9%, transparent); }
.hour-morning { background: color-mix(in srgb, #f2b705 9%, transparent); }
.hour-afternoon { background: color-mix(in srgb, #2bb673 8%, transparent); }
.hour-evening { background: color-mix(in srgb, #e25c8a 8%, transparent); }
.hour-row.is-now { box-shadow: inset 4px 0 0 var(--brand); }
.hour-task { font-size: 0.8125rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.hour-task.is-done { text-decoration: line-through; opacity: 0.7; }
.plan-progress-body { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; }
.plan-bars { list-style: none; margin: 0; padding: 0; flex: 1 1 220px; display: grid; gap: 10px; }
.plan-bars li { display: grid; gap: 4px; }
.progress-ring .ring-track { stroke: var(--surface-2); }
.progress-ring .ring-fill { stroke: var(--brand); }
.progress-ring .ring-text { fill: var(--text); font-weight: 800; font-size: 22px; }
.plan-bar { width: 160px; }
.task-list { list-style: none; margin: 0; padding: 0; }
.task-row { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: 0; }
.task-main { display: grid; gap: 2px; min-width: 0; }
.task-book { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task-book select { width: auto; margin: 0; }
.task-row.is-done .task-main strong { text-decoration: line-through; opacity: 0.7; }
.tick { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--edge); background: transparent; color: var(--muted); font-weight: 800; cursor: pointer; }
.tick.is-on { background: #157347; border-color: #157347; color: #fff; }
@media (min-width: 760px) { .task-row { grid-template-columns: auto 1fr auto; } .task-book { grid-column: auto; } }

/* 1.5.0 (update 3.1): registration — verify first, then four gentle steps */
.reg-card { max-width: 460px; margin: 24px auto; padding: 28px 24px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 0 0 1px rgba(var(--brand-rgb), 0.06), 0 18px 50px rgba(var(--brand-rgb), 0.18); animation: reg-rise 0.5s ease both; }
.reg-title { text-align: center; font-size: 1.6rem; font-weight: 800; letter-spacing: 0.01em; margin: 0 0 6px; }
.reg-lead { text-align: center; color: var(--muted); margin: 0 0 16px; }
.reg-form { display: grid; gap: 14px; }
.reg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.reg-field { grid-column: 1 / -1; display: grid; gap: 6px; margin: 0; font-weight: 600; font-size: 0.9rem; }
.reg-field.reg-half { grid-column: span 1; }
.reg-field input:not([type=checkbox]):not([type=radio]), .reg-field select, .reg-field textarea { width: 100%; margin: 0; border-radius: 12px; min-height: 48px; font-size: 1rem;
  transition: box-shadow 0.2s ease, border-color 0.2s ease; }
.reg-field input:focus, .reg-field select:focus, .reg-field textarea:focus { box-shadow: 0 0 0 4px rgba(var(--brand-rgb), 0.18); }
.reg-field.has-error input, .reg-field.has-error select, .reg-field.has-error textarea { border-color: #c0392b; }
.reg-check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.reg-code { text-align: center; font-size: 1.6rem !important; letter-spacing: 0.4em; font-variant-numeric: tabular-nums; }
.reg-button { min-height: 50px; border: 0; border-radius: 14px; background: var(--brand); color: var(--brand-text); font-weight: 700; font-size: 1.05rem; cursor: pointer;
  box-shadow: 0 8px 22px rgba(var(--brand-rgb), 0.35); transition: transform 0.15s ease, box-shadow 0.2s ease; }
.reg-button:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(var(--brand-rgb), 0.45); }
.reg-button:active { transform: translateY(1px); }
.reg-back { background: var(--surface-2); color: var(--text); box-shadow: none; }
.reg-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.reg-nav .reg-button:only-child { grid-column: 1 / -1; }
.reg-link { background: none; border: 0; color: var(--link); cursor: pointer; font-weight: 600; padding: 6px; }
.reg-link:disabled { color: var(--muted); cursor: default; }
.reg-resend { text-align: center; }
.reg-foot { text-align: center; color: var(--muted); margin: 18px 0 0; }
.reg-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 14px; background: var(--surface-2); }
.reg-switch-option { margin: 0; }
.reg-switch-option input { position: absolute; opacity: 0; }
.reg-switch-option span { display: block; text-align: center; padding: 10px; border-radius: 10px; font-weight: 700; cursor: pointer; transition: background 0.2s ease; }
.reg-switch-option input:checked + span { background: var(--surface); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); }
.reg-switch-option input:focus-visible + span { outline: 2px solid var(--brand); }
.reg-steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 14px 0 18px; padding: 0; counter-reset: none; }
.reg-steps li { display: grid; justify-items: center; gap: 4px; font-size: 0.72rem; color: var(--muted); }
.reg-steps li span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); transition: background 0.3s ease, color 0.3s ease; }
.reg-steps li em { font-style: normal; text-align: center; }
.reg-steps li.is-current span { background: var(--brand); color: var(--brand-text); box-shadow: 0 0 0 5px rgba(var(--brand-rgb), 0.18); }
.reg-steps li.is-done span { background: #157347; color: #fff; }
.reg-step { border: 0; margin: 0; padding: 0; min-width: 0; }
.reg-step-title { font-size: 1.1rem; font-weight: 800; margin: 0 0 12px; padding: 0; }
.reg-in-right { animation: reg-in-right 0.35s ease both; }
.reg-in-left { animation: reg-in-left 0.35s ease both; }
.reg-timer { text-align: center; margin: 16px 0 0; font-size: 0.9rem; color: var(--muted); }
.reg-timer strong { font-variant-numeric: tabular-nums; color: var(--text); }
.reg-timer.is-low strong, .reg-timer.is-expired { color: #c0392b; }
@keyframes reg-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes reg-in-right { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes reg-in-left { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .reg-card, .reg-in-right, .reg-in-left { animation: none; } .reg-button { transition: none; } }
@media (max-width: 420px) { .reg-card { margin: 8px auto; padding: 22px 16px; border-radius: 18px; } .reg-grid { grid-template-columns: 1fr; } .reg-field.reg-half { grid-column: 1 / -1; } }

/* 1.5.0 (update 3.1): master-plan sheets */
.coverage-group th { background: var(--surface-2); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.past-grid td { text-align: center; }
.past-grid input { width: 22px; height: 22px; }
.week-grid select { min-width: 52px; margin: 0; padding: 4px; min-height: 34px; }
.week-grid td, .week-grid th { padding: 4px 6px; }
.activity-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.activity-code { display: inline-grid; place-items: center; min-width: 34px; padding: 2px 6px; border-radius: 8px; background: var(--soft); color: var(--soft-text); font-weight: 800; font-size: 0.8rem; }
.plan-sheets { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.plan-sheets li { display: grid; gap: 4px; }

/* 1.5.0 (update 3.1): the "?" help assistant and first steps */
.help-assistant { position: fixed; right: 16px; bottom: 16px; z-index: 60; }
.has-nav .help-assistant { bottom: 92px; }
@media (min-width: 900px) { .has-nav .help-assistant { bottom: 20px; } }
.help-fab { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--brand); color: var(--brand-text); font-size: 1.3rem; font-weight: 800;
  box-shadow: 0 8px 20px rgba(var(--brand-rgb), 0.35); cursor: pointer; opacity: 0.9; }
.help-fab:hover, .help-fab:focus-visible { opacity: 1; }
.help-panel { position: absolute; right: 0; bottom: 56px; width: min(92vw, 360px); max-height: 70vh; overflow-y: auto; padding: 14px 16px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25); animation: reg-rise 0.25s ease both; }
.help-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.help-head h2 { font-size: 1rem; margin: 0; }
.help-close { border: 0; background: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); }
.help-steps { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 10px; }
.help-steps li { display: grid; gap: 6px; }
.help-steps li .btn { justify-self: start; }
.help-video { margin: 12px 0 0; }
.help-video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.help-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.help-video figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.help-lit { outline: 3px solid var(--brand) !important; outline-offset: 4px; border-radius: 10px; transition: outline-color 0.3s ease; }
.help-pointer { position: absolute; font-size: 1.8rem; z-index: 70; transform: rotate(90deg); animation: help-hover 0.9s ease-in-out infinite alternate; pointer-events: none; }
@keyframes help-hover { from { translate: -4px 0; } to { translate: 4px 0; } }
@media (prefers-reduced-motion: reduce) { .help-pointer, .help-panel { animation: none; } }
.first-steps { display: grid; gap: 8px; list-style: none; padding: 0; margin: 8px 0 0; }
.first-steps li a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); text-decoration: none; color: var(--text); font-weight: 600; }
.first-steps .step-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--edge); font-size: 0.8rem; flex: none; }
.first-steps .is-done .step-dot { background: #157347; border-color: #157347; color: #fff; }
.first-steps .is-done a { color: var(--muted); text-decoration: line-through; }
.first-steps .is-next a { box-shadow: 0 0 0 2px var(--brand); }
.help-inline-pointer { margin-left: auto; animation: help-hover 0.9s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) { .help-inline-pointer { animation: none; } }

/* 1.5.0: AI pictures and suggested marks */
.picture-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.75rem; }
.picture-card { display: flex; flex-direction: column; gap: 0.4rem; text-decoration: none; color: inherit; }
.picture-card img, .ai-picture img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border); }
.ai-picture { margin: 0 0 1rem; max-width: 40rem; }
.ai-suggestion { margin: 0.5rem 0; }
.big-steps { font-size: 1.1rem; line-height: 1.7; padding-left: 1.4rem; }
.big-code { font-size: 1.4rem; letter-spacing: 0.08em; }
.team-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 0.5rem 0.9rem; margin-bottom: 1rem;
  border-radius: 12px; background: var(--warn-bg, #fff4d6); color: var(--text); font-weight: 600; }
.team-bar form { margin: 0 0 0 auto; }
.block-edit { border: 1px solid var(--border); border-radius: 14px; padding: 0.8rem 1rem; margin: 0 0 1rem; }
.block-edit legend { font-weight: 700; padding: 0 0.4rem; }
.site-strip { margin-bottom: 1rem; }
.big-check { font-size: 1.1rem; font-weight: 700; }
/* 1.5.0: a long name never widens the sidebar. */
.side-person { max-width: 100%; overflow: hidden; }
.side-person-name, .side-person-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-bar a { color: var(--text); }
