/* =====================================================================
   GryphonGuard — GLTHS Conflict Resolution & Bullying Reports
   V2 "Crest" theme: high-contrast navy + gold, sampled from the school crest.
   Contrast notes (WCAG 2.1 AA):
     white on navy #283b84 ≈ 10:1 · navy on gold #fdc93a ≈ 6.9:1 · gold on navy-deep ≈ 9:1
     Gold is never text on white (≈1.5:1); it is a fill, a border, or text on navy only.
   ===================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
}

:root {
  /* GLTHS palette */
  --navy: #283b84;          /* crest navy: primary */
  --navy-hover: #1f2f6b;
  --navy-deep: #1a2759;     /* top bar shadow, footer, sorted column */
  --navy-ink: #121c45;      /* text on gold */
  --navy-tint: #e8ecf8;
  --navy-tint-2: #f3f5fc;
  --navy-ring: rgba(40, 59, 132, 0.25);
  --gold: #fdc93a;          /* crest gold: accent (fills, borders, text on navy only) */
  --gold-hover: #f3bb1c;
  --gold-deep: #d9a514;     /* button "lip" under navy buttons */
  --gold-tint: #fff4cc;
  --tan: #9a8a62;           /* griffin tan: decorative only */
  --control-border: #6b7591; /* form control edges: >= 4:1 on white and on --surface-2 (WCAG 1.4.11) */

  /* Text on navy */
  --on-navy: #ffffff;
  --on-navy-muted: #c9d0ea; /* ≈ 6.9:1 on --navy */

  /* Neutrals (tinted toward navy) */
  --page: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --border: #d6dbe8;
  --border-strong: #b9c0d3;
  --text: #141a2e;
  --muted: #4f5a74;         /* ≈ 7:1 on white */

  /* Meaning only */
  --danger: #b3121a;
  --danger-tint: #fdeaea;
  --success: #17703f;
  --success-tint: #e4f4ea;

  /* Shape */
  --radius: 14px;
  --radius-sm: 10px;
  --lip: 0 3px 0;           /* the solid "pressable" shadow under buttons */
  --shadow: 0 1px 0 rgba(20, 28, 69, 0.06), 0 4px 14px rgba(20, 28, 69, 0.07);
  --shadow-lg: 0 6px 16px rgba(20, 28, 69, 0.12), 0 18px 40px rgba(20, 28, 69, 0.12);
  --topbar-h: 72px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--page);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; color: var(--text); }
p { margin: 0 0 12px; }
a { color: var(--navy); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--navy-hover); text-decoration-thickness: 2.5px; }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; border-radius: 6px; }
/* Dark regions: a gold ring is the visible one there (≈ 7:1 on navy). */
.topbar :focus-visible, .site-footer :focus-visible, .hero :focus-visible, .action-bar :focus-visible { outline-color: var(--gold); }
.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus {
  left: 12px; top: 12px; z-index: 100; padding: 10px 16px; border-radius: 10px;
  background: var(--gold); color: var(--navy-ink); font-weight: 800; box-shadow: var(--shadow-lg);
}
.small { font-size: 0.85rem; }
/* Admin-written plain text (Settings → Features): keep its line breaks. */
.preline { white-space: pre-line; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Top bar (navy, gold rule) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--navy);
  color: var(--on-navy);
  border-bottom: 5px solid var(--gold);
  box-shadow: 0 2px 0 var(--navy-deep), 0 8px 24px rgba(18, 28, 69, 0.18);
}
.topbar-inner { display: flex; align-items: center; gap: 24px; min-height: var(--topbar-h); }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--on-navy); flex-shrink: 0; }
.brand:hover { color: var(--on-navy); }
/* Full-colour crest needs a white plate: its navy outline would vanish on the navy bar. */
.brand img {
  height: 50px; width: 50px; object-fit: contain; display: block;
  background: #fff; border-radius: 50%; padding: 5px;
  box-shadow: 0 0 0 3px var(--gold);
}
.brand-name { display: block; font-weight: 850; font-size: 1.2rem; color: var(--on-navy); letter-spacing: -0.01em; }
.brand-sub { display: block; font-size: 0.75rem; color: var(--on-navy-muted); line-height: 1.2; font-weight: 500; }
.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav a {
  position: relative; padding: 9px 16px; border-radius: 999px; white-space: nowrap;
  text-decoration: none; color: var(--on-navy-muted); font-weight: 650; font-size: 0.95rem;
  transition: background-color 0.15s, color 0.15s;
}
.nav a:hover { color: var(--on-navy); background: rgba(255, 255, 255, 0.14); }
.nav a.active { color: var(--navy-ink); background: var(--gold); font-weight: 750; }
.userbox { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 0.9rem; }
/* The menu wrapper only matters on phones; on larger screens its children sit in the top bar as before. */
.site-menu { display: contents; }
.menu-toggle { display: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: var(--navy-ink); font-weight: 800; font-size: 0.85rem;
  box-shadow: 0 0 0 2px var(--navy), 0 0 0 4px #fff;
}
.userbox .who { line-height: 1.2; }
.userbox .who strong { display: block; font-weight: 700; color: var(--on-navy); }
.userbox .who span { color: var(--on-navy-muted); font-size: 0.78rem; }

/* ---------- Page ---------- */
main.container { padding-top: 36px; padding-bottom: 96px; min-height: calc(100vh - var(--topbar-h) - 80px); }
.page-header {
  position: relative;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 28px; padding-bottom: 16px;
  border-bottom: 3px solid var(--navy);
}
/* Gold segment riding on the navy rule. */
.page-header::after {
  content: ''; position: absolute; left: 0; bottom: -3px; width: 96px; height: 3px; background: var(--gold);
}
.eyebrow {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; color: var(--navy); margin: 0 0 8px;
}
.eyebrow::before { content: ''; width: 10px; height: 10px; border-radius: 2px; background: var(--gold); box-shadow: 0 0 0 2px var(--navy); }
.page-header h1 { margin: 0; font-size: 2.1rem; font-weight: 850; color: var(--navy); letter-spacing: -0.025em; }
.page-meta { margin: 8px 0 0; color: var(--muted); font-size: 0.9rem; font-weight: 500; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 70ch; }

/* ---------- Footer (navy) ---------- */
.site-footer {
  background: var(--navy-deep); color: var(--on-navy-muted);
  border-top: 5px solid var(--gold);
  padding: 22px 0 32px; font-size: 0.82rem; font-weight: 500;
}
.site-footer a { color: var(--on-navy); }
.site-footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.site-footer .container::before { content: none; }

/* ---------- Cards / sections ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 5px solid var(--navy);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 26px;
  margin: 0 0 22px;
  min-width: 0;
}
.card h2, .section-title {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 18px; font-size: 1.2rem; font-weight: 800; color: var(--navy); letter-spacing: -0.015em;
}
.card h2::before, fieldset.card > legend::before {
  content: ''; width: 6px; height: 1.15em; border-radius: 3px; background: var(--gold); flex-shrink: 0;
  box-shadow: 2px 0 0 var(--navy);
}
.section-title { margin-top: 36px; }
fieldset.card { position: relative; }
fieldset.card > legend {
  float: left; width: 100%; padding: 0; margin: 0 0 20px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  font-size: 1.2rem; font-weight: 800; color: var(--navy); letter-spacing: -0.015em;
}
fieldset.card > legend + * { clear: both; }
.sub {
  font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--navy);
  margin: 22px 0 12px; padding-top: 18px; border-top: 2px dashed var(--border-strong);
}
.sub:first-of-type { border-top: 0; padding-top: 0; margin-top: 4px; }
.label-like { font-weight: 650; font-size: 0.93rem; margin: 16px 0 8px; }

/* Numbered sections on the public report form */
form.numbered { counter-reset: section; }
form.numbered fieldset.card > legend::before {
  counter-increment: section; content: counter(section);
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--navy); color: #fff; font-size: 0.95rem; font-weight: 800;
  box-shadow: 0 0 0 3px var(--gold);
}

/* "From the initial submission" sections on the Dean update page */
fieldset.original { background: var(--surface-2); border-top-color: var(--tan); }
fieldset.original > legend::after {
  content: 'Original submission'; margin-left: auto;
  font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--navy); background: #fff; border: 2px solid var(--navy); border-radius: 999px; padding: 2px 10px;
}
fieldset.original input[type=text], fieldset.original input[type=date], fieldset.original input[type=time],
fieldset.original select, fieldset.original textarea { background: #eef0f6; }

/* ---------- Forms ---------- */
.field { margin-bottom: 20px; }
label { display: block; font-weight: 650; font-size: 0.93rem; margin-bottom: 7px; }
.help { color: var(--muted); font-size: 0.88rem; margin: 0 0 12px; }
.req {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  background: var(--navy); color: #fff;
  font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; vertical-align: 2px;
}
input[type=text], input[type=email], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; min-height: 46px;
  font: inherit; font-size: 0.97rem; font-weight: 450; color: var(--text);
  padding: 10px 13px;
  background: #fff;
  border: 2px solid var(--control-border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--navy); }
/* Focus: solid navy edge plus a 2px navy ring (≥3:1), with a gold halo outside it for character. */
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--navy); background: #fff;
  box-shadow: 0 0 0 2px var(--navy), 0 0 0 6px rgba(253, 201, 58, 0.6);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url('/img/select-arrow.svg');
  background-repeat: no-repeat; background-position: right 14px center;
}
select.short, input.short { max-width: 240px; }
.field-error { color: var(--danger); font-size: 0.86rem; font-weight: 650; margin: 6px 0 0; }
.field-error::before { content: '! '; font-weight: 900; }
.field:has(.field-error) input, .field:has(.field-error) select, .field:has(.field-error) textarea {
  border-color: var(--danger); background: var(--danger-tint);
}
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 0 24px; align-items: start; }
.pairs { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 0 24px; }
.pairs.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stack > * { margin-bottom: 12px; }
form.inline { display: inline; }

/* Option tiles: radios and checkboxes. Checked = solid navy tile, gold edge. */
.radio-group { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
.radio-group > legend { font-weight: 650; font-size: 0.93rem; margin-bottom: 10px; padding: 0; }
.radio-group:not(.inline-radios), .checkbox-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 10px; align-content: start;
}
.radio-group:not(.inline-radios) > legend { grid-column: 1 / -1; float: left; width: 100%; }
.radio-group > .field-error { grid-column: 1 / -1; }
label.radio {
  display: flex; align-items: center; gap: 10px; margin: 0;
  padding: 11px 14px; min-height: 48px;
  font-weight: 550; font-size: 0.93rem; line-height: 1.3;
  background: #fff; border: 2px solid var(--border-strong); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s, color 0.15s;
}
label.radio:hover { border-color: var(--navy); background: var(--navy-tint); }
label.radio:has(input:checked) {
  border-color: var(--navy); background: var(--navy); color: #fff; font-weight: 700;
  box-shadow: inset 5px 0 0 var(--gold);
}
label.radio:has(input:focus-visible) { outline: 3px solid var(--navy); outline-offset: 3px; }
label.radio:has(input:checked) input:focus-visible { outline-color: var(--gold); } /* navy ring would vanish on the navy tile */
label.radio input { accent-color: var(--gold); width: 20px; height: 20px; margin: 0; flex-shrink: 0; }
.checkbox-grid { margin-bottom: 18px; }

/* Yes/No segmented control */
.inline-radios { display: flex; flex-wrap: wrap; align-items: center; gap: 0; }
.inline-radios > legend { width: 100%; }
.inline-radios label.radio {
  border-radius: 0; min-width: 100px; justify-content: center; margin-left: -2px; box-shadow: none;
}
.inline-radios label.radio:first-of-type { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.inline-radios label.radio:last-of-type { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.inline-radios label.radio:has(input:checked) { position: relative; z-index: 1; box-shadow: inset 0 -5px 0 var(--gold); }
.inline-radios > .field-error { width: 100%; }

/* ---------- Buttons ----------
   Every button has a solid border (≥3:1) and a solid "lip" underneath; pressing drops it. */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 9px 20px;
  font: inherit; font-size: 0.95rem; font-weight: 750; line-height: 1.2; text-decoration: none; white-space: nowrap;
  color: var(--navy); background: #fff;
  border: 2px solid var(--navy); border-radius: var(--radius-sm);
  box-shadow: var(--lip) var(--navy);
  cursor: pointer; transition: background-color 0.15s, border-color 0.15s, box-shadow 0.1s, transform 0.1s, color 0.15s;
}
.button:hover { background: var(--navy-tint); color: var(--navy-hover); text-decoration: none; }
.button:active { transform: translateY(3px); box-shadow: 0 0 0 var(--navy); }
.button:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
.button.primary { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: var(--lip) var(--gold-deep); }
.button.primary:hover { background: var(--navy-hover); border-color: var(--navy-hover); color: #fff; }
.button.accent { background: var(--gold); border-color: var(--navy); color: var(--navy-ink); box-shadow: var(--lip) var(--navy); }
.button.accent:hover { background: var(--gold-hover); color: var(--navy-ink); }
.button.subtle, .button.ghost {
  background: transparent; border-color: transparent; box-shadow: none; color: var(--navy);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px;
}
.button.subtle:hover, .button.ghost:hover { background: var(--navy-tint); color: var(--navy-hover); border-color: transparent; }
.button.subtle:active, .button.ghost:active { transform: none; }
.button.danger { color: var(--danger); border-color: var(--danger); box-shadow: var(--lip) var(--danger); }
.button.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.button.small { min-height: 36px; padding: 6px 14px; font-size: 0.85rem; --lip: 0 2px 0; }
.button.small:active { transform: translateY(2px); }
.button.lg { min-height: 52px; padding: 12px 26px; font-size: 1.02rem; }
.button.block { width: 100%; }
.link-button { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--navy); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-button.danger { color: var(--danger); }
.actions { margin: 22px 0; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.actions .help { margin: 0; }
details > summary.button { list-style: none; }
details > summary.button::-webkit-details-marker { display: none; }

/* Buttons sitting on navy (top bar, action bar): flip to gold / outlined white. */
.topbar .button, .action-bar .button { background: transparent; color: #fff; border-color: #fff; box-shadow: var(--lip) rgba(0, 0, 0, 0.35); }
.topbar .button:hover, .action-bar .button:hover { background: #fff; color: var(--navy); }
.topbar .button.primary, .action-bar .button.primary,
.topbar .button.accent, .action-bar .button.accent {
  background: var(--gold); border-color: var(--gold); color: var(--navy-ink); box-shadow: var(--lip) var(--navy-ink);
}
.topbar .button.primary:hover, .action-bar .button.primary:hover,
.topbar .button.accent:hover, .action-bar .button.accent:hover { background: #fff; border-color: #fff; color: var(--navy); }
.action-bar .button.subtle, .action-bar .button.ghost { background: transparent; border-color: transparent; color: #fff; box-shadow: none; }
.action-bar .button.subtle:hover, .action-bar .button.ghost:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.action-bar .button.danger { background: #fff; color: var(--danger); border-color: #fff; }

/* Sticky bottom action bar for long forms: a navy dock with a gold rule. */
.action-bar {
  position: sticky; bottom: 16px; z-index: 40;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin: 28px 0 0; padding: 14px 18px;
  background: var(--navy); color: #fff;
  border: 0; border-top: 5px solid var(--gold);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.action-bar .help { margin: 0; color: var(--on-navy-muted); }
.action-bar a:not(.button) { color: #fff; }

/* ---------- Alerts ---------- */
.flash {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 18px; margin: 0 0 22px;
  background: var(--success-tint); color: #0f4628;
  border: 2px solid #9fd3b4; border-left: 8px solid var(--success); border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 500;
}
.flash.warn, .flash.info { background: var(--gold-tint); color: #3d2f00; border-color: #f2d576; border-left-color: var(--navy); }
.flash.error { background: var(--danger-tint); color: #6e0a0f; border-color: #eeaaaa; border-left-color: var(--danger); }
.flash > div { flex: 1; }
.flash h2 { color: inherit; font-size: 1.1rem; font-weight: 800; }
.flash a { color: inherit; }

/* ---------- Key/value display ---------- */
.kv { display: grid; grid-template-columns: minmax(min(170px, 40%), 32%) minmax(0, 1fr); gap: 0; margin: 0; }
.kv dt, .kv dd { padding: 11px 0; border-bottom: 1px solid var(--border); margin: 0; }
.kv dt { color: var(--muted); font-size: 0.86rem; font-weight: 700; padding-right: 16px; }
.kv dd { font-size: 0.96rem; font-weight: 500; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }
.kv.compact dt, .kv.compact dd { padding: 4px 0; border: 0; }
.kv.compact { grid-template-columns: minmax(min(110px, 40%), 35%) minmax(0, 1fr); }
/* Long unbroken values (emails, names, URLs) wrap instead of pushing out of their card. */
.kv dt, .kv dd, .welcome-text, .flash, .timeline, .plain-list, .alert-item, .card h2, .card h3, fieldset.card > legend { overflow-wrap: anywhere; }
.pre, .kv dd.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.changed-badge {
  display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
}
.changed-text { color: var(--danger) !important; font-weight: 700; }
.was { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(179, 18, 26, 0.6); }

/* ---------- Badges (solid fills; the word carries the meaning) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 800; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.06em;
}
.badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.big { font-size: 0.86rem; padding: 6px 14px; }
.status-open { background: var(--gold); color: var(--navy-ink); box-shadow: inset 0 0 0 2px var(--gold-deep); }
.status-open::before { background: var(--navy); }
.status-active { background: var(--navy); color: #fff; }
.status-active::before { background: var(--gold); }
.status-closed { background: #474f63; color: #fff; }
.status-closed::before { background: #c9ced9; }

/* ---------- Steps ---------- */
.steps { display: flex; gap: 10px; list-style: none; margin: 0 0 28px; padding: 0; counter-reset: step; flex-wrap: wrap; }
.steps li {
  counter-increment: step; display: flex; align-items: center; gap: 10px;
  font-size: 0.9rem; font-weight: 700; color: var(--muted);
}
.steps li::before {
  content: counter(step); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; border: 2px solid var(--control-border); color: var(--muted); font-size: 0.85rem; font-weight: 800;
}
.steps li:not(:last-child)::after { content: ''; width: 44px; height: 4px; background: var(--border-strong); border-radius: 4px; }
.steps li.done { color: var(--navy); }
.steps li.done::before { content: '\2713'; background: var(--navy); border-color: var(--navy); color: var(--gold); }
.steps li.done::after { background: var(--navy); }
.steps li.current { color: var(--navy); }
.steps li.current::before { background: var(--gold); border-color: var(--navy); color: var(--navy-ink); box-shadow: 0 0 0 4px var(--navy-tint); }

/* ---------- Landing ---------- */
/* Hero: flat navy panel, left-aligned, big type. Reversed wordmark at the top, then the gold bar and headline. */
.hero .wordmark { display: block; width: 100%; max-width: 340px; height: auto; margin: 0 0 30px; }
.card.hero {
  text-align: left; padding: 52px 56px 48px; overflow: hidden;
  color: #fff; background: var(--navy);
  border: 0; border-radius: 20px; box-shadow: var(--shadow-lg);
}
.hero h1 {
  font-size: clamp(1.75rem, 1.1rem + 2.4vw, 2.9rem); line-height: 1.08; font-weight: 850; letter-spacing: -0.03em;
  color: #fff; max-width: 20ch; margin: 0 0 18px;
}
/* Short gold accent bar above the headline. */
.hero h1::before { content: ''; display: block; width: 56px; height: 6px; border-radius: 3px; background: var(--gold); margin-bottom: 24px; }
.hero .lead { font-size: 1.15rem; color: var(--on-navy-muted); max-width: 60ch; margin: 0; }
/* Anonymous-report notice: a darker strip across the bottom of the panel. */
.hero-note {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 36px -56px -48px; padding: 20px 56px;
  background: var(--navy-deep); color: #fff; font-size: 0.95rem; font-weight: 600;
}
.hero-note p { margin: 0; max-width: 80ch; }
.hero-note svg { flex-shrink: 0; margin-top: 1px; color: var(--gold); }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 22px; }
.choices > .card { margin: 0; }
.choice { display: flex; flex-direction: column; transition: box-shadow 0.15s, transform 0.15s; }
.choice:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.choice.anon { border-top-color: var(--gold); }
.choice-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.choice-head h2 { margin: 0; font-size: 1.35rem; }
.choice h2::before { display: none; }
.choice .icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--navy); color: #fff; box-shadow: var(--lip) var(--gold-deep);
}
.choice.anon .icon { background: var(--gold); color: var(--navy-ink); box-shadow: var(--lip) var(--navy); }
.choice p { color: var(--muted); }
/* Buttons sit on the bottom edge, so both cards line up whatever the text length. */
.choice-foot { margin-top: auto; padding-top: 8px; }

/* Signed in: one wide welcome bar instead of a stretched single card. */
.card.welcome { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px 24px; align-items: center; border-top-color: var(--gold); padding: 26px 28px; }
.welcome h2 { margin: 0 0 4px; font-size: 1.4rem; }
.welcome h2::before { display: none; }
.welcome-text p { color: var(--muted); }
.welcome-email { margin: 0 0 2px; font-weight: 650; color: var(--text); overflow-wrap: anywhere; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.avatar.xl { width: 64px; height: 64px; font-size: 1.35rem; box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--navy); }

/* How reporting works: three numbered steps. */
.how { margin: 40px 0 0; }
.how h2 { font-size: 1.3rem; font-weight: 850; color: var(--navy); margin: 0 0 16px; }
.how-steps { list-style: none; margin: 0; padding: 0; counter-reset: how; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 18px; }
.how-steps li {
  counter-increment: how; position: relative;
  padding: 22px 22px 22px 76px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.how-steps li::before {
  content: counter(how); position: absolute; left: 20px; top: 20px;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: var(--navy-ink); font-weight: 900; box-shadow: 0 0 0 3px var(--navy);
}
.how-steps strong { display: block; color: var(--navy); font-size: 1.05rem; font-weight: 800; margin-bottom: 4px; }
.how-steps span { display: block; color: var(--muted); font-size: 0.93rem; }

/* Confirmation */
.confirm { text-align: center; padding: 52px 32px; max-width: 660px; margin: 0 auto 22px; border-top-color: var(--success); }
.confirm .check {
  width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 20px; display: grid; place-items: center;
  background: var(--success); color: #fff; box-shadow: 0 0 0 6px var(--success-tint);
}
.confirm h1, .confirm h2 { justify-content: center; font-size: 1.6rem; font-weight: 850; color: var(--navy); margin: 0 0 18px; }
.confirm h2::before { display: none; }
.confirm .report-no {
  display: inline-block; font-size: 3rem; font-weight: 900; color: var(--navy); letter-spacing: -0.03em;
  margin: 2px 0 16px; padding: 4px 26px; border-radius: var(--radius);
  background: var(--navy-tint); border-bottom: 5px solid var(--gold);
}
.confirm .actions { justify-content: center; }
.confirm .eyebrow { justify-content: center; }

/* ---------- Admin list ---------- */
.toolbar-card { padding: 0; overflow: hidden; }
.filters { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; padding: 20px 22px; border-bottom: 1px solid var(--border); background: var(--navy-tint-2); }
.filters label { margin: 0; font-size: 0.78rem; font-weight: 750; color: var(--navy); }
.filters label > input, .filters label > select { margin-top: 4px; }
.filters input, .filters select { width: auto; min-width: 150px; min-height: 42px; padding-top: 8px; padding-bottom: 8px; }
.filters input[type=search] { min-width: 240px; }
.filters .status-filter { flex-basis: 100%; }
.filters label.grow { flex: 1 1 260px; }
.filters label.grow input { width: 100%; }
.card.filters { padding: 20px 22px; border-bottom: 1px solid var(--border); }
.card:not(.toolbar-card) > .filters { padding: 0; border: 0; background: none; }
main > .table-wrap { background: var(--surface); border: 1px solid var(--border); border-top: 5px solid var(--navy); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 22px; }
main > .count { padding: 0 2px 10px; }
.segmented { display: inline-flex; background: #fff; border: 2px solid var(--navy); border-radius: var(--radius-sm); padding: 3px; gap: 3px; flex-wrap: wrap; }
.segmented a { padding: 7px 14px; border-radius: 7px; font-size: 0.86rem; font-weight: 700; color: var(--navy); text-decoration: none; }
.segmented a:hover { background: var(--navy-tint); }
.segmented a.active { background: var(--navy); color: #fff; box-shadow: inset 0 -3px 0 var(--gold); }
.count { margin: 0; padding: 14px 22px; font-size: 0.9rem; color: var(--muted); }
.count strong { color: var(--navy); font-weight: 850; font-size: 1.05rem; }
/* Sideways-scrolling tables show a soft shadow on the side that has more (CSS only: the white covers
   scroll with the content and hide the shadow once you reach that edge). */
.table-wrap {
  overflow-x: auto;
  background:
    linear-gradient(to right, var(--surface) 40%, rgba(255, 255, 255, 0)) left center / 48px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 40%, rgba(255, 255, 255, 0)) right center / 48px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(20, 28, 69, 0.28), rgba(20, 28, 69, 0)) left center / 16px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(20, 28, 69, 0.28), rgba(20, 28, 69, 0)) right center / 16px 100% no-repeat scroll,
    var(--surface);
}
.card > .table-wrap { margin: 0 -26px -24px; }
.toolbar-card > .table-wrap { margin: 0; }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.92rem; }
table.data th {
  position: sticky; top: 0;
  background: var(--navy); color: #fff; text-align: left; white-space: nowrap;
  font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em;
  padding: 12px 14px; border-bottom: 3px solid var(--navy-deep);
}
table.data th a { color: inherit; text-decoration: none; }
table.data th a:hover { color: var(--gold); text-decoration: underline; }
table.data th.sorted { background: var(--navy-deep); color: var(--gold); border-bottom-color: var(--gold); }
table.data td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tbody tr:nth-child(even) td { background: rgba(40, 59, 132, 0.045); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr td { transition: background-color 0.1s; }
table.data tbody tr:hover td { background: rgba(253, 201, 58, 0.22); }
table.data tbody tr:hover td:first-child { box-shadow: inset 5px 0 0 var(--gold); }
table.data tr[data-href] { cursor: pointer; }
table.data td.id a { font-weight: 850; text-decoration: none; color: var(--navy); }
table.data td.id a:hover { text-decoration: underline; }
table.data td.empty { text-align: center; color: var(--muted); padding: 52px 16px; font-weight: 600; }
.pager { margin: 18px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.pager a, .pager strong { min-width: 40px; height: 40px; display: grid; place-items: center; padding: 0 10px; border-radius: 9px; text-decoration: none; font-size: 0.92rem; font-weight: 750; }
.pager a { background: #fff; border: 2px solid var(--navy); color: var(--navy); }
.pager a:hover { background: var(--navy-tint); }
.pager strong { background: var(--navy); color: #fff; box-shadow: inset 0 -4px 0 var(--gold); }
.hints { margin: 0 0 16px; padding-left: 20px; color: var(--muted); font-size: 0.88rem; }

/* ---------- Detail page ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.detail-aside { position: sticky; top: calc(var(--topbar-h) + 24px); display: grid; gap: 20px; max-height: calc(100vh - var(--topbar-h) - 44px); overflow: auto; }
.detail-aside .card { margin: 0; }
.status-card { border-top-color: var(--gold); background: linear-gradient(180deg, var(--navy-tint-2), #fff 120px); }
.status-card .badge { margin-bottom: 14px; }
.status-card .kv { grid-template-columns: 76px 1fr; }
.status-card .kv dt, .status-card .kv dd { padding: 6px 0; font-size: 0.85rem; }
.status-card .actions { margin: 18px 0 8px; }
.status-card .actions .button { flex: 1; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
.subnav { display: inline-flex; background: #fff; border: 2px solid var(--navy); border-radius: var(--radius-sm); padding: 4px; gap: 3px; margin-bottom: 26px; flex-wrap: wrap; box-shadow: var(--shadow); }
.subnav a { padding: 8px 16px; border-radius: 7px; text-decoration: none; font-weight: 700; font-size: 0.9rem; color: var(--navy); }
.subnav a:hover { background: var(--navy-tint); }
.subnav a.active { background: var(--navy); color: #fff; box-shadow: inset 0 -3px 0 var(--gold); }

/* History timeline */
.plain-list { list-style: none; padding: 0; margin: 0 0 12px; }
.plain-list > li { padding: 9px 0; border-bottom: 1px solid var(--border); }
.plain-list > li:last-child { border-bottom: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 20px 26px; }
.timeline li::before { content: ''; position: absolute; left: 3px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px var(--navy); }
.timeline li:not(:last-child)::after { content: ''; position: absolute; left: 8px; top: 22px; bottom: 2px; width: 2px; background: var(--navy-tint); }
.timeline .when { font-size: 0.78rem; color: var(--muted); }
.timeline .what { font-weight: 750; font-size: 0.92rem; color: var(--navy); }
.timeline .reason { font-weight: 400; color: var(--text); }
table.diff { border-collapse: collapse; margin-top: 8px; font-size: 0.82rem; width: 100%; table-layout: fixed; }
table.diff td { overflow-wrap: anywhere; }
table.diff th, table.diff td { border-bottom: 1px solid var(--border); padding: 7px 9px; text-align: left; vertical-align: top; }
table.diff th { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: #fff; background: var(--navy); }
.card table.diff.big { font-size: 0.92rem; }
.card table.diff.big th, .card table.diff.big td { padding: 10px 12px; }
table.audit pre { white-space: pre-wrap; font-size: 0.78rem; max-width: 420px; margin: 6px 0 0; background: var(--surface-2); padding: 8px; border-radius: 8px; border-left: 3px solid var(--navy); }

/* Dean update page header */
.incident-top { display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: center; justify-content: space-between; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 2px solid var(--border); }
.incident-top .big { font-size: 1.7rem; font-weight: 900; color: var(--navy); }
.incident-top .id-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 800; display: block; }
.inline-field { display: flex; align-items: center; gap: 10px; margin: 0; }
.inline-field label { margin: 0; }
.inline-field select { width: auto; min-width: 160px; }
.original-block { background: var(--surface-2); border: 1px solid var(--border); border-left: 5px solid var(--tan); border-radius: var(--radius-sm); padding: 12px 16px; }
.incident-header .sub { border-top: 0; padding-top: 0; margin-top: 0; }

/* ---------- Responsive ---------- */
@media screen and (max-width: 960px) {
  .detail-grid { grid-template-columns: 1fr; }
  /* One column: status and actions first, then the report, with the history at the end. */
  .detail-aside { display: contents; }
  .detail-aside .status-card { order: -1; }
  .detail-aside .history { order: 1; }
  .brand-sub { display: none; }
}
@media screen and (max-width: 720px) {
  main.container { padding-top: 22px; }
  .page-header h1 { font-size: 1.55rem; }
  .card { padding: 18px; border-radius: 12px; }
  .card > .table-wrap { margin: 0 -18px -18px; }
  .toolbar-card { padding: 0; }
  .toolbar-card > .table-wrap { margin: 0; }
  .filters { padding: 16px; }
  table.data td, table.data th { white-space: nowrap; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { border-bottom: 0; padding-bottom: 0; }
  .pairs, .pairs.even { grid-template-columns: 1fr; }
  .filters input, .filters select, .filters input[type=search] { min-width: 0; width: 100%; }
  .filters label { flex: 1 1 140px; }
  .card.hero { padding: 30px 22px 28px; border-radius: 16px; }
  .hero .wordmark { max-width: 250px; margin-bottom: 22px; }
  .hero .lead { font-size: 1.02rem; }
  .hero-note { margin: 26px -22px -28px; padding: 16px 22px; }
  .card.welcome { grid-template-columns: auto minmax(0, 1fr); padding: 22px 20px; }
  .welcome-actions { grid-column: 1 / -1; }
  .welcome-actions .button { flex: 1 1 100%; }
  .avatar.xl { width: 52px; height: 52px; font-size: 1.1rem; }
  .action-bar { position: static; }
  .steps li:not(:last-child)::after { width: 16px; }
  .confirm .report-no { font-size: 2.3rem; }
  /* Long button labels wrap instead of overflowing; buttons in an action row share the width. */
  .button { white-space: normal; text-align: center; }
  .actions .button, .action-bar .button { flex: 1 1 auto; }
  .actions { align-items: stretch; }
  /* Settings sub-menu and status filter: equal cells instead of ragged rows. */
  .subnav { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .subnav a { text-align: center; }
  .subnav a:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .segmented { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .segmented a { text-align: center; }
  .filters .status-filter { width: 100%; }
  /* Progress steps stay on one row; the current step's name may wrap. */
  .steps { flex-wrap: nowrap; }
  .steps li.current { min-width: 0; }
  .inline-field { flex-wrap: wrap; }
  .inline-field select { width: 100%; }
}

/* ---------- Top bar on tablets and phones ----------
   Up to 1180px the signed-in name/email text hides (the avatar stays) so the menu fits on one row.
   Up to 960px the menu folds behind the Menu button (public/js/app.js; without JavaScript it wraps). */
@media screen and (max-width: 1180px) {
  .userbox .who { display: none; }
  .brand-sub { display: none; }
  .topbar-inner { gap: 16px; }
  .nav a { padding: 9px 13px; }
}
@media screen and (max-width: 960px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px 12px; padding-top: 10px; padding-bottom: 10px; }
  .brand img { height: 42px; width: 42px; padding: 4px; }
  .nav { order: 3; width: 100%; flex-wrap: wrap; margin: 0 -8px; }
  /* Menu button + fold-out menu (only when JavaScript runs; otherwise the menu wraps in the top bar). */
  .js .topbar-inner { flex-wrap: wrap; gap: 8px; }
  .js .topbar-inner .brand { gap: 10px; min-width: 0; }
  .js .menu-toggle {
    display: inline-flex; align-items: center; gap: 6px; margin-left: auto; min-height: 44px; padding: 8px 14px;
    border: 2px solid #fff; border-radius: var(--radius-sm); background: transparent; color: #fff;
    font: inherit; font-weight: 750; cursor: pointer;
  }
  .js .menu-toggle:hover, .js .menu-toggle[aria-expanded="true"] { background: var(--gold); border-color: var(--gold); color: var(--navy-ink); }
  .menu-toggle .menu-icon-close, .menu-toggle[aria-expanded="true"] .menu-icon-open { display: none; }
  .menu-toggle[aria-expanded="true"] .menu-icon-close { display: inline; }
  .js .site-menu { display: none; order: 3; width: 100%; border-top: 1px solid rgba(255, 255, 255, 0.22); padding: 10px 0 12px; }
  .js .site-menu.open { display: block; }
  .js .nav { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 4px; margin: 0; width: 100%; }
  .js .nav a { padding: 12px 14px; font-size: 1rem; border-radius: var(--radius-sm); }
  .js .nav a.active { box-shadow: inset 5px 0 0 var(--navy); }
  .js .userbox { margin: 10px 0 0; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.22); flex-wrap: wrap; }
  .js .userbox .who { display: block; flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .js .userbox form, .js .userbox > .button { width: 100%; }
  .js .userbox .button { width: 100%; min-height: 44px; }
}

/* Small utilities (the Content-Security-Policy forbids inline style attributes). */
.m-0 { margin: 0; }
.mt-8 { margin: 8px 0 0; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin: 12px 0 0; }
.text-left { text-align: left; }
.bg-white { background: #fff; }
.filter-label { display: block; font-weight: 750; font-size: .78rem; margin-bottom: 4px; color: var(--navy); }
.filter-label.muted { color: var(--navy); }
.hash { word-break: break-all; font-size: .8rem; }

/* Sign-out warning (public/js/app.js) */
.session-dialog { max-width: 460px; width: calc(100% - 32px); border: 0; border-top: 6px solid var(--gold); border-radius: var(--radius); padding: 26px; color: var(--text); background: var(--surface); box-shadow: 0 24px 60px rgba(18, 28, 69, .35); }
.session-dialog::backdrop { background: rgba(18, 28, 69, .6); }
.session-dialog h2 { margin: 0 0 8px; color: var(--navy); font-weight: 850; }
.session-dialog-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
@media print { .session-dialog { display: none; } }

/* System page (/admin/system) */
.mt-0 { margin-top: 0; }
.section-title { margin: 32px 0 14px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 18px; margin-bottom: 18px; }
.chart-grid > .card { margin: 0; }
.chart-grid h3, .card > h3 { margin: 0 0 10px; font-size: 1rem; font-weight: 800; color: var(--navy); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.warn-num { color: var(--danger); font-weight: 800; }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.alert-item { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius-sm); border-left: 6px solid; font-weight: 500; }
.alert-item.red { background: var(--danger-tint); border-color: var(--danger); }
.alert-item.yellow { background: var(--gold-tint); border-color: var(--navy); }
.alert-item.ok { background: var(--success-tint); border-color: var(--success); color: var(--success); font-weight: 700; }
.alert-item > span:nth-child(2) { flex: 1; min-width: 200px; }
.badge.alert-red { background: var(--danger); color: #fff; }
.badge.alert-yellow { background: var(--gold); color: var(--navy-ink); }
.badge.alert-ok { background: var(--success); color: #fff; }
.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--border-strong); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 10px; }
.chart .bar.s0, .chart .key.s0 { fill: var(--navy); background: var(--navy); }
.chart .bar.s1, .chart .key.s1 { fill: var(--danger); background: var(--danger); }
.chart .legend { font-size: .82rem; color: var(--muted); margin-top: 6px; }
.chart .key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; vertical-align: -1px; }
.chart .key:first-child { margin-left: 0; }
@media print { .chart-grid { grid-template-columns: 1fr 1fr; } .chart .bar { print-color-adjust: exact; -webkit-print-color-adjust: exact; } }
table.data.compact td, table.data.compact th { padding: 7px 10px; }

/* Summary tiles ("At a glance"): label, big value, one line of detail. The value is always a word or
   number, so the coloured edge (good/bad/warn) never carries meaning alone. */
/* Fixed column counts so the five tiles never leave one stranded: 5 / 3+2 / 2+2+1 (last spans) / 1. */
.kpis { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
@media screen and (max-width: 1180px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media screen and (max-width: 720px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media screen and (max-width: 400px) { .kpis { grid-template-columns: 1fr; } }
.kpi {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--border); border-left: 6px solid var(--navy); border-radius: var(--radius); box-shadow: var(--shadow);
}
.kpi.good { border-left-color: var(--success); }
.kpi.bad { border-left-color: var(--danger); }
.kpi.bad .kpi-value { color: var(--danger); }
.kpi.warn { border-left-color: var(--gold); }
.kpi-label { font-size: 0.82rem; font-weight: 750; color: var(--muted); }
.kpi-value { font-size: 1.85rem; font-weight: 850; line-height: 1.15; color: var(--navy); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.kpi-sub { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }

/* Security overview: events table beside the stacked charts; every card sizes to its content. */
.sys-split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 20px; }
.sys-split > .card, .sys-stack > .card { margin: 0; }
.sys-stack { display: grid; gap: 20px; }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 20px; align-items: start; margin-bottom: 20px; }
.sys-grid > .card { margin: 0; }
.sys-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sys-grid .span-2 { grid-column: 1 / -1; }
.backup-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 28px; align-items: start; }
/* Card heading with its action button on the right. */
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.card-head h3 { margin: 0; }
.card-head .button { margin-left: auto; }
/* A card whose table runs edge to edge. */
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head, .card.flush > .empty-note { padding: 20px 22px 0; }
.card.flush > .empty-note { padding-bottom: 20px; }
.card.flush > .table-wrap { margin: 0; }
table.stats a.row-link { font-weight: 700; text-decoration: none; }
table.stats a.row-link:hover, table.stats a.row-link:focus-visible { text-decoration: underline; }
table.data td.zero { color: var(--muted); }
/* Label/value rows for counts: value right-aligned and bold. */
.kv.stat-list { grid-template-columns: minmax(min(9.5rem, 50%), 1fr) minmax(0, max-content); }
.kv.stat-list a { display: inline-block; padding: 3px 0; }
.kv.stat-list dt, .kv.stat-list dd { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.kv.stat-list dd { text-align: right; font-weight: 750; color: var(--navy); padding-left: 12px; }
.kv.stat-list dt:last-of-type, .kv.stat-list dd:last-of-type { border-bottom: 0; }
.empty-note { margin: 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font-weight: 600; }
.sub-head { margin: 18px 0 8px; font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: var(--navy); }
@media screen and (max-width: 960px) {
  .sys-split { grid-template-columns: 1fr; }
}
@media screen and (max-width: 720px) {
  .sys-grid.two, .backup-body { grid-template-columns: 1fr; }
}
@media screen and (max-width: 720px) {
  /* Stat lists keep two columns on phones (the general .kv rule stacks them). */
  .kv.stat-list { grid-template-columns: minmax(min(9.5rem, 50%), 1fr) minmax(0, max-content); }
  .kv.stat-list dt { border-bottom: 1px solid var(--border); padding-bottom: 8px; }
  .card.flush { padding: 0; }
  .card.flush > .card-head, .card.flush > .empty-note { padding: 16px 16px 0; }
  .kpi-value { font-size: 1.6rem; }
}
.heading-link { font-weight: 600; margin-left: 8px; }

/* Accessibility helpers */
/* Text for screen readers only (e.g. "Witness 1" before a visible "Name" label). */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.error-summary ul { margin: 6px 0 0; padding-left: 20px; }
.error-summary a { color: inherit; font-weight: 700; }
.error-summary:focus { outline: 3px solid var(--navy); outline-offset: 2px; }

/* ---------- Phones ---------- */
@media screen and (max-width: 720px) {

  /* Progress steps: only the current step is named on screen (all three are still read out). */
  .steps li:not(.current) .step-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  /* Reports list: keep the columns that identify a report; the rest are on the report page. */
  table.data .col-secondary { display: none; }
  table.reports-table td, table.reports-table th { padding: 10px 8px; white-space: normal; }
  table.reports-table td { overflow-wrap: break-word; }
  table.reports-table td.id, table.reports-table td:nth-child(2) { white-space: nowrap; }

  /* Edit page: space between the stacked "Submitted" and "Updating" boxes. */
  .incident-header .two-col { row-gap: 12px; }

  /* System page */
  table.stats td, table.stats th { padding: 10px 8px; }
  .chart .tick { font-size: 22px; }
  .page-meta { font-size: 0.82rem; }
}

/* Very narrow phones (320px): keep the logo and the Menu button on one line. */
@media screen and (max-width: 360px) {
  .brand-name { font-size: 1rem; }
  .brand img { height: 38px; width: 38px; }
  .js .menu-toggle { padding: 8px 10px; }
}

/* Respect "reduce motion": no lifts, slides, or fades. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .choice:hover, .button:active { transform: none; }
}
