/* Pit Wall: one stylesheet for every page. Minimal, frosted, greys plus BFR red. Dark by default; theme.js switches to light. */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0b0c; --text: #f5f5f7; --muted: #a1a1a6; --low: #6e6e73;
  --glass: rgb(40 40 44 / .55); --glass-strong: rgb(34 34 38 / .74); --solid: #1c1c1e; --header: rgb(18 18 20 / .62);
  --line: rgb(255 255 255 / .08); --line-strong: rgb(255 255 255 / .16); --hover: rgb(255 255 255 / .06);
  --field: rgb(0 0 0 / .35); --field-line: rgb(255 255 255 / .18);
  --red: #e0213f; --red-text: #ff6b7d; --red-halo: rgb(255 58 82 / .2); --red-glow: rgb(224 33 63 / .42);
  --dot: #f5f5f7; --selected: #f5f5f7; --on-selected: #0b0b0c;
  --shadow: 0 10px 30px rgb(0 0 0 / .45); --shadow-pop: 0 24px 60px rgb(0 0 0 / .6);
  --glow-a: rgb(150 24 50 / .38); --glow-b: rgb(80 80 90 / .32);
  --green: #30d158;
}
[data-theme="light"] {
  color-scheme: light;
  --page: #eeeef0; --text: #0b0b0c; --muted: #55555a; --low: #a1a1a6;
  --glass: rgb(255 255 255 / .72); --glass-strong: rgb(255 255 255 / .8); --solid: #fff; --header: rgb(255 255 255 / .62);
  --line: rgb(0 0 0 / .07); --line-strong: rgb(0 0 0 / .14); --hover: rgb(0 0 0 / .045);
  --field: #fff; --field-line: rgb(0 0 0 / .18);
  --red: #c8102e; --red-text: #b0122e; --red-halo: rgb(200 16 46 / .14); --red-glow: rgb(200 16 46 / .3);
  --dot: #0b0b0c; --selected: #0b0b0c; --on-selected: #fff;
  --shadow: 0 10px 30px rgb(0 0 0 / .1); --shadow-pop: 0 24px 60px rgb(0 0 0 / .22);
  --glow-a: rgb(232 165 177 / .55); --glow-b: rgb(255 255 255 / .95);
  --green: #1a7f37;
}
:root { --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif; font: 16px/1.5 var(--sans); color: var(--text); background: var(--page); }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
/* Soft glows behind everything: gradients, not blur filters, so they cost nothing to draw. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(640px 460px at 100% 0, var(--glow-a), transparent 70%), radial-gradient(560px 460px at 0 100%, var(--glow-b), transparent 70%);
}
h1, h2, h3, h4, p, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num, .mono { font-variant-numeric: tabular-nums; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; }
.error { color: var(--red-text); font-size: 14px; overflow-wrap: anywhere; }
.error:empty { display: none; }
.empty { color: var(--muted); padding: 16px 0; }

/* ---- Header ---- */
.masthead {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; height: 56px; padding: 0 22px;
  background: var(--header); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
}
.icon { width: 1em; height: 1em; flex: none; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 650; letter-spacing: -.015em; text-decoration: none; white-space: nowrap; margin-right: 8px; }
.logo-mark { display: inline-block; aspect-ratio: 800 / 275; height: auto; background: currentColor; -webkit-mask: url(/logo.png) center / contain no-repeat; mask: url(/logo.png) center / contain no-repeat; }
.brand .logo-mark { width: 56px; height: auto; color: var(--red); }
/* Section pills: emblem + label, the open section is lit. */
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav a, .tabbar a { position: relative; display: flex; align-items: center; gap: 7px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 500; }
.nav a { padding: 7px 12px; border-radius: 10px; font-size: 14px; }
.nav a .icon { width: 16px; height: 16px; }
.nav a:hover { color: var(--text); background: var(--hover); }
.nav a[aria-current="page"] { color: var(--text); background: var(--hover); box-shadow: inset 0 0 0 1px var(--line-strong); }
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.tabbar { display: none; }
.mast-end { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.mast-link { color: var(--muted); text-decoration: none; }
.mast-link:hover { color: var(--text); }
.account { display: flex; align-items: center; gap: 14px; }
.account button { background: none; border: 0; padding: 0; color: var(--text); font-size: 14px; min-height: 44px; }
.theme-toggle { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--hover); color: var(--text); }
.theme-toggle svg { width: 17px; height: 17px; }
[data-theme="light"] .theme-toggle .sun, :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }

/* ---- Page frame ---- */
.page { max-width: 1120px; margin: 0 auto; padding: 30px 22px 72px; }
.page-title { display: flex; align-items: center; gap: 12px; font-size: 32px; font-weight: 650; letter-spacing: -.035em; line-height: 1.1; margin-bottom: 20px; }
.page-title .icon { width: 30px; height: 30px; stroke-width: 1.5; color: var(--muted); }
.sheet { background: var(--glass); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: clip; }
.sheet + .sheet { margin-top: 18px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 21px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.sheet-section { padding: 16px 20px 20px; border-top: 1px solid var(--line); }
.sheet-section:first-child { border-top: 0; }
.sheet-section > .label { display: block; margin-bottom: 12px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.facts { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; font-size: 14px; color: var(--muted); }
.facts b { color: var(--text); font-weight: 500; }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 72ch; }

/* ---- Buttons and fields ---- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  background: var(--hover); border: 1px solid var(--line-strong); border-radius: 12px; color: var(--text);
  font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.button:hover { background: var(--line-strong); }
.button.primary { background: var(--red); border-color: transparent; color: #fff; box-shadow: 0 6px 18px var(--red-glow); }
.button.primary:hover { filter: brightness(1.08); }
.button.ghost { background: none; border-color: transparent; padding: 0 10px; }
.button.ghost:hover { background: var(--hover); }
.button:disabled { opacity: .5; cursor: default; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; font-size: 14px; font-weight: 500; }
.field input, .field select, .field textarea, .table input {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--field-line); border-radius: 11px;
  background: var(--field); font-size: 16px; font-weight: 400; font-variant-numeric: tabular-nums;
}
.field textarea { min-height: 100px; resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus, .table input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-halo); }
.field .hint { font-weight: 400; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 16px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-all { grid-column: 1 / -1; }
.inline-change { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.inline-change .button { min-height: 36px; }

/* Severity in one colour: Critical solid red, High red ring, Medium solid ink, Low grey. The word is always shown. */
.sev { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.sev::before { content: ""; width: 9px; height: 9px; border-radius: 50%; flex: none; box-sizing: border-box; }
.sev.sev-critical { color: var(--red-text); }
.sev.sev-critical::before { background: var(--red); box-shadow: 0 0 0 3px var(--red-halo); }
.sev.sev-high::before { border: 2px solid var(--red); }
.sev.sev-medium::before { background: var(--dot); }
.sev.sev-low { color: var(--muted); }
.sev.sev-low::before { background: var(--low); }
.status { font-size: 13px; font-weight: 500; white-space: nowrap; }
.status-closed { color: var(--muted); }

.severity-wrap { display: grid; gap: 6px; }
.severity-wrap > .field-name { font-size: 14px; font-weight: 500; }
.severity-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.severity-pick label { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 11px; background: var(--hover); border: 1px solid var(--line); cursor: pointer; font-size: 14px; font-weight: 500; }
.severity-pick input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.severity-pick label:has(input:checked) { background: var(--selected); color: var(--on-selected); border-color: transparent; font-weight: 600; }
/* Each severity button carries its own colour (same as the subsystem board): a dot when unselected, filled when picked. */
.severity-pick label[class^="sev-"]::before { content: ""; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: var(--sev-color); }
.severity-pick label.sev-low { --sev-color: var(--ring-low); } .severity-pick label.sev-medium { --sev-color: var(--ring-medium); }
.severity-pick label.sev-high { --sev-color: var(--ring-high); } .severity-pick label.sev-critical { --sev-color: var(--ring-critical); }
.severity-pick label[class^="sev-"]:has(input:checked) { background: var(--sev-color); color: #111; box-shadow: 0 6px 18px color-mix(in srgb, var(--sev-color) 40%, transparent); }
.severity-pick label[class^="sev-"]:has(input:checked)::before { background: rgb(0 0 0 / .35); }
.severity-pick label.sev-critical:has(input:checked) { color: #fff; }
.intel-thumb .icon { width: 40px; height: 40px; stroke-width: 1.4; }
.intel-thumb.has-icon { gap: 4px; align-content: center; font-size: 12px; letter-spacing: .08em; }
.severity-pick label:has(input:focus-visible) { outline: 2px solid var(--red); outline-offset: 2px; }

.drop {
  position: relative; display: grid; place-items: center; gap: 4px; min-height: 96px; padding: 16px; text-align: center;
  border: 1.5px dashed var(--line-strong); border-radius: 14px; background: var(--hover); font-size: 15px; font-weight: 400;
}
.drop:hover, .drop:focus-within { border-color: var(--muted); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop strong { font-weight: 600; }
.drop .files { font-size: 13px; color: var(--text); }

.check { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border-radius: 12px; background: var(--hover); border: 1px solid var(--line); font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--red); flex: none; }
.check:has(input:checked) { border-color: var(--line-strong); }

/* ---- Tables and lists ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td, .table tbody tr:last-child th { border-bottom: 0; }
.table tbody th { font-size: 14px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--text); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: var(--hover); }
.table a { font-weight: 600; text-decoration: none; }
.table a:hover { text-decoration: underline; text-underline-offset: 3px; }
.table input { min-width: 66px; min-height: 40px; padding: 6px 9px; }
.table .changed td { background: var(--red-halo); }
.sheet > .table-wrap .table th:first-child, .sheet > .table-wrap .table td:first-child { padding-left: 20px; }
.sheet > .table-wrap .table th:last-child, .sheet > .table-wrap .table td:last-child { padding-right: 20px; }
.readout { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px 20px; }
.readout dt { font-size: 12px; font-weight: 500; color: var(--muted); }
.readout dd { margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.readout dd.num { font-variant-numeric: tabular-nums; }
.issue-line { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 11px 0; border-top: 1px solid var(--line); }
.issue-line:first-of-type { border-top: 0; }
.issue-line a { font-weight: 600; text-decoration: none; }
.laps { display: flex; flex-wrap: wrap; gap: 6px; }
.laps span { font-variant-numeric: tabular-nums; padding: 6px 12px; border-radius: 10px; background: var(--hover); border: 1px solid var(--line); }
.laps .best { background: var(--selected); color: var(--on-selected); border-color: transparent; font-weight: 600; }
.checks-read li { display: flex; gap: 10px; padding: 5px 0; }
.checks-read .yes::before { content: "✓"; font-weight: 700; width: 1em; }
.checks-read .no { color: var(--muted); }
.checks-read .no::before { content: "–"; width: 1em; }

/* ---- Car layout: four corners as seen from above ---- */
.car { display: grid; grid-template-columns: auto 1fr 1fr; gap: 12px 16px; }
/* FRONT and REAR run vertically beside their axle. */
.car-end { display: flex; align-items: center; justify-content: center; writing-mode: vertical-rl; transform: rotate(180deg); padding: 0 2px; font-size: 11px; font-weight: 600; letter-spacing: .3em; color: var(--muted); border-right: 2px solid var(--line-strong); }
.corner { border-radius: 14px; background: var(--hover); border: 1px solid var(--line); min-width: 0; overflow: clip; }
.corner > h4 { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; font-size: 15px; font-weight: 650; border-bottom: 1px solid var(--line); }
.corner > h4 span { font-size: 13px; font-weight: 400; color: var(--muted); }
.corner-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--line); }
.corner > h4 + .corner-row { border-top: 0; }
.corner-row .field { font-size: 12px; color: var(--muted); }
.corner-row .field input { min-height: 40px; padding: 6px 9px; }
.corner-row .value { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.balance { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 14px; font-size: 14px; font-variant-numeric: tabular-nums; }
.balance div { display: flex; gap: 8px; }
.balance dt { color: var(--muted); }

/* ---- Pop-ups: the only real blur on the page, besides the header ---- */
#track-dialog {
  width: min(780px, calc(100% - 32px)); max-height: min(92dvh, 960px); padding: 0; color: var(--text);
  background: var(--solid); border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: var(--shadow-pop);
}
#track-dialog[open] { display: flex; flex-direction: column; }
#track-dialog::backdrop { background: rgb(0 0 0 / .55); }
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  #track-dialog { background: var(--glass-strong); -webkit-backdrop-filter: blur(30px) saturate(1.3); backdrop-filter: blur(30px) saturate(1.3); }
  #track-dialog::backdrop { background: rgb(0 0 0 / .3); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  [data-theme="light"] #track-dialog::backdrop { background: rgb(0 0 0 / .16); }
}
@media (prefers-reduced-transparency: reduce) {
  .masthead, #track-dialog, .sheet, .panel, .metrics, .sidebar { background: var(--solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
  #track-dialog::backdrop { background: rgb(0 0 0 / .55); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { font-size: 19px; font-weight: 650; letter-spacing: -.015em; }
#dialog-content { display: flex; flex-direction: column; min-height: 0; flex: 1; }
#dialog-content > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.form-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px 24px; display: grid; gap: 18px; align-content: start; overscroll-behavior: contain; }
.form-context { font-size: 13px; color: var(--muted); }
.form-section { display: grid; gap: 12px; }
.form-section + .form-section { padding-top: 18px; border-top: 1px solid var(--line); }
.form-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); }
.form-foot .error { flex-basis: 100%; }
.form-foot .hint { margin-right: auto; font-size: 13px; }
.steps { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 0 12px; border-bottom: 1px solid var(--line); }
.steps button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 0 8px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; font-weight: 500; text-align: left; }
.steps .n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid currentColor; font-size: 12px; flex: none; }
.steps [aria-current="step"] { color: var(--text); border-bottom-color: var(--red); font-weight: 600; }
.steps [aria-current="step"] .n { background: var(--selected); color: var(--on-selected); border-color: transparent; }
.steps .done { color: var(--text); }
@media (prefers-reduced-motion: no-preference) {
  #track-dialog[open] { animation: rise 160ms cubic-bezier(.2, .8, .2, 1); }
  @keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.99); } }
  .button, .theme-toggle, .severity-pick label { transition: background-color 140ms ease, filter 140ms ease; }
}

/* ---- Issue log ---- */
.issue { border-top: 1px solid var(--line); scroll-margin-top: 72px; }
.issue:first-child { border-top: 0; }
.issue > summary { display: grid; grid-template-columns: 104px minmax(0, 1fr) 64px 20px; gap: 14px; align-items: center; padding: 14px 20px; cursor: pointer; list-style: none; }
.issue > summary::-webkit-details-marker { display: none; }
.issue > summary::after { content: "+"; font-size: 18px; color: var(--muted); text-align: right; }
.issue[open] > summary::after { content: "–"; }
.issue > summary:hover { background: var(--hover); }
.issue-title { font-weight: 600; }
.issue-sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.issue-body { padding: 4px 20px 20px 138px; display: grid; gap: 14px; }
.issue-resolution { border-left: 2px solid var(--line-strong); padding-left: 14px; display: grid; gap: 8px; }

/* ---- Home and sign-in ---- */
.index a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 20px; align-items: center; padding: 22px 22px; text-decoration: none; border-top: 1px solid var(--line); }
.index a:first-child { border-top: 0; }
.index a:hover { background: var(--hover); }
.index h2 { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.index p { color: var(--muted); grid-column: 1; }
.index .go { grid-row: 1 / span 2; grid-column: 2; font-size: 20px; color: var(--muted); }
.index a:hover .go { color: var(--text); }
.login { max-width: 420px; margin: 40px auto; }
.login form { display: grid; gap: 16px; padding: 26px 24px; }
.login h1 { font-size: 26px; font-weight: 650; letter-spacing: -.03em; }
.login .button { width: 100%; }
.login .switch { text-align: center; color: var(--muted); font-size: 14px; }
.login .switch button { background: none; border: 0; padding: 0; font-weight: 600; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* ---- Competition archive ---- */
.shell { display: grid; grid-template-columns: 290px minmax(0, 1fr); max-width: 1600px; margin: auto; }
.sidebar { position: sticky; top: 57px; align-self: start; height: calc(100dvh - 57px); display: flex; flex-direction: column; min-width: 0; background: var(--glass); border-right: 1px solid var(--line); }
.side-head { padding: 18px 14px 12px; }
.side-head > div { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.side-head h2 { font-size: 17px; font-weight: 650; }
#team-count { font-size: 13px; color: var(--muted); }
.search { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; border: 1px solid var(--field-line); border-radius: 11px; background: var(--field); }
.search:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-halo); }
.search span { width: 12px; height: 12px; border: 1.6px solid var(--muted); border-radius: 50%; position: relative; flex: none; }
.search span::after { content: ""; position: absolute; width: 6px; height: 1.6px; background: var(--muted); transform: rotate(45deg); bottom: -2px; right: -4px; }
.search input { width: 100%; border: 0; background: none; font-size: 16px; outline: none; }
.team-controls { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 12px; font-size: 13px; }
.leaderboard-controls { display: flex; gap: 8px; width: 100%; }
.leaderboard-controls .select-wrap:first-child { flex: 1; min-width: 0; }
.leaderboard-controls .select-wrap:first-child select { width: 100%; }
.select-wrap { position: relative; display: inline-flex; }
.select-wrap::after { content: ""; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; margin-top: -5px; border: solid var(--muted); border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); pointer-events: none; }
.select-wrap select { appearance: none; min-height: 40px; padding: 0 30px 0 11px; border: 1px solid var(--field-line); border-radius: 10px; background: var(--field); font-size: 14px; max-width: 100%; }
.rating-help summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 6px 0; }
.rating-help[open] { flex-basis: 100%; }
.rating-help p, #ranking-note { margin-top: 6px; padding: 10px 12px; border-radius: 10px; background: var(--hover); color: var(--muted); line-height: 1.45; font-size: 13px; }
.team-list { overflow: auto; padding: 4px 8px 12px; border-top: 1px solid var(--line); }
.team-btn { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 8px 10px; background: none; border: 0; border-radius: 10px; text-align: left; font-size: 14px; line-height: 1.25; }
.team-btn:hover { background: var(--hover); }
.team-btn[aria-pressed="true"] { background: var(--line-strong); font-weight: 600; }
.team-rating { font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); }
.team-rating small { display: block; font-size: 11px; }
.no-results { padding: 14px 10px; color: var(--muted); font-size: 14px; }
main { min-width: 0; }
.hero { padding: 26px 28px 6px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.hero h1 { font-size: clamp(28px, 3.6vw, 40px); font-weight: 700; letter-spacing: -.035em; line-height: 1.1; margin-bottom: 6px; }
.hero-text > p:last-child { font-size: 14px; color: var(--muted); }
.middot { margin: 0 4px; }
.selected-rating { margin-left: 10px; padding: 3px 9px; border-radius: 8px; background: var(--hover); border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 500; white-space: nowrap; }
.content { padding: 18px 28px 0; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; background: var(--glass); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: clip; }
.metric { padding: 16px 18px; border-left: 1px solid var(--line); }
.metric:first-child { border-left: 0; }
.metric h3 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 8px; }
.metric strong { display: block; font-size: 30px; font-weight: 650; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.metric p { font-size: 13px; color: var(--muted); margin-top: 8px; }
.panel { background: var(--glass); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: clip; min-width: 0; }
.grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(250px, 1fr); gap: 18px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 12px; }
.panel-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -.015em; }
.panel-head p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.segmented { display: flex; padding: 2px; border-radius: 10px; background: var(--hover); border: 1px solid var(--line); flex: none; }
.segmented button { border: 0; background: none; border-radius: 8px; padding: 6px 12px; min-height: 34px; font-size: 13px; font-weight: 500; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--selected); color: var(--on-selected); }
canvas { display: block; width: calc(100% - 24px); height: 230px; margin: 0 12px 10px; }
#seasons { padding: 0 8px 10px; }
.season { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; min-height: 44px; padding: 0 10px; background: none; border: 0; border-radius: 10px; font-size: 14px; font-variant-numeric: tabular-nums; text-align: left; }
.season:hover { background: var(--hover); }
.season[aria-pressed="true"] { background: var(--line-strong); font-weight: 600; }
.season .credit { color: var(--muted); font-size: 13px; }
.car-specs { margin-bottom: 18px; }
.car-number { padding: 4px 10px; border-radius: 8px; background: var(--hover); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.spec-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 1px solid var(--line); margin: 0; }
.spec-grid > div { padding: 14px 18px; border-left: 1px solid var(--line); }
.spec-grid > div:first-child { border-left: 0; }
.spec-grid dt { font-size: 13px; color: var(--muted); }
.spec-grid dd { margin: 6px 0 0; font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.spec-grid small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.events table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.events th { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 11px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; }
.events td { padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 15px; }
.events td:last-child, .events th:last-child { text-align: right; }
.events tbody tr:hover { background: var(--hover); }
.gain { color: var(--green); font-weight: 600; } .loss { color: var(--red-text); font-weight: 600; } .quiet { color: var(--muted); }
.event-note { padding: 12px 18px; color: var(--muted); font-size: 13px; }
footer { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 20px 0 36px; font-size: 13px; color: var(--muted); }
footer a { color: var(--text); }

/* ---- Small screens ---- */
@media (max-width: 1100px) { .spec-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .spec-grid > div:nth-child(3n+1) { border-left: 0; } .spec-grid > div:nth-child(n+4) { border-top: 1px solid var(--line); } }
@media (max-width: 940px) { .grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .masthead { gap: 12px; padding: 0 14px; height: 52px; }
  .nav { display: none; }
  /* Phones get an app-style bottom tab bar. */
  .tabbar {
    position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--header); border-top: 1px solid var(--line);
    -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  }
  .tabbar a { flex-direction: column; justify-content: center; gap: 3px; min-height: 50px; border-radius: 10px; font-size: 11px; }
  .tabbar a .icon { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--text); background: var(--hover); }
  .tabbar .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .page-title .icon { width: 26px; height: 26px; }
  .mast-link, .account span { display: none; }
  .page { padding: 20px 12px 56px; }
  .page-title { font-size: 28px; margin-bottom: 14px; }
  .sheet-head, .sheet-section { padding-left: 14px; padding-right: 14px; }
  .sheet > .table-wrap .table th:first-child, .sheet > .table-wrap .table td:first-child { padding-left: 14px; }
  .fields, .fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .issue > summary { grid-template-columns: minmax(0, 1fr) auto 18px; padding: 12px 14px; gap: 6px 10px; }
  .issue > summary .sev { grid-column: 1 / -1; }
  .issue-body { padding: 0 14px 16px; }
  .issue-line { grid-template-columns: minmax(0, 1fr) auto; }
  .issue-line .sev { grid-column: 1 / -1; }
  #track-dialog { width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .form-body { padding: 16px 14px 24px; }
  .form-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .form-foot .hint { display: none; }
  .form-foot .primary { margin-left: auto; }
  .steps { padding: 0; }
  .steps button { flex-direction: column; justify-content: center; gap: 3px; padding: 6px 2px; font-size: 11.5px; text-align: center; }
  .shell { display: block; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .team-list { display: flex; gap: 4px; overflow-x: auto; border-top: 0; }
  .team-btn { width: auto; max-width: 230px; flex: none; }
  .hero, .content { padding-left: 14px; padding-right: 14px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .events td, .events th { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 560px) {
  .car { grid-template-columns: 1fr; }
  .car-end { writing-mode: horizontal-tb; transform: none; border: 0; padding: 4px 0 0; }
  .fields.two { grid-template-columns: 1fr; }
  .severity-pick label { font-size: 13px; }
  .spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec-grid > div:nth-child(n) { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .spec-grid > div:nth-child(odd) { border-left: 0; }
}
@media (hover: none) { .form-foot .hint { display: none; } }

/* ---- Season heading: the year is the switch ---- */
.season-heading h2 { font-size: 30px; font-weight: 700; letter-spacing: -.035em; line-height: 1.15; }
.season-heading .hint { margin-top: 4px; }
.season-select { position: relative; display: inline-block; }
.season-select select {
  appearance: none; background: none; border: 0; border-radius: 10px; color: inherit; font: inherit; letter-spacing: inherit;
  padding: 0 30px 0 6px; margin-left: -6px; cursor: pointer;
}
.season-select select:hover { background: var(--hover); }
.season-select::after { content: ""; position: absolute; right: 10px; top: 50%; width: 8px; height: 8px; margin-top: -7px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); pointer-events: none; }
.season-select option { font-size: 16px; color: var(--text); background: var(--solid); }

/* Whole rows open their page. */
.row-link { cursor: pointer; }
.issue-line.row-link:hover { background: var(--hover); }
.issue-line { margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 10px; }

/* ---- Type-ahead name picker ---- */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 5; top: 100%; left: 0; right: 0; margin-top: 6px; padding: 4px; max-height: 260px; overflow: auto;
  background: var(--solid); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow-pop);
}
.combo-list li { padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 15px; font-weight: 400; color: var(--text); }
.combo-list li:hover, .combo-list li[aria-selected="true"] { background: var(--line-strong); }
.combo-list .combo-empty { color: var(--muted); cursor: default; }
.combo-list .combo-empty:hover { background: none; }

/* ---- In-site confirm prompt ---- */
.ask {
  width: min(380px, calc(100% - 32px)); padding: 22px; color: var(--text); border: 1px solid var(--line-strong); border-radius: 18px;
  background: var(--solid); box-shadow: var(--shadow-pop);
}
.ask h2 { font-size: 18px; font-weight: 650; margin-bottom: 6px; }
.ask .actions { justify-content: flex-end; margin-top: 18px; }
.ask::backdrop { background: rgb(0 0 0 / .4); }
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .ask { background: var(--glass-strong); -webkit-backdrop-filter: blur(30px) saturate(1.3); backdrop-filter: blur(30px) saturate(1.3); }
}

/* ---- Photos and videos: scrollable strip plus full-screen viewer ---- */
.file-strip { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; overscroll-behavior-x: contain; }
.file-strip figure { flex: 0 0 180px; margin: 0; scroll-snap-align: start; min-width: 0; }
.thumb { position: relative; display: grid; place-items: center; width: 100%; height: 130px; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--field); cursor: pointer; }
a.thumb { cursor: pointer; text-decoration: none; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.is-video::after { content: ""; position: absolute; width: 0; height: 0; border-style: solid; border-width: 11px 0 11px 18px; border-color: transparent transparent transparent #fff; filter: drop-shadow(0 2px 6px rgb(0 0 0 / .6)); }
.file-ext { font-size: 13px; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.file-strip figcaption { font-size: 12px; margin: 6px 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-strip figcaption a { color: var(--muted); text-decoration: none; }
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgb(0 0 0 / .92); color: #fff; }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgb(0 0 0 / .6); }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.viewer-bar .button { color: #fff; background: rgb(255 255 255 / .1); border-color: rgb(255 255 255 / .2); }
.viewer-count { font-size: 14px; color: #c7c7cc; font-variant-numeric: tabular-nums; }
.viewer-track { flex: 1; min-height: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.viewer-slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 0 16px 24px; min-width: 0; }
.viewer-slide img, .viewer-slide video { max-width: 100%; max-height: calc(100dvh - 120px); object-fit: contain; border-radius: 8px; }
.viewer-slide figcaption { font-size: 13px; color: #c7c7cc; }
.viewer-prev, .viewer-next { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; padding: 0; border-radius: 50%; font-size: 26px; color: #fff; background: rgb(255 255 255 / .12); border-color: rgb(255 255 255 / .2); }
.viewer-prev { left: 14px; } .viewer-next { right: 14px; }
@media (hover: none) { .viewer-prev, .viewer-next { display: none; } }

/* ---- Home dashboard ---- */
.home .eyebrow { margin-bottom: 8px; }
.greeting { font-size: clamp(32px, 5vw, 48px); font-weight: 700; letter-spacing: -.045em; line-height: 1.05; margin-bottom: 26px; }
.home-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.home-card {
  display: flex; flex-direction: column; gap: 2px; min-height: 168px; padding: 18px; text-decoration: none;
  background: var(--glass); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  transition: transform 160ms ease, border-color 160ms ease;
}
.home-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.home-card .icon { width: 24px; height: 24px; margin-bottom: auto; color: var(--muted); }
.home-card .card-label { font-size: 13px; color: var(--muted); margin-top: 16px; }
.home-card strong { font-size: 22px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.home-card.alert strong, #card-issues strong, #card-archive strong { font-size: 32px; font-weight: 700; }
.home-card.alert strong { color: var(--red-text); }
.home-actions { margin-top: 18px; }
@media (max-width: 760px) { .home-cards { grid-template-columns: 1fr; } .home-card { min-height: 0; } .greeting { margin-bottom: 18px; } }
@media (prefers-reduced-motion: reduce) { .home-card { transition: none; } .home-card:hover { transform: none; } }

/* ---- Issue statistics ---- */
.stats { display: grid; gap: 18px; }
.stat-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stat-tile { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--hover); border: 1px solid var(--line); }
.stat-tile span { font-size: 12px; color: var(--muted); }
.stat-tile strong { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-tile.open strong { color: var(--red-text); }
.bars { display: grid; grid-template-columns: minmax(80px, max-content) 1fr 32px; gap: 8px 12px; align-items: center; font-size: 14px; }
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--hover); }
.seg-critical { background: var(--ring-critical); } .seg-high { background: var(--ring-high); } .seg-medium { background: var(--ring-medium); } .seg-low { background: var(--ring-low); }
.bars .num { text-align: right; font-variant-numeric: tabular-nums; }
.day-counts { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 16px; font-size: 14px; }
.day-counts .open { color: var(--red-text); }

/* ---- Subsystem status board: traffic-light rings, only here ---- */
/* Severity traffic-light colours: used by the status board rings and the statistics bars. */
:root { --ring-critical: #ff3b30; --ring-high: #ff9f0a; --ring-medium: #ffd60a; --ring-low: #30d158; }
/* Rows stay centred, so a short last row sits in the middle. */
.board { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px 8px; }
.board-cell { width: calc((100% - 6 * 8px) / 7); display: grid; justify-items: center; gap: 6px; padding: 6px 0; background: none; border: 0; border-radius: 12px; color: var(--text); }
.board-cell:hover { background: var(--hover); }
.ring { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; }
.ring > span { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--solid); font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.ring.clear { border: 2px solid var(--line-strong); }
.ring.clear > span { color: var(--muted); background: none; }
.board-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.board-issues:empty { display: none; }
.board-issues { display: grid; padding: 14px 16px; border-radius: 14px; background: var(--hover); border: 1px solid var(--line); }
.board-issues-title { font-weight: 600; margin-bottom: 4px; }
.board-issues .issue-line { margin: 0; }
.board-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); }
.board-legend span { display: flex; align-items: center; gap: 7px; }
.board-legend i { width: 12px; height: 12px; border-radius: 50%; }
@media (max-width: 760px) {
  .board-cell { width: calc((100% - 3 * 8px) / 4); }
  .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Issue number, type tags and picker ---- */
.issue-no { color: var(--muted); font-weight: 500; margin-right: 8px; font-variant-numeric: tabular-nums; }
.type-tag { display: inline-block; margin-left: 10px; padding: 2px 9px; border-radius: 7px; font-size: 12px; font-weight: 500; vertical-align: 2px; color: var(--text); }
.day-counts .type-tag { margin-left: 0; }
.type-temporary { --tag: rgb(191 90 242 / .24); } .type-assembly { --tag: rgb(255 140 60 / .26); } .type-design { --tag: rgb(90 160 255 / .26); }
.type-tag { background: var(--tag); }
.type-pick { grid-template-columns: repeat(3, 1fr); }
.type-pick label::before { content: ""; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: var(--tag); box-shadow: inset 0 0 0 1px var(--line-strong); }
@media (max-width: 560px) { .type-pick { grid-template-columns: 1fr; } }

/* ---- Test day videos ---- */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.video-grid figure { margin: 0; min-width: 0; }
.video-grid .thumb { height: 120px; }
.video-grid figcaption { font-size: 14px; font-weight: 600; color: var(--text); margin-top: 8px; }
.video-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.video-meta .button { min-height: 32px; padding: 0 8px; font-size: 13px; color: var(--muted); }
.viewer-slide iframe { width: min(100%, calc((100dvh - 140px) * 16 / 9)); aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: 8px; background: #000; }
.home-card { position: relative; }
.card-go { position: absolute; top: 18px; right: 18px; font-size: 13px; font-weight: 600; color: var(--muted); }
.home-card:hover .card-go { color: var(--text); }

/* ---- Test plan / report buttons: grey light = nothing attached, green = PDF attached ---- */
.docs { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 28px; }
.doc-light { width: 10px; height: 10px; border-radius: 50%; background: var(--low); flex: none; }
.doc-light.on { background: #30d158; box-shadow: 0 0 0 3px rgb(48 209 88 / .22); }
.docs + .readout { margin-top: 16px; }

/* ---- Several people in one field ---- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; border-radius: 8px; background: var(--hover); border: 1px solid var(--line-strong); font-size: 14px; font-weight: 500; }
.chip button { width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 16px; line-height: 1; }
.chip button:hover { background: var(--line-strong); color: var(--text); }
.docs .button { min-width: 150px; }
.doc-count { min-width: 22px; padding: 0 6px; border-radius: 11px; background: var(--line-strong); font-size: 12px; line-height: 22px; text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .docs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .docs .button { min-width: 0; } }

/* ---- PDF pages, shown like photos ---- */
.pdf-pages { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 14px 32px; overscroll-behavior: contain; }
.pdf-page { width: min(100%, 900px); margin: 0 auto 14px; background: #fff; border-radius: 4px; overflow: hidden; box-shadow: 0 8px 24px rgb(0 0 0 / .45); }
.pdf-page canvas { display: block; width: 100%; height: auto; }
.pdf-error { color: #ff8a95; padding: 40px 16px; text-align: center; }
.viewer-bar .actions .button { color: #fff; background: rgb(255 255 255 / .1); border-color: rgb(255 255 255 / .2); }

/* ---- Competitive intelligence ---- */
.intel-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; padding: 18px 20px 22px; }
.intel-tile { display: grid; gap: 2px; padding: 8px 8px 12px; border-radius: 14px; background: var(--hover); border: 1px solid var(--line); text-decoration: none; transition: border-color 140ms ease, transform 140ms ease; }
.intel-tile:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.intel-tile.empty { opacity: .5; }
.intel-thumb { display: grid; place-items: center; height: 96px; margin-bottom: 8px; border-radius: 10px; overflow: hidden; background: var(--field); font-size: 22px; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
.intel-thumb img { width: 100%; height: 100%; object-fit: cover; }
.intel-name { font-weight: 600; padding: 0 4px; }
.intel-tile .hint { padding: 0 4px; font-size: 13px; }
.intel-entry > summary { grid-template-columns: 170px minmax(0, 1fr) auto 20px; }
.intel-when { font-size: 13px; color: var(--muted); }
.toolbar .field input[type="search"] { min-width: 200px; }
@media (max-width: 760px) {
  .intel-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px; }
  .intel-entry > summary { grid-template-columns: minmax(0, 1fr) auto 18px; }
  .intel-entry .intel-when { grid-column: 1 / -1; }
  .toolbar .field input[type="search"] { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { .intel-tile, .intel-tile:hover { transition: none; transform: none; } }

/* ---- Footer on every page ---- */
/* Sits at the very bottom of the screen on short pages (sticky to 100vh), and after the content on long ones. */
.site-footer { position: sticky; top: 100vh; display: block; padding: 18px 16px 14px; text-align: center; font-size: 12px; color: var(--low); }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.site-footer .heart { color: var(--red); }

/* ---- Feedback ---- */
.feedback-form { display: grid; gap: 14px; }
.kind-pick { grid-template-columns: repeat(3, 1fr); }
.feedback-form .hint { display: flex; align-items: center; gap: 4px; }
.feedback-form .hint .button { min-height: 28px; padding: 0 8px; }
.feedback-list { padding: 6px 20px 16px; }
.feedback-item { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.feedback-item:first-child { border-top: 0; }
.feedback-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.feedback-meta .type-tag { margin-left: 0; }
.vote { display: grid; justify-items: center; align-content: center; gap: 2px; width: 52px; min-height: 56px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--hover); color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.vote span:last-child { font-size: 15px; color: var(--text); }
.vote.on { border-color: var(--red); color: var(--red-text); background: var(--red-halo); }
.status-pick { min-height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--field-line); background: var(--field); color: var(--text); font-size: 13px; }
.kind-bug { --tag: rgb(255 59 48 / .24); } .kind-idea { --tag: rgb(90 160 255 / .26); } .kind-change { --tag: rgb(191 90 242 / .24); }
@media (max-width: 760px) { .feedback-list { padding: 4px 14px 12px; } }
/* "Karunmay" in the footer: contact details pop up on hover, tap or keyboard focus. */
.credit { position: relative; color: var(--muted); text-decoration: underline dotted; text-underline-offset: 3px; cursor: default; outline-offset: 2px; }
.credit-card {
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); z-index: 30; white-space: nowrap;
  padding: 8px 12px; border-radius: 10px; background: var(--solid); border: 1px solid var(--line-strong); box-shadow: var(--shadow-pop);
  font-size: 13px; color: var(--muted); opacity: 0; visibility: hidden; transition: opacity 120ms ease, visibility 120ms;
}
.credit-card::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 10px; }
.credit:hover .credit-card, .credit:focus-within .credit-card { opacity: 1; visibility: visible; }
.site-footer .credit-card a { color: var(--text); }

/* Sortable column headings and the Issue Log sort picker */
.sort-head { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }
.sort-head:hover { color: var(--text); }
.sort-head:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }
.sort-arrow { display: inline-block; min-width: .8em; color: var(--red-text); }
th[aria-sort] { color: var(--text); }
.sort-pick { display: flex; align-items: flex-end; gap: 6px; }
.sort-flip { min-width: 44px; padding-inline: 0; font-size: 16px; }

/* Testing schedule calendar */
.calendar-wrap { border-bottom: 1px solid var(--line); }
.calendar-wrap > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; cursor: pointer; list-style: none; }
.calendar-wrap > summary::-webkit-details-marker { display: none; }
.calendar-wrap > summary:hover { background: var(--hover); }
.calendar-wrap > summary:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.calendar-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.calendar-summary .hint { margin: 0; }
.calendar-toggle { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 7px 12px 7px 14px; border-radius: 999px; background: var(--hover); border: 1px solid var(--line-strong); font-size: 13px; font-weight: 600; color: var(--text); }
.calendar-wrap > summary:hover .calendar-toggle { border-color: var(--red); }
.calendar-toggle .icon { width: 16px; height: 16px; color: var(--red); transition: transform 160ms ease; }
.calendar-wrap[open] .calendar-toggle .icon { transform: rotate(180deg); }
.calendar-wrap:not([open]) .when-open, .calendar-wrap[open] .when-closed { display: none; }
.calendar { padding: 4px 20px 16px; }
.cal-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px; margin-bottom: 12px; }
.cal-head h3 { margin: 2px 0 0; font-size: 20px; letter-spacing: -.01em; }
.cal-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-nav .button { min-width: 44px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-weekday { padding: 0 6px 4px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.cal-day { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 3px; min-height: 72px; padding: 6px; border-radius: 10px; background: var(--hover); border: 1px solid transparent; cursor: pointer; overflow: hidden; }
.cal-day:hover { border-color: var(--line-strong); }
.cal-day:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
.cal-num { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-day.today .cal-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; }
.cal-tag { display: block; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-strong); font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-tag.logged { background: var(--red); border-color: transparent; color: #fff; }
.cal-key { display: inline-block; border: 1px solid var(--line-strong); }
.cal-key.logged { background: var(--red); border-color: transparent; }
.calendar .board-legend { margin-top: 10px; }
@media (max-width: 640px) {
  .calendar { padding: 4px 14px 14px; }
  .calendar-wrap > summary { padding: 12px 14px; }
  .cal-day { min-height: 48px; padding: 4px; align-items: center; }
  .cal-tag { width: 8px; height: 8px; padding: 0; border-radius: 50%; font-size: 0; }
}

/* Packing list */
.pack-list { display: grid; grid-template-columns: repeat(var(--pack-columns, 1), minmax(0, 1fr)); gap: 14px; padding: 18px 20px 22px; align-items: start; }
.pack-col { display: grid; gap: 14px; align-content: start; }
.pack-category { padding: 12px 14px; border-radius: 14px; background: var(--hover); border: 1px solid var(--line); }
.pack-category-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.pack-category-head h3 { margin: 0; font-size: 16px; }
.pack-group { margin: 6px 0 2px; }
.pack-group-name { margin: 6px 0 2px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pack-row { display: flex; align-items: center; gap: 8px; min-height: 36px; border-top: 1px solid var(--line); }
.pack-row.sub { padding-left: 14px; }
.pack-check { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; font-size: 14px; }
.pack-check input { width: 18px; height: 18px; accent-color: var(--red); flex: none; }
.pack-row.done .pack-check span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.packed-by { font-size: 12px; color: var(--muted); white-space: nowrap; }
.pack-tools { display: flex; gap: 2px; }
.icon-button { all: unset; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 16px; }
.icon-button:hover { background: var(--field); color: var(--text); }
.icon-button:focus-visible { outline: 2px solid var(--red); }
@media (max-width: 560px) { .pack-list { padding: 14px; } }

/* Alumni */
.tab-pick { display: inline-grid; grid-template-columns: repeat(2, auto); }
.tab-pick label { padding: 0 16px; }
.question, .lesson { padding: 16px 20px; border-top: 1px solid var(--line); }
.question h3, .lesson h3 { margin: 6px 0 4px; font-size: 17px; letter-spacing: -.01em; }
.question.answered h3 { color: var(--muted); }
.question-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.answers { display: grid; gap: 8px; margin: 12px 0 4px; padding-left: 14px; border-left: 2px solid var(--line-strong); }
.answer .prose { margin: 2px 0 0; }
.answer-by { margin: 0; font-size: 13px; color: var(--muted); }
.answer-by strong { color: var(--text); }
.answer-form { display: grid; gap: 8px; margin-top: 10px; }
.answer-form textarea { min-height: 96px; }
.lesson-group { padding: 4px 0 8px; border-top: 1px solid var(--line); }
.lesson-group-title { margin: 14px 20px 0; font-size: 13px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.lesson-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; padding: 10px 20px 12px; }
.lesson { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--hover); }
.lesson h3 { margin-top: 0; }
.lesson-answer { margin-top: 10px; }
.lesson-answer .prose { margin: 2px 0 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; margin: 0; padding: 0; border: 0; min-width: 0; }
.check-grid legend { margin-bottom: 6px; padding: 0; }
.alum-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.alum-row .hint { margin: 2px 0 0; }
.invite-link { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--field-line); background: var(--field); color: var(--text); font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; }
@media (max-width: 560px) {
  .question { padding: 14px; }
  .lesson-list { grid-template-columns: 1fr; padding: 10px 14px 12px; }
  .lesson-group-title { margin-inline: 14px; }
}
.check-grid .check { min-height: 40px; padding: 0 10px; font-size: 14px; gap: 8px; }
.check-grid .check input { width: 18px; height: 18px; }

.captain-fields { align-items: end; }
.captain-fields .check { min-height: 48px; }
.question > .actions { margin-top: 14px; }
.answer-form .actions { margin-top: 2px; }

/* Sensor Status: the button and summary take the overall colour (green / yellow / red). */
.sensor-button { gap: 8px; }
.sensor-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--sensor); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sensor) 25%, transparent); }
.sensor-green { --sensor: var(--ring-low); } .sensor-yellow { --sensor: var(--ring-medium); } .sensor-red { --sensor: var(--ring-critical); }
.sensor-button.sensor-green, .sensor-button.sensor-yellow, .sensor-button.sensor-red { border-color: color-mix(in srgb, var(--sensor) 55%, transparent); background: color-mix(in srgb, var(--sensor) 14%, var(--hover)); }
.sensor-summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--sensor) 45%, transparent); background: color-mix(in srgb, var(--sensor) 10%, transparent); }
.sensor-summary .sensor-dot { width: 14px; height: 14px; }
.sensor-summary .hint { margin: 2px 0 0; }
.sensor-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.sensor-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--low); }
.state-working::before { background: var(--ring-low); } .state-fault { color: var(--red-text); } .state-fault::before { background: var(--ring-critical); }
.state-none { color: var(--muted); }
.sensor-table td { vertical-align: top; }
.sensor-table .error { font-size: 13px; }
.check-list { display: grid; }
.check-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 6px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.check-row .hint { margin: 0; font-size: 12px; }
.sensor-pick { grid-template-columns: repeat(2, 1fr); }
.sensor-pick label { min-height: 38px; }
.sensor-pick label.state-working:has(input:checked) { background: var(--ring-low); color: #111; }
.sensor-pick label.state-fault:has(input:checked) { background: var(--ring-critical); color: #fff; }
.sensor-pick label::before { display: none; }
.fault-note { grid-column: 1 / -1; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--field-line); background: var(--field); color: var(--text); font: inherit; font-size: 14px; }
.check-row:not(:has(input[value=Fault]:checked)) .fault-note { display: none; }
@media (max-width: 560px) { .check-row { grid-template-columns: 1fr; } }
.answer-form textarea { box-sizing: border-box; width: 100%; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--field-line); background: var(--field); color: var(--text); font: inherit; font-size: 15px; resize: vertical; }
.answer-form textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-halo); }
.answer-form .error:empty { display: none; }
.tabbar a .logo-mark { width: 30px; height: 22px; aspect-ratio: auto; }
.home-card .logo-mark, .page-title .logo-mark { aspect-ratio: auto; }
.drive-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--ring-critical); color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; }
.login .name-switch { justify-self: start; margin-top: 2px; background: none; border: 0; padding: 0; font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.login .name-switch:hover { color: var(--text); }
.combo-list .combo-empty { color: var(--muted); cursor: default; }
.combo-anchor { position: relative; display: grid; }

/* Resources */
.resource-group { border-top: 1px solid var(--line); padding-bottom: 8px; }
.resource-list { display: grid; gap: 8px; padding: 10px 20px 12px; }
.resource { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 14px; background: var(--hover); border: 1px solid var(--line); }
.resource-badge { all: unset; box-sizing: border-box; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; font-size: 12px; font-weight: 800; letter-spacing: .04em; color: #fff; background: var(--low); }
button.resource-badge { cursor: pointer; }
.badge-pdf { background: var(--red); } .badge-spreadsheet { background: #1f8a4c; } .badge-image { background: #2f6fde; } .badge-document { background: #2b579a; }
.resource-title { all: unset; display: block; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
button.resource-title { cursor: pointer; }
button.resource-title:hover { text-decoration: underline; text-underline-offset: 3px; }
button.resource-title:focus-visible, button.resource-badge:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 6px; }
.resource-text .hint { margin: 2px 0 0; font-size: 13px; }
.resource-actions { display: flex; align-items: center; gap: 6px; }
@media (max-width: 560px) {
  .resource-list { padding: 10px 14px 12px; }
  .resource { grid-template-columns: auto minmax(0, 1fr); }
  .resource-actions { grid-column: 1 / -1; }
}
/* With seven sections the header gets tight; the name beside Sign out goes first. */
@media (max-width: 1240px) { .account span { display: none; } }
