:root {
  --brand: #1d4ed8;      /* replaced at runtime by the school's own colour from the database */
  --accent: #facc15;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --bad: #b91c1c;
  --warn: #b45309;
  --good: #15803d;
  color-scheme: light;
}
/* Dark mode: follows the phone unless the person picked light; or picked dark (data-theme, see common.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0b1120; --card: #111827; --text: #f1f5f9; --muted: #94a3b8; --line: #1f2937; --bad: #f87171; --warn: #fbbf24; --good: #4ade80; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #0b1120; --card: #111827; --text: #f1f5f9; --muted: #94a3b8; --line: #1f2937; --bad: #f87171; --warn: #fbbf24; --good: #4ade80; color-scheme: dark; }

* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, sans-serif; background: var(--bg); color: var(--text); }
main { max-width: 960px; margin: 0 auto; padding: 16px; }
main.narrow { max-width: 460px; }
header.top { background: var(--brand); color: #fff; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 5; }
header.top a, header.top > span:first-child { color: #fff; text-decoration: none; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
h1 { font-size: 1.7rem; margin: .5em 0; }
h2 { font-size: 1.25rem; margin: 0 0 .5em; }
h3 { font-size: 1.05rem; margin: 1.2em 0 .3em; }
section { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 16px 0; }
a { color: var(--brand); }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.scroll-x { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.scroll-x > * { flex-shrink: 0; }
button, .btn {
  display: inline-block; font: inherit; font-weight: 600; padding: 12px 16px; min-height: 44px;
  border-radius: 10px; border: 2px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; text-decoration: none;
}
button.secondary, .btn.secondary { background: transparent; color: var(--text); border-color: var(--line); }
button.secondary.active { border-color: var(--brand); color: var(--brand); }
button.small { padding: 6px 12px; min-height: 36px; }
button.icon { background: transparent; border: none; color: inherit; padding: 6px 10px; min-height: 40px; font-size: 1.1rem; position: relative; }
button.link { background: none; border: none; color: var(--brand); padding: 8px 0; text-decoration: underline; font-weight: 500; }
.big { font-size: 1.15rem; padding: 16px 28px; }
.wide { width: 100%; }
button:disabled { opacity: .6; cursor: default; }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
label { display: block; margin: 12px 0 4px; font-weight: 600; }
input, select, textarea { width: 100%; font: inherit; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
input[type="checkbox"], input[type="radio"] { width: auto; }
form { max-width: 520px; }
.msg { min-height: 1.5em; margin: 8px 0; }
.msg.bad { color: var(--bad); }
.msg.good { color: var(--good); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.big-code { font-size: 2.4rem; font-weight: 800; letter-spacing: .2em; }
.hidden { display: none !important; }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); max-width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / .5); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
td, th { text-align: left; padding: 6px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
.strength { font-weight: 700; }
ol li { margin: 6px 0; }
code { overflow-wrap: anywhere; }

/* Search bar on top (PRD 2.8). */
.search { display: flex; gap: 8px; max-width: none; margin-bottom: 8px; }
.search input { flex: 1; min-width: 0; }

/* Lists, tags, numbers. */
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.list li p { margin: 4px 0 0; }
.list li.unread { font-weight: 600; }
.tag { display: inline-block; font-size: .8rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.tag.present, .tag.merit { color: var(--good); }
.tag.late { color: var(--warn); }
.tag.absent, .tag.discipline { color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.stat strong { display: block; font-size: 1.6rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.good strong { color: var(--good); }
.stat.warn strong { color: var(--warn); }
.stat.bad strong { color: var(--bad); }
.badge { position: absolute; top: 2px; right: 0; background: var(--bad); color: #fff; border-radius: 999px; font-size: .7rem; padding: 0 5px; }
.switch { display: flex; gap: 8px; align-items: center; font-weight: 600; }

/* Register: one row per learner, three big buttons (P/L/A). */
.register { max-width: none; }
.reg-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.seg { display: flex; gap: 4px; flex-shrink: 0; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; }
.seg label { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; position: relative; }
.seg label:has(input:checked) { background: var(--brand); border-color: var(--brand); color: #fff; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--accent); }

/* Landing (PRD 1.2): the school's video fills the screen; Sign In sits on top of it. */
.hero-page { background: var(--brand); min-height: 100vh; min-height: 100dvh; overflow: hidden; }
.hero-media { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-shade { position: fixed; inset: 0; background: linear-gradient(to bottom, rgb(0 0 0 / .15), rgb(0 0 0 / .6)); }
.hero { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #fff; gap: 12px; padding: 24px 16px; }
.hero h1 { font-size: clamp(1.6rem, 6vw, 2.6rem); text-shadow: 0 2px 8px rgb(0 0 0 / .5); max-width: 18em; }
.hero p { text-shadow: 0 1px 4px rgb(0 0 0 / .6); margin: 0; }
.hero .btn.big { min-width: 220px; box-shadow: 0 6px 20px rgb(0 0 0 / .35); border-color: #fff; }
.hero-link { color: #fff; }
.logo { width: 96px; height: 96px; object-fit: contain; border-radius: 16px; background: rgb(255 255 255 / .9); padding: 8px; }
.theme-btn { position: fixed; top: 12px; right: 12px; z-index: 2; background: rgb(0 0 0 / .35); border: none; min-height: 40px; padding: 6px 12px; }

@media (max-width: 480px) {
  h1 { font-size: 1.4rem; }
  section { padding: 12px; }
}
