/* RDHS Test & Tag — built on the palette rdhs.com.au publishes in its own
   stylesheet, so this reads as part of the same organisation rather than as a
   separate tool that happens to belong to it.

   Brand values, taken verbatim:
     dark blue  #01527c    light blue  #0079c2    blue        #005581
     green      #b2bb1e    link green  #97a211    terracotta  #d06f19
     orange     #f9a21a    midnight    #15113b    off-white   #f3f3f6
     grey text  #595959    warm grey   #bcafa8    darker warm #877a75

   Hand-authored rather than Tailwind: avoiding a Node build keeps deployment
   to "upload PHP files". */

/* Barlow is what rdhs.com.au sets its links in. Its headings use Proxima Nova,
   which is licensed through Typekit and cannot be redistributed here — Barlow
   is the part of their type we can legitimately carry over. Self-hosted rather
   than loaded from Google so the field app still renders it with no connection,
   and so nobody's address is handed to a third party on every page view. */
@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/barlow-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/barlow-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/barlow-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/barlow-700.woff2') format('woff2');
}

:root {
  --ground:      #F3F3F6;   /* brand off-white */
  --surface:     #FFFFFF;
  --surface-2:   #F8F8FB;
  --line:        #DEDEE7;
  --line-soft:   #ECECF2;
  --ink:         #15113B;   /* brand midnight blue */
  --ink-2:       #595959;   /* brand grey text */
  --ink-3:       #7F736E;   /* brand darker warm grey, a shade down to clear 4.5:1 */
  --accent:      #01527C;   /* brand dark blue */
  --accent-2:    #013D5E;   /* darkened for hover — white on light blue is too thin */
  --accent-soft: #E1EDF4;

  /* Semantic states are not brand decoration: they have to be told apart at a
     glance and read at small sizes, so each is the brand hue pushed to a legible
     depth. Nothing in the RDHS palette reads as danger, so critical is a red
     chosen to sit beside the terracotta without being confused for it. */
  --critical:    #A3231B;
  --critical-bg: #F9E4E2;
  --warn:        #9C540C;   /* brand terracotta, darkened */
  --warn-bg:     #FBEEDC;
  --ok:          #66730C;   /* brand green, darkened to clear 4.5:1 on its tint */
  --ok-bg:       #EFF2DA;

  --shadow:      0 1px 2px rgba(21,17,59,.06), 0 4px 14px rgba(21,17,59,.05);

  --f-body: 'Barlow', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-data: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

/* System mode: follow the OS, unless the person has explicitly chosen light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* The neutral blue-slate dark theme. The brand midnight blue read as
       purple across a whole dark screen, so the dark theme stays cool grey
       while the light theme carries the RDHS colours. */
    --ground:      #0D151A;
    --surface:     #151F26;
    --surface-2:   #1B272F;
    --line:        #2A3941;
    --line-soft:   #223038;
    --ink:         #E6EDF1;
    --ink-2:       #A8BAC4;
    --ink-3:       #7B909C;
    --accent:      #61AFD1;
    --accent-2:    #8CC7E2;
    --accent-soft: #1B333F;
    --critical:    #E88B82;
    --critical-bg: #35201E;
    --warn:        #DCB264;
    --warn-bg:     #332818;
    --ok:          #7EBF97;
    --ok-bg:       #1B2E22;
    --shadow:      0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  }
}

/* An explicit choice overrides the OS in both directions. Keep the dark
   values in step with the media-query block above — CSS cannot share one
   declaration list across a media boundary. */
:root[data-theme="dark"] {
    /* The neutral blue-slate dark theme. The brand midnight blue read as
       purple across a whole dark screen, so the dark theme stays cool grey
       while the light theme carries the RDHS colours. */
    --ground:      #0D151A;
    --surface:     #151F26;
    --surface-2:   #1B272F;
    --line:        #2A3941;
    --line-soft:   #223038;
    --ink:         #E6EDF1;
    --ink-2:       #A8BAC4;
    --ink-3:       #7B909C;
    --accent:      #61AFD1;
    --accent-2:    #8CC7E2;
    --accent-soft: #1B333F;
    --critical:    #E88B82;
    --critical-bg: #35201E;
    --warn:        #DCB264;
    --warn-bg:     #332818;
    --ok:          #7EBF97;
    --ok-bg:       #1B2E22;
    --shadow:      0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

/* ---------------------------------------------------------------- guest */

.guest {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.guest-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.guest-head {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.brand { display: flex; align-items: baseline; gap: 9px; margin-bottom: 10px; }

.brand-mark {
  font-family: var(--f-data);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #fff;
  background: var(--accent);
  padding: 4px 7px;
  border-radius: 3px;
}

.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }

.guest-head h1 {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -.01em;
  text-wrap: balance;
}

.guest-head p { margin: 0; font-size: 13.5px; color: var(--ink-3); max-width: 46ch; }

.guest-body { padding: 22px 26px 26px; display: flex; flex-direction: column; gap: 16px; }

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

.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.input {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 11px;
  width: 100%;
}

.input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.input[aria-invalid="true"] { border-color: var(--critical); }

.hint { font-size: 12.5px; color: var(--ink-3); }

.error {
  font-size: 12.5px;
  color: var(--critical);
  font-weight: 550;
}

.btn {
  font: inherit;
  font-weight: 650;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 10px 16px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.btn:hover { background: var(--accent-2); border-color: var(--accent-2); }

.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-block { width: 100%; }

.btn-quiet {
  color: var(--ink-2);
  background: transparent;
  border-color: var(--line);
}

.btn-quiet:hover { background: var(--surface-2); border-color: var(--ink-3); }

.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 13px; font-size: 13.5px; color: var(--ink-2); }
.steps li { padding-left: 3px; }

.qr {
  margin: 11px 0;
  padding: 12px;
  background: #fff;          /* a QR code must stay dark-on-light to scan */
  border: 1px solid var(--line);
  border-radius: 5px;
  display: inline-block;
  line-height: 0;
}

.qr svg { display: block; width: 200px; height: 200px; }

.secret {
  display: block;
  margin-top: 7px;
  padding: 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--f-data);
  font-size: 14px;
  letter-spacing: .06em;
  word-break: break-all;
}

.input-code {
  font-family: var(--f-data);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: .28em;
  text-align: center;
  padding: 12px;
}

.codes {
  list-style: none;
  margin: 0 0 4px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  font-family: var(--f-data);
  font-size: 14px;
  letter-spacing: .04em;
}

.linkrow { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }

/* ---------------------------------------------------------------- alerts */

.alert {
  padding: 11px 14px;
  border-radius: 4px;
  font-size: 13.5px;
  border: 1px solid transparent;
  border-left-width: 3px;
}

.alert-error   { background: var(--critical-bg); color: var(--critical); border-left-color: var(--critical); }
.alert-ok      { background: var(--ok-bg);       color: var(--ok);       border-left-color: var(--ok); }
.alert-info    { background: var(--accent-soft); color: var(--accent);   border-left-color: var(--accent); }

/* ---------------------------------------------------------------- app shell */

.appbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 13px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.appbar .brand { margin: 0 auto 0 0; }

.nav { display: flex; gap: 2px; flex-wrap: wrap; }

.nav a {
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 11px;
  border-radius: 4px;
  font-weight: 500;
}

.nav a:hover { background: var(--accent-soft); color: var(--accent); }
.nav a[aria-current="page"] { background: var(--accent); color: #fff; }

/* Same idea as the dashboard count, sized for a navigation bar. */
.navcount {
  display: inline-block;
  font-family: var(--f-data);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 16%, var(--surface));
  border: 1px solid var(--warn);
  border-radius: 3px;
  padding: 2px 5px;
  margin-left: 3px;
  vertical-align: 1px;
}

/* On the current page the link is filled with the accent colour, and amber on
   that clashes and stops being legible. Borrow the link's own colours instead. */
.nav a[aria-current="page"] .navcount {
  color: #fff;
  background: transparent;
  border-color: rgba(255, 255, 255, .65);
}

.nav a:hover .navcount { border-color: var(--warn); }

.whomenu { position: relative; }

/* Avatar only — a plain circle, no chrome around it. */
.whotrigger {
  display: block;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  line-height: 0;
}

.whotrigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  flex: none;
}

.whotrigger:hover .avatar,
.whotrigger[aria-expanded="true"] .avatar {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.rolechip {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 3px;
}

/* ---------------------------------------------------------------- menu */

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  min-width: 258px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.menu-head { padding: 14px 16px 13px; }

.menu-name { font-size: 14.5px; font-weight: 600; color: var(--ink); }

.menu-sub {
  font-size: 12.5px;
  color: var(--ink-3);
  word-break: break-all;
  margin-top: 2px;
}

/* A rule between groups rather than boxes around them — the reference reads as
   one list divided, not as several panels stacked. */
.menu-group { padding: 6px; border-top: 1px solid var(--line-soft); }

.menu a,
.menu-signout {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  background: transparent;
  border: 0;
  border-radius: 4px;
  padding: 9px 10px;
  cursor: pointer;
}

.menu a:hover,
.menu-signout:hover { background: var(--surface-2); }

.menu a[aria-current="page"] { color: var(--accent); font-weight: 550; }

.menu a:focus-visible,
.menu-signout:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }





/* Full width. The register and the dashboard breakdowns are the reason — both
   are tables and bar charts that use every pixel they are given. The login card
   and the field capture screen set their own narrower widths and are unaffected. */
.wrap { width: 100%; margin: 0; padding: 0 28px 72px; }

/* Running prose still needs a line length someone can read, even when the page
   around it is 2560px wide. */
.page-lede, .banner p, .alert { max-width: 95ch; }

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 26px 0 14px;
}

.sec-head h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.sec-head .rule { flex: 1; height: 1px; background: var(--line-soft); }
.sec-head .note { font-size: 12px; color: var(--ink-3); }

.page-title {
  margin: 26px 0 2px;
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.page-lede { margin: 0; color: var(--ink-3); font-size: 13.5px; }

/* ---------------------------------------------------------------- tiles */

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 15px 16px 14px;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--ink-3);
}

.tile:hover { border-color: var(--accent); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tile.is-critical::before { background: var(--critical); }
.tile.is-warn::before     { background: var(--warn); }
.tile.is-ok::before       { background: var(--ok); }

.tile-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 9px;
}

.tile-val {
  font-family: var(--f-data);
  font-variant-numeric: tabular-nums;
  font-size: 33px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.02em;
}

.tile.is-critical .tile-val { color: var(--critical); }

.tile-sub {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.tile-bar {
  margin-top: 11px;
  height: 3px;
  border-radius: 2px;
  background: var(--line-soft);
  overflow: hidden;
}

.tile-bar i { display: block; height: 100%; border-radius: 2px; }

/* ---------------------------------------------------------------- bars */

.cols { display: grid; grid-template-columns: 1.05fr 1fr; gap: 28px; }

.bars { display: flex; flex-direction: column; gap: 13px; }

.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; }

.bar-name { font-size: 13.5px; font-weight: 550; }

.bar-fig {
  font-family: var(--f-data);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}

.bar-fig b { color: var(--critical); font-weight: 600; }

.bar-track {
  grid-column: 1 / -1;
  height: 9px;
  border-radius: 2px;
  background: var(--line-soft);
  display: flex;
  overflow: hidden;
}

.bar-track i { display: block; height: 100%; }

.seg-crit { background: var(--critical); }
.seg-warn { background: var(--warn); }
.seg-ok   { background: var(--ok); opacity: .55; }

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-2);
}

.legend span { display: inline-flex; align-items: center; gap: 6px; }

.swatch { width: 10px; height: 10px; border-radius: 2px; }

/* ---------------------------------------------------------------- table */

.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

table.register { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 820px; }

table.register thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
}

table.register thead th a { color: inherit; text-decoration: none; }
table.register thead th a:hover { color: var(--accent); }

table.register tbody td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  vertical-align: middle;
}

table.register tbody tr:last-child td { border-bottom: 0; }
table.register tbody tr:hover td { background: var(--surface-2); }

.c-tag {
  font-family: var(--f-data);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
}

.c-tag a { color: inherit; text-decoration: none; }
.c-tag a:hover { color: var(--accent); text-decoration: underline; }

.c-item { color: var(--ink); font-weight: 550; }

.c-date {
  font-family: var(--f-data);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  white-space: nowrap;
}

.c-loc { font-size: 12.5px; }
.c-muted { color: var(--ink-3); }

/* ---------------------------------------------------------------- pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.p-overdue { background: var(--critical-bg); color: var(--critical); }
.p-due     { background: var(--warn-bg);     color: var(--warn); }
.p-current { background: var(--ok-bg);       color: var(--ok); }
.p-unknown { background: var(--surface-2);   color: var(--ink-3); }
.p-review  { background: var(--warn-bg);     color: var(--warn); }
.p-failed  { background: var(--critical-bg); color: var(--critical); }
.p-fail    { background: var(--critical-bg); color: var(--critical); }
.p-pass    { background: var(--ok-bg);       color: var(--ok); }

/* ---------------------------------------------------------------- filters */

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

/* A group of filter chips. Wraps on a wide screen; becomes a single swipeable
   strip on a phone (see the mobile block) rather than a wall of wrapped rows. */
.chipscroll {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chip {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 5px 11px;
  border-radius: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.chip b { font-variant-numeric: tabular-nums; font-weight: 700; }

.chip-danger { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 40%, transparent); }
.chip-danger:hover { background: var(--critical-bg); border-color: var(--critical); color: var(--critical); }

.filterform { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-left: auto; }

.select, .search {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 4px;
}

.search { min-width: 210px; }
.select:focus-visible, .search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------------------------------------------------------------- pagination */

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ink-3);
  flex-wrap: wrap;
}

.pager nav { display: flex; gap: 4px; flex-wrap: wrap; }

.pager a, .pager span {
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager [aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager .disabled { opacity: .45; }

/* ---------------------------------------------------------------- detail */

.detail { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 18px 20px;
}

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 9px 14px; font-size: 13.5px; }

.kv dt {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: 2px;
}

.kv dd { margin: 0; color: var(--ink); }

.timeline { display: flex; flex-direction: column; gap: 0; }

.tl-item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}

.tl-item:last-child { border-bottom: 0; }

.tl-date {
  font-family: var(--f-data);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--ink-2);
}

.tl-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }

.elsewhere {
  list-style: none;
  margin: 12px auto 0;
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
}

.elsewhere li { display: flex; align-items: center; gap: 9px; }
.elsewhere a { text-decoration: none; display: flex; align-items: center; gap: 8px; }
.elsewhere a:hover { text-decoration: underline; }

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
}

.banner {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  margin-top: 22px;
  padding: 14px 16px;
  background: var(--warn-bg);
  border: 1px solid transparent;
  border-left: 3px solid var(--warn);
  border-radius: 4px;
}

.banner h3 { margin: 0 0 5px; font-size: 13.5px; font-weight: 650; color: var(--ink); }

/* The count carries the whole message — the rest of the sentence is context.
   Boxed rather than merely coloured so it reads as a figure at a glance and
   survives the amber-on-amber of the banner it sits in. */
.tallycount {
  display: inline-block;
  font-family: var(--f-data);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 16%, var(--surface));
  border: 1.5px solid var(--warn);
  border-radius: 4px;
  padding: 3px 7px;
  margin-right: 3px;
}
.banner p { margin: 0; font-size: 13px; color: var(--ink-2); max-width: 78ch; }
.banner .act { margin-left: auto; align-self: center; white-space: nowrap; }

/* ---------------------------------------------------------------- admin */

.assetgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
  max-width: 900px;
}

.assetgrid-wide { grid-column: 1 / -1; }
.assetgrid .btn { justify-self: start; }
.assetgrid textarea.input { resize: vertical; }

@media (max-width: 760px) { .assetgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .assetgrid { grid-template-columns: 1fr; } }

.mailgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  max-width: 760px;
}

.mailgrid-wide { grid-column: 1 / -1; }

.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.checkline input[type="checkbox"] { width: 17px; height: 17px; cursor: pointer; }
.mailgrid .btn { justify-self: start; }

@media (max-width: 620px) {
  .assetgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
  max-width: 900px;
}

.assetgrid-wide { grid-column: 1 / -1; }
.assetgrid .btn { justify-self: start; }
.assetgrid textarea.input { resize: vertical; }

@media (max-width: 760px) { .assetgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .assetgrid { grid-template-columns: 1fr; } }

.mailgrid { grid-template-columns: 1fr; }
}

.addgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 12px 14px;
  align-items: end;
}

.addgrid-action { justify-self: start; }
.addgrid .btn { white-space: nowrap; }

table.register .input {
  font-size: 13px;
  padding: 6px 8px;
}

table.register th.num, table.register td.num { text-align: right; }

.invitelink {
  display: block;
  margin-top: 9px;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--f-data);
  font-size: 12px;
  color: var(--ink-2);
  word-break: break-all;
}

@media (max-width: 720px) {
  .assetgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
  max-width: 900px;
}

.assetgrid-wide { grid-column: 1 / -1; }
.assetgrid .btn { justify-self: start; }
.assetgrid textarea.input { resize: vertical; }

@media (max-width: 760px) { .assetgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .assetgrid { grid-template-columns: 1fr; } }

.mailgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  max-width: 760px;
}

.mailgrid-wide { grid-column: 1 / -1; }

.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.checkline input[type="checkbox"] { width: 17px; height: 17px; cursor: pointer; }
.mailgrid .btn { justify-self: start; }

@media (max-width: 620px) {
  .assetgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
  max-width: 900px;
}

.assetgrid-wide { grid-column: 1 / -1; }
.assetgrid .btn { justify-self: start; }
.assetgrid textarea.input { resize: vertical; }

@media (max-width: 760px) { .assetgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .assetgrid { grid-template-columns: 1fr; } }

.mailgrid { grid-template-columns: 1fr; }
}

.addgrid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- triage */

.triage-list { display: flex; flex-direction: column; gap: 12px; }

.triage-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 5px;
  padding: 15px 17px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.triage-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.triage-pick { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.triage-pick input { width: 17px; height: 17px; cursor: pointer; }
.triage-pick .c-tag { font-size: 15px; }

.triage-reason { font-size: 12.5px; color: var(--warn); font-weight: 550; }
.triage-legacy { font-size: 12px; margin-left: auto; }

.triage-orig summary {
  font-size: 12.5px;
  color: var(--ink-3);
  cursor: pointer;
  padding: 4px 0;
}

.triage-orig summary:hover { color: var(--accent); }

.triage-orig .kv {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 4px;
  font-size: 12.5px;
  grid-template-columns: 110px 1fr;
}

.triage-orig .kv dd { font-family: var(--f-data); color: var(--ink-2); }

.fixgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px 13px;
}

.fixgrid .input { font-size: 13.5px; padding: 7px 9px; }

.triage-actions { display: flex; gap: 9px; }
.triage-actions .btn { padding: 8px 15px; font-size: 13.5px; }

@media (max-width: 760px) {
  .fixgrid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .fixgrid { grid-template-columns: 1fr; }
  .triage-legacy { margin-left: 0; }
}

@media (max-width: 960px) {
  .tiles  { grid-template-columns: repeat(2, 1fr); }
  .cols   { grid-template-columns: 1fr; gap: 22px; }
  .detail { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .tiles { grid-template-columns: 1fr; }
  .filterform { margin-left: 0; width: 100%; }
  .search { flex: 1; min-width: 0; }
}


/* ---------------------------------------------------------------- theme switch */

.menu-appearance { padding: 8px 10px 10px; }

.menu-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 2px 2px 7px;
}

.themeseg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.themebtn {
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: 4px;
  padding: 6px 4px;
  cursor: pointer;
}

.themebtn:hover { color: var(--ink); }

.themebtn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow);
}

.themebtn:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---------------------------------------------------------------- mobile */

@media (max-width: 640px) {
  /* The header was three stacked rows — brand, nav, account — eating ~150px
     before any content. Now the brand and account share the top row and the
     navigation is a swipeable strip beneath, roughly half the height. */
  .appbar { padding: 9px 14px; gap: 8px 10px; }
  .appbar .brand { order: 0; margin-right: auto; }
  .whomenu { order: 1; }
  .nav {
    order: 2;
    flex-basis: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -14px;
    padding: 2px 14px;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; white-space: nowrap; }

  .wrap { padding: 0 14px 56px; }
  .page-title { font-size: 20px; }

  /* iOS zooms the whole page when a focused field is smaller than 16px, which
     lurches the layout on every filter or form tap. Every text control is
     bumped to 16px on a phone to stop it. */
  .input, .select, .search,
  input, select, textarea { font-size: 16px; }

  /* Filters become one horizontal strip pulled to the screen edges, instead of
     wrapping into a tall block. */
  .chipscroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -14px;
    padding: 0 14px 2px;
  }
  .chipscroll::-webkit-scrollbar { display: none; }
  .chipscroll .chip { flex: none; white-space: nowrap; }

  /* A comfortable touch height on the small controls. */
  .chip { min-height: 34px; }

  .tablewrap { -webkit-overflow-scrolling: touch; }

  /* Filter controls in a compact two-column grid under the chips: the two
     dropdowns share a row, search spans the width, actions share the last row.
     Column-stacking every control made the toolbar taller than the table. */
  .filterform {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    margin-left: 0;
  }
  .filterform .select,
  .filterform .search,
  .filterform .chip,
  .filterform .btn { width: 100%; min-width: 0; }
  .filterform .search { grid-column: 1 / -1; }
}

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