/* =========================================================
   WisDOT Member Hub: forked from the DOT hub (same layout system: Daylight sections + night sections, rail,
   photo openers), restyled as highway signage instead of police blue.
   Palette: asphalt charcoal, sign amber (fills only, always behind dark text), guide-sign green (links/accents on
   light, filled panels with white text), work-zone orange for hazard stripes only (never text).
   Type: Overpass (open-source Highway Gothic) for headings, Figtree body.
   ========================================================= */
:root {
  --bg: #fafaf7;
  --bg-alt: #f0f0ea;
  --surface: #ffffff;
  --border: #e2e2da;
  --border-strong: #c9c9bf;
  --text: #1c1f22;
  --muted: #5a5f66;
  --accent: #006b3f;
  --accent-fill: #ffb000;
  --accent-soft: rgba(0, 107, 63, 0.1);
  --on-accent: #1c1f22;
  --sign-green: #006b3f;
  --hazard: #f26522;
  --shadow: 0 1px 2px rgba(28, 31, 34, 0.06), 0 12px 32px -16px rgba(28, 31, 34, 0.22);
  --night: #1c1f22;
  --night-2: #262a2f;
  --night-ink: #f4f4f0;
  --night-soft: #b8bcc0;
  --night-line: rgba(255, 255, 255, 0.08);
  --night-accent: #ffb000;
  --signal-red: #f26522;
  --ok: #17753f;
  --warn: #8a5a00;
  --bad: #b42318;
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Overpass', var(--font);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
  --top: 68px;
  color-scheme: light;
}

/* Dark theme: Daylight sections go dark; night sections, header and openers stay as they are.
   Chosen in the theme picker (site.js); the inline script in <head> sets data-theme before first paint. */
:root[data-theme='dark'] {
  --bg: #15181b;
  --bg-alt: #1d2125;
  --surface: #1e2226;
  --border: #2c3136;
  --border-strong: #3c4248;
  --text: #eef0f2;
  --muted: #a9afb6;
  --accent: #ffb000;
  --accent-soft: rgba(255, 176, 0, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -16px rgba(0, 0, 0, 0.7);
  --ok: #5fd08a;
  --warn: #f2b453;
  --bad: #ff8577;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 20px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1.0625rem/1.65 var(--font); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 0.5em; font-weight: 800; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 2.8vw, 2.2rem); }
h3 { font-family: var(--font); font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.2em; }
li { margin-bottom: 0.35em; }
code, kbd { font-family: var(--mono); font-size: 0.86em; background: var(--bg-alt); padding: 0.1em 0.4em; border-radius: 6px; }
::selection { background: var(--accent-fill); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--muted); }
.nw { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent-fill); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
.lead { font-size: clamp(1.05rem, 1.5vw, 1.2rem); color: var(--muted); max-width: 60ch; }
.split .wd { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.split .wd > span { display: inline-block; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5em; padding: 0.75em 1.35em; border-radius: 999px; font-weight: 500; font-size: 1rem; white-space: nowrap; border: 1px solid transparent; transition: transform 0.2s var(--ease), background-color 0.2s, border-color 0.2s; }
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn .btn-ext { opacity: 0.7; }
.btn-primary { background: var(--accent-fill); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent-fill) 88%, var(--text)); color: var(--on-accent); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--text); color: var(--text); }
.btn-dark { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.4); color: var(--night-ink); }
.btn-dark:hover { border-color: #fff; color: #fff; }
.btn-sm { padding: 0.5em 1em; font-size: 0.925rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.8rem; }

/* ---------- Header: GVRPJ's dark bar + a ticket payoff countdown ---------- */
.top { position: sticky; top: 0; z-index: 50; background: var(--night); border-bottom: 1px solid var(--night-line); color: var(--night-ink); }
.top-in { height: var(--top); display: flex; align-items: center; gap: 22px; }
.brand { flex: none; display: inline-flex; align-items: center; gap: 10px; color: var(--night-ink); font-weight: 700; font-size: 1.125rem; letter-spacing: -0.02em; white-space: nowrap; }
.brand:hover { color: #fff; text-decoration: none; }
.brand img { width: 32px; height: 32px; }
.payoff-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12); color: rgba(245, 247, 250, 0.85) !important; font-size: 0.82rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; transition: background 0.2s, border-color 0.2s; }
.payoff-pill i { font-size: 1rem; color: var(--night-accent); }
.payoff-pill:hover { text-decoration: none; background: rgba(255, 255, 255, 0.12); }
.payoff-pill.is-open { background: rgba(91, 140, 255, 0.18); border-color: rgba(91, 140, 255, 0.45); color: #fff !important; }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a { display: block; padding: 7px 12px; border-radius: 999px; color: rgba(245, 247, 250, 0.72); font-weight: 500; font-size: 0.95rem; white-space: nowrap; transition: color 0.2s, background-color 0.2s; }
.nav a:hover { color: #fff; text-decoration: none; }
.nav a[aria-current] { color: #fff; background: rgba(255, 255, 255, 0.1); }

/* ---------- Photo opener (home + every handbook page), from GVRPJ's department pages ---------- */
.opener { position: relative; min-height: 78svh; display: grid; align-items: end; overflow: clip; background: var(--night); color: #fff; }
.opener--doc { min-height: 56svh; }
.opener-img { position: absolute; inset: 0; width: 100%; height: 112%; max-width: none; object-fit: cover; }
.opener-scrim { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(11, 15, 20, 0.97) 0%, rgba(11, 15, 20, 0.72) 45%, rgba(11, 15, 20, 0.15) 85%); }
.opener-copy { position: relative; z-index: 2; padding-block: clamp(96px, 14svh, 150px) clamp(40px, 7svh, 72px); }
.back { display: flex; width: fit-content; align-items: center; gap: 8px; margin-bottom: 1.3rem; font-weight: 600; font-size: 0.95rem; color: #dde3ea; }
.back:hover { color: #fff; }
.badge { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 1rem; padding: 5px 14px 5px 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); font-weight: 700; }
.badge img { width: 30px; height: 30px; border-radius: 50%; background: rgba(0, 0, 0, 0.3); }
.opener-title { margin: 0; max-width: 14ch; font-size: clamp(2.8rem, 7.5vw, 6.6rem); line-height: 0.95; letter-spacing: -0.05em; color: #fff; }
.opener--doc .opener-title { font-size: clamp(2.6rem, 6vw, 5rem); max-width: 16ch; }
.opener-title .acc { color: var(--accent-fill); }
.opener-title .line { display: block; overflow: hidden; padding-bottom: 0.05em; }
.opener-title .line > span { display: inline-block; }
.opener-lead { margin: 1.2rem 0 0; max-width: 50ch; font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: #dde3ea; }
@media (prefers-reduced-motion: no-preference) {
  .opener-img { animation: settle 1.6s var(--ease) both; }
  .opener--doc .opener-copy > * { animation: rise 0.9s var(--ease) both; }
  .opener--doc .opener-copy > :nth-child(2) { animation-delay: 0.06s; }
  .opener--doc .opener-copy > :nth-child(3) { animation-delay: 0.12s; }
  .opener--doc .opener-copy > :nth-child(4) { animation-delay: 0.2s; }
}
@keyframes settle { from { transform: scale(1.06); } }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } }

/* ---------- Section rhythm: Daylight + night ---------- */
.day { background: var(--bg); padding-block: clamp(56px, 8vw, 104px); }
.night { background: var(--night); color: var(--night-ink); padding-block: clamp(56px, 8vw, 104px); }
.night a { color: var(--night-accent); }
.h2 { margin: 0; font-size: clamp(2rem, 4.2vw, 3.2rem); letter-spacing: -0.04em; line-height: 1.02; }
.night .h2 { color: #fff; }
.sub { margin: 0.8rem 0 0; max-width: 60ch; font-size: 1.08rem; color: var(--muted); }
.night .sub { color: var(--night-soft); }
.night kbd { background: rgba(255, 255, 255, 0.1); color: #fff; }
.stat-label { font-family: var(--display); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin: 0 0 0.6rem; }
.night .stat-label { color: var(--night-accent); }

/* Home: status band (big GVRPJ-style numbers) */
.status-band { padding-block: clamp(44px, 6vw, 72px); border-bottom: 1px solid var(--border); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(24px, 4vw, 56px); }
.stats b { display: block; font-family: var(--display); font-size: clamp(2.2rem, 4.4vw, 3.6rem); font-weight: 800; letter-spacing: -0.05em; line-height: 1; margin-bottom: 0.4rem; }
.stats small { display: block; color: var(--muted); font-size: 0.98rem; max-width: 32ch; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 8px; vertical-align: 1px; background: var(--signal-red); }
.dot.open { background: #1f9d55; box-shadow: 0 0 0 4px rgba(31, 157, 85, 0.18); }

/* Home: lookup + quick actions (night) */
.lookup { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 2rem; }
.spot { flex: 1 1 420px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-radius: 999px; background: var(--night-2); border: 1px solid rgba(255, 255, 255, 0.14); transition: border-color 0.2s, box-shadow 0.2s; }
.spot:focus-within { border-color: var(--accent-fill); box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.2); }
.spot > i { font-size: 1.25rem; color: var(--night-soft); }
.spot input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: #fff; font: inherit; font-size: 1.05rem; padding: 15px 0; }
.spot input::placeholder { color: #8a95a3; }
.seg { display: flex; gap: 6px; }
.seg button { font: 600 0.9rem var(--font); color: var(--night-soft); background: none; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 999px; padding: 8px 14px; cursor: pointer; transition: all 0.2s; }
.seg button:hover { color: #fff; border-color: rgba(255, 255, 255, 0.4); }
.seg button[aria-pressed='true'] { background: var(--accent-fill); color: var(--on-accent); border-color: var(--accent-fill); }
.results { list-style: none; margin: 12px 0 0; padding: 0; }
.results li { margin: 0; }
.results button { width: 100%; display: grid; grid-template-columns: 140px 1fr auto; gap: 16px; align-items: baseline; padding: 11px 18px; border: 0; border-bottom: 1px solid var(--night-line); background: none; color: var(--night-ink); font: inherit; text-align: left; cursor: pointer; transition: background 0.15s; }
.results button:hover { background: rgba(255, 255, 255, 0.05); }
.results b { font: 500 0.9rem var(--mono); color: var(--night-accent); }
.results em { font-style: normal; font-size: 0.88rem; color: var(--night-soft); white-space: nowrap; }
.results .none { color: var(--night-soft); padding: 12px 18px; }
.actions { list-style: none; padding: 0; margin: 2.4rem 0 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.actions li { margin: 0; }
.action { display: grid; gap: 4px; align-content: start; height: 100%; padding: 18px; border-radius: var(--radius); background: var(--night-2); border: 1px solid var(--night-line); color: var(--night-ink) !important; transition: transform 0.3s var(--ease), border-color 0.2s; }
.action:hover { transform: translateY(-3px); border-color: rgba(91, 140, 255, 0.5); text-decoration: none; }
.action-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 10px; border-radius: 12px; background: rgba(91, 140, 255, 0.16); color: var(--night-accent); font-size: 1.35rem; }
.action b { font-weight: 700; line-height: 1.25; }
.action small { color: var(--night-soft); font-size: 0.85rem; line-height: 1.35; }

/* Home: handbook photo cards (Daylight) */
.hb-grid { list-style: none; padding: 0; margin: 2.2rem 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.hb-grid li { margin: 0; }
.hb-card { display: flex; flex-direction: column; height: 100%; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text); transition: transform 0.3s var(--ease), box-shadow 0.3s; }
.hb-card:hover { transform: translateY(-4px); text-decoration: none; color: var(--text); box-shadow: 0 1px 2px rgba(30, 40, 60, 0.06), 0 20px 40px -18px rgba(30, 40, 60, 0.3); }
.hb-media { aspect-ratio: 16 / 9; overflow: hidden; }
.hb-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.hb-card:hover .hb-media img { transform: scale(1.04); }
.hb-body { display: grid; gap: 4px; padding: 18px 20px 22px; }
.hb-body b { font-family: var(--display); font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; }
.hb-body small { color: var(--muted); font-size: 0.95rem; }
.tag { justify-self: start; display: inline-block; margin-bottom: 6px; padding: 3px 11px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); }

/* Home: chain of command as a numbered path (night) */
.path { list-style: none; counter-reset: p; padding: 0; margin: 2.2rem 0 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.path li { counter-increment: p; position: relative; margin: 0; padding: 64px 20px 22px; border-radius: var(--radius); background: var(--night-2); border: 1px solid var(--night-line); }
.path li::before { content: counter(p); position: absolute; left: 20px; top: 18px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-family: var(--display); font-weight: 800; background: var(--accent-fill); color: var(--on-accent); }
.path b { display: block; color: #fff; font-size: 1.08rem; line-height: 1.3; margin-bottom: 4px; }
.path span { color: var(--night-soft); font-size: 0.93rem; }
.more { margin: 1.6rem 0 0; }
.more a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* Home: links + agreement, credits (Daylight) */
.links-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: start; }
.links { display: grid; margin-top: 1.6rem; }
.link-row { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 16px 4px; border-top: 1px solid var(--border); color: var(--text); }
.link-row:last-child { border-bottom: 1px solid var(--border); }
.link-row:hover { text-decoration: none; color: var(--text); }
.link-row > i:first-child { font-size: 1.3rem; color: var(--accent); background: var(--accent-soft); padding: 10px; border-radius: 12px; }
.link-row b { display: block; }
.link-row small { color: var(--muted); font-size: 0.93rem; }
.link-row .go { color: var(--muted); transition: transform 0.3s var(--ease), color 0.2s; }
.link-row:hover .go { transform: translate(3px, -3px); color: var(--accent); }
.card { padding: clamp(22px, 3vw, 32px); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.agree h3 { font-family: var(--display); font-size: 1.4rem; font-weight: 800; letter-spacing: -0.03em; }
.agree p:last-child { margin: 0; }
.credits-band { padding-top: 0; }
.credits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin-top: 1.8rem; }
.credits ul { list-style: none; padding: 0; margin: 0; }
.credits li { margin-bottom: 10px; }
.credits b { display: block; }
.credits span { color: var(--muted); font-size: 0.93rem; }

/* ---------- Handbook pages: rail + content on Daylight ---------- */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: clamp(32px, 5vw, 64px); padding-top: 48px; padding-bottom: 96px; }
.rail { position: sticky; top: calc(var(--top) + 20px); align-self: start; max-height: calc(100dvh - var(--top) - 40px); overflow: auto; scrollbar-width: thin; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.rail-mobile { display: none; }
.rail-h { font-family: var(--display); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin: 16px 10px 6px; }
.rail-h:first-child { margin-top: 4px; }
.rail-nav > a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-weight: 500; font-size: 0.95rem; transition: background 0.15s, color 0.15s; }
.rail-nav > a i { font-size: 1.1rem; }
.rail-nav > a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.rail-nav > a[aria-current] { color: var(--text); background: var(--accent-soft); font-weight: 600; }
.rail-nav > a[aria-current] i { color: var(--accent); }
.rail-sub { margin: 2px 0 8px 20px; padding-left: 12px; border-left: 2px solid var(--border); display: grid; }
.rail-sub a { color: var(--muted); font-size: 0.88rem; padding: 4px 8px; }
.rail-sub a:hover { color: var(--text); text-decoration: none; }
.rail-sub a.on { color: var(--accent); font-weight: 600; }
.doc-body { max-width: 860px; }
.doc-sec { padding-bottom: 56px; }
.doc-sec > h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); letter-spacing: -0.04em; }
.doc-sec .sub { margin-top: 1.6em; color: var(--text); font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; }
.help { color: var(--muted); display: flex; gap: 8px; align-items: center; }
.help i { color: var(--accent); font-size: 1.3rem; }
.next { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 20px; margin-top: 12px; padding: 24px 28px; border-radius: var(--radius); background: var(--night); color: #fff; transition: transform 0.3s var(--ease); }
.next:hover { color: #fff; text-decoration: none; transform: translateY(-3px); }
.next-k { grid-column: 1; font-family: var(--display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--night-accent); }
.next-t { grid-column: 1; font-family: var(--display); font-size: 1.7rem; font-weight: 800; letter-spacing: -0.04em; }
.next i { grid-column: 2; grid-row: 1 / 3; font-size: 1.6rem; color: var(--accent-fill); transition: transform 0.35s var(--ease); }
.next:hover i { transform: translateX(6px); }

/* Notes */
.note { display: flex; gap: 12px; padding: 14px 18px; margin: 0 0 1.2em; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.note > i { font-size: 1.3rem; flex: none; margin-top: 2px; color: var(--muted); }
.note > div > :last-child { margin-bottom: 0; }
.note-warn { background: var(--accent-soft); border-color: rgba(37, 82, 196, 0.25); }
.note-warn > i, .note-ok > i, .note-pin > i { color: var(--accent); }

/* Numbered rules (GVRPJ numbered-step circles) */
.rules { list-style: none; counter-reset: rule; padding: 0; }
.rules > li { counter-increment: rule; display: grid; grid-template-columns: 50px 1fr; gap: 10px; padding: 14px 0; margin: 0; }
.rules > li + li { border-top: 1px solid var(--border); }
.rules > li::before { content: counter(rule); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-family: var(--display); font-weight: 800; font-size: 0.95rem; background: var(--accent-fill); color: var(--on-accent); }
.rules > li > div { padding-top: 5px; }
.rules p { margin: 0; }
.rule-title { font-weight: 700; margin-bottom: 4px !important; }

/* Tables */
.table-scroll { overflow-x: auto; margin: 0 0 1.2em; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.data { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.data th, .data td { text-align: left; padding: 11px 16px; vertical-align: top; }
.data thead th { font-family: var(--display); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); white-space: nowrap; border-bottom: 1px solid var(--border); background: var(--bg); }
.data tbody tr + tr { border-top: 1px solid var(--border); }
.data tbody tr:hover { background: var(--bg); }
.data tbody th { font-weight: 600; }
.data .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-hot th, .row-hot td { color: var(--accent); font-weight: 600; }

/* Stat blocks */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-bottom: 1.2em; }
.pair .note { margin: 0; }
.stat { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.stat p { margin: 0; }
.stat-k { font-family: var(--display); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px !important; }
.stat-v b { font-family: var(--display); font-size: 1.4rem; font-weight: 800; margin: 0 2px; }
.stat-big { font-family: var(--display); font-size: 1.9rem; font-weight: 800; letter-spacing: -0.04em; }
.quota { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 1.4em; }
.quota .stat p:last-child { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 1.2em; }
.cards3 .card { padding: 18px; box-shadow: none; }
.card h3 { display: flex; gap: 8px; align-items: center; }
.card h3 i { color: var(--accent); }
.cards3 ul { margin: 0; padding-left: 1.1em; font-size: 0.95rem; }

/* Copyable commands */
.cmd { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; text-align: left; font: inherit; color: var(--night-ink); background: var(--night); border: 1px solid var(--night); border-radius: 12px; padding: 11px 14px; margin: 0 0 1em; cursor: pointer; transition: transform 0.2s var(--ease), box-shadow 0.2s; }
.cmd:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -10px rgba(11, 15, 20, 0.6); }
.cmd code { background: none; padding: 0; font-size: 0.9rem; color: #d7e3ff; }
.cmd i { color: var(--night-accent); flex: none; }
.callouts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.callout-card { padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.callout-card h3 { display: flex; gap: 8px; align-items: center; }
.callout-card h3 i { color: var(--accent); }
.callout-card .cmd { margin-bottom: 8px; }
.callout-card p { font-size: 0.93rem; color: var(--muted); }
.callout-label { font-size: 0.8rem !important; margin-bottom: 4px !important; color: var(--muted); }
.command { padding: 22px 24px; margin: 0 0 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.command h3 { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; font-size: 1.2rem; }
.command h3 code { font-size: 0.95rem; color: var(--accent); background: var(--accent-soft); }
.fields-h { font-family: var(--display); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin: 1.3em 0 0.4em; }
.fields { margin: 0 0 1em; display: grid; }
.fields > div { display: grid; grid-template-columns: 180px 1fr; gap: 16px; padding: 8px 0; }
.fields > div + div { border-top: 1px solid var(--border); }
.fields dd { margin: 0; font-size: 0.96rem; }
.files { display: flex; gap: 8px; align-items: flex-start; font-size: 0.96rem; margin: 0; }
.files i { color: var(--accent); margin-top: 4px; }
.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ids { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 1.4em; }
.ids li { padding: 14px 16px; margin: 0; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.ids code { display: block; background: none; padding: 0; font-family: var(--display); font-weight: 800; font-size: 1.25rem; color: var(--accent); }
.ids span { font-size: 0.9rem; color: var(--muted); }

/* Search + filters */
.search { display: flex; align-items: center; gap: 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-strong); padding: 0 18px; margin-bottom: 16px; transition: border-color 0.2s, box-shadow 0.2s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search i { color: var(--muted); font-size: 1.2rem; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; padding: 13px 0; }
.search input::placeholder { color: #7a828d; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; }
.codes li { display: flex; gap: 12px; align-items: baseline; margin: 0; padding: 9px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.codes b { font: 500 0.9rem var(--mono); color: var(--accent); min-width: 5.4em; }
.codes span { font-size: 0.95rem; }
.empty { color: var(--muted); padding: 20px 0; }
.miranda { counter-reset: m; list-style: none; padding: 0; }
.miranda li { counter-increment: m; position: relative; padding: 12px 0 12px 50px; margin: 0; font-size: 1.05rem; }
.miranda li + li { border-top: 1px solid var(--border); }
.miranda li::before { content: counter(m); position: absolute; left: 0; top: 10px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 800; background: var(--accent-fill); color: var(--on-accent); }
.phonetic { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.phonetic li { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); display: flex; gap: 10px; align-items: baseline; }
.phonetic b { font-family: var(--display); font-size: 1.2rem; font-weight: 800; color: var(--accent); width: 1ch; }

/* Ranks */
.ladder { list-style: none; padding: 0; position: relative; }
.ladder::before, .ladder::after { content: ''; position: absolute; left: 17px; top: 18px; bottom: 18px; width: 2px; }
.ladder::before { background: var(--border-strong); }
.ladder::after { background: var(--accent-fill); transform-origin: top; transform: scaleY(var(--fill, 1)); }
.ladder li { position: relative; padding: 0 0 26px 54px; margin: 0; }
.ladder li::before { content: ''; position: absolute; left: 9px; top: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); border: 3px solid var(--accent-fill); z-index: 1; }
.ladder h3 { font-family: var(--display); font-weight: 800; margin-bottom: 4px; }
.ladder p { margin: 0; color: var(--muted); }
.chain { display: grid; gap: 12px; margin-bottom: 1.2em; }
.chain-group { padding: 16px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.chain-group h3 { font-family: var(--display); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.chain-group ul { list-style: none; padding: 0; margin: 0; }
.chain-group li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; margin: 0; }
.chain-group li + li { border-top: 1px solid var(--border); }
.chain-group li span:first-child { font-weight: 600; }
.chain-group li span:last-child { color: var(--muted); font-size: 0.92rem; }
.chain-group li.last span:last-child { color: var(--accent); font-weight: 600; }

/* Uniform tabs (radio + :checked, no JS) */
.tabs > input { position: absolute; opacity: 0; }
.tabs > label { display: inline-block; padding: 8px 16px; border: 1px solid var(--border-strong); border-radius: 999px; margin: 0 6px 16px 0; cursor: pointer; font-weight: 600; font-size: 0.95rem; color: var(--muted); background: var(--surface); transition: all 0.2s; }
.tabs > label:hover { color: var(--text); border-color: var(--text); }
.tabs > input:checked + label { background: var(--accent-fill); color: var(--on-accent); border-color: var(--accent-fill); }
.tabs > input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 3px; }
.tab-panel { display: none; }
#tab-wisp:checked ~ #panel-wisp, #tab-ocso:checked ~ #panel-ocso { display: block; }
.hats { margin: 0; overflow: hidden; border-radius: 12px; }


/* Divisions */
.divs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.div-card { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.div-card img { aspect-ratio: 16 / 8; object-fit: cover; width: 100%; transition: transform 0.5s var(--ease); }
.div-card:hover img { transform: scale(1.04); }
.div-copy { padding: 22px; }
.div-copy > :last-child { margin-bottom: 0; }
.div-copy h3 { font-family: var(--display); font-weight: 800; font-size: 1.3rem; }
.div-wide { grid-column: 1 / -1; background: var(--night); color: var(--night-ink); border-color: var(--night); }
.div-wide h3 { color: #fff; }
.div-wide a { color: var(--night-accent); }
.div-wide .div-copy p { color: var(--night-soft); }
.div-tag { display: flex; gap: 10px; align-items: center; margin-bottom: 8px !important; }
.div-tag b { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.div-wide .div-tag b { background: rgba(91, 140, 255, 0.18); color: var(--night-accent); }
.div-tag span { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.div-wide .div-tag span { color: var(--night-soft); }
.tagline { font-family: var(--display); font-size: 1.3rem; font-weight: 800; color: #fff !important; }

/* Penal codes */
.penal-bar { position: sticky; top: var(--top); z-index: 5; padding: 12px 0 4px; margin-bottom: 8px; background: var(--bg); }
.penal-bar .search { margin-bottom: 10px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.chips a { flex: none; font-size: 0.88rem; font-weight: 600; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); white-space: nowrap; transition: all 0.2s; }
.chips a:hover { text-decoration: none; border-color: var(--text); }
.penal th[scope='row'] { min-width: 12em; }
.code-copy { font: 500 0.84rem var(--mono); color: var(--accent); background: var(--accent-soft); border: 0; border-radius: 8px; padding: 4px 9px; cursor: pointer; white-space: nowrap; transition: background 0.2s, color 0.2s; }
.code-copy:hover { background: var(--accent-fill); color: var(--on-accent); }
.type { font-size: 0.78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; background: var(--bg-alt); color: var(--muted); }
.t-felony { background: rgba(220, 38, 38, 0.1); color: var(--bad); }
.t-misd { background: rgba(217, 119, 6, 0.12); color: var(--warn); }
.yes { color: var(--accent); font-weight: 700; }

/* Footer, 404, toast */
.foot { background: var(--bg-alt); border-top: 1px solid var(--border); padding-top: 56px; }
.foot-in { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; }
.foot .brand { color: var(--text); }
.foot-brand p { color: var(--muted); font-size: 0.93rem; max-width: 42ch; margin-top: 14px; }
.foot-h { font-family: var(--display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text); margin: 0 0 12px; }
.foot ul { list-style: none; padding: 0; margin: 0; }
.foot li { margin-bottom: 6px; }
.foot li a { color: var(--muted); font-size: 0.95rem; }
.foot li a:hover { color: var(--text); }
.foot-base { margin-top: 40px; padding-top: 20px; padding-bottom: 28px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.88rem; }
.lost { padding-top: 120px; padding-bottom: 150px; }
.lost-code { font: 500 1rem var(--mono); color: var(--accent); }
.lost h1 { font-size: clamp(2.4rem, 6vw, 4rem); letter-spacing: -0.05em; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: var(--night); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; transition: opacity 0.25s, transform 0.35s var(--ease); z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Reveals: without JS or with reduced motion everything is simply visible. */
.js-motion [data-reveal] { opacity: 0; transform: translateY(24px); }
.js-motion [data-reveal].in { opacity: 1; transform: none; transition: opacity 0.7s var(--ease), transform 0.8s var(--ease); }
@media (prefers-reduced-motion: no-preference) {
  #tab-wisp:checked ~ #panel-wisp, #tab-ocso:checked ~ #panel-ocso { animation: rise 0.45s var(--ease); }
}

/* ---------- Tablet and phone ---------- */
@media (max-width: 1100px) {
  .actions { grid-template-columns: repeat(3, 1fr); }
  .path { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 28px; }
  .rail { display: none; }
  .rail-mobile { display: block; margin-bottom: 28px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
  .rail-mobile summary { cursor: pointer; padding: 14px 18px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
  .rail-mobile .rail-nav { padding: 0 10px 12px; }
  .hb-grid { grid-template-columns: 1fr 1fr; }
  .quota { grid-template-columns: 1fr 1fr; }
  .cards3 { grid-template-columns: 1fr; }
  .foot-in { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 767px) {
  body { font-size: 1rem; }
  .top-in { gap: 10px; }
  .nav { display: none; }
  .top .btn { margin-left: auto; }
  .opener { min-height: 70svh; }
  .opener--doc { min-height: 48svh; }
  .stats, .links-grid, .credits, .pair, .split-2, .callouts, .divs { grid-template-columns: 1fr; }
  .stats { gap: 24px; }
  .actions { grid-template-columns: 1fr 1fr; }
  .path { grid-template-columns: 1fr; }
  .path li { padding: 18px 18px 18px 68px; }
  .path li::before { top: 16px; left: 18px; }
  .hb-grid { grid-template-columns: 1fr; }
  .results button { grid-template-columns: 100px 1fr; padding: 10px 12px; }
  .results em { display: none; }
  .fields > div { grid-template-columns: 1fr; gap: 4px; }
  .ids, .quota { grid-template-columns: 1fr 1fr; }
  .div-wide { grid-column: auto; }
  .link-row { grid-template-columns: auto 1fr; }
  .link-row .go { display: none; }
  .foot-in { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 560px) {
  .brand span, .pp-long { display: none; }
  .top .btn-sm { padding: 0.5em 0.85em; }
}
/* Tablet header: compact payoff pill; below 1180px no text links (pages keep the handbook menu). */
@media (max-width: 1023px) {
  .pp-long, .brand span { display: none; }
}

/* Legal pages (Terms, Privacy) */
.legal-head { background: var(--night); color: #fff; padding-block: clamp(56px, 9vw, 104px) clamp(32px, 5vw, 56px); }
.legal-head .stat-label { color: var(--night-accent); }
.legal-head h1 { margin: 0; font-size: clamp(2.4rem, 5.5vw, 4.2rem); letter-spacing: -0.05em; color: #fff; }
.legal-date { margin: 0.8rem 0 0; color: var(--night-soft); }
.legal { max-width: 780px; padding-block: clamp(40px, 6vw, 72px) clamp(56px, 8vw, 96px); }
.legal h2 { font-size: 1.35rem; letter-spacing: -0.03em; margin-top: 2em; }
.legal ul { display: grid; gap: 10px; margin: 0 0 1em; }
.legal li { margin: 0; }
.foot-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.foot-base p { margin: 0; }
.foot-legal { display: flex; gap: 20px; }
.foot-legal a { color: var(--muted); }
.foot-legal a:hover { color: var(--text); }
.foot .brand img { background: var(--night); border-radius: 9px; padding: 3px; }
.div-wide img { aspect-ratio: 16 / 5; }

/* Contact & command (modelled on gvrpj-site's contact page) */
.cx-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cx-choice { display: grid; gap: 8px; align-content: start; padding: clamp(24px, 3vw, 36px); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text); transition: transform 0.3s var(--ease); }
.cx-choice:hover { text-decoration: none; color: var(--text); transform: translateY(-3px); }
.cx-choice--dark { background: var(--night); border-color: var(--night); color: var(--night-ink); }
.cx-choice--dark:hover { color: var(--night-ink); }
.cx-choice-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 8px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); font-size: 1.5rem; }
.cx-choice--dark .cx-choice-icon { background: rgba(91, 140, 255, 0.18); color: var(--night-accent); }
.cx-kicker { font-family: var(--display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.cx-choice--dark .cx-kicker { color: var(--night-accent); }
.cx-choice-title { font-family: var(--display); font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -0.04em; }
.cx-choice-text { color: var(--muted); }
.cx-choice--dark .cx-choice-text { color: var(--night-soft); }
.cx-cta { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 700; color: var(--accent); }
.cx-choice--dark .cx-cta { color: var(--night-accent); }
.cx-rank { margin-top: 2.4rem; }
.cx-rank-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--night-line); }
.cx-rank-head h3 { margin: 0; font-family: var(--display); font-size: 1.3rem; font-weight: 800; color: #fff; }
.cx-rank-head span { font-size: 0.9rem; color: var(--night-soft); }
.cx-people { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.cx-person { display: flex; gap: 16px; align-items: center; margin: 0; padding: 16px; border-radius: var(--radius); background: var(--night-2); border: 1px solid var(--night-line); }
.cx-avatar { flex: none; width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: #222a35; }
.cx-person p { margin: 0; }
.cx-callsign, .cx-note { font: 500 0.8rem var(--mono); color: var(--night-accent); }
.cx-note { font-family: var(--font); font-weight: 600; }
.cx-name { font-family: var(--display); font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.cx-handle { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; color: var(--night-soft); }
@media (max-width: 767px) { .cx-choices { grid-template-columns: 1fr; } }
/* Seven nav links: compact the payoff pill below 1200px, drop the text links below 1180px (menus cover it). */
@media (max-width: 1199px) { .pp-long { display: none; } }
@media (max-width: 1179px) { .nav { display: none; } .top .btn { margin-left: auto; } }

/* Crossed-out codes (struck through in the handbook) */
.codes li.struck b, .codes li.struck span, .results li.struck b, .results li.struck span { text-decoration: line-through; opacity: 0.55; }
.codes li.struck del { text-decoration: none; }
.divs { grid-template-columns: 1fr; }
.penal tr.struck th, .penal tr.struck td { text-decoration: line-through; opacity: 0.55; }

/* Vehicles (built from the vehicle structure sheet) */
.veh-rank .sub { margin-top: 1.4em; }
.veh th[scope='row'] { min-width: 14em; }
.st-licensed { background: var(--accent-soft); color: var(--accent); }
.st-ingame { background: rgba(31, 157, 85, 0.12); color: var(--ok); }
.st-offsale { background: rgba(217, 119, 6, 0.12); color: var(--warn); }
.trims { display: flex; flex-wrap: wrap; gap: 4px; }
.trim { font-size: 0.78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--bg-alt); color: var(--text); white-space: nowrap; }

/* CAD (phase 1) */
.cad { padding-block: 32px 96px; }
.cad-login { max-width: 520px; margin: 24px auto; text-align: center; box-shadow: var(--shadow); }
.cad-login .btn { margin-top: 8px; }
.cad-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.cad-who { display: flex; align-items: center; gap: 12px; }
.cad-who img { border-radius: 50%; }
.cad-who b { display: block; }
.cad-who span:not(.tag) { font-size: 0.9rem; color: var(--muted); }
.cad-tabs { margin-left: auto; }
.cad-tabs button { color: var(--muted); border-color: var(--border-strong); background: var(--surface); }
.cad-tabs button[aria-pressed='true'] { background: var(--accent-fill); color: var(--on-accent); border-color: var(--accent-fill); }
.cad-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cad-tools .search { flex: 1 1 320px; margin: 0; }
.cad-tools p { margin: 0; }
.cad-rank .sub { margin-top: 1.2em; }
.cad-table td, .cad-table th { vertical-align: middle; }
.cad-notes { max-width: 32ch; color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.cad-actions { white-space: nowrap; text-align: right; }
.cad-actions .btn + .btn { margin-left: 6px; }
.cad-table tr.struck th, .cad-table tr.struck td { opacity: 0.55; }
.cad-flash { padding: 10px 14px; border-radius: 12px; background: rgba(31, 157, 85, 0.12); color: var(--ok); font-weight: 600; margin: 0 0 16px; }
.cad-flash.bad, .cad-error { background: rgba(220, 38, 38, 0.1); color: var(--bad); padding: 10px 14px; border-radius: 12px; font-weight: 600; }
.cad-dialog { width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--text); border: 0; border-radius: var(--radius); padding: 28px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5); }
.cad-dialog::backdrop { background: rgba(11, 15, 20, 0.6); }
.cad-dialog h2 { font-size: 1.5rem; }
.cad-dialog label { display: grid; gap: 6px; margin-bottom: 14px; font-weight: 600; font-size: 0.95rem; }
.cad-dialog input, .cad-dialog select, .cad-dialog textarea { font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); }
.cad-dialog input:focus, .cad-dialog select:focus, .cad-dialog textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.cad-dialog small { font-weight: 400; }
.cad-rank .cad-table { table-layout: fixed; min-width: 640px; }
.cad-rank .cad-full { min-width: 700px; }
.cad-rank .cad-table th:nth-child(1) { width: 12%; }
.cad-rank .cad-table th:nth-child(3) { width: 12%; }
.cad-rank .cad-full th:nth-child(4) { width: 14%; }
.cad-rank .cad-full th:nth-child(6) { width: 26%; }
.cad-table small { display: block; font-size: 0.8rem; font-weight: 400; color: var(--muted); margin-top: 2px; }
.cad-ok { color: var(--ok); font-weight: 700; }
.cad-short { color: var(--warn); font-weight: 700; }
/* Live board + your shift */
.cad-h { display: flex; align-items: center; gap: 10px; margin: 0; }
.cad-h .tag { margin: 0; }
.cad-live { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.cad-live .dot { width: 8px; height: 8px; border-radius: 50%; background: #1f9d55; animation: cad-pulse 2s infinite; }
@keyframes cad-pulse { 0% { box-shadow: 0 0 0 0 rgba(31, 157, 85, 0.5); } 70%, 100% { box-shadow: 0 0 0 8px rgba(31, 157, 85, 0); } }
@media (prefers-reduced-motion: reduce) { .cad-live .dot { animation: none; } }
.cad-empty { text-align: center; padding: 28px; }
.cad-board { min-width: 600px; }
.cad-warrants { min-width: 680px; }
.st-108 { background: rgba(31, 157, 85, 0.12); color: var(--ok); }
.st-106, .st-1015 { background: rgba(217, 119, 6, 0.12); color: var(--warn); }
.st-1097, .st-1023 { background: var(--accent-soft); color: var(--accent); }
.st-1011 { background: rgba(220, 38, 38, 0.1); color: var(--bad); }
.cad-shift { margin-bottom: 28px; display: grid; gap: 20px; }
.cad-shift-top { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; justify-content: space-between; }
.cad-shift-top p { margin: 0; }
.cad-shift-top .cad-timer { font: 800 clamp(2rem, 5vw, 2.8rem) / 1.1 var(--display); font-variant-numeric: tabular-nums; margin: 4px 0 6px; }
.cad-note { font-weight: 600; color: var(--text); }
.cad-status { display: grid; gap: 12px; }
.cad-note-in { display: grid; gap: 6px; font-weight: 600; font-size: 0.95rem; max-width: 420px; }
.cad-note-in input { font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); }
.cad-status-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.cad-status-btns span { font-weight: 400; opacity: 0.8; }
.cad-quota { display: grid; gap: 8px; }
.cad-quota-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 0.95rem; }
.cad-bar-track { height: 8px; border-radius: 999px; background: var(--bg-alt); overflow: hidden; }
.cad-bar-track span { display: block; height: 100%; background: var(--accent-fill); border-radius: inherit; }
.cad-mine summary { cursor: pointer; font-weight: 600; color: var(--accent); margin-top: 4px; }
.cad-mine .table-scroll { margin-top: 10px; }
.cad-dialog.wide { width: min(760px, calc(100vw - 32px)); }

/* Website preferences: gear button (header), footer link, and the panel (also the first-visit theme prompt) */
.prefs-btn { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 50%; background: none; color: var(--night-soft); font-size: 1.15rem; cursor: pointer; transition: color 0.2s, border-color 0.2s; }
.prefs-btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.4); }
.foot-prefs { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.foot-prefs:hover { color: var(--text); }
.theme-prompt:not(.is-prefs) .tp-prefs, .theme-prompt.is-prefs .tp-first, .theme-prompt.is-prefs .stat-label { display: none; }
.tp-label { margin: 0 0 8px; font-family: var(--display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.theme-prompt { position: fixed; right: 24px; bottom: 24px; z-index: 70; width: min(380px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45); opacity: 0; transform: translateY(16px); pointer-events: none; transition: opacity 0.3s, transform 0.4s var(--ease); }
.theme-prompt.show { opacity: 1; transform: none; pointer-events: auto; }
.theme-prompt.is-prefs { top: calc(var(--top) + 12px); bottom: auto; transform: translateY(-12px); }
.theme-prompt.is-prefs.show { transform: none; }
.theme-prompt h2 { font-size: 1.4rem; margin-bottom: 0.3em; }
.theme-prompt p:not(.stat-label) { color: var(--muted); font-size: 0.95rem; }
.tp-close { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.tp-close:hover { background: var(--bg-alt); color: var(--text); }
.tp-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tp-options button { display: grid; gap: 8px; padding: 8px 8px 10px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--bg); color: var(--text); font: 600 0.85rem var(--font); cursor: pointer; transition: border-color 0.2s, transform 0.2s var(--ease); }
.tp-options button:hover { border-color: var(--accent-fill); transform: translateY(-2px); }
.tp-options button[aria-pressed='true'] { border-color: var(--accent-fill); box-shadow: 0 0 0 3px var(--accent-soft); }
.tp-swatch { height: 52px; border-radius: 8px; border: 1px solid var(--border); }
.tp-light { background: linear-gradient(#0b0f14 0 28%, #f6f5f2 28%); }
.tp-dark { background: linear-gradient(#0b0f14 0 28%, #151b23 28%); }
.tp-system { background: linear-gradient(#0b0f14 0 28%, transparent 28%), linear-gradient(115deg, #f6f5f2 50%, #151b23 50%); }
@media (max-width: 560px) { .theme-prompt { right: 16px; bottom: 16px; } }
@media (prefers-reduced-motion: reduce) { .theme-prompt, .tp-options button { transition: none; } }

/* CAD personnel files */
.type.cad-bad { background: rgba(220, 38, 38, 0.12); color: var(--bad); }
.type.cad-warn { background: rgba(217, 119, 6, 0.14); color: var(--warn); }
.cad-table th .type { font-family: var(--font); margin-left: 4px; vertical-align: 1px; }
.file-meta { margin-bottom: 0.6em; }
.file-standing { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 1.2em; }
.file-standing .type { margin: 0; }
.file-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 20px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.file-actions .btn i { font-size: 1.05em; }
.file-actions .file-danger { color: var(--bad); margin-left: auto; }
.file-actions .file-danger:hover { border-color: var(--bad); color: var(--bad); }
.file-record { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.file-record li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); margin: 0; }
.file-record li.muted { display: block; }
.file-record li > i { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--bg-alt); color: var(--muted); font-size: 1rem; }
.file-record li p { margin: 4px 0 2px; overflow-wrap: anywhere; }
.file-record li span { color: var(--muted); }
.file-record small { color: var(--muted); font-size: 0.82rem; }
.file-record .rec-promote > i, .file-record .rec-infraction-lift > i, .file-record .rec-leave-end > i, .file-record .rec-rehire > i { background: rgba(31, 157, 85, 0.14); color: var(--ok); }
.file-record .rec-demote > i, .file-record .rec-leave-start > i { background: rgba(217, 119, 6, 0.14); color: var(--warn); }
.file-record .rec-infraction > i, .file-record .rec-terminate > i { background: rgba(220, 38, 38, 0.12); color: var(--bad); }
.cad-former { margin-top: 2rem; }
.cad-former summary { cursor: pointer; font-weight: 700; margin-bottom: 10px; }
.cad-match td { min-width: 260px; }
.cad-match select { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); }
.dsearch { display: flex; gap: 6px; margin-top: 6px; }
.dsearch input { flex: 1; min-width: 0; font: inherit; font-size: 0.9rem; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); }

/* CAD roster statistics */
.cad-stats { margin-bottom: 24px; display: grid; gap: 16px; }
.cad-stats-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.cad-stats-head .cad-live { margin: 0; }
.cad-stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.cad-stat { display: grid; gap: 2px; padding: 14px 16px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); min-width: 0; container-type: inline-size; }
.cad-stat .stat-label { margin: 0; }
.cad-stat b { font: 800 clamp(1.5rem, 3vw, 2rem) / 1.1 var(--display); font-size: min(2rem, calc(155cqi / var(--n, 4))); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; white-space: nowrap; } /* --n = characters in the value (see tiles in cad.js): long ones like $2,542,620 shrink to fit */
.cad-stat small { color: var(--muted); font-size: 0.82rem; }
@media (max-width: 900px) { .cad-stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cad-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.cad-len { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }

/* CAD: paycheck tracker, monthly achievements (Bronze/Premier/Diamond/Elite Officer) and Past months */
.cad-pay { margin-top: 8px; }
.cad-next { margin: 0; font-size: 0.88rem; }
.cad-ach { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.cad-ach li { display: grid; gap: 4px; font-size: 0.85rem; }
.cad-ach b { display: flex; align-items: center; gap: 4px; }
.cad-ach small { color: var(--muted); }
.cad-ach .cad-bar-track span { background: var(--ach); }
.ach-bronze { --ach: #b0773f; }
.ach-premier { --ach: #7d8795; }
.ach-diamond { --ach: #2aa7b5; }
.ach-elite { --ach: #8b5cf6; }
.cad-ach li.got b { color: var(--ach); }
.type[class*='ach-'] { background: color-mix(in srgb, var(--ach) 16%, transparent); color: var(--ach); }
.cad-month { margin-bottom: 16px; }
.cad-month summary { list-style: none; cursor: pointer; display: grid; gap: 14px; }
.cad-month summary::-webkit-details-marker { display: none; }
.cad-month summary .ph-caret-down { transition: transform 0.2s; }
.cad-month[open] summary .ph-caret-down { transform: rotate(180deg); }
.cad-month .cad-stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.cad-month .table-scroll { margin-top: 16px; }
.cad-pay-stats .cad-stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.cad-note-in select { font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); }

/* CAD: FTO tab (guide + quota cards) */
.cad-guide { margin-bottom: 16px; display: grid; gap: 10px; }
.cad-guide > :first-child { margin-top: 0; }
.cad-guide .sub { margin: 10px 0 0; }
.cad-guide ul, .cad-guide ol { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.cad-guide p { margin: 0; }
.cad-guide hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; width: 100%; }
.cad-table td .btn { margin-top: 6px; }
.cad-subtabs { margin-left: 0; }
.cad-len > label { min-width: 0; } .cad-dialog select { min-width: 0; width: 100%; }

/* CAD: 10-12 ride-alongs */
.st-1012 { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }
:root[data-theme='dark'] .st-1012 { color: #b69cff; }
.cad-st.st-sub { background: var(--accent-soft); color: var(--accent); }
.cad-st.st-urgent { background: rgba(220, 38, 38, 0.14); color: var(--bad); }
.cad-ride { display: grid; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(124, 58, 237, 0.3); background: rgba(124, 58, 237, 0.06); }
.cad-ride p { margin: 0; }

/* Penal codes: charge calculator (pinned to the bottom of the screen while the tables are in view) */
.code-cell { white-space: nowrap; }
.calc-add { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 6px; vertical-align: middle; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; position: relative; transition: background 0.2s, color 0.2s, border-color 0.2s; }
.calc-add:hover { border-color: var(--accent); color: var(--accent); }
.calc-add.on { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.calc-add[data-n]:not([data-n=''])::after { content: attr(data-n); position: absolute; top: -8px; right: -10px; font: 700 0.68rem var(--mono); background: var(--text); color: var(--bg); border-radius: 999px; padding: 1px 5px; }
.calc { position: sticky; bottom: 12px; z-index: 6; margin: 20px 0; padding: 14px 16px; display: grid; gap: 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18); }
.calc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.calc-head .stat-label { margin: 0; }
.calc-totals { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.calc-totals div { display: grid; gap: 2px; }
.calc-totals span { font-size: 0.78rem; color: var(--muted); }
.calc-totals b { font: 800 1.15rem / 1.2 var(--display); font-variant-numeric: tabular-nums; }
.calc-note { margin: 0; font-size: 0.88rem; color: var(--warn); }
.calc-list summary { cursor: pointer; font-weight: 600; color: var(--accent); font-size: 0.92rem; }
.calc-list ol { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; max-height: 30vh; overflow: auto; }
.calc-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; font-size: 0.9rem; }
.calc-list b { font: 600 0.82rem var(--mono); }
.calc-rm { border: 0; background: none; color: var(--muted); font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.calc-rm:hover { color: var(--bad); background: var(--bg-alt); }
.calc-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (max-width: 640px) { .calc-totals { grid-template-columns: repeat(3, minmax(0, 1fr)); } .calc-list li { grid-template-columns: 1fr auto; } .calc-list li .muted { grid-column: 1; } }

/* CAD tab skeletons (shown while a tab loads) and the fade-in that follows */
.cad-skel { display: inline-block; border-radius: 8px; background: linear-gradient(90deg, var(--bg-alt) 25%, var(--surface) 50%, var(--bg-alt) 75%); background-size: 200% 100%; animation: cad-shimmer 1.3s linear infinite; }
.cad-skel-wrap > p { margin: 14px 0; }
.cad-skel-card { display: grid; gap: 12px; padding: 20px; margin-bottom: 16px; }
.cad-skel-stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.cad-skel-stats > div { display: grid; gap: 8px; }
.cad-skel-table { padding: 6px 18px; }
.cad-skel-row { display: flex; gap: 6%; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.cad-skel-row:last-child { border-bottom: 0; }
@keyframes cad-shimmer { to { background-position: -200% 0; } }
.cad-in > :not(.cad-bar) { animation: cad-fade 0.22s var(--ease, ease-out); }
@keyframes cad-fade { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .cad-skel { animation: none; } .cad-in > :not(.cad-bar) { animation: none; } }

/* ---------- Cadet Academy (/academy/) ---------- */
.ac { max-width: 860px; padding-top: 40px; padding-bottom: 96px; display: grid; gap: 36px; }
.ac h2 { margin: 0 0 14px; font: 800 clamp(1.35rem, 2.6vw, 1.7rem) / 1.2 var(--display); color: var(--text); letter-spacing: -0.01em; }
.ac .note { margin: 0; }
.ac-k { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.ac-k i { font-size: 1.05rem; }
.ac-path { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; counter-reset: p; }
.ac-path li { position: relative; padding: 14px 14px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); display: grid; gap: 2px; counter-increment: p; }
.ac-path li::before { content: counter(p); font: 800 0.8rem var(--display); color: var(--muted); }
.ac-path li span { font-size: 0.85rem; color: var(--muted); }
.ac-path li.here { border-color: var(--accent); background: var(--accent-soft); }
.ac-path li.here::after { content: 'You’re here'; position: absolute; top: -10px; right: 10px; font-size: 0.68rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--accent-fill); color: var(--on-accent); }
.ac-tools { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ac-tool { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; transition: border-color 0.2s, transform 0.2s; }
.ac-tool:hover { border-color: var(--accent); transform: translateY(-1px); }
.ac-tool > i { grid-row: span 2; font-size: 1.5rem; color: var(--accent); margin-top: 2px; }
.ac-tool span { font-size: 0.9rem; color: var(--muted); }
.ac-steps-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.ac-progress { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; font-weight: 700; color: var(--muted); }
.ac-bar { width: 140px; height: 8px; border-radius: 999px; background: var(--bg-alt); overflow: hidden; }
.ac-bar span { display: block; height: 100%; background: var(--accent-fill); transform: scaleX(0); transform-origin: left; transition: transform 0.4s var(--ease); }
.ac-steps { display: grid; gap: 10px; }
.ac-step { border-radius: 16px; background: var(--surface); border: 1px solid var(--border); scroll-margin-top: calc(var(--top, 64px) + 16px); }
.ac-step[open] { border-color: var(--border-strong); box-shadow: var(--shadow); }
.ac-step summary { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer; list-style: none; min-height: 64px; }
.ac-step summary::-webkit-details-marker { display: none; }
.ac-n { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--bg-alt); font: 800 0.95rem var(--display); }
.ac-t { display: grid; gap: 2px; }
.ac-t small { color: var(--muted); font-size: 0.88rem; }
.ac-ic { font-size: 1.4rem; color: var(--muted); }
.ac-n i { display: none; font-size: 1.1rem; }
.ac-step.is-done .ac-n { background: var(--ok); color: #fff; }
.ac-step.is-done .ac-n span { display: none; }
.ac-step.is-done .ac-n i { display: block; }
.ac-body { padding: 0 18px 20px 66px; display: grid; gap: 16px; }
.ac-body > p { margin: 0; }
.ac-body .table-scroll { margin: 0; }
.ac-dd { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ac-dd > div { padding: 14px 16px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); }
.ac-dd ul { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; font-size: 0.95rem; }
.ac-dont .ac-k { color: var(--bad); }
.ac-do .ac-k { color: var(--ok); }
.ac-rules { margin: -8px 0 0; padding-left: 1.3em; display: grid; gap: 6px; }
.ac-words { margin: 0; display: grid; gap: 8px; padding: 12px 16px; border-radius: 12px; border: 1px dashed var(--border-strong); }
.ac-words div { display: grid; grid-template-columns: minmax(90px, auto) 1fr; gap: 12px; font-size: 0.92rem; }
.ac-words dt { font-weight: 800; }
.ac-words dd { margin: 0; color: var(--muted); }
.ac-map, .ac-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ac-tiles { grid-template-columns: repeat(2, 1fr); }
.ac-map > div, .ac-tiles > div { padding: 14px 16px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); }
.ac-map p:last-child, .ac-tiles p:last-child { margin: 0; font-size: 0.93rem; }
.ac-pair { display: grid; gap: 6px; }
.ac-pair p { margin: 0; }
.ac-pair i { color: var(--accent); margin-right: 6px; vertical-align: -2px; }
.ac-more { border-radius: 12px; border: 1px solid var(--border); padding: 0 16px; }
.ac-more summary { display: flex; align-items: center; gap: 8px; padding: 12px 0; font-weight: 700; cursor: pointer; }
.ac-more ul { padding-left: 1.1em; display: grid; gap: 8px; }
.ac-check, .ac-drill { padding: 16px; border-radius: 12px; background: var(--accent-soft); display: grid; gap: 10px; }
.ac-check .ac-k, .ac-drill .ac-k { margin: 0; }
.ac-q { margin: 0; font-weight: 700; }
.ac-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.ac-opt { font: inherit; font-weight: 600; padding: 10px 16px; min-height: 44px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.ac-opt:hover { border-color: var(--accent); }
.ac-opt.is-right { border-color: var(--ok); background: rgba(31, 157, 85, 0.14); }
.ac-opt.is-wrong { border-color: var(--bad); background: rgba(220, 38, 38, 0.1); }
.ac-fb { margin: 0; font-weight: 600; }
.ac-fb.ok { color: var(--ok); }
.ac-fb.no { color: var(--bad); }
.ac-drill .btn { justify-self: start; }
.ac-find-links { display: flex; flex-wrap: wrap; gap: 8px; }
.ac-find-links a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.ac-find-links a:hover { border-color: var(--accent); color: var(--accent); }
.ac-got { justify-self: start; }
.ac-end h2 { margin-top: 0; }
.ac-end .btn-row { margin: 0 0 1rem; }
.ac-reset { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }
@media (max-width: 720px) {
  .ac-path { grid-template-columns: 1fr 1fr; row-gap: 16px; }
  .ac-tools, .ac-dd, .ac-map, .ac-tiles { grid-template-columns: 1fr; }
  .ac-body { padding: 0 14px 18px; }
  .ac-step summary { padding: 14px; gap: 12px; }
  .ac-ic { display: none; }
}
@media (prefers-reduced-motion: reduce) { .ac-bar span, .ac-tool { transition: none; } }

/* CAD on phones: every tab on screen. Name + Log out on top, tabs in an even 3-column grid underneath (no row that
   runs off the edge and makes the whole page scroll sideways). Sub-tab rows wrap. */
.cad-tabs { flex-wrap: wrap; max-width: 100%; }
@media (max-width: 720px) {
  .cad-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'who out' 'tabs tabs'; gap: 14px 12px; }
  .cad-bar > .cad-who { grid-area: who; min-width: 0; }
  .cad-bar > .cad-tabs { grid-area: tabs; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .cad-bar > .cad-tabs button { min-height: 46px; padding: 6px 8px; line-height: 1.2; white-space: normal; text-align: center; }
  .cad-bar > [data-logout] { grid-area: out; }
}

/* Vehicles page: editing bar and the vehicle form's trim checkboxes (Administrative Staff) */
.veh-admin { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 1em; }
.veh-rank .sub .veh-add { margin-left: 10px; vertical-align: middle; }
.veh-trims { border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px 14px; margin: 0 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px 16px; }
.veh-trims legend { padding: 0 6px; font-weight: 600; font-size: 0.95rem; }
.veh-trim { display: flex !important; align-items: center; gap: 8px; margin: 0 !important; font-weight: 500 !important; }
.veh-trim input { width: 18px; height: 18px; margin: 0; flex: none; }
.veh-remove { margin: 0 0 18px; }
.veh-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { .veh-row2 { grid-template-columns: 1fr; } }

/* Rosters (CAD and staff site): one table, column headings once (pinned under the site header while the page scrolls),
   each rank a slim divider row with a coloured edge right above its members. Phones: two-line rows, no sideways scroll. */
.roster-wrap { margin: 0 0 1.2em; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.roster { table-layout: fixed; }
.roster thead th { position: sticky; top: var(--top); z-index: 2; }
.roster thead tr th:first-child { border-top-left-radius: var(--radius); }
.roster thead tr th:last-child { border-top-right-radius: var(--radius); }
.roster .roster-rank th { padding: 9px 16px; font: 700 0.82rem var(--display); letter-spacing: 0.04em; text-transform: uppercase; color: var(--rk, var(--accent)); background: color-mix(in srgb, var(--rk, var(--accent)) 7%, var(--bg)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); box-shadow: inset 3px 0 0 var(--rk, var(--accent)); }
.roster .roster-rank th span { margin-left: 8px; font: 600 0.78rem var(--font); letter-spacing: 0; text-transform: none; color: var(--muted); }
.roster tbody.roster-group:first-of-type .roster-rank th { border-top: 0; }
.roster tbody tr.roster-rank:hover { background: none; }
.roster tbody tr.roster-m + tr.roster-m { border-top: 1px solid var(--border); }
.roster th:nth-child(1) { width: 12%; }
.cad-table.roster th:nth-child(3) { width: 13%; }
.cad-full.roster th:nth-child(4) { width: 15%; }
.cad-full.roster th:nth-child(6) { width: 25%; }
.roster .r-acts .btn { opacity: 0.72; transition: opacity 0.15s; }
.roster tr.roster-m:hover .r-acts .btn, .roster .r-acts .btn:focus-visible { opacity: 1; }
@media (hover: none) { .roster .r-acts .btn { opacity: 1; } }
@media (max-width: 720px) {
  .roster, .roster tbody, .roster tr, .roster th, .roster td { display: block; width: auto !important; }
  .roster thead { display: none; }
  .roster tbody.roster-group[hidden] { display: none; }
  .roster .roster-rank th { border-top: 1px solid var(--border); }
  .roster tr.roster-m { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'cs name st' 'cs hrs ac' 'cs nt nt'; gap: 6px 12px; align-items: center; padding: 12px 14px; }
  .roster tr.roster-m[hidden] { display: none; }
  .roster tr.roster-m > * { padding: 0; }
  .roster .r-cs { grid-area: cs; font-weight: 700; }
  .roster .r-name { grid-area: name; min-width: 0; }
  .roster .r-st { grid-area: st; text-align: right; }
  .roster .r-hrs { grid-area: hrs; white-space: normal; }
  .roster .r-notes { grid-area: nt; max-width: none; }
  .roster .r-notes:empty { display: none; }
  .roster .r-acts { grid-area: ac; text-align: right; }
  .roster .r-acts .btn { padding: 5px 10px; font-size: 0.8rem; }
  .roster .r-acts .btn + .btn { margin-left: 4px; }
  .roster .r-cs { align-self: start; }
  .roster tbody.roster-group:first-of-type .roster-rank th { border-top: 0; }
  .roster-wrap { overflow: hidden; } /* no pinned headings on phones, so the corners can be clipped */
}

/* =========================================================
   WisDOT layer: highway-sign shapes on top of the shared system.
   ========================================================= */
/* Signs have small, consistent corners: 6px for controls, 10px for panels. */
.btn, .nav a, .seg button, .spot, .tag, .badge, .payoff-pill, .type, .search, .cad-tabs button { border-radius: 6px; }
.btn { font-weight: 700; letter-spacing: 0.01em; }
.btn-primary { box-shadow: inset 0 0 0 2px rgba(28, 31, 34, 0.18); }
h1, h2, h3, .h2, .opener-title, .hb-body b, .stats b { letter-spacing: -0.01em; }
.opener-title { font-weight: 900; line-height: 0.98; letter-spacing: -0.02em; }
.h2 { font-weight: 900; }
.stat-label { font-family: var(--display); letter-spacing: 0.08em; }

/* Work-zone stripe under the header and above the footer. */
.hazard { height: 8px; background: repeating-linear-gradient(-45deg, var(--hazard) 0 14px, var(--night) 14px 28px); }
.foot { border-top: 8px solid transparent; border-image: repeating-linear-gradient(-45deg, var(--hazard) 0 14px, var(--night) 14px 28px) 8; }
.top { border-bottom: 0; }

/* Callsign as a route shield: white sign, black border, bold numerals. */
.shield { display: inline-grid; place-items: center; min-width: 3.2em; padding: 0.12em 0.45em 0.05em; border: 2px solid #1c1f22; border-radius: 6px 6px 50% 50% / 6px 6px 22% 22%; background: #fff; color: #1c1f22; font: 800 0.86em/1.1 var(--display); letter-spacing: 0; white-space: nowrap; box-shadow: 0 0 0 1.5px #fff; }
.shield.none { border-style: dashed; color: #6b7076; }

/* Green guide sign: white text and a white inner border, like the panels over a highway. */
.guide { position: relative; display: grid; gap: 4px; padding: 18px 20px; border-radius: 10px; background: var(--sign-green); color: #fff; box-shadow: inset 0 0 0 3px var(--sign-green), inset 0 0 0 5px rgba(255, 255, 255, 0.9); }
.guide b { font: 800 1.2rem/1.15 var(--display); }
.guide small { color: rgba(255, 255, 255, 0.86); font-size: 0.95rem; }
a.guide { text-decoration: none; transition: transform 0.25s var(--ease); }
a.guide:hover { color: #fff; transform: translateY(-3px); }
.guide .ph-arrow-right, .guide .ph-arrow-up-right { position: absolute; right: 18px; top: 18px; font-size: 1.3rem; }
.guides { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.guides li { margin: 0; }

/* Amber warning panel (diamond sign colours) for "first week" and must-know boxes. */
.amber { padding: 22px 24px; border-radius: 10px; background: var(--accent-fill); color: #1c1f22; box-shadow: inset 0 0 0 3px var(--accent-fill), inset 0 0 0 5px #1c1f22; }
.amber h2, .amber h3 { color: #1c1f22; }
.amber a { color: #1c1f22; text-decoration: underline; text-underline-offset: 3px; }
.amber ol, .amber ul { margin: 0.6em 0 0; }

/* Career ladder: one rung per rank, lowest at the bottom. */
.ladder { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 10px; counter-reset: rung; }
.ladder li { margin: 0; display: grid; grid-template-columns: 8.5rem 1fr auto; gap: 6px 18px; align-items: start; padding: 16px 18px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--rk, var(--accent)); }
.ladder .rung-cs { font-family: var(--display); font-weight: 800; color: var(--muted); font-size: 0.9rem; padding-top: 3px; }
.ladder b { font: 800 1.1rem/1.2 var(--display); display: block; }
.ladder p { margin: 4px 0 0; color: var(--muted); font-size: 0.98rem; }
.ladder .rung-q { text-align: right; font-size: 0.9rem; color: var(--muted); white-space: nowrap; }
.ladder .rung-q strong { display: block; color: var(--text); font: 800 1.05rem var(--display); }
@media (max-width: 720px) {
  .ladder li { grid-template-columns: 1fr auto; }
  .ladder .rung-cs { grid-column: 1 / -1; padding: 0; }
}

/* Session slot meter on the CAD board and the vehicles page. */
.slots { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 1rem; padding: 0; list-style: none; }
.slots li { margin: 0; display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-size: 0.92rem; }
.slots .pips { display: inline-flex; gap: 4px; }
.slots .pips i { width: 12px; height: 12px; border-radius: 3px; background: var(--border-strong); }
.slots .pips i.on { background: var(--accent-fill); box-shadow: inset 0 0 0 1.5px #1c1f22; }
.slots li.full { border-color: var(--hazard); }
.slots li.full b { color: var(--bad); }

/* Certification chips on the roster and the medal chips. */
.certs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cert { display: inline-block; padding: 1px 7px; border-radius: 4px; font: 700 0.72rem/1.5 var(--display); letter-spacing: 0.04em; text-transform: uppercase; background: var(--bg-alt); color: var(--muted); border: 1px solid var(--border); }
.cert.on { background: var(--sign-green); color: #fff; border-color: var(--sign-green); }
.medal { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 6px; font-weight: 700; font-size: 0.82rem; background: color-mix(in srgb, var(--m) 18%, transparent); color: color-mix(in srgb, var(--m) 70%, var(--text)); border: 1px solid color-mix(in srgb, var(--m) 45%, transparent); }
.medal-copper { --m: #b8733a; } .medal-gold { --m: #d4a017; } .medal-platinum { --m: #8fa3b5; } .medal-emerald { --m: #1f9d68; } .medal-top { --m: #e0218a; }

/* Roster rank dividers: flat sign colours per tier (set per rank in cad.js). */
.roster .roster-group .roster-rank th { color: color-mix(in srgb, var(--rk, var(--accent)) 75%, var(--text)); background: color-mix(in srgb, var(--rk, var(--accent)) 9%, var(--bg)); box-shadow: inset 5px 0 0 var(--rk, var(--accent)); }

/* Two-column tables and fact lists on handbook pages. */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 1.2rem 0; }
.facts > div { padding: 14px 16px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.facts b { display: block; font: 800 1.5rem/1.1 var(--display); }
.facts small { color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 28px; }
.medal-card { height: 100%; padding: 18px 20px; }
.medal-card b { display: block; font: 800 1.15rem var(--display); margin-bottom: 6px; }
.medal-card ul { margin: 0; padding-left: 1.1em; font-size: 0.95rem; }
.first-week { padding-top: 0; }
.guide .ph:first-child { font-size: 1.6rem; margin-bottom: 4px; }
.cad-certs { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; }
.cad-certs legend { padding: 0 6px; font-weight: 700; font-size: 0.9rem; }
.cad-certs .check { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; }
.cad-board .shield, .roster .shield { font-size: 0.8rem; }
