/* ACS "operations ledger" design system, shared with Time Audit (samsara-time-audit/public/css/tokens.css + ui.css):
   warm paper neutrals, a petrol accent, brick for problems; soft 6/8px corners, hairline rules, no shadows.
   IBM Plex Sans for text, Plex Mono for numbers and dates. Text colours meet 4.5:1 on their backgrounds.
   Keep the tokens in step with Time Audit's so the two apps look like one family. */
:root {
  color-scheme: light;
  --bg: #f3f2ef;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --surface-3: #ecebe6;
  --line: #dedbd4;
  --line-strong: #b9b4aa;
  --field-line: #8a8579;  /* form field borders: 3:1 against the page and panels (WCAG 1.4.11) */
  --ink: #1c1e20;
  --ink-2: #474a4f;
  --muted: #5f6266;
  --accent: #0b5f73;
  --accent-hover: #084b5b;
  --accent-tint: #e2eff1;
  --accent-ink: #ffffff;
  --review: #a3301c;  --review-tint: #f8e8e3;
  --warn: #7f4f00;    --warn-tint: #faefd9;
  --ok: #2d6a38;      --ok-tint: #e5efe5;
  --info: #0b5f73;    --info-tint: #e2eff1;
  --neutral-tint: #efeee9;
  --chart-ok: #4a9a86; --chart-warn: #f2b84b; --chart-bad: #a3201c;

  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-16: 16px; --fs-20: 20px; --fs-28: 28px; --fs-40: 40px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;
  --r: 6px; --r-2: 8px; --r-sm: 4px;
  --row-h: 38px; --cell-pad: 6px;
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}
/* Row density (Display menu): Comfortable / Compact. */
:root[data-density="compact"] { --row-h: 28px; --cell-pad: 2px; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121416; --surface: #1a1d20; --surface-2: #1f2326; --surface-3: #282c30; --line: #2f3439; --line-strong: #454b52; --field-line: #6c737b;
    --ink: #e9e7e2; --ink-2: #bcb9b1; --muted: #a09d95;
    --accent: #66b8ca; --accent-hover: #8dcbd8; --accent-tint: #14292e; --accent-ink: #0d1517;
    --review: #f0907b; --review-tint: #381d17; --warn: #e2b660; --warn-tint: #31270f; --ok: #87c48f; --ok-tint: #17291b;
    --info: #8dcbd8; --info-tint: #14292e; --neutral-tint: #24282c;
    --chart-ok: #2b7a69; --chart-warn: #f5cd6a; --chart-bad: #f06a52;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121416; --surface: #1a1d20; --surface-2: #1f2326; --surface-3: #282c30; --line: #2f3439; --line-strong: #454b52; --field-line: #6c737b;
  --ink: #e9e7e2; --ink-2: #bcb9b1; --muted: #a09d95;
  --accent: #66b8ca; --accent-hover: #8dcbd8; --accent-tint: #14292e; --accent-ink: #0d1517;
  --review: #f0907b; --review-tint: #381d17; --warn: #e2b660; --warn-tint: #31270f; --ok: #87c48f; --ok-tint: #17291b;
  --info: #8dcbd8; --info-tint: #14292e; --neutral-tint: #24282c;
  --chart-ok: #2b7a69; --chart-warn: #f5cd6a; --chart-bad: #f06a52;
}

/* ---- base ---------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { font: 400 var(--fs-14)/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1 { font-size: var(--fs-20); font-weight: 600; margin: 0; }
h2 { font-size: var(--fs-16); font-weight: 600; margin: var(--s-2) 0 0; }
h3 { font-size: var(--fs-13); font-weight: 600; margin: 0; }
p { margin: 0 0 var(--s-2); }
a { color: var(--accent); text-underline-offset: 2px; }
/* The ring is a box-shadow; the transparent outline is what shows in Windows high-contrast mode, which drops shadows. */
:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--focus); }
html { scroll-padding-top: 64px; }  /* anything scrolled to or focused stays clear of the sticky app bar */
main:focus { outline: none; box-shadow: none; }
.skip { position: absolute; left: var(--s-3); top: -60px; z-index: 50; padding: 8px 14px; border-radius: var(--r); background: var(--surface);
  color: var(--accent); font-weight: 600; border: 2px solid var(--accent); text-decoration: none; }
.skip:focus { top: var(--s-2); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.small { font-size: var(--fs-12); }
code { font: 500 var(--fs-12) var(--mono); background: var(--surface-3); padding: 1px 4px; border-radius: var(--r-sm); }
pre { font: 12px/1.5 var(--mono); white-space: pre-wrap; margin: 6px 0 0; }
details summary { cursor: pointer; }

/* ---- app bar (dark ledger header) ---------------------------------------------------------- */
.devstrip { background: var(--warn-tint); color: var(--warn); text-align: center; padding: 3px; font-size: var(--fs-12); font-weight: 500;
  border-bottom: 1px solid var(--line); }
/* An Admin signed in as someone: who, and the way back. Blue while view only; red-edged with full access. */
.asbar { display: flex; align-items: center; justify-content: center; gap: var(--s-2) var(--s-4); flex-wrap: wrap; padding: 6px var(--s-4);
  background: var(--info-tint); color: var(--ink); border-bottom: 2px solid var(--accent); font-size: var(--fs-13); }
.asbar p { margin: 0; }
.asbar.full { background: var(--review-tint); border-bottom-color: var(--review); }
.appbar { position: sticky; top: 0; z-index: 20; height: 52px; display: flex; align-items: stretch; gap: var(--s-5); padding: 0 var(--s-5);
  background: #1c1e20; color: #e9e7e2; border-bottom: 1px solid #000; }
:root[data-theme="dark"] .appbar { background: #0c0d0e; }
/* ACS logo (white on transparent) with the product name in small capitals under it, starting under the lettering. */
.wordmark { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; margin-right: var(--s-3);
  color: inherit; text-decoration: none; white-space: nowrap; }
.wordmark .logo { display: block; height: 24px; width: auto; }
.wordmark .name { font-size: 10px; font-weight: 600; line-height: 1; letter-spacing: .2em; text-transform: uppercase; color: #9d9a93; padding-left: 46px; }
.tabs { display: flex; align-items: stretch; gap: 2px; flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.wordmark, .appbar .right { flex: none; }
.tabs a { display: flex; align-items: center; gap: 8px; padding: 0 14px; color: #bdbab3; text-decoration: none; font-weight: 500;
  border-bottom: 3px solid transparent; border-top: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.tabs a[aria-current="page"] { color: #fff; border-bottom-color: #66b8ca; }
.tabs a:focus-visible { box-shadow: inset 0 0 0 2px #66b8ca; outline-offset: -2px; }  /* inside the tab: the strip scrolls and would clip it */
.tabs .n { font-family: var(--mono); font-size: var(--fs-12); color: #1c1e20; background: #e2b660; padding: 0 6px; border-radius: 999px; }
.appbar .right { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.appbar .who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; font-size: var(--fs-12); color: #bdbab3; }
.appbar .who b { color: #e9e7e2; font-weight: 500; font-size: var(--fs-13); }
.initials { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-12); font-weight: 600;
  background: #3a3e43; color: #e9e7e2; text-decoration: none; flex: none; }
.appbar form { margin: 0; }
.barbtn { height: 34px; min-width: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid #5a5e63; border-radius: var(--r); background: none; color: #d8d6d0; cursor: pointer; font: 500 var(--fs-13) var(--font); }
.barbtn:hover, details[open] > .barbtn { background: rgba(255, 255, 255, .08); color: #fff; }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* The Display and account menus: a <details> in the app bar, its menu dropping below it. */
.anchor { position: relative; display: flex; align-items: center; }
details.display > summary, details.account > summary { list-style: none; border-color: transparent; }
details.display > summary::-webkit-details-marker, details.account > summary::-webkit-details-marker { display: none; }
details.account > summary { height: 40px; gap: 8px; padding: 0 6px 0 10px; }
details.account .caret { width: 14px; height: 14px; color: #9d9a93; }
.menu nav { display: flex; flex-direction: column; }
details.account .menu a { padding: 8px 10px; }
.menu form { margin: 0; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-2); box-shadow: 0 4px 14px rgba(0, 0, 0, .18); padding: 4px; }
.menu .label { padding: 8px 10px 4px; font-size: var(--fs-12); color: var(--muted); }
.menu button { width: 100%; height: auto; display: flex; gap: var(--s-2); align-items: center; justify-content: flex-start; padding: 8px 10px;
  border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; text-align: left; color: var(--ink); font-weight: 400; }
.menu button:hover { background: var(--surface-3); border: 0; }
.menu button[aria-pressed="true"]::after { content: "\2713"; margin-left: auto; color: var(--accent); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---- page ---------------------------------------------------------------------------------- */
.page { padding: var(--s-5) var(--s-6) var(--s-7); display: flex; flex-direction: column; gap: var(--s-4); max-width: 1440px; margin: 0 auto; }
.page > h2 { margin-top: var(--s-3); }
.page-head { display: flex; align-items: flex-end; gap: var(--s-4); flex-wrap: wrap; }
.page-head .t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.page-head .eyebrow { font-size: var(--fs-12); color: var(--muted); }
.page-head .tools { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
h1 .muted.small, h1 .small { font-weight: 400; margin-left: 6px; }
/* One certification's sections (Overview, Certificate…): underlined tabs on a hairline, scrolling sideways on phones. */
.pagetabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.pagetabs a { padding: 8px 12px; color: var(--ink-2); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.pagetabs a:hover { color: var(--ink); }
.pagetabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.pagetabs a:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); outline-offset: -2px; }
.pagetabs .n { font: var(--fs-12) var(--mono); color: var(--muted); margin-left: 4px; }

/* Admin pages: a sub-navigation down the left, like Time Audit's Settings. */
.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s-5); align-items: start; }
.settings > .content { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }
/* The admin sidebar: Overview, then each group under a heading that reads as one (sentence case, semibold, dark ink,
   a hairline and room above it, as GitHub's Primer and Atlassian now do), never as a faint, disabled-looking label. */
.subnav { display: flex; flex-direction: column; border-left: 1px solid var(--line); position: sticky; top: 76px; }
.subnav ul, .subnav-menu ul { list-style: none; margin: 0; padding: 0; }
.subnav .navhead { margin: 18px 0 4px; padding: 14px 14px 0; border-top: 1px solid var(--line);
  font: 600 var(--fs-13)/1.3 var(--font); color: var(--ink); letter-spacing: 0; text-transform: none; }
.subnav a { display: block; padding: 7px 14px; color: var(--ink-2); text-decoration: none; font-weight: 400; margin-left: -1px; border-left: 2px solid transparent; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); border-left-color: var(--accent); font-weight: 600; }

/* ---- banners (alerts) ---------------------------------------------------------------------- */
.alert, .banner { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-2); border: 1px solid; }
.alert > *, .banner > * { margin: 0; }
.alert.err { background: var(--review-tint); border-color: var(--review); color: var(--ink); }
.alert.err::before { content: ""; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--review); flex: none; }
.alert.ok { background: var(--ok-tint); border-color: var(--ok); color: var(--ink); }
.alert.info { background: var(--info-tint); border-color: var(--accent); color: var(--ink); }
.alert.warn { background: var(--warn-tint); border-color: var(--warn); color: var(--ink); }
.alert { flex-wrap: wrap; }
.flashes { display: flex; flex-direction: column; gap: var(--s-2); }
/* After a submit with errors: one summary that takes focus and links to each field, and the message at the field. */
.error-summary { border: 3px solid var(--review); border-radius: var(--r-2); background: var(--surface); padding: var(--s-3) var(--s-4); }
.error-summary h2 { margin: 0 0 var(--s-2); font-size: var(--fs-16); }
.error-summary ul { margin: 0; padding-left: 18px; }
.error-summary a { color: var(--review); font-weight: 600; }
.field-error { color: var(--review); font-weight: 600; font-size: var(--fs-13); }
[aria-invalid="true"] { border-color: var(--review); box-shadow: inset 0 0 0 1px var(--review); }
[role="group"][aria-invalid="true"] { border: 2px solid var(--review); }
.alert form.inline { margin-left: auto; }

/* ---- controls ------------------------------------------------------------------------------ */
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--field-line); border-radius: var(--r); }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select:not([size]):not([multiple]) { height: 34px; padding: 0 10px; }
select[size], select[multiple] { padding: 4px; }
input[type=file] { padding: 5px 8px; max-width: 100%; }
input[type=file]::file-selector-button { font: 500 var(--fs-13) var(--font); height: 26px; padding: 0 10px; margin-right: 10px; cursor: pointer;
  border: 1px solid var(--field-line); border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink); }
textarea { padding: 8px 10px; }
input[type=checkbox], input[type=radio] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); vertical-align: -2px; }
button, .btn { height: 34px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: var(--r);
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: 500 var(--fs-14) var(--font); cursor: pointer;
  white-space: nowrap; text-decoration: none; }
button:hover, .btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.secondary, .btn.secondary { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
button.secondary:hover, .btn.secondary:hover { background: var(--surface-3); }
button.danger, .btn.danger { border-color: var(--review); background: var(--surface); color: var(--review); }
button.danger:hover { background: var(--review-tint); }
button.small, .btn.small { height: 28px; padding: 0 10px; font-size: var(--fs-13); }
button[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.filters { display: flex; gap: var(--s-2) var(--s-3); flex-wrap: wrap; align-items: flex-end; }
.filters label, .field { display: flex; flex-direction: column; font-size: var(--fs-12); color: var(--ink-2); gap: 4px; font-weight: 500; }
.filters label > span { display: inline-flex; align-items: center; gap: 6px; height: 34px; font-size: var(--fs-13); font-weight: 400; }
.filters.choices { align-items: flex-start; gap: var(--s-4); }
.filters label > span.note { height: auto; }
.stack { display: flex; flex-direction: column; gap: var(--s-2); }
.sheet-head h2 { margin: 0; }
/* A box of tick boxes (job titles, attendees, certifications) that flows into columns and scrolls. */
.picker { columns: 240px; column-gap: var(--s-4); margin-top: 6px; max-height: 320px; overflow: auto; border: 1px solid var(--line);
  border-radius: var(--r); padding: var(--s-2); }
.picker.people { columns: 280px; max-height: 420px; }
.picker label { break-inside: avoid; }
/* Voided records: muted text and the strike-through (not opacity, which drops below readable contrast). */
tr.void td, tr.void td a { color: var(--muted); }
/* Small toggles ("Edit…", "Needs this again…") get a 24px target (WCAG 2.5.8) and room from what's next to them. */
summary.small { line-height: 24px; min-height: 24px; }
td details + details, td form + details, td details + form { margin-top: 4px; }
.row-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
/* Import check: the counts before anything is written. */
.kpi { padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface); }
.kpi .v { font: 500 var(--fs-28)/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.kpi .l { font-size: var(--fs-12); color: var(--ink-2); }
.kpi.ok .v { color: var(--ok); } .kpi.bad .v { color: var(--review); } .kpi.warn .v { color: var(--warn); }
/* A person's page: where they stand, what needs doing, and the add form behind one button. */
.standing { display: flex; flex-direction: column; gap: var(--s-2); }
.standing-line { margin: 0; font-size: var(--fs-14); }
.todo-h { font-size: var(--fs-13); margin: var(--s-2) 0 0; }
.todo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.todo li { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ok-text { color: var(--ok); margin: 0; }
td.wrap { white-space: normal; }
.cell-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
/* The add form: closed, a button (with +); open, the form's title row (with × to close), so the only button inside
   is the one that sends it. Disclosures that only show more (Individual requirements, More details) keep the ▸. */
details.addform > summary { list-style: none; display: flex; align-items: center; gap: 8px; }
details.addform > summary::-webkit-details-marker { display: none; }
details.addform:not([open]) { background: none; border: 0; padding: 0; }
details.addform:not([open]) > summary { width: fit-content; height: 34px; padding: 0 14px; border: 1px solid var(--accent); border-radius: var(--r);
  background: var(--accent); color: var(--accent-ink); font-size: var(--fs-14); font-weight: 500; }
details.addform:not([open]) > summary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
details.addform[open] > summary { font-size: var(--fs-16); font-weight: 600; padding-bottom: var(--s-3); margin-bottom: var(--s-3);
  border-bottom: 1px solid var(--line); }
details.addform[open] > summary .plus, details.addform:not([open]) > summary .x { display: none; }
details.addform > summary .x { margin-left: auto; width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--r-sm);
  color: var(--ink-2); }
details.addform > summary .x .icon { width: 18px; height: 18px; }
details.addform[open] > summary:hover .x { background: var(--surface-3); color: var(--ink); }
details.more > summary { color: var(--accent); font-weight: 500; margin: var(--s-3) 0 var(--s-2); }
.field.upload { gap: 6px; }
.addform .evaluation { margin-top: var(--s-3); }  /* a certification where each person is evaluated */
.field.upload .camera { align-self: flex-start; }
@media (hover: hover) and (pointer: fine) { .field.upload .camera { display: none; } }  /* no camera to open: Choose File does it */
.preview { max-width: 180px; max-height: 140px; object-fit: cover; border: 1px solid var(--line); border-radius: var(--r); }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s-3); align-items: end; }
.formgrid .field input, .formgrid .field select { width: 100%; }
label.role, label.attendee { display: block; }

/* ---- sheets (surfaces) --------------------------------------------------------------------- */
.panel, .sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); }
.panel { padding: var(--s-4); }
.panel > h2:first-child, .panel > input[type=hidden]:first-child + h2, .panel > b:first-child { display: block; margin: 0 0 var(--s-3); font-size: var(--fs-14); font-weight: 600; }
details.panel > summary { font-weight: 500; }
.sheet { overflow: hidden; }
.sheet-head { display: flex; align-items: center; gap: var(--s-3); padding: 10px var(--s-4); border-bottom: 1px solid var(--line); min-height: 48px; flex-wrap: wrap; }
.sheet-head .tools { margin-left: auto; display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }  /* phones: onto two lines */
.sheet-head .tools .record { white-space: normal; height: auto; min-height: 28px; padding-block: 4px; text-align: left; }
.sheet-body { padding: var(--s-4); }
.grid { display: grid; gap: var(--s-4); }
.kpis { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: var(--s-4); align-items: start; }
/* Dashboard: the headline figure and the per-department breakdown side by side, the same height. */
.overview { display: grid; grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); gap: var(--s-4); align-items: stretch; }
.overview .hero { align-content: center; }
/* A row of filters: fields share the width evenly, the buttons sit at the end. */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3); }
.toolbar label { flex: 1 1 150px; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-12); font-weight: 500; color: var(--ink-2); }
.toolbar label select, .toolbar label input { width: 100%; }
.toolbar .actions { display: flex; gap: var(--s-2); flex: none; }
form[aria-busy="true"], [data-live][aria-busy="true"] { opacity: .6; cursor: progress; transition: opacity .15s .15s; }

/* The one number that matters (dashboard), then the facts that explain it. */
.hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-3) var(--s-6); align-items: end; padding: var(--s-5) var(--s-5) var(--s-4); }
.hero .big { font: 600 var(--fs-40)/1 var(--font); letter-spacing: -.02em; }
.hero .big small { font-size: var(--fs-16); font-weight: 500; color: var(--ink-2); letter-spacing: 0; margin-left: 8px; }
.hero .bar { height: 6px; border-radius: 3px; overflow: hidden; background: var(--surface-3); position: relative; }
.hero .bar > i { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.hero .bar-label { display: flex; justify-content: space-between; font-size: var(--fs-12); color: var(--ink-2); margin-bottom: 6px; }
.facts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--s-2) 0; border-top: 1px solid var(--line); margin-top: var(--s-2); padding-top: var(--s-3); }
.facts > * { padding: 0 var(--s-5) 0 0; margin-right: var(--s-5); border-right: 1px solid var(--line); }
.facts > *:last-child { border-right: 0; }
/* Each figure opens the list it counts; the one showing is underlined in the accent (a border, which high-contrast
   mode keeps). */
.facts > a { color: inherit; text-decoration: none; border-bottom: 2px solid transparent; padding-bottom: 2px; }
.facts > a:hover .k { color: var(--accent); text-decoration: underline; }
.facts > a[aria-current] { border-bottom-color: var(--accent); }
.facts > a[aria-current] .k { color: var(--ink); font-weight: 600; }
.facts .k { font-size: var(--fs-12); color: var(--ink-2); }
.facts .v { font: 500 var(--fs-16)/1.3 var(--mono); }
.facts .v.review { color: var(--review); } .facts .v.warn { color: var(--warn); }
.facts .v.sans { font-family: var(--font); font-size: var(--fs-14); }  /* names and places, not figures */

/* Per-department bars. */
.bars .sheet-body { padding-top: 4px; padding-bottom: 8px; }
.bars .row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(80px, 1fr) 52px 12px; gap: var(--s-3); align-items: center;
  margin: 0 calc(-1 * var(--s-2)); padding: 5px var(--s-2); border-bottom: 1px solid var(--line); font-size: var(--fs-13); }
.bars .row:last-child { border-bottom: 0; }
.bars .row .pct { font-family: var(--mono); text-align: right; }
/* A department's bar filters the list to it; the one picked is tinted with a bar down its side (which forced-colors
   mode keeps), and its × shows them all again. */
.bars a.row { color: inherit; text-decoration: none; border-radius: var(--r-sm); }
.bars a.row:hover { background: var(--surface-3); }
.bars a.row[aria-current] { background: var(--accent-tint); border-left: 3px solid var(--accent); padding-left: calc(var(--s-2) - 3px); }
.bars a.row[aria-current] .name { font-weight: 600; }
.bars .go { color: var(--muted); text-align: center; }
.bars a.row:hover .go, .bars a.row[aria-current] .go { color: var(--ink); }
.bars .track { height: 5px; border-radius: 3px; overflow: hidden; background: var(--surface-3); }
.bars .fill { height: 100%; background: var(--chart-ok); }
.bars .fill.mid { background: var(--chart-warn); } .bars .fill.low { background: var(--chart-bad); }

/* ---- Org chart: one team at a time (the reporting line, the manager and their branch's totals, then cards for
   the managers under them and their other people), with an outline of every team beside it. Status always has a word
   or a mark (the dashboard grid's ✕ ○ … !) as well as its colour. */
.org-filters { margin: var(--s-3) 0; }
.org-filters input[type=search] { width: 220px; }
.org-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); gap: var(--s-4); align-items: start; }
.org-main { min-width: 0; }
.org-side { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; }
.org-side .sheet-body { padding: var(--s-2) var(--s-3) var(--s-3); }
.org-h { display: flex; align-items: baseline; gap: var(--s-2); flex-wrap: wrap; margin: var(--s-4) 0 var(--s-3); font-size: var(--fs-14); }
.org-h .count { font: 500 var(--fs-13) var(--mono); color: var(--muted); }
/* The team hangs off the manager above it: a stem down from their card to a bracket over the cards. */
.org-team { position: relative; margin-top: var(--s-6); padding-top: var(--s-1); border-top: 2px solid var(--line-strong);
  border-radius: 10px 10px 0 0; }
.org-team > .stem { position: absolute; left: 50%; top: calc(-1 * var(--s-6) - 2px); height: var(--s-6); border-left: 2px solid var(--line-strong); }
.org-team > .org-h:first-of-type { margin-top: var(--s-3); }

.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface-3); color: var(--ink-2); font: 600 var(--fs-12)/1 var(--font); letter-spacing: .03em; }
.avatar.lg { width: 56px; height: 56px; font-size: var(--fs-16); background: var(--accent-tint); color: var(--accent); }
.meter { display: block; height: 6px; border-radius: 3px; overflow: hidden; background: var(--surface-3); }
.meter > span { display: block; height: 100%; background: var(--chart-ok); }
.meter > span.mid { background: var(--chart-warn); } .meter > span.low { background: var(--chart-bad); }

.crumbs ol { list-style: none; margin: 0 0 var(--s-2); padding: 0; display: flex; flex-wrap: wrap; gap: 2px 6px; font-size: var(--fs-13); }
.crumbs li + li::before { content: "›"; color: var(--muted); margin-right: 6px; }
.crumbs [aria-current] { font-weight: 600; }

.focus { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s-4) var(--s-6); padding: var(--s-4) var(--s-5); }
.focus-id { display: flex; gap: var(--s-3); align-items: flex-start; min-width: 0; }
.focus-id h2 { margin: 0; font-size: var(--fs-20); line-height: 1.25; }
.focus-id h2 a { color: var(--ink); text-decoration: none; } .focus-id h2 a:hover { text-decoration: underline; }
.focus-own { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--s-2); margin-top: var(--s-3); }
.focus-stats { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.focus-stats .big { font: 600 var(--fs-28)/1.1 var(--mono); }
.most { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: var(--s-3); }
.most ul { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 4px var(--s-5); }
.most li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); padding: 5px 0; border-bottom: 1px solid var(--line); }
.most li .small { display: flex; gap: var(--s-3); flex: none; }

.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(232px, 100%), 1fr)); gap: var(--s-3); }
.pcards.mcards { grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); padding: var(--s-3);
  display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; scroll-margin-top: 72px; }
.pcard:target { outline: 2px solid var(--accent); outline-offset: 1px; }
.pc-head { display: flex; gap: var(--s-2); align-items: center; min-width: 0; }
.pc-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.pc-name { font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.pc-name:hover { color: var(--accent); text-decoration: underline; }
.pc-title { font-size: var(--fs-12); color: var(--muted); overflow-wrap: anywhere; }
.pc-status { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-13); }
.pc-status .badge { white-space: normal; }
.pills { list-style: none; margin: 0; padding: 0 0 0 1px; display: flex; flex-direction: column; gap: 1px; font-size: var(--fs-12); color: var(--ink-2); }
.pills .more { padding-left: 18px; }
.mk { display: inline-block; width: 18px; font-weight: 700; }
.mk-expired, .mk-missing { color: var(--review); } .mk-pending, .mk-expiring { color: var(--warn); }
.pc-branch { border-top: 1px solid var(--line); padding-top: var(--s-2); display: flex; flex-direction: column; gap: 6px; }
.pc-own { display: flex; align-items: baseline; gap: var(--s-2); flex-wrap: wrap; }
.pc-go { margin-top: auto; }
.pc-pct .num { font: 600 var(--fs-16) var(--mono); }
.pc-gaps { display: flex; flex-wrap: wrap; gap: 2px var(--s-3); font-size: var(--fs-12); }
.pcard .pc-go { align-self: flex-start; }

/* The Teams outline: managers only, joined by lines; +/− opens a level. */
.teams, .teams ul { list-style: none; margin: 0; padding: 0; font-size: var(--fs-13); }
.teams ul { margin-left: 9px; }
.teams li { position: relative; }
.teams ul > li { padding-left: 14px; border-left: 1px solid var(--line-strong); }
.teams ul > li:last-child { border-left-color: transparent; }
.teams ul > li::before { content: ""; position: absolute; left: -1px; top: 0; width: 12px; height: 16px;
  border: solid var(--line-strong); border-width: 0 0 1px 1px; border-bottom-left-radius: 6px; }
.teams summary { list-style: none; cursor: pointer; }
.teams summary::-webkit-details-marker { display: none; }
.trow { display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 2px 6px 2px 0; border-radius: var(--r-sm); }
.trow.here { background: var(--accent-tint); }
.trow .tog { width: 16px; height: 16px; flex: none; display: grid; place-items: center; border-radius: 50%; font: 600 12px/1 var(--mono); color: var(--muted); }
.teams summary .tog { border: 1px solid var(--line-strong); }
.teams summary .tog::before { content: "+"; }
.teams details[open] > summary .tog::before { content: "−"; }
.teams .leaf .tog::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); }
.teams summary:hover .tog { color: var(--ink); border-color: var(--ink-2); }
.trow a { flex: 1 1 auto; min-width: 0; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow a:hover { text-decoration: underline; }
.trow a[aria-current] { font-weight: 600; color: var(--accent); }
.trow .meter { width: 40px; height: 4px; flex: none; }
.trow .num { font: 500 var(--fs-12) var(--mono); min-width: 3.4em; text-align: right; color: var(--ink-2); flex: none; }

@media (max-width: 1000px) {
  .org-layout { grid-template-columns: minmax(0, 1fr); }
  .org-side { position: static; max-height: none; }
}
@media (max-width: 760px) {
  .focus { grid-template-columns: minmax(0, 1fr); padding: var(--s-4); }
  .org-filters input[type=search] { width: 100%; }
}

/* ---- status marks (dot + text, never colour alone) ----------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; white-space: nowrap; color: var(--ink-2); }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--line-strong); }
.b-compliant, .b-verified, .b-ok, .b-sent { color: var(--ok); } .b-compliant::before, .b-verified::before, .b-ok::before, .b-sent::before { background: var(--ok); }
.b-expiring, .b-pending, .b-duplicate, .b-deactivate, .b-warning, .b-queued { color: var(--warn); }
.b-expiring::before, .b-pending::before, .b-duplicate::before, .b-deactivate::before, .b-warning::before, .b-queued::before { background: var(--warn); }
.b-pending::before, .b-queued::before { background: none; border: 1.5px solid currentColor; }
.b-expired, .b-missing, .b-rejected, .b-error, .b-failed, .b-deactivation_aborted { color: var(--review); }
.b-expired::before, .b-missing::before, .b-rejected::before, .b-error::before, .b-failed::before, .b-deactivation_aborted::before { background: var(--review); }
.b-not_yet_due, .b-skip, .b-running, .b-discarded { color: var(--muted); }
.b-not_yet_due::before, .b-skip::before, .b-running::before, .b-discarded::before { background: none; border: 1.5px solid currentColor; }
.flag, .tag { display: inline-block; font: 500 var(--fs-11)/1 var(--mono); padding: 3px 6px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; vertical-align: 1px; }

/* ---- ledger tables ------------------------------------------------------------------------- */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-12); font-weight: 600; text-align: left;
  padding: 0 var(--s-3); height: 34px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { padding: var(--cell-pad) var(--s-3); min-height: var(--row-h); height: var(--row-h); border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td a { font-weight: 500; }
.panel table td, .panel table th { padding-left: 6px; padding-right: 6px; }
.pager { display: flex; align-items: center; gap: var(--s-2); padding: 8px var(--s-4); color: var(--ink-2); font-size: var(--fs-13); }
.pager .tools { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pager .page-n { min-width: 30px; padding: 0 8px; }
.pager .gap { padding: 0 4px; color: var(--muted); }

/* Compliance over time under the headline: a small area chart from the daily snapshots (2px line, a 10% wash, solid
   hairline grid at 0/50/100%, a dot per day while there are few, a crosshair and readout on hover or focus), and how
   far it moved; and each department's change in 30 days as an extra column on its bar. */
.hero .trend { margin: 2px 0 0; padding: 8px 6px 0 0; outline-offset: 2px; border-radius: var(--r); }  /* room for 100% and the end dot */
.tc { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; }
.tc-y { position: relative; width: 34px; font-size: var(--fs-12); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tc-y span { position: absolute; right: 0; transform: translateY(-50%); line-height: 1; }
.tc-plot { position: relative; height: 72px; cursor: crosshair; touch-action: pan-y; }
.tc-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tc-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); }
.tc-grid.base { border-color: var(--line-strong); }
.tc-area { fill: var(--accent); fill-opacity: .1; }
.tc-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round;
  vector-effect: non-scaling-stroke; }
.tc-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface); transform: translate(-50%, -50%); pointer-events: none; }
.tc-dot.tc-on { width: 10px; height: 10px; }
.tc-cross { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--line-strong); pointer-events: none; }
.tc-tip { position: absolute; top: 50%; margin-left: 10px; transform: translateY(-50%); white-space: nowrap; pointer-events: none;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 4px 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .14); font-size: var(--fs-12); color: var(--ink-2); z-index: 2; }
.tc-tip b { color: var(--ink); font-size: var(--fs-14); margin-right: 6px; font-variant-numeric: tabular-nums; }
.tc-tip.right { margin-left: -10px; transform: translate(-100%, -50%); }  /* past the middle: on the crosshair's left */
.tc-x { grid-column: 2; display: flex; justify-content: space-between; margin-top: 6px; }
.hero .delta { margin-top: 8px; }  /* the change, under the headline figure */
.bars.with-change .row { grid-template-columns: minmax(110px, 1fr) minmax(60px, 1fr) 52px 48px 12px; }
.bars .chg { font: 500 var(--fs-12) var(--mono); text-align: right; color: var(--muted); white-space: nowrap; }
.bars .row .name { overflow-wrap: anywhere; }  /* "Service/Maintenance" on a phone */
.bars .chg.up { color: var(--ok); }
.bars .chg.down { color: var(--review); }

/* Setup left to do (Admin › Overview's checklist), one line above the dashboard. */
.setup-left { margin: 0 0 var(--s-3); }
/* Coming up with only a few weeks that have any: those weeks as a short list. */
.few-weeks { list-style: none; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); }
.few-weeks a { text-decoration: none; }
.few-weeks a:hover { text-decoration: underline; }
.few-weeks a[aria-current] { font-weight: 600; text-decoration: underline; }
/* The dashboard's filters used now and then, behind "More filters" (they open by themselves when one is set). */
.toolbar .more-filters { flex: 1 1 100%; order: 10; }
.toolbar .more-filters > summary { cursor: pointer; font-size: var(--fs-13); color: var(--ink-2); width: max-content; }
.toolbar .more-filters .more { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-2); }
.toolbar .actions { order: 5; }
/* By certification: the counts line up. */
table.cert-groups td.num .badge { justify-content: flex-end; }

/* Coming up: a column per week for the next 13 weeks (count on top, week below), across the overview. */
.overview > .coming { grid-column: 1 / -1; }
.weeks { display: grid; grid-template-columns: repeat(13, minmax(40px, 1fr)); gap: 4px; align-items: end; overflow-x: auto;
  padding-top: var(--s-2); padding-bottom: var(--s-2); }
.wk { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 2px; border-radius: var(--r-sm);
  color: inherit; text-decoration: none; border-bottom: 2px solid transparent; }
a.wk:hover { background: var(--surface-3); }
a.wk:hover .lbl { color: var(--accent); text-decoration: underline; }
a.wk[aria-current] { background: var(--accent-tint); border-bottom-color: var(--accent); }
.wk .n { font: 500 var(--fs-13)/1 var(--mono); }
div.wk .n { color: var(--muted); }
.wk .col { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 48px; }
.wk .col i { display: block; width: min(24px, 70%); min-height: 2px; background: var(--chart-warn); border-radius: 2px 2px 0 0; }
a.wk[aria-current] .col i { background: var(--accent); }
.wk .lbl { font-size: var(--fs-11); color: var(--muted); white-space: nowrap; }

/* The dashboard's List / Grid switch, and the Grid: people against their required certifications. Names stay in
   view while the certifications scroll sideways; a cell is a mark (its shape gives the status, not just its colour)
   and the date that matters. */
.views { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; }
.views a { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; font-size: var(--fs-13); font-weight: 500;
  color: var(--ink-2); text-decoration: none; }
.views a + a { border-left: 1px solid var(--line-strong); }
.views a:hover { background: var(--surface-3); }
.views a[aria-current] { background: var(--accent); color: var(--accent-ink); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0; padding: 6px var(--s-3); border-bottom: 1px solid var(--line); color: var(--ink-2); }
.legend > span { padding: 3px 6px; }
/* Each status in the legend shows only people with one in that state; the one showing has an outline. */
.legend a { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid transparent; color: var(--ink-2); text-decoration: none; }
.legend a:hover { background: var(--surface-3); color: var(--ink); text-decoration: underline; }
.legend a[aria-current] { border-color: var(--accent); background: var(--accent-tint); color: var(--ink); font-weight: 600; }
.grid-table th.cert { white-space: normal; min-width: 88px; max-width: 140px; height: auto; padding-block: 6px; line-height: 1.2;
  vertical-align: bottom; text-align: center; }
.grid-table thead th:first-child { left: 0; z-index: 2; border-right: 1px solid var(--line); }
.grid-table tbody th { position: sticky; left: 0; top: auto; z-index: 1; background: var(--surface); color: var(--ink); text-align: left;
  font-size: var(--fs-14); font-weight: 500; height: var(--row-h); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.grid-table tbody th .sub { display: block; font-size: var(--fs-12); font-weight: 400; color: var(--muted); }
.grid-table tbody tr:hover th { background: var(--surface-2); }
.grid-table td.g, .grid-table td.g-na { text-align: center; padding: 0 6px; }
.grid-table td.g a { display: inline-flex; align-items: center; gap: 5px; padding: 2px 6px; border-radius: var(--r-sm); color: inherit;
  text-decoration: none; font: 500 var(--fs-12) var(--mono); white-space: nowrap; }
.grid-table td.g a:hover { text-decoration: underline; }
.mk { font: 700 var(--fs-14)/1 var(--font); }
.g-compliant .mk { color: var(--ok); }
.g-expiring .mk { color: var(--warn); } td.g-expiring a { background: var(--warn-tint); }
.g-expired .mk, .g-missing .mk { color: var(--review); } td.g-expired a, td.g-missing a { background: var(--review-tint); }
.g-pending .mk { color: var(--info); }
.g-not_yet_due, .g-not_yet_due .mk { color: var(--muted); }
/* A person's page opened from a grid cell: that requirement is picked out. */
tr:target td { background: var(--accent-tint); }

/* Audit log: a sentence per entry that opens to its raw details. */
.log { list-style: none; margin: 0; padding: 0; }
.log > li { border-bottom: 1px solid var(--line); }
.log > li:last-child { border-bottom: 0; }
.log summary { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: var(--s-3); align-items: baseline; padding: 9px var(--s-4); cursor: pointer; }
.log summary:hover { background: var(--surface-2); }
.log-detail { margin: 0; padding: 0 var(--s-4) var(--s-3) calc(170px + var(--s-3) + var(--s-4)); display: grid; gap: 2px; }
.log-detail > div { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: var(--s-2); }
.log-detail dt { color: var(--muted); } .log-detail dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 700px) { .log summary { grid-template-columns: minmax(0, 1fr); gap: 2px; } .log-detail { padding-left: var(--s-4); } }

/* Email outbox: the count in each state (each a filter), then one line per email that opens to its text. */
.statetabs { display: flex; flex-wrap: wrap; gap: 6px; }
.statetabs a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--line-strong);
  border-radius: 999px; color: var(--ink-2); text-decoration: none; font-size: var(--fs-13); font-weight: 500; background: var(--surface); }
.statetabs a:hover { background: var(--surface-3); }
.statetabs a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.statetabs .n { font-family: var(--mono); }
.mails { list-style: none; margin: 0; padding: 0; }
.mails > li { border-bottom: 1px solid var(--line); }
.mails > li:last-child { border-bottom: 0; }
.mails summary { display: grid; grid-template-columns: 150px minmax(120px, 1fr) minmax(0, 2fr) auto; gap: var(--s-3); align-items: center;
  padding: 10px var(--s-4); cursor: pointer; }
.mails summary:hover { background: var(--surface-2); }
.mails .to, .mails .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-body { padding: 0 var(--s-4) var(--s-4); display: flex; flex-direction: column; gap: 8px; }
.mail-body p { margin: 0; }
.mail-body iframe { width: 100%; height: 320px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
@media (max-width: 700px) { .mails summary { grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s-3); }
  .mails .when, .mails .to { grid-column: 1 / -1; } }

/* Sign in on a tablet (kiosk): no app bar or menus; big names to tap, and a signature box that doesn't scroll the
   page while someone signs. */
body.kiosk .appbar, body.kiosk .bottombar, body.kiosk .navmenu { display: none !important; }
body.kiosk .page { max-width: 900px; }
.kiosk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); }
.kiosk-head h1 { font-size: var(--fs-28); margin: 2px 0; }
.kiosk-head p { margin: 0; }
.kiosk-lead { font-size: var(--fs-16); margin: 0; }
.names { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s-2); }
.names .name { display: flex; flex-direction: column; justify-content: center; min-height: 64px; padding: 10px var(--s-4); border-radius: var(--r-2);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); text-decoration: none; font-size: var(--fs-16); font-weight: 600; }
.names a.name:hover { border-color: var(--accent); background: var(--accent-tint); }
.names .name.signed { border-style: dashed; color: var(--ok); font-weight: 500; }
.names .name small { font-size: var(--fs-12); color: var(--muted); font-weight: 400; }
.sign-pad { padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.sign-pad h2 { margin: 0; font-size: var(--fs-20); }
.sign-pad p { margin: 0; }
.sign-pad .pad { display: block; width: 100%; height: 220px; background: #fff; border: 2px solid var(--field-line); border-radius: var(--r-2);
  touch-action: none; cursor: crosshair; }
.sign-pad .row-actions button, .sign-pad .row-actions .btn { min-height: 44px; padding: 0 20px; }
/* A class page: who signed, and their signature. */
.sig { height: 28px; width: auto; max-width: 120px; background: #fff; border-radius: var(--r-sm); vertical-align: middle; }

/* A class page: attaching the signed sheet. */
.attach-sheet { flex-wrap: wrap; align-items: flex-end; gap: var(--s-2); margin-top: var(--s-3); }
.attach-sheet label { display: flex; flex-direction: column; gap: 4px; color: var(--ink-2); }

/* Record a class: tick a group, and the trimmable list of who's ticked. */
.group-pick { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-2) var(--s-3); margin: 6px 0; }
.group-pick .pick { display: inline-flex; align-items: flex-end; gap: 6px; }
.group-pick label { display: flex; flex-direction: column; gap: 4px; }
.picked { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.picked .chip { height: 26px; padding: 0 8px; gap: 6px; background: var(--accent-tint); border: 1px solid var(--accent); color: var(--ink);
  font-size: var(--fs-12); font-weight: 500; }
.picked .chip:hover { background: var(--surface-3); }

/* A manual employee's page: the merge row wraps on a phone (its list of names is wide). */
#manual form.inline { flex-wrap: wrap; }
#manual select { max-width: 100%; }

/* Admin overview: the setup checklist (a mark whose shape gives the state, what it is, the link that fixes it) and
   a few facts about the system. */
.setup { list-style: none; margin: 0; padding: 0; }
.setup li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: var(--s-3); align-items: center;
  padding: 10px var(--s-4); border-bottom: 1px solid var(--line); }
.setup li:last-child { border-bottom: 0; }
.setup .what { display: flex; flex-direction: column; gap: 2px; }
.setup .mk { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font: 700 var(--fs-13)/1 var(--font); }
.setup .s-done .mk { background: var(--ok-tint); color: var(--ok); }
.setup .s-todo .mk { background: var(--warn-tint); color: var(--warn); }
.setup .s-info .mk { background: var(--info-tint); color: var(--info); font-style: italic; }
.facts-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s-3); margin: 0; }
.facts-list dt { font-size: var(--fs-12); color: var(--ink-2); }
.facts-list dd { margin: 2px 0 0; font-weight: 500; }
@media (max-width: 600px) { .setup li { grid-template-columns: 24px minmax(0, 1fr); } .setup li .btn { grid-column: 2; justify-self: start; } }

/* ---- a list in one card (Dashboard, Employees, Review): count, rows per page, table, page links ---- */
.list-card { margin-top: var(--s-4); }
.list-card .sheet-head h2 { margin: 0; }
.list-card .tablewrap { border: 0; border-radius: 0; overflow: auto; max-height: calc(100vh - 150px); }
.list-card .pager { border-top: 1px solid var(--line); }
.list-card td.nowrap { white-space: nowrap; }
.per-page { display: flex; align-items: center; gap: var(--s-2); }
.per-page label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-13); color: var(--ink-2); white-space: nowrap; }
.per-page select { height: 30px; }
.chips { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; min-height: 26px; border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: var(--fs-12); color: var(--ink); text-decoration: none; background: var(--surface-2); }
.chip b { font-weight: 600; }
.chip span[aria-hidden] { color: var(--muted); }
.chip:hover { border-color: var(--accent); }
.chip:hover span[aria-hidden] { color: var(--accent); }
th a.sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; font-weight: inherit; }
th a.sort .arrow { color: var(--muted); font-size: 10px; opacity: .55; }
th a.sort:hover .arrow, th[aria-sort] a.sort .arrow { opacity: 1; color: var(--accent); }
th[aria-sort] { color: var(--ink); }

/* ---- "My card" and the public check page: a phone-sized card ---- */
.cert-card { max-width: 460px; margin: 0 auto; }
.cert-card .cc-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #1c1e20; color: #bdbab3;
  font-size: var(--fs-12); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.cert-card .cc-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.cert-card .cc-name { font-size: var(--fs-20); font-weight: 600; }
.cert-card .cc-list { list-style: none; margin: 4px 0; padding: 0; border-top: 1px solid var(--line); }
.cert-card .cc-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cert-card .cc-qr { display: flex; justify-content: center; padding: 8px 0; }
.cert-card .cc-qr svg { width: 220px; height: 220px; background: #fff; border-radius: var(--r); }
.warn-text { color: var(--warn); }

/* ---- sign-in pages ------------------------------------------------------------------------- */
.signin { max-width: 440px; margin: var(--s-7) auto; }
.signin .panel { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }

/* ---- narrow windows ------------------------------------------------------------------------ */
/* Phones: the tabs fold into a Menu button; people with only their own pages get a bar along the bottom instead. */
.navmenu, .bottombar, .subnav-menu { display: none; }
.navmenu .menu { left: 0; right: auto; min-width: 240px; }
.menu a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; }
.menu a:hover { background: var(--surface-3); }
.menu a[aria-current="page"] { background: var(--accent-tint); font-weight: 600; }
.navmenu > summary { list-style: none; } .navmenu > summary::-webkit-details-marker { display: none; }
.bottombar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #1c1e20; border-top: 1px solid #000;
  grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding-bottom: env(safe-area-inset-bottom, 0px); }
.bottombar a { display: flex; align-items: center; justify-content: center; min-height: 56px; color: #bdbab3; font-weight: 600;
  text-decoration: none; border-top: 3px solid transparent; }
.bottombar a[aria-current="page"] { color: #fff; border-top-color: #66b8ca; }
.bottombar a:focus-visible { box-shadow: inset 0 0 0 2px #66b8ca; }
.subnav-menu > summary { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface); font-weight: 600; }
.subnav-menu nav { display: flex; flex-direction: column; padding: 6px 0; }
.subnav-menu nav .navhead { margin: 8px 0 2px; padding: 12px 12px 4px; border-top: 1px solid var(--line);
  font: 600 var(--fs-13)/1.3 var(--font); color: var(--ink); }
.subnav-menu nav a { display: block; padding: 10px 12px; color: var(--ink-2); text-decoration: none; font-weight: 400; border-left: 3px solid transparent; }
.subnav-menu nav a[aria-current="page"] { color: var(--ink); border-left-color: var(--accent); font-weight: 600; }
@media (max-width: 1300px) { .appbar .lbl { display: none; } }
/* Narrower laptops: closer tabs, then no name beside the initials, then the Menu button (from 900px down). */
@media (max-width: 1366px) { .tabs a { padding: 0 9px; } }
@media (max-width: 1100px) {
  .split, .overview { grid-template-columns: minmax(0, 1fr); }
  .appbar .who, .appbar .lbl { display: none; }
}
@media (max-width: 900px) {
  .appbar { gap: 8px; padding: 0 12px; }
  .wordmark .logo { height: 18px; } .wordmark .name { font-size: 9px; padding-left: 34px; }
  .tabs a { padding: 0 10px; }
  .page { padding: 16px 12px 32px; }
  .settings { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }
  .subnav { display: none; }
  .subnav-menu { display: block; }
  body:not(.nav-simple) .tabs { display: none; }
  body:not(.nav-simple) .navmenu { display: flex; }
  .hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .appbar { gap: 4px; padding: 0 8px; }
  .wordmark .name, details.account .caret { display: none; }
  .tabs { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .tabs a { padding: 0 8px; }
  body.nav-simple .tabs { display: none; }
  body.nav-simple .bottombar { display: grid; }
  body.nav-simple .page { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  /* Tables marked .cards (a person's requirements) read as one card per row on a phone. */
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr { display: block; }
  table.cards tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.cards tr:last-child { border-bottom: 0; }
  table.cards td { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); height: auto; padding: 2px 0; border: 0; }
  table.cards td.title { font-weight: 600; }
  table.cards td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-12); flex: none; }
  table.cards td.actions { padding-top: 6px; }
  table.cards td.actions:not(:has(a, details)) { display: none; }  /* nothing to do on this one */
  table.cards .cell-actions { flex-direction: row; flex-wrap: wrap; }
  .todo .btn, .field.upload .camera { min-height: 40px; }
  details.addform:not([open]) > summary { width: 100%; height: 40px; justify-content: center; }
}

/* ---- Departments & titles: a row's people (and, unmapped, what's wrong) open in a row under it. */
.rowtoggle { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; white-space: nowrap; }
.rowtoggle:hover { text-decoration: underline; }
.rowtoggle .badge { cursor: pointer; }
.rowtoggle .caret::before { content: "▸"; font-size: 10px; color: var(--muted); }
.rowtoggle[aria-expanded="true"] .caret::before { content: "▾"; }
table.org-map tr.more > td { background: var(--surface-2); padding: var(--s-3) var(--s-4); border-top: 0; }
.org-map .why { max-width: 820px; margin: 0 0 var(--s-3); padding: var(--s-2) var(--s-3); border-left: 3px solid var(--review);
  background: var(--review-tint); border-radius: var(--r-sm); font-size: var(--fs-13); line-height: 1.5; }
.who-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
  gap: 4px var(--s-5); font-size: var(--fs-13); }
.who-list li { display: flex; flex-direction: column; line-height: 1.3; padding: 3px 0; }
table.org-map tr.unused > td { color: var(--muted); }

/* A person's upcoming training (scheduled ahead): one line each. */
.upcoming ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }

/* Feedback: the app bar's dialog (and /feedback), the thanks toast, Admin › Feedback's list */
dialog.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line-strong);
  border-radius: var(--r-2); background: var(--surface); color: var(--ink); box-shadow: 0 12px 40px rgba(0, 0, 0, .28); }
dialog.modal::backdrop { background: rgba(12, 13, 14, .45); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: var(--fs-16); }
.modal-body { padding: var(--s-4); }
.fb-form { gap: var(--s-3); }
.stack-xs { display: flex; flex-direction: column; gap: 4px; }
.fb-form textarea { width: 100%; min-height: 128px; resize: vertical; }
.fb-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; border: 0; }
.fb-kind { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; }
.fb-kind:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
label.fb-check { display: inline-flex; align-items: center; gap: 8px; }
.fb-where { margin-top: -6px; overflow-wrap: anywhere; }
.fb-error { margin: 0; color: var(--review); font-weight: 500; }
.fb-actions { justify-content: flex-end; align-items: center; }
.fb-hint { margin-right: auto; }
.fb-sheet { max-width: 640px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; padding: 10px 16px; border-radius: var(--r-2);
  background: var(--ink); color: var(--surface); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.toast[hidden] { display: none; }
.fb-list { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: flex; flex-direction: column; }
.fb-item { padding: var(--s-3) 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.fb-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.fb-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-context { overflow-wrap: anywhere; }
.fb-review { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.fb-review input[name=note] { flex: 1 1 260px; }
.b-fb-new { color: var(--review); } .b-fb-new::before { background: var(--review); }
.b-fb-seen { color: var(--accent); } .b-fb-seen::before { background: none; border: 1.5px solid currentColor; }
.b-fb-planned { color: var(--warn); } .b-fb-planned::before { background: none; border: 1.5px solid currentColor; }
.b-fb-done { color: var(--ok); } .b-fb-done::before { background: var(--ok); }
.b-fb-wont { color: var(--muted); } .b-fb-wont::before { background: none; border: 1.5px solid currentColor; }

/* A person's history: the records that count now, then the earlier ones folded away. */
details.earlier { margin-top: var(--s-3); }
details.earlier > summary { cursor: pointer; font-weight: 600; }
.who-when { margin: 0; }
.also-holds { margin: 4px 0 0; }

/* ---- Certifications list: one plain row each, filtered by Required / Not required / Retired ------- */
.clist-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin: 0 0 var(--s-3); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; }
.seg a { padding: 6px 14px; font-size: var(--fs-13); color: var(--ink-2); text-decoration: none; border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; }
.seg a span { color: var(--muted); margin-left: 4px; }
.seg a:hover { background: var(--surface-2); }
.seg a[aria-current] { background: var(--accent-tint); color: var(--ink); font-weight: 600; }
.clist-search { flex: 1; min-width: 200px; max-width: 360px; }
.clist-search input { width: 100%; }
.clist { list-style: none; margin: 0 0 var(--s-4); padding: 0; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-2); overflow: hidden; }
.clist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-1) var(--s-4); align-items: center; padding: 10px var(--s-4); border-bottom: 1px solid var(--line); }
.cl-name { font-weight: 600; color: var(--ink); text-decoration: none; }
.cl-name:hover { color: var(--accent); text-decoration: underline; }
.cl-tag, .cl-where { display: inline-block; margin-left: var(--s-2); padding: 1px 8px; border-radius: 999px; font-size: var(--fs-12); background: var(--accent-tint); color: var(--accent); text-decoration: none; vertical-align: 1px; }
.cl-where { background: var(--neutral-tint); color: var(--muted); }
.cl-meta { font-size: var(--fs-13); color: var(--muted); margin-top: 2px; }
.cl-side { text-align: right; font-size: var(--fs-13); display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.cl-pct { color: var(--muted); font-size: var(--fs-12); }
@media (max-width: 640px) { .clist li { grid-template-columns: minmax(0, 1fr); } .cl-side { align-items: flex-start; text-align: left; flex-direction: row; gap: var(--s-3); } }

/* A verified record's scan, opened from wherever the certification is shown. */
a.scan-link { white-space: nowrap; font-size: var(--fs-12); }

/* Generate certificates: Download, with an arrow beside it for the other way (one PDF with everyone). */
.split-button { position: relative; display: inline-flex; align-items: stretch; vertical-align: middle; }
.split-button > button { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split-more > summary { list-style: none; border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 1px;
  padding: 0 8px; display: inline-flex; align-items: center; height: 34px; cursor: pointer; }
.split-button > .split-more { display: inline-flex; position: static; }  /* the menu drops from the whole button */
.split-more > summary::-webkit-details-marker { display: none; }
.split-more .menu { left: 0; right: auto; min-width: 260px; }
.split-more .menu button { flex-direction: column; align-items: flex-start; gap: 2px; }
