/* Charming 活動點名系統 — UI stylesheet.
 *
 * Mobile-first operational tool for staff standing at an entrance with one hand
 * free. No external fonts or images: the Worker serves CSP default-src 'none'
 * with style-src 'self', so everything here is same-origin and the type is the
 * platform stack. That is a deliberate choice, not a fallback — across an
 * unknown mix of parent and teacher phones the system face is the one that is
 * always already loaded and always renders zh-Hant correctly.
 *
 * Flat on purpose: no shadows, no gradients, one radius, and status carried by
 * colour + weight + a text badge rather than by card chrome.
 */

:root {
  /* ---- ink & surface ---- */
  --ink: #1b2233;
  --ink-2: #4a5365;          /* secondary text */
  --ink-3: #6b7383;          /* meta / captions */
  --bg: #ffffff;
  --surface: #ffffff;
  --line: #d9dde5;           /* hairline */
  --line-2: #eceef2;         /* inner divider */

  /* ---- brand ---- */
  --navy: #1f2a44;
  --navy-2: #2a3858;
  --gold: #e3b45c;           /* the single accent; event name only */

  /* ---- interactive ---- */
  --primary: #2b4acb;
  --primary-hover: #1f3aa6;
  --primary-soft: #eaeefc;

  /* ---- status ---- */
  --ok: #136c34;      --ok-bg: #e6f4ea;      --ok-line: #a9d8b9;
  --warn: #7a4b00;    --warn-bg: #fff4d8;    --warn-line: #f0cf86;
  --danger: #b42318;  --danger-bg: #fdecea;  --danger-line: #f3b7b1;
  --info: #1d4f91;    --info-bg: #e9f0fc;    --info-line: #b6cbef;

  /* ---- one radius, controls only ---- */
  --r: 6px;

  /* ---- type scale ----
   * Five steps replace the eight ad-hoc sizes this file used to carry:
   * 13 / 14 / 16 / 20 / 28, plus one display size for the single big figure. */
  --t-xs: 0.8125rem;
  --t-sm: 0.875rem;
  --t-base: 1rem;
  --t-lg: 1.25rem;
  --t-xl: 1.75rem;
  --t-display: 2.25rem;

  --font: system-ui, -apple-system, "Segoe UI", "PingFang HK", "PingFang TC",
          "Noto Sans TC", "Noto Sans HK", "Microsoft JhengHei", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: var(--t-base)/1.6 var(--font);
  color: var(--ink);
  background: var(--bg);
}
body.page-show {
  min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem;
}
.show-only { margin: 0; font-size: 1.75rem; font-weight: 700; text-align: center; }
main { flex: 1 0 auto; }

h1, h2, h3 { line-height: 1.3; margin: 0 0 .5rem; font-weight: 700; }
h1 { font-size: var(--t-xl); letter-spacing: -0.01em; }
h2 { font-size: var(--t-lg); }
h3 { font-size: var(--t-base); }
p { margin: 0 0 .75rem; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
code, .mono { font-family: var(--mono); }

.muted { color: var(--ink-2); }
.note { color: var(--ink-3); font-size: var(--t-sm); margin: 0 0 .4rem; }
.small { font-size: var(--t-sm); }
.break { word-break: break-all; }
.lead { font-size: var(--t-base); color: var(--ink-2); }

/* The HTML hidden attribute must always win over author display rules
   (e.g. .btn { display: inline-flex }). Without this, hidden controls such as
   「停止相機」 stayed visible — this was a real bug, keep the rule. */
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Focus is always visible for keyboard users. */
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 3px; }
.topbar :focus-visible { outline-color: var(--gold); }
main:focus { outline: none; }

.skip-link {
  position: absolute; left: .75rem; top: -3rem; z-index: 20;
  background: var(--surface); color: var(--ink); padding: .5rem .9rem;
  border: 1px solid var(--line); border-radius: var(--r);
}
.skip-link:focus { top: .75rem; }

/* ================= chrome ================= */

.topbar { background: var(--navy); color: #fff; }
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: .5rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  color: #fff; text-decoration: none; min-height: 44px; margin-right: auto;
}
.brand:hover { color: #fff; }
.brand-mark {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem;
  border-radius: var(--r); background: var(--gold); color: var(--navy);
  font: 700 1.05rem/1 var(--font);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: var(--t-base); font-weight: 700; }
.brand-sub { font-size: var(--t-xs); color: #c3cbdd; }

/* Logos stay modest: they identify, they do not decorate. */
.crest { height: 2.25rem; width: auto; background: #fff; padding: 2px; border-radius: var(--r); flex: none; }
.brand-logo { height: 2rem; width: auto; max-width: 48vw; object-fit: contain; background: #fff; padding: 2px 4px; border-radius: var(--r); flex: none; }

.session { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.whoami { margin: 0; font-size: var(--t-xs); color: #c3cbdd; }
.whoami [aria-hidden] { color: #7ddc9b; }
.logout { margin: 0; }

/* The event bar is the one place the gold accent appears. */
.eventbar { background: var(--navy-2); }
.eventbar-inner {
  max-width: 1120px; margin: 0 auto; padding: .3rem 1rem;
  display: flex; flex-wrap: wrap; gap: 0 .75rem;
  font-size: var(--t-xs); color: #dfe4ef;
}
.event-school { font-weight: 600; }
.event-name { color: var(--gold); font-weight: 600; }

/* Work navigation: thumb-reachable bottom bar on phones, top bar on desktop. */
.worknav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.worknav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .1rem; min-height: 56px; color: var(--ink-2); text-decoration: none;
  font-size: var(--t-xs); font-weight: 600;
}
.worknav .wn-icon { font-size: 1.15rem; line-height: 1; }
.worknav a[aria-current="page"] {
  color: var(--primary); background: var(--primary-soft);
  box-shadow: inset 0 3px 0 var(--primary);
}
.worknav a:focus-visible { outline-offset: -3px; }

.site-footer {
  color: var(--ink-3); font-size: var(--t-xs);
  padding: 1.25rem 1rem 1.5rem; border-top: 1px solid var(--line);
  background: var(--surface);
}
.site-footer p { margin: 0; }
.f-event { font-weight: 600; color: var(--ink-2); }

/* ================= layout ================= */

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 1rem 1rem 2.5rem; }
body.work .container { padding: .75rem .75rem 6rem; }   /* clear the fixed nav */

.screen-title { font-size: var(--t-lg); margin: 0 0 .15rem; }
.screen-sub { color: var(--ink-2); font-size: var(--t-sm); margin: 0 0 .75rem; }

/* A panel groups related controls. Hairline border, no shadow, no radius: the
   surface is the content, not a card floating above it. */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  padding: .9rem; margin: 0 0 .75rem;
}
.panel.narrow { max-width: 460px; }
.panel-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 1rem; margin-bottom: .6rem;
}
.panel-head h2 { margin: 0; }
.auth-card { margin-top: 1rem; }
.stack > * + * { margin-top: .9rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.btn-row.tight { display: inline-flex; gap: .4rem; margin: 0; }
.back { margin: 0 0 .5rem; font-size: var(--t-sm); }
.back a { display: inline-flex; min-height: 44px; align-items: center; }

/* ================= the one big figure =================
 * On the scanner this row is both the outstanding count and the way into the
 * 未到 list. It is the single loud element in the interface; everything else
 * stays quiet. It is a row, not a card: full-bleed, one hairline, a chevron. */

.outstanding {
  display: flex; align-items: baseline; gap: .35rem;
  background: var(--surface); border: 1px solid var(--line);
  padding: .7rem .85rem; margin: 0 0 .75rem;
  color: var(--ink); text-decoration: none; min-height: 56px;
}
.outstanding:hover { color: var(--ink); background: #fffafa; }
.os-value {
  font-size: var(--t-xl); font-weight: 700; line-height: 1;
  color: var(--danger); font-variant-numeric: tabular-nums;
}
.os-unit { font-size: var(--t-base); font-weight: 600; color: var(--danger); }
.os-sub { font-size: var(--t-xs); color: var(--ink-3); margin-left: auto; text-align: right; }
.os-go { font-size: var(--t-lg); color: var(--ink-3); margin-left: .4rem; align-self: center; }

/* Roster: the same figure, inline, without the navigation affordance. */
.figure-line {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .5rem;
  margin: 0 0 .75rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line);
}
.fl-value {
  font-size: var(--t-xl); font-weight: 700; line-height: 1;
  color: var(--danger); font-variant-numeric: tabular-nums;
}
.fl-unit { font-size: var(--t-base); font-weight: 600; color: var(--danger); }
.fl-sub { font-size: var(--t-xs); color: var(--ink-3); margin-left: auto; font-variant-numeric: tabular-nums; }

/* Back-office figures: a dense label/value row, not five cards. */
.figures {
  display: flex; flex-wrap: wrap; margin: 0 0 .75rem;
  border: 1px solid var(--line); background: var(--surface);
}
.figures .fig {
  flex: 1 1 5.5rem; padding: .55rem .7rem;
  border-right: 1px solid var(--line-2);
}
.figures .fig:last-child { border-right: 0; }
.figures dt { font-size: var(--t-xs); color: var(--ink-3); font-weight: 600; }
.figures dd {
  margin: .1rem 0 0; font-size: var(--t-lg); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.figures .fig-warn { color: var(--danger); }

/* ================= forms ================= */

.field label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: var(--t-sm); }
.optional { font-weight: 400; color: var(--ink-3); }
.hint { font-size: var(--t-xs); color: var(--ink-3); margin: .3rem 0 0; }

input[type="text"], input[type="password"], input[type="search"], input:not([type]) {
  display: block; width: 100%; min-height: 48px; font: inherit; font-size: var(--t-base);
  color: var(--ink); padding: .6rem .75rem; background: var(--surface);
  border: 1px solid #aeb6c4; border-radius: var(--r);
  -webkit-appearance: none; appearance: none;
}
input:focus-visible { outline: 3px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
input[aria-invalid="true"] { border-color: var(--danger); }
#manual-input { letter-spacing: .06em; text-transform: uppercase; }

/* ================= buttons ================= */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1rem; border: 1px solid transparent;
  border-radius: var(--r); font: inherit; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: #aeb6c4; }
.btn-secondary:hover { background: #f1f3f8; color: var(--ink); }
.btn-success { background: var(--ok); color: #fff; }
.btn-success:hover { background: #0e5228; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f1c13; color: #fff; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn-ghost-dark { background: transparent; color: var(--primary); border-color: transparent; text-decoration: underline; }
.btn-sm { min-height: 40px; padding: .4rem .8rem; font-size: var(--t-sm); }
.btn-lg { min-height: 52px; font-size: var(--t-base); padding: .7rem 1.3rem; }
/* The camera is the primary action of the whole system. */
.btn-xl { min-height: 64px; font-size: var(--t-lg); padding: .9rem 1.3rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-btn {
  background: none; border: 0; padding: .5rem .25rem; min-height: 44px;
  color: var(--primary); font: inherit; text-decoration: underline; cursor: pointer;
}
.link-action { display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; }

/* ================= alerts & status ================= */
/* Text only — no icon discs. The border colour and the words carry the state. */

.alert {
  display: block; padding: .65rem .85rem; margin: 0 0 .75rem;
  border: 1px solid; border-left-width: 3px; border-radius: 0;
  font-size: var(--t-sm);
}
.alert-error   { background: var(--danger-bg); border-color: var(--danger-line); border-left-color: var(--danger); color: #7a170f; }
.alert-success { background: var(--ok-bg);     border-color: var(--ok-line);     border-left-color: var(--ok);     color: #0d4d25; }
.alert-info    { background: var(--info-bg);   border-color: var(--info-line);   border-left-color: var(--info);   color: #163d70; }
.alert-warn    { background: var(--warn-bg);   border-color: var(--warn-line);   border-left-color: var(--warn);   color: #5c3900; }

.status {
  margin: .6rem 0 0; padding: .5rem .7rem; font-size: var(--t-sm);
  background: #f1f3f8; color: var(--ink-2); border-radius: var(--r);
}
.status[data-state="active"] { background: var(--ok-bg); color: #0d4d25; }
.status[data-state="busy"]   { background: var(--info-bg); color: #163d70; }
.status[data-state="error"]  { background: var(--danger-bg); color: #7a170f; }

.badge {
  display: inline-block; padding: .05rem .5rem; border-radius: 999px;
  font-size: var(--t-xs); font-weight: 700; border: 1px solid; white-space: nowrap;
}
.badge-ok     { background: var(--ok-bg);     color: var(--ok);     border-color: var(--ok-line); }
.badge-absent,
.badge-muted {
  border: none; border-radius: 4px; padding: .12rem .4rem;
}
.badge-absent { background: var(--danger-bg); color: var(--danger); }
.badge-muted  { background: #f1f3f8;          color: var(--ink-2); }

.empty-state { padding: 1.25rem .5rem; text-align: center; }
.empty-state.compact { padding: .9rem .5rem; }
.empty-title { font-weight: 600; font-size: var(--t-base); color: var(--ink-2); margin: 0; }

.code {
  font-family: var(--mono); background: #f1f3f8; border: 1px solid var(--line);
  border-radius: 3px; padding: .05rem .35rem; white-space: nowrap;
}
.code-lg { font-size: var(--t-lg); letter-spacing: .1em; padding: .2rem .5rem; }

/* ================= scanner ================= */

.scan-layout { display: grid; gap: 0; }
.scan-camera #cam-start,
.scan-camera #cam-stop { margin-top: .6rem; }
.camera-frame {
  position: relative; overflow: hidden; width: 100%;
  background: #111820; aspect-ratio: 3 / 4; max-height: 62vh; border-radius: 4px;
}
.camera-frame video { width: 100%; height: 100%; object-fit: cover; display: none; }
.camera-frame.is-live video { display: block; }
.cam-hint {
  position: absolute; inset: 22%; z-index: 1; margin: 0;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: .4rem; color: #fff; font-size: var(--t-sm); font-weight: 600; line-height: 1.45;
}
.camera-frame.is-live .cam-hint { display: none; }
.camera-reticle {
  position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.92);
  border-radius: 4px; box-shadow: 0 0 0 999px rgba(0,0,0,.28); pointer-events: none;
}

.result { min-height: 11rem; }
.result-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: .2rem 1rem; margin-bottom: .5rem;
}
.result-head h2 { margin: 0; font-size: var(--t-lg); }
.progress-line { font-weight: 600; font-size: var(--t-sm); font-variant-numeric: tabular-nums; }

/* Ticking people off is the core gesture: big rows, big checkboxes. */
.checklist { list-style: none; margin: .4rem 0 0; padding: 0; border-top: 1px solid var(--line-2); }
.checklist li {
  display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .7rem;
  padding: .4rem 0; border-bottom: 1px solid var(--line-2);
}
.checklist label {
  flex: 1 1 14rem; display: flex; align-items: center; gap: .7rem;
  min-height: 48px; font-size: var(--t-base); cursor: pointer;
}
.checklist .name { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.checklist .name-meta { font-size: var(--t-xs); font-weight: 400; color: var(--ink-3); }
.checklist input[type="checkbox"] { width: 1.5rem; height: 1.5rem; accent-color: var(--primary); flex: none; }
.checklist li.is-present .name { color: var(--ok); font-weight: 600; }
.checklist li.is-present label { cursor: default; }
.checklist .when { font-size: var(--t-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.select-row { display: flex; flex-wrap: wrap; gap: .2rem 1rem; margin: .5rem 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.actions .btn { flex: 1 1 12rem; }

/* ================= roster ================= */

.roster-search { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.roster-search .btn-ghost-dark { grid-column: 1 / -1; justify-self: start; }

/* Filter chips carry their own counts, which is why the KPI cards that used to
   sit above them were redundant and are gone. 未到 is the default filter. */
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-bottom: .5rem; }
.chip {
  display: flex; align-items: center; justify-content: center; gap: .3rem;
  min-height: 44px; padding: .35rem .5rem; border: 1px solid #aeb6c4;
  border-radius: 999px; background: var(--surface); color: var(--ink);
  text-decoration: none; font-weight: 600; font-size: var(--t-sm);
}
.chip-count { font-variant-numeric: tabular-nums; color: var(--ink-3); font-weight: 700; }
.chip[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip[aria-current="page"] .chip-count { color: var(--gold); }

.roster-summary { margin: 0 0 .5rem; font-size: var(--t-xs); color: var(--ink-3); }

.roster { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }

.hh-row {
  border: 0; border-radius: 10px; padding: .6rem .7rem; background: #e8f2fc;
}
.hh-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: .2rem .6rem;
}
.hh-open { display: block; color: inherit; text-decoration: none; }
.hh-open:hover .hh-name, .hh-open:focus-visible .hh-name { text-decoration: underline; }
.hh-name { font-size: var(--t-base); font-weight: 700; margin: 0; overflow-wrap: anywhere; }
.hh-row.is-complete .hh-name { font-weight: 600; color: var(--ink-2); }

.r-members {
  list-style: none; margin: .45rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(7.25rem, 1fr)); gap: .35rem;
}
.r-member {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  gap: .15rem; min-height: 3.25rem; padding: .4rem .5rem;
  border: 0; border-radius: 8px; background: #fff;
}
.r-name { display: flex; flex-direction: column; overflow-wrap: anywhere; font-size: var(--t-base); line-height: 1.25; }
.r-meta { font-size: var(--t-xs); font-weight: 400; color: var(--ink-3); }
.r-member.is-absent .r-name { font-weight: 700; }
.r-member.is-present .r-name { color: var(--ink-3); }
.r-status { display: inline-flex; align-items: center; gap: .35rem; font-size: var(--t-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }

.hh-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .35rem .7rem; margin-top: .4rem; font-size: var(--t-xs); color: var(--ink-3);
}
.hh-action { min-height: 44px; min-width: 5.5rem; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .8rem; font-size: var(--t-sm); }

/* ================= back-office table ================= */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); }
.data-table { border-collapse: collapse; width: 100%; min-width: 780px; font-size: var(--t-sm); }
.data-table th, .data-table td {
  text-align: left; vertical-align: top; padding: .55rem .65rem;
  border-bottom: 1px solid var(--line-2);
}
.data-table thead th {
  background: #f6f7fa; font-size: var(--t-xs); color: var(--ink-3); font-weight: 700;
  position: sticky; top: 0; white-space: nowrap; border-bottom: 1px solid var(--line);
}
.data-table tbody tr:hover { background: #fafbfd; }
.data-table .num { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.data-table .hh-label { font-weight: 700; }
.data-table .email { color: var(--ink-2); word-break: break-all; }

.members { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.member { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .4rem; }
.member-meta { font-size: var(--t-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.member.is-present .member-name { color: var(--ok); font-weight: 600; }

.danger-zone { border-color: var(--danger-line); }
.danger-zone h2 { color: var(--danger); font-size: var(--t-base); }
.reset-form { display: grid; gap: .7rem; max-width: 420px; }
.reset-form .btn { justify-self: start; }

/* ================= email preview ================= */

.email { max-width: 640px; }
.email-head {
  display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem;
  padding-bottom: .7rem; margin: 0 0 .9rem; border-bottom: 1px solid var(--line);
  font-size: var(--t-sm);
}
.email-head dt { font-weight: 600; color: var(--ink-3); }
.email-head dd { margin: 0; word-break: break-word; }
.email-members { padding-left: 1.25rem; }
.qr { margin: .9rem 0; }
.qr svg { width: 220px; height: auto; max-width: 100%; border: 1px solid var(--line); }

.email-banner { margin: 0 0 1rem; overflow: hidden; border: 1px solid var(--line); }
.email-banner img { display: block; width: 100%; height: auto; }
.email-banner-text { display: grid; gap: .1rem; padding: .9rem 1rem; background: var(--navy); color: #fff; border: 0; }
.eb-caption { display: grid; gap: .1rem; margin: 0; padding: .65rem .9rem; background: var(--navy); color: #fff; font-size: var(--t-sm); }
.eb-school { font-weight: 700; }
.eb-event { color: var(--gold); font-weight: 600; }
.eb-brand { font-size: var(--t-xs); color: #c3cbdd; justify-self: end; }

/* ================= wider screens ================= */

@media (max-width: 959px) {
  body { overflow-x: hidden; }
  .topbar-inner { flex-wrap: nowrap; gap: .35rem .5rem; padding: .4rem .7rem; }
  .crest { height: 1.7rem; }
  .brand { min-width: 0; gap: .4rem; }
  .brand-logo { height: 1.55rem; max-width: 32vw; }
  .brand-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 7.5rem; }
  .whoami { max-width: 4.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .eventbar-inner { flex-wrap: nowrap; padding: .25rem .7rem; }
  .event-school, .event-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-scan .site-footer { display: none; }
  .page-scan .container { padding: .55rem .7rem 5.25rem; }
  .page-scan .screen-title { font-size: 1.05rem; margin-bottom: .35rem; }
  .page-scan .outstanding { margin-bottom: .45rem; padding: .45rem .65rem; min-height: 0; }
  .page-scan .panel.scan-camera { padding: .55rem; margin-bottom: .5rem; }
  .page-scan .result { min-height: 0; }
  .page-scan .btn-xl { min-height: 48px; }
}

@media (min-width: 640px) {
  .container { padding: 1.25rem 1.5rem 3rem; }
  body.work .container { padding: 1rem 1.25rem 2rem; }
  .panel { padding: 1.1rem 1.25rem; }
  .screen-title { font-size: var(--t-xl); }
  .chips { display: flex; flex-wrap: wrap; }
  .chip { padding: .35rem 1rem; }
  .eventbar-inner { padding: .3rem 1.5rem; }
}

@media (min-width: 960px) {
  .worknav {
    position: sticky; top: 0; bottom: auto;
    display: flex; justify-content: center; gap: .25rem;
    border-top: 0; border-bottom: 1px solid var(--line); padding: 0 1rem;
  }
  .worknav a { flex-direction: row; gap: .4rem; min-height: 48px; padding: 0 1.25rem; font-size: var(--t-sm); }
  .worknav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--primary); }
  .scan-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 1.25rem; align-items: start; }
  .result { position: sticky; top: 4rem; }
  .roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .6rem; align-items: start; }
}

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

@media print {
  .topbar, .site-footer, .worknav, .danger-zone, .pager, .skip-link, .outstanding { display: none; }
  body { background: #fff; }
  .panel, .figures, .table-wrap { border: 0; }
}
