/* WE Exam — one stylesheet for every page, on the Wecasoft design system ("clean look").
 * Tokens are Wecasoft's (frontend/packages/config/tailwind.preset.css): no raw colours below :root.
 *
 * The five rules of the clean look, as they apply here:
 *  1. Red is a signal, never a style: only what is wrong, and the ONE primary button of a screen.
 *  2. Words carry state; colour never does alone (every chip has its word, warnings have ⚠).
 *  3. Chrome on grey (--bg), the data on white sheets (--surface) with hairlines.
 *  4. Sentence case, hairlines, weights one step lighter; radius 0.
 *  5. Secondary actions are filled grey; a form opens on demand.
 *
 * Class reference (used by the page scripts):
 *  body.staff | body.exam | body.student     page kinds (staff is wide; the other two are one column)
 *  .topbar .brand .nav .who                  the grey bar on top
 *  .page  .page-head (h1 + .actions)  .sub   a page and its title row; .sub = the grey line under a title
 *  .sheet (.pad)                             a white surface for data
 *  table.data (th, td, tr.sel, td.n)         a table on a sheet; td.n = number, right-aligned
 *  button | .primary | .ghost | .link | .small | .wide
 *  .field (label, input|select|textarea, .hint, .err)
 *  .chip | .chip.ok | .chip.warn | .chip.bad      a word with its tone
 *  .stats (.stat > b + span)                 the numbers on top of a board
 *  .notice | .notice.warn | .notice.done     a full-width band that says one thing
 *  .tabs (button[aria-selected])             a segmented control
 *  .grid2 (main + aside.rail)                two columns from 960 px
 *  .rail-block (h3 + content)                a block of the right-hand column
 *  .bar (> i[style=width])                   a thin progress bar (graphic only)
 *  .muted .small .flag .n .nowrap .hide .sr  text helpers
 *  dialog.dlg                                a dialog; .toast = the status line at the bottom
 *  kbd                                       a key hint
 */
@font-face { font-family: "Archivo Variable"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/assets/fonts/archivo-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Archivo Variable"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/assets/fonts/archivo-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  --bg: #f3f2f2; --surface: #ffffff; --surface-muted: #eae9e9;
  --foreground: #201e1d; --muted-foreground: #605d5d;
  --primary: #ae1800; --primary-foreground: #ffffff; --primary-hover: #8c1300; --accent-bar: #ec3013;
  --border: #d7d3d3; --border-strong: #8a8585; --ring: #ae1800;
  --danger: #a3171c; --danger-surface: #fbeaea; --success: #15663f; --success-surface: #e7f2ec;
  --warning: #7a4a00; --warning-surface: #fbf1e2;
  --font: "Archivo Variable", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --shadow: 0 12px 32px -8px rgba(32, 30, 29, .28);
  --text: .9375rem; --meta: .8125rem; --target: 2.5rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171514; --surface: #201e1d; --surface-muted: #2a2726;
    --foreground: #f1eeed; --muted-foreground: #aaa4a2;
    --primary: #ff9783; --primary-foreground: #201e1d; --primary-hover: #ffb3a4; --accent-bar: #ff6a52;
    --border: #413d3b; --border-strong: #766f6d; --ring: #ff9783;
    --danger: #f08c7d; --danger-surface: #2e1a18; --success: #6fcb9f; --success-surface: #16291f;
    --warning: #e3ac63; --warning-surface: #2b2216;
    --shadow: 0 12px 32px -8px rgba(0, 0, 0, .7);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--foreground); font: 400 var(--text)/1.45 var(--font); }
body.exam, body.student { --text: 1.125rem; --meta: .9375rem; --target: 3rem; }
h1, h2, h3, p { margin: 0 0 .75rem; }
h1 { font-size: 1.75rem; line-height: 1.1; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; line-height: 1.25; font-weight: 600; }
h3 { font-size: var(--text); font-weight: 600; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
ul { margin: 0 0 .75rem; padding-left: 1.25rem; } li { margin-bottom: .375rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
.muted { color: var(--muted-foreground); } .small { font-size: var(--meta); } .flag { color: var(--danger); font-weight: 600; }
.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; } .nowrap { white-space: nowrap; } .hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .9em; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- controls */
button, .btn { font: 500 var(--text)/1.2 var(--font); min-height: var(--target); padding: .5rem .875rem; border: 1px solid transparent; border-radius: 0;
  background: var(--surface-muted); color: var(--foreground); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
button:hover, .btn:hover { background: var(--border); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--primary); color: var(--primary-foreground); font-weight: 600; }
button.primary:hover, .btn.primary:hover { background: var(--primary-hover); }
button.ghost { background: transparent; } button.ghost:hover { background: var(--surface-muted); }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--primary); text-decoration: underline; font-weight: 500; }
button.small, .btn.small { min-height: 2rem; padding: .25rem .625rem; font-size: var(--meta); }
button.wide { width: 100%; }
input, select, textarea { font: 400 var(--text)/1.3 var(--font); color: var(--foreground); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 0;
  min-height: var(--target); padding: .5rem .625rem; width: 100%; }
textarea { min-height: 6rem; resize: vertical; line-height: 1.45; }
input[type=checkbox], input[type=radio] { width: 1.5rem; height: 1.5rem; min-height: 0; accent-color: var(--primary); flex: none; }
input[type=number] { text-align: right; }
.field { display: block; margin-bottom: .875rem; } .field > label, .field > span.label { display: block; font-weight: 600; margin-bottom: .25rem; }
.field .hint { color: var(--muted-foreground); font-size: var(--meta); margin-top: .25rem; } .field .err, .err { color: var(--danger); font-size: var(--meta); font-weight: 600; margin-top: .25rem; }
.check { display: flex; gap: .625rem; align-items: flex-start; margin-bottom: .75rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; } .row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.row > .grow { flex: 1 1 12rem; }
kbd { font: 600 .75rem var(--mono); border: 1px solid var(--border-strong); padding: .0625rem .3125rem; background: var(--surface); }

/* ---- chrome */
.topbar { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; flex-wrap: wrap; }
.brand { font-weight: 800; letter-spacing: -.01em; white-space: nowrap; } .brand i { font-style: normal; color: var(--primary); }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--foreground); text-decoration: none; padding: .5rem .75rem; font-weight: 500; }
.nav a:hover { background: var(--surface-muted); } .nav a[aria-current=page] { background: var(--surface); font-weight: 600; box-shadow: inset 0 -2px 0 var(--foreground); }
.who { color: var(--muted-foreground); font-size: var(--meta); display: flex; align-items: center; gap: .5rem; }
.page { max-width: 90rem; margin: 0 auto; padding: .5rem 1rem 4rem; }
body.exam .page, body.student .page, .page.narrow { max-width: 42rem; }
.page-head { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: flex-end; justify-content: space-between; padding: .75rem 0 1rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.page-head h1 { margin: 0; } .page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.sub { color: var(--muted-foreground); margin: .25rem 0 0; }
.crumb { font-size: var(--meta); color: var(--muted-foreground); margin-bottom: .25rem; } .crumb a { color: inherit; }
@media (min-width: 60rem) { .page { padding: .5rem 2.5rem 4rem; } .topbar { padding: .75rem 2.5rem; } }

/* ---- data */
.sheet { background: var(--surface); border: 1px solid var(--border); margin-bottom: 1rem; } .sheet.pad { padding: 1rem; }
.sheet > h2, .sheet > h3 { padding: .875rem 1rem 0; } .sheet.pad > h2, .sheet.pad > h3 { padding: 0; }
.scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: var(--meta); font-weight: 600; color: var(--muted-foreground); padding: .75rem; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: bottom; }
table.data td { padding: .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.click { cursor: pointer; } table.data tbody tr.click:hover { background: var(--bg); } table.data tr.sel { background: var(--surface-muted); }
table.data th.n, table.data td.n { text-align: right; }
table.data td button.link { font-weight: 600; text-align: left; }
.chip { display: inline-flex; align-items: center; gap: .25rem; padding: .125rem .5rem; font-size: var(--meta); font-weight: 500; background: var(--surface-muted); color: var(--muted-foreground); white-space: nowrap; }
.chip.ok { background: var(--success-surface); color: var(--success); } .chip.warn { background: var(--warning-surface); color: var(--warning); } .chip.bad { background: var(--danger-surface); color: var(--danger); }
.chip.solid { background: var(--foreground); color: var(--surface); }
.stats { display: flex; flex-wrap: wrap; gap: .5rem 2rem; margin-bottom: 1rem; }
.stat b { display: block; font-size: 1.25rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; } .stat span { font-size: var(--meta); color: var(--muted-foreground); }
.stat.warn b, .stat.warn span { color: var(--danger); }
.notice { background: var(--surface-muted); padding: .75rem 1rem; margin-bottom: 1rem; } .notice b { display: block; }
.notice.warn b { color: var(--danger); } .notice.done b { color: var(--success); } .notice button, .notice .btn { background: var(--surface); margin-top: .5rem; }
.tabs { display: inline-flex; background: var(--surface-muted); padding: .1875rem; gap: .125rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs button { background: transparent; min-height: 2.125rem; padding: .25rem .875rem; color: var(--muted-foreground); }
.tabs button[aria-selected=true] { background: var(--surface); color: var(--foreground); font-weight: 600; box-shadow: 0 1px 2px rgba(32, 30, 29, .18); }
.grid2 { display: grid; gap: 1rem 1.875rem; } @media (min-width: 60rem) { .grid2 { grid-template-columns: minmax(0, 1fr) 25rem; align-items: start; } }
.rail-block { margin-bottom: 1.25rem; } .rail-block h3 { margin-bottom: .375rem; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0; } dl.facts dt { color: var(--muted-foreground); white-space: nowrap; } dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.bar { height: .5rem; background: var(--surface-muted); min-width: 4rem; } .bar > i { display: block; height: 100%; background: var(--foreground); } /* never red: a low score is not an error */
.list { list-style: none; padding: 0; margin: 0; } .list > li { padding: .625rem 0; border-bottom: 1px solid var(--border); margin: 0; } .list > li:last-child { border-bottom: 0; }
details > summary { cursor: pointer; font-weight: 600; padding: .5rem 0; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted-foreground); }

/* ---- dialogs and status */
dialog.dlg { border: 0; padding: 1.25rem; width: min(34rem, calc(100vw - 2rem)); background: var(--surface); color: var(--foreground); box-shadow: var(--shadow); }
dialog.dlg.wide { width: min(56rem, calc(100vw - 2rem)); } dialog.dlg::backdrop { background: rgba(32, 30, 29, .45); }
dialog.dlg h2 { margin-bottom: .75rem; } dialog.dlg .row.end { margin-top: 1rem; }
.toast { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); background: var(--foreground); color: var(--surface); padding: .625rem 1rem; display: flex; gap: 1rem; align-items: center;
  max-width: calc(100vw - 2rem); box-shadow: var(--shadow); z-index: 30; } .toast button { background: transparent; color: inherit; text-decoration: underline; min-height: 0; padding: 0; }
.banner { position: sticky; top: 0; z-index: 20; background: var(--warning-surface); color: var(--warning); padding: .625rem 1rem; font-weight: 600; text-align: center; }

/* ---- review: one candidate, three equal buttons */
.decide { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--border); padding: .75rem 0; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; z-index: 5; }
.decide button { flex: 1 1 8rem; min-height: 3rem; font-weight: 600; border: 1px solid var(--border-strong); background: var(--surface); } .decide button:hover { background: var(--surface-muted); }
.reasons { display: grid; gap: .375rem; } .reasons button { justify-content: flex-start; text-align: left; } .reasons button[aria-pressed=true] { background: var(--foreground); color: var(--surface); }
.parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem 1.5rem; } .parts .part b { font-size: 1.125rem; font-weight: 600; }
.qa { padding: .75rem 0; border-bottom: 1px solid var(--border); } .qa:last-child { border-bottom: 0; } .qa .q { font-weight: 600; margin-bottom: .25rem; }
.qa ul { list-style: none; padding: 0; margin: .25rem 0; } .qa li.key::after { content: "  ✓ key"; color: var(--success); font-weight: 600; } .qa li.chosen { font-weight: 600; } .qa li.chosen::before { content: "→ "; }

/* ---- taking a test */
#bar { position: sticky; top: 0; z-index: 10; background: var(--foreground); color: var(--surface); padding: .625rem 1rem; display: flex; justify-content: space-between; gap: 1rem; font-weight: 600; }
#sect { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#time { font-variant-numeric: tabular-nums; flex: none; } #time.low { color: var(--accent-bar); }
#save { font-weight: 400; font-size: var(--meta); opacity: .85; }
.card { background: var(--surface); border: 1px solid var(--border); padding: 1.125rem; margin-bottom: 1rem; }
.opts { display: grid; gap: .5rem; margin-top: .75rem; }
.opt { justify-content: flex-start; text-align: left; background: var(--surface); border: 1px solid var(--border-strong); padding: .75rem .875rem; line-height: 1.35; min-height: 3rem; font-weight: 400; }
.opt:hover { background: var(--bg); } .opt.sel { background: var(--foreground); color: var(--surface); border-color: var(--foreground); font-weight: 600; }
.nav2 { display: flex; gap: .5rem; justify-content: space-between; margin-bottom: .75rem; } .nav2 button { flex: 1; }
.dots { display: flex; flex-wrap: wrap; gap: .375rem; margin-bottom: .75rem; }
.dot { min-height: 2.5rem; min-width: 2.5rem; padding: 0; background: var(--surface); border: 1px solid var(--border-strong); font-size: var(--meta); }
.dot.done { background: var(--surface-muted); border-color: var(--surface-muted); box-shadow: inset 0 -3px 0 var(--foreground); } /* answered: a bar under the number, not colour alone */ .dot.cur { outline: 2px solid var(--foreground); outline-offset: 1px; font-weight: 700; }
.dots .teil { flex-basis: 100%; font-size: var(--meta); color: var(--muted-foreground); margin-top: .25rem; }
.words { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.word { background: var(--surface); border: 1px solid var(--border); padding: .75rem; } .word b { display: block; font-size: 1.25rem; }
table.lang { border-collapse: collapse; width: 100%; } table.lang td { padding: .375rem .5rem; border-bottom: 1px solid var(--border); } table.lang td:first-child { font-weight: 600; }
.passage { background: var(--surface); border: 1px solid var(--border); padding: .875rem; margin-bottom: .75rem; white-space: pre-wrap; }
.passage h3 { margin-bottom: .5rem; }
.gaptext { line-height: 2.4; white-space: pre-wrap; } .gaptext input, .gaptext select { display: inline-block; width: auto; min-width: 7rem; max-width: 100%; margin: 0 .125rem; }
.gaptext input { width: 9rem; }
.umlauts { display: flex; flex-wrap: wrap; gap: .375rem; margin: .5rem 0; } .umlauts button { flex: 1 1 0; min-width: 2.25rem; padding: 0; min-height: 3rem; font-size: 1.125rem; font-weight: 600; background: var(--surface); border: 1px solid var(--border-strong); }
.match { display: grid; gap: .625rem; } .match .pair { display: grid; gap: .25rem; }
.total { font-size: 2.125rem; font-weight: 800; line-height: 1.05; margin-bottom: .5rem; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; max-width: 18rem; margin: 0 auto; } .pinpad button { min-height: 3.5rem; font-size: 1.375rem; background: var(--surface); border: 1px solid var(--border-strong); }
.pin-dots { text-align: center; font-size: 1.75rem; letter-spacing: .5rem; min-height: 2.5rem; }
.names { display: grid; gap: .5rem; margin-bottom: 1rem; } .pinpad, .pin-dots { margin-bottom: 1rem; } .err:empty { margin: 0; }
details.passage > summary { padding: 0; } .names button { justify-content: flex-start; background: var(--surface); border: 1px solid var(--border-strong); min-height: 3rem; }
.todo { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ---- marking */
.mark { display: grid; gap: 1rem; } @media (min-width: 60rem) { .mark { grid-template-columns: minmax(0, 1fr) 24rem; align-items: start; } }
.answer-text { background: var(--surface); border: 1px solid var(--border); padding: 1rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.0625rem; line-height: 1.6; }
.crit { padding: .5rem; border: 1px solid transparent; } .crit.cur { border-color: var(--foreground); background: var(--surface); }
.crit .pts { display: flex; gap: .25rem; margin: .25rem 0; } .crit .pts button { min-width: 2.5rem; background: var(--surface); border: 1px solid var(--border-strong); }
.crit .pts button[aria-pressed=true] { background: var(--foreground); color: var(--surface); border-color: var(--foreground); }

/* ---- sign-in cards for printing */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .75rem; }
.idcard { background: #fff; color: #201e1d; border: 1px solid #8a8585; padding: .875rem; display: grid; grid-template-columns: 1fr auto; gap: .5rem .75rem; break-inside: avoid; }
.idcard h3 { margin: 0; font-size: 1.125rem; } .idcard img { width: 7.5rem; height: 7.5rem; } .idcard .pin { font: 700 1.375rem var(--mono); letter-spacing: .12em; }
@media print {
  body { background: #fff; } .topbar, .page-head .actions, .no-print, .toast, .decide { display: none !important; }
  .page { padding: 0; max-width: none; } .sheet { border: 0; } .cards { grid-template-columns: repeat(2, 1fr); }
}
/* the honeypot field of the registration form: off screen, never display:none (bots skip those) */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
/* controls in a row keep their own width; the one marked .grow takes the rest */
.row > select, .row > input, .row > .field { width: auto; flex: 0 1 auto; } .row > input.grow, .row > .grow { flex: 1 1 14rem; }
.page-head .actions > select { width: auto; }
table.data td input[type=text] { min-width: 12rem; } table.data td input[type=number] { width: 5.5rem; }
