/* ===========================================================================
   PHA Baseline Capture

   The resolved theme is written to <html data-theme> by an inline script in
   the page head, before first paint. --ok / --low are the workbook's green and
   red: at or above the pass mark, and below it. The brand blue, navy and gold
   are taken from the school crest.
   =========================================================================== */

:root {
  color-scheme: light;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eff2f6;
  --border: #e0e5ec;
  --border-strong: #cbd3de;

  --text: #0f1724;
  --text-2: #465366;
  --text-3: #627084;

  --brand: #1a5f9e;
  --brand-strong: #144a7c;
  --brand-fg: #ffffff;
  --brand-soft: #e7eff8;
  --brand-ring: rgba(26, 95, 158, .3);

  --ok: #11663f;   --ok-bg: #e3f4ea;  --ok-line: #b6dec8;
  --bad: #a3201f;  --bad-bg: #fcebea; --bad-line: #efcbca;
  --warn: #85540a; --warn-bg: #fdf3e0; --warn-line: #eedcb4;

  --r-sm: 7px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  --sh-sm: 0 1px 2px rgba(15, 23, 36, .05);
  --sh: 0 1px 2px rgba(15, 23, 36, .05), 0 2px 8px rgba(15, 23, 36, .05);

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0b0e14;
  --surface: #141922;
  --surface-2: #1a202b;
  --border: #252d3a;
  --border-strong: #343f50;

  --text: #e7ebf2;
  --text-2: #a6b0c0;
  --text-3: #8a95a6;

  --brand: #6aaee8;
  --brand-strong: #94c6f0;
  --brand-fg: #06121f;
  --brand-soft: #13263d;
  --brand-ring: rgba(106, 174, 232, .34);

  --ok: #62d39f;   --ok-bg: #0f2c1d;  --ok-line: #1e5239;
  --bad: #f4918a;  --bad-bg: #311a1a; --bad-line: #5b2f2f;
  --warn: #e3b263; --warn-bg: #2f2410; --warn-line: #57431f;

  --sh-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --sh: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 400 15px/1.55 var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { letter-spacing: -.011em; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px;
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 13px; }
.spacer { margin-left: auto; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 22px; width: 100%; }
.wrap.wide { max-width: 1440px; }
.wrap.narrow { max-width: 640px; }
main { flex: 1 0 auto; padding: 26px 0 52px; }

/* ------------------------------------------------------------------- bar -- */

.bar {
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px; min-height: 56px; flex: none;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 680; color: var(--text); flex: none; }
.brand:hover { text-decoration: none; }
.brand-crest { display: block; width: 28px; height: auto; flex: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px;
  border-radius: 8px; background: var(--brand); color: var(--brand-fg);
}
.bar nav { display: flex; gap: 4px; margin-right: auto; overflow-x: auto; }
.bar nav a {
  color: var(--text-2); font-size: 14px; font-weight: 520; white-space: nowrap;
  padding: 6px 10px; border-radius: var(--r-sm);
}
.bar nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.bar nav a.on { color: var(--brand); background: var(--brand-soft); }
.bar .who { font-size: 13.5px; color: var(--text-2); white-space: nowrap; }
.inline { display: inline-flex; align-items: center; margin: 0; }

/* ----------------------------------------------------------------- forms -- */

label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }

input[type=text]:not(.item-val), input[type=email], input[type=password], input[type=search], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 15px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  transition: border-color .12s, box-shadow .12s;
}
select { width: auto; min-width: 120px; }
textarea { font-family: var(--mono); font-size: 13px; resize: vertical; }
input:not(.item-val):focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: .8; }

.field { margin-bottom: 16px; }
.field.grow { flex: 1; min-width: 220px; margin-bottom: 0; }
.hint { color: var(--text-3); font-size: 13px; margin: 6px 0 0; line-height: 1.5; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; color: var(--text-2); font-size: 14px; margin: 0 0 14px; }
.check input { margin-top: 3px; accent-color: var(--brand); }
.inline-form { display: flex; gap: 10px; align-items: flex-end; }
.inline-form .field { margin: 0; max-width: 140px; }
.search-inline input { width: 260px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: var(--brand); color: var(--brand-fg);
  font: inherit; font-size: 14.5px; font-weight: 640; line-height: 1.2;
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--brand-strong); color: var(--brand-fg); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--surface); color: var(--bad); border-color: var(--bad-line); }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }

.link-btn {
  background: none; border: 0; color: var(--brand); cursor: pointer;
  font: inherit; font-size: 14px; padding: 4px 2px;
}
.link-btn.danger { color: var(--bad); }
.icon-btn {
  flex: none; display: inline-grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover:not(:disabled) { color: var(--brand); border-color: var(--brand); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn svg { display: block; grid-area: 1 / 1; }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

kbd {
  font-family: var(--mono); font-size: 11.5px; padding: 1px 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px;
  background: var(--surface); color: var(--text-2);
}

/* -------------------------------------------------------------- surfaces -- */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px 22px; box-shadow: var(--sh-sm);
  margin-bottom: 18px;
}
.card.flush { padding: 0; overflow: hidden; }
.card h2 { margin: 0 0 4px; font-size: 16px; font-weight: 650; }
.card .h1ish { font-size: 21px; }
.narrow-card { max-width: 620px; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; margin-top: 8px; }
.section-title { font-size: 17px; margin: 20px 0 12px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.plain { padding-left: 18px; margin: 8px 0; }
.problems { margin: 6px 0 0; padding-left: 18px; }

.auth {
  max-width: 420px; margin: 52px auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 30px 28px; box-shadow: var(--sh);
}
.auth h1 { font-size: 22px; margin: 0 0 6px; font-weight: 680; }
.auth .sub { color: var(--text-3); margin: 0 0 22px; font-size: 14px; }

.page-head { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 10px 12px; margin-bottom: 18px; }
.page-head.tight { margin-bottom: 12px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 680; }
.page-head .sub { margin: 4px 0 0; color: var(--text-3); font-size: 14px; }

.flash, .notice {
  padding: 11px 14px; border-radius: var(--r); font-size: 14px;
  margin: 0 0 16px; border: 1px solid; line-height: 1.5;
}
.wrap > .flash { margin-top: 16px; }
.flash-ok, .notice-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.flash-error, .notice-bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad); }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.temp-pw {
  display: inline-block; margin: 6px 0; padding: 4px 10px; font-family: var(--mono); font-size: 16px;
  background: var(--surface); color: var(--text); border: 1px solid var(--ok-line); border-radius: 6px; letter-spacing: .04em;
}

.empty { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty-title { font-size: 16px; margin: 0 0 6px; color: var(--text-2); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.chip {
  padding: 5px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 560;
  border: 1px solid var(--border-strong); color: var(--text-2); background: var(--surface);
}
.chip:hover { text-decoration: none; border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }

.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border);
}
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.pill.low { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.legend { display: flex; gap: 8px; margin: -4px 0 12px; }

/* ---------------------------------------------------------------- tables -- */

.table-scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th, .grid td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.grid thead th { font-size: 12px; font-weight: 650; color: var(--text-3); background: var(--surface-2); text-transform: none; }
.grid tbody tr:last-child td, .grid tbody tr:last-child th { border-bottom: 0; }
.grid tbody tr:hover { background: var(--surface-2); }
.grid tfoot th, .grid tfoot td { border-top: 2px solid var(--border-strong); border-bottom: 0; background: var(--surface-2); }
.grid .actions { text-align: right; }
.grid .actions > * { margin-left: 10px; }
.grid .name-col { white-space: nowrap; }
.grid .school { white-space: normal; min-width: 160px; font-size: 13px; color: var(--text-2); }
.grid tr.is-left td { color: var(--text-3); }
.sub-no { display: block; font-size: 11.5px; color: var(--text-3); font-family: var(--mono); }

.progress th[scope=row] { font-weight: 600; }
.prog { display: flex; align-items: center; gap: 10px; color: var(--text-2); min-width: 150px; }
.prog:hover { text-decoration: none; color: var(--brand); }
.prog-bar { flex: 1; height: 7px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.prog-bar span { display: block; height: 100%; background: var(--brand); }
.prog.is-done .prog-bar span { background: var(--ok); }
.prog-text { font-size: 13px; font-variant-numeric: tabular-nums; min-width: 52px; }

/* The reports: one coloured cell per category, as in the workbook. */
.report th, .report td { padding: 7px 10px; }
.report .group th { background: var(--surface); border-bottom: 0; padding-bottom: 2px; }
.report .grp { text-align: center; color: var(--text-2); border-left: 2px solid var(--border-strong); }
.report .cat-h { white-space: normal; min-width: 72px; max-width: 120px; vertical-align: bottom; line-height: 1.3; }
.report .first { border-left: 2px solid var(--border-strong); }
.report td.v { text-align: center; font-variant-numeric: tabular-nums; }
td.v.ok { background: var(--ok-bg); color: var(--ok); }
td.v.low { background: var(--bad-bg); color: var(--bad); }

.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.report-cards .card { margin: 0; display: flex; flex-direction: column; }
.report-cards .row-actions { margin-top: auto; padding-top: 14px; }

.items-table .facility-h { min-width: 220px; }
.facility { display: flex; align-items: center; gap: 10px; }
.facility-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.facility-bar span { display: block; height: 100%; }
.facility.ok .facility-bar span { background: var(--ok); }
.facility.low .facility-bar span { background: var(--bad); }
.facility-val { font-variant-numeric: tabular-nums; width: 40px; text-align: right; font-weight: 600; }
.facility.ok .facility-val { color: var(--ok); }
.facility.low .facility-val { color: var(--bad); }

/* ================================================================ capture == */

.cap-main { padding-top: 20px; }
.cap { display: grid; grid-template-columns: 250px minmax(0, 1fr) 270px; gap: 16px; align-items: start; }
.cap .card { margin: 0; }

.cap-list { position: sticky; top: 12px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; }
.cap-list-head { padding: 12px; border-bottom: 1px solid var(--border); }
.cap-list-head input { padding: 8px 10px; font-size: 14px; }
.learners { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.learner {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 7px 8px; border: 0; border-radius: var(--r-sm); background: none;
  font: inherit; font-size: 13.5px; color: var(--text); cursor: pointer;
}
.learner:hover { background: var(--surface-2); }
.learner.is-current { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.learner-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot {
  flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; font-size: 11px; font-weight: 700;
  border: 1.5px solid var(--border-strong); color: transparent;
}
.learner.is-done .dot { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.learner.is-absent .dot { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }

.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sheet-who { flex: 1; min-width: 0; text-align: center; }
.sheet-who h2 { margin: 0; font-size: 19px; }
.sheet-who .hint { margin: 2px 0 0; font-family: var(--mono); font-size: 12px; }

.sheet-extra { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; margin-bottom: 16px; }
.seg { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0; }
.seg legend { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; padding: 0; width: 100%; }
.seg label { margin: 0; font-weight: 500; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: inline-block; padding: 9px 16px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 14px;
}
.seg label:first-of-type span { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.seg label:last-of-type span { border-radius: 0 var(--r-sm) var(--r-sm) 0; border-left: 0; }
.seg input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

.items { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.item {
  display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 1px;
  min-height: 58px; padding: 4px 4px 3px; margin: 0; border-radius: var(--r-sm);
  border: 1.5px solid var(--border-strong); background: var(--surface);
  color: var(--text); cursor: text;
}
.item-label { font-size: 11px; color: var(--text-3); line-height: 1.1; text-align: center; font-weight: 500; }
.item-val {
  width: 100%; min-width: 0; padding: 0; margin: 0; border: 0; background: transparent;
  text-align: center; font: inherit; font-size: 21px; font-weight: 700; line-height: 1.15;
  color: var(--text); caret-color: var(--brand); font-variant-numeric: tabular-nums;
}
.item-val:focus { outline: none; box-shadow: none; }
.item:hover { border-color: var(--brand); }
.item.is-right { background: var(--ok-bg); border-color: var(--ok-line); }
.item.is-right .item-val { color: var(--ok); }
.item.is-wrong { background: var(--bad-bg); border-color: var(--bad-line); }
.item.is-wrong .item-val { color: var(--bad); }
.item.is-part { background: var(--warn-bg); border-color: var(--warn-line); }
.item.is-cursor { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.item.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

.keys { margin: 12px 0 0; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
#msg { margin: 14px 0 0; }

.cap-score { position: sticky; top: 12px; }
.total { text-align: center; padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.total-num { display: block; font-size: 28px; font-weight: 720; font-variant-numeric: tabular-nums; }
.total-sub { display: block; color: var(--text-3); font-size: 13px; }
.cat-group h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin: 12px 0 6px; }
.cat { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin-bottom: 7px; font-size: 12.5px; }
.cat-name { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-val { font-weight: 650; font-variant-numeric: tabular-nums; }
.cat-bar { grid-column: 1 / -1; height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.cat-bar span { display: block; height: 100%; background: var(--border-strong); }
.cat.is-ok .cat-val { color: var(--ok); }
.cat.is-ok .cat-bar span { background: var(--ok); }
.cat.is-low .cat-val { color: var(--bad); }
.cat.is-low .cat-bar span { background: var(--bad); }

/* ======================================================= learner reports == */

.lrep {
  background: #fff; color: #111; border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 28px 32px; margin: 0 auto 22px; max-width: 820px; box-shadow: var(--sh-sm);
}
.lrep-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 3px solid #d9a92e; padding-bottom: 14px; margin-bottom: 8px; }
.lrep-brand { display: flex; align-items: center; gap: 16px; }
.lrep-crest { width: 74px; height: auto; flex: none; }
.lrep-org { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #1a5f9e; font-weight: 700; }
.lrep-head h2 { margin: 2px 0 0; font-size: 20px; color: #26355a; }
.lrep-who { margin: 0; display: grid; grid-template-columns: auto auto; gap: 2px 12px; font-size: 13px; }
.lrep-who div { display: contents; }
.lrep-who dt { color: #5c6663; }
.lrep-who dd { margin: 0; font-weight: 600; }
.lrep-test { padding: 14px 0 6px; border-bottom: 1px solid #e3e7e5; break-inside: avoid; }
.lrep-test h3 { font-size: 16px; margin: 0 0 10px; display: flex; gap: 10px; align-items: center; }
.lrep-dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.lrep-dim h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #5c6663; margin: 0 0 6px; font-weight: 650; }
.lrep-row { display: grid; grid-template-columns: 1fr 38px; gap: 1px 8px; font-size: 12.5px; margin-bottom: 6px; }
.lrep-name { color: #333; }
.lrep-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.lrep-bar { grid-column: 1 / -1; grid-row: 2; height: 6px; background: #eef1f0; border-radius: 99px; overflow: hidden; }
.lrep-bar span { display: block; height: 100%; }
.lrep-row.ok .lrep-val { color: #11663f; }
.lrep-row.ok .lrep-bar span { background: #2e9a63; }
.lrep-row.low .lrep-val { color: #a3201f; }
.lrep-row.low .lrep-bar span { background: #d0463f; }
.lrep .pill.ok { background: #e3f4ea; color: #11663f; border-color: #b6dec8; }
.lrep .pill.low { background: #fcebea; color: #a3201f; border-color: #efcbca; }
.lrep .muted { color: #5c6663; }
.lrep-foot { font-size: 11.5px; color: #5c6663; margin: 12px 0 0; }

/* ---------------------------------------------------------------- footer -- */

.siteftr { border-top: 1px solid var(--border); padding: 18px 0 26px; margin-top: auto; flex-shrink: 0; }
.siteftr p { margin: 0; font-size: 13px; color: var(--text-3); }
.ver {
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; margin-left: 6px;
}

/* ============================================================ responsive == */

@media (max-width: 1180px) {
  .cap { grid-template-columns: 220px minmax(0, 1fr); }
  .cap-score { grid-column: 1 / -1; position: static; }
  #cats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 20px; }
}

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .items { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .lrep-dims { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
  /* iOS Safari zooms the page when a control under 16px takes focus. */
  input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], select, textarea { font-size: 16px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .bar { flex-wrap: wrap; gap: 8px 12px; padding: 8px 14px; }
  .bar nav { order: 5; width: 100%; margin: 0; }
  .bar .theme-spacer { margin-left: auto; }
  .bar .who { margin-left: auto; }
  .cap { grid-template-columns: 1fr; }
  .cap-list { position: static; max-height: 260px; }
  #cats { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .wrap { padding: 0 14px; }
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
  .auth { margin: 22px auto; padding: 24px 18px; }
  .brand-name { font-size: 14px; }
  /* Room for brand, theme and Sign out on one row; the name is one tap away under Account. */
  .bar .who { display: none; }
  .bar > .icon-btn { margin-left: auto; }
  .search-inline, .search-inline input { width: 100%; }
  .lrep { padding: 18px 16px; }
  .lrep-dims { grid-template-columns: 1fr; }
  .card { padding: 16px; }
}

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

/* ================================================================== print == */

@media print {
  .bar, .siteftr, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .lrep { border: 0; box-shadow: none; padding: 0; margin: 0; max-width: none; break-after: page; }
  .lrep:last-child { break-after: auto; }
  .lrep-dims { grid-template-columns: repeat(3, 1fr); }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4; margin: 14mm; }
}

/* ===================================================== subject selection == */

.subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 14px; }
.subject {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm); overflow: hidden; display: flex; flex-direction: column;
  transition: border-color .12s, box-shadow .12s;
}
.subject:hover { border-color: var(--brand); box-shadow: var(--sh); }
.subject-main { display: flex; flex-direction: column; gap: 10px; padding: 22px 22px 20px; color: var(--text); }
.subject-main:hover { text-decoration: none; }
.subject-name { font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.subject-count { font-size: 14px; color: var(--text-2); }
.subject-count strong { color: var(--text); font-size: 16px; }
.prog-bar.big { flex: none; height: 9px; }
.subject.is-done .prog-bar span { background: var(--ok); }
.subject-go { align-self: flex-start; margin-top: 6px; }
.subject-classes { list-style: none; margin: 0; padding: 6px 10px 10px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 4px; }
.subject-classes a {
  display: inline-flex; gap: 8px; padding: 4px 10px; border-radius: 999px; font-size: 13px;
  color: var(--text-2); background: var(--surface-2);
}
.subject-classes a:hover { color: var(--brand); text-decoration: none; }

.cap-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.subject-tabs { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; flex-wrap: wrap; }
.subject-tabs a {
  padding: 9px 18px; border-radius: 9px; font-size: 15px; font-weight: 620; color: var(--text-2);
}
.subject-tabs a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.subject-tabs a.on { background: var(--brand); color: var(--brand-fg); box-shadow: var(--sh-sm); }
.cap-meta { margin: 0; }

@media (max-width: 620px) {
  .subject-tabs { display: flex; width: 100%; }
  .subject-tabs a { flex: 1; text-align: center; padding: 9px 8px; font-size: 14px; }
}

/* ===================================================== primary schools == */

.schools .school-name { white-space: normal; min-width: 220px; }
.schools td.v.thin { opacity: .6; }
.school-test h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 18px; margin-bottom: 14px; }
.inline-hint { margin: 0; font-weight: 400; }
/* The school's bars reuse the learner report's, which are fixed light colours. */
.school-test .lrep-name { color: var(--text-2); }
.school-test .lrep-bar { position: relative; overflow: visible; background: var(--surface-2); }
.school-test .lrep-bar > span { border-radius: 99px; }
.grade-mark {
  position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px;
  background: var(--text); border-radius: 1px; opacity: .75;
}
.school-test .lrep-dim h4 { color: var(--text-3); }
:root[data-theme="dark"] .school-test .lrep-row.ok .lrep-val { color: var(--ok); }
:root[data-theme="dark"] .school-test .lrep-row.low .lrep-val { color: var(--bad); }
.report-tabs { margin-bottom: 14px; }
/* Mathematics has fourteen sub-categories; when that is wider than the screen
   the school's name stays pinned on the left while the figures scroll. */
.schools .school-name { min-width: 170px; max-width: 220px; }
.schools .cat-h { min-width: 60px; max-width: 96px; }
.schools .name-col { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
.schools thead .name-col { background: var(--surface-2); }
.schools tfoot .name-col { background: var(--surface-2); }
.schools tbody tr:hover .name-col { background: var(--surface-2); }
