/* carparks.je console — light only, Overpass, app tokens.
   Colour discipline mirrors the iOS app: the tier triple appears ONLY on
   data (counts, sparklines, incident marks, fault text); chrome is ink,
   greys, and brand blue for interaction. No pills, no dots, no boxes. */

:root {
  --brand: #0075FF;
  --safe: #11E787;
  --busy: #F59E0B;
  --full: #DC2626;
  --ink: #111114;
  --muted: #75757c;
  --faint: #b9b9c0;
  --hairline: #ececef;
  --wash: rgba(0, 117, 255, 0.04);
  --bg: #ffffff;
  --field: #f4f4f6;
  /* safe-text is the app's tierSafe verbatim — the hero is big and bold
     enough to carry the brand mint straight. busy/full stay darkened
     for smaller text. */
  --safe-text: #11E787;
  --busy-text: #92510a;
  --full-text: #b91c1c;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Overpass", -apple-system, sans-serif;
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }

/* ── Sign-in page ─────────────────────────────────────────────────── */

.gate {
  position: relative; overflow: hidden;
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px;
  text-align: center;
  background: var(--bg);
}
.gate > div { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.gate > div[hidden] { display: none; }
/* St Helier's road network, very faint — same treatment as carparks.je. */
.gate-map {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  opacity: 0.16;
  pointer-events: none; user-select: none;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 58%, transparent 97%);
  mask-image: linear-gradient(180deg, #000 0%, #000 58%, transparent 97%);
}
/* One uniform line: "carparks.je console". */
.gate h1 {
  font-size: clamp(30px, 8.5vw, 40px); font-weight: 800; letter-spacing: -0.03em; color: var(--ink);
  margin: 0 0 10px; text-align: center;
}
.gate .sub {
  color: var(--muted); margin: 0 0 36px; text-align: center; max-width: 380px;
}
.gate form { width: min(340px, 86vw); margin: 34px auto 0; display: flex; flex-direction: column; gap: 12px; }
.gate input[type=email] {
  font-family: inherit; font-size: 16px; padding: 13px 16px;
  border: none; border-radius: 12px; background: var(--field); color: var(--ink);
  outline: none; transition: box-shadow .15s;
}
.gate input[type=email]:focus { box-shadow: 0 0 0 3px rgba(0,117,255,.3); }
.gate button {
  font-size: 16px; font-weight: 700; padding: 13px 16px; border: none;
  border-radius: 12px; background: var(--brand); color: #fff; cursor: pointer;
  transition: opacity .15s;
}
.gate button:hover { opacity: .92; }
.gate .msg { position: relative; z-index: 1; margin-top: 22px; color: var(--muted); text-align: center; max-width: 360px; }
.gate .msg.err { color: var(--full-text); }
.gate .sent h1 { font-size: 26px; }
.gate footer {
  position: fixed; z-index: 1; bottom: 22px; color: var(--faint); font-size: 12.5px;
}

/* ── App shell: leading sidebar + content ─────────────────────────── */

.shell { display: flex; min-height: 100vh; }
.side {
  flex: 0 0 252px; width: 252px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 22px 14px 16px;
  background: #f8f9fb;
  border-right: 1px solid var(--hairline);
}

/* Two-line lockup: the name never fights the badge for width. */
.lockup { display: flex; align-items: center; gap: 11px; padding: 0 10px; margin-bottom: 26px; text-decoration: none; }
.lockup img { height: 32px; width: auto; display: block; }
.lockup-text {
  display: flex; flex-direction: column; line-height: 1.1;
  font-weight: 800; font-size: 15.5px; letter-spacing: -0.01em; color: var(--ink);
}
.lockup-text em {
  font-style: normal; font-weight: 800; font-size: 10px;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--brand);
  margin-top: 3px;
}

.nav-label {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint); margin: 0 10px 8px;
}
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 13.5px; color: var(--muted);
  padding: 9px 10px; border-radius: 9px;
  transition: background .12s, color .12s, box-shadow .12s;
}
.side-nav a svg {
  width: 17px; height: 17px; flex: none;
  stroke: currentColor; stroke-width: 1.9; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: 0.7;
}
.side-nav a:hover { background: #eef0f4; color: var(--ink); }
.side-nav a.active {
  background: #ffffff; color: var(--ink);
  box-shadow: 0 1px 2px rgba(17, 17, 20, 0.06), 0 0 0 1px var(--hairline);
}
.side-nav a.active svg { stroke: var(--brand); opacity: 1; }

.side-foot {
  margin-top: auto; padding: 14px 10px 0;
  border-top: 1px solid var(--hairline);
  display: flex; flex-direction: column; gap: 8px;
}
.who-chip { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0, 117, 255, 0.12); color: var(--brand);
  font-weight: 800; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
#whoami {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-foot button {
  background: none; border: none; cursor: pointer; padding: 0;
  text-align: left; font-size: 12px; color: var(--faint);
}
.side-foot button:hover { color: var(--ink); text-decoration: underline; }
/* Superadmin org switcher (view-as). */
#org-switch {
  font-family: inherit; font-size: 12.5px; font-weight: 700;
  color: var(--muted); background: #fff;
  border: 1px solid var(--hairline); border-radius: 8px;
  padding: 6px 8px; margin-bottom: 4px; width: 100%;
}
/* Organisation page bits */
.invite-form { display: flex; gap: 8px; flex-wrap: wrap; max-width: 560px; }
.invite-form input[type=email] {
  flex: 1 1 220px; font-family: inherit; font-size: 14px;
  padding: 9px 12px; border: 1px solid var(--hairline); border-radius: 9px;
  background: var(--field); color: var(--ink); outline: none;
}
.invite-form input[type=email]:focus { box-shadow: 0 0 0 3px rgba(0,117,255,.25); }
.invite-form select {
  font-family: inherit; font-size: 14px; padding: 9px 10px;
  border: 1px solid var(--hairline); border-radius: 9px; background: #fff;
}
.invite-form button {
  font-family: inherit; font-size: 14px; font-weight: 700; border: none;
  border-radius: 9px; padding: 9px 16px; background: var(--brand);
  color: #fff; cursor: pointer;
}
.mini-btn {
  font-family: inherit; font-size: 12px; font-weight: 700;
  border: 1px solid var(--hairline); border-radius: 7px;
  background: #fff; color: var(--full-text); padding: 3px 10px; cursor: pointer;
}
.mini-btn:hover { background: color-mix(in srgb, var(--full) 6%, white); }

main#view { flex: 1 1 auto; min-width: 0; }

/* Collapsible carparks group with an indent guide. */
.nav-group { margin-top: 16px; }
.nav-group summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint); margin: 0 10px 8px;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary svg {
  width: 11px; height: 11px; stroke: currentColor; stroke-width: 2.4;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .15s;
}
.nav-group:not([open]) summary svg { transform: rotate(-90deg); }
#nav-parks { display: flex; flex-direction: column; gap: 2px; }
#nav-parks a {
  display: block; font-weight: 600; font-size: 13px; color: var(--muted);
  padding: 6px 10px 6px 27px; border-radius: 8px; position: relative;
  transition: background .12s, color .12s;
}
#nav-parks a::before {
  content: ""; position: absolute; left: 14px; top: 7px; bottom: 7px;
  width: 2px; border-radius: 2px; background: var(--hairline);
}
#nav-parks a:hover { background: #eef0f4; color: var(--ink); }
#nav-parks a.active {
  background: #fff; color: var(--ink);
  box-shadow: 0 1px 2px rgba(17, 17, 20, 0.06), 0 0 0 1px var(--hairline);
}
#nav-parks a.active::before { background: var(--brand); }

/* ── Home (welcome dashboard) ─────────────────────────────────────── */
.page h1.home-greet { font-size: 20px; font-weight: 800; letter-spacing: -0.015em; margin: 0; }
.home-date { color: var(--muted); font-size: 13px; margin: 1px 0 0; }
.home-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px; max-width: 1100px;
}
.home-card {
  display: block; background: #fff; border: 1px solid var(--hairline);
  border-radius: 14px; padding: 20px 22px; color: inherit;
  transition: box-shadow .15s, transform .15s;
}
a.home-card:hover { box-shadow: 0 8px 24px rgba(17, 17, 20, 0.07); transform: translateY(-1px); }
.hc-kicker {
  font-size: 11px; font-weight: 800; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 10px;
}
.hc-hero { font-size: 19px; font-weight: 800; letter-spacing: -0.015em; line-height: 1.3; }
.home-card.warn .hc-hero { color: var(--full-text); }
.hc-stats { margin-top: 8px; display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.hc-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.home-card.soon { background: var(--wash); border: 1.5px dashed rgba(0, 117, 255, 0.25); }
.hc-soon-list { font-size: 13.5px; color: var(--muted); line-height: 1.6; }

/* ── Park page tabs + forecast tab ────────────────────────────────── */
.ptabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  border-bottom: 1px solid var(--hairline);
  margin: 16px 0 22px;
}
.ptabs a {
  font-weight: 700; font-size: 14px; color: var(--muted);
  padding: 8px 14px; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color .12s;
}
.ptabs a:hover { color: var(--ink); }
.ptabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

.wk-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; max-width: 1100px;
}
.wk-cell {
  border: 1px solid var(--hairline); border-radius: 10px;
  padding: 8px 8px 6px; background: var(--bg);
}
.wk-cell svg { width: 100%; height: 64px; display: block; }
.wk-cell span { font-size: 11.5px; font-weight: 700; color: var(--muted); }

.soon-card {
  max-width: 560px; border: 1.5px dashed rgba(0, 117, 255, 0.25);
  border-radius: 14px; background: var(--wash); padding: 22px 24px;
}
.soon-card .hc-kicker {
  font-size: 11px; font-weight: 800; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 10px;
}
.soon-title { font-size: 18px; font-weight: 800; letter-spacing: -0.015em; margin-bottom: 6px; }
.soon-card p { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0; }

/* ── Explorers: history, trends, settings, fill times ─────────────── */
.row-tools { display: inline-flex; gap: 8px; align-items: center; }
.stats-7 { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.stat .n.dim { color: var(--faint); font-size: 15px; }

.mbars { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.mbar { text-align: center; min-width: 44px; }
.mbar-bar { background: var(--brand); opacity: 0.75; border-radius: 5px 5px 2px 2px; min-height: 4px; }
.mbar-v { font-size: 12px; font-weight: 800; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.mbar-d { color: var(--muted); font-weight: 700; margin-left: 4px; font-size: 11px; }
.mbar-l { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-top: 5px; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { font-size: 12px; font-weight: 800; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--bg); }
.chip-live { border-color: rgba(24, 160, 88, 0.4); color: #0e7a42; }
.chip-pub  { border-color: rgba(0, 117, 255, 0.4); color: var(--brand); }
.chip-draft{ border-color: rgba(216, 148, 0, 0.5); color: #a06a00; }
.chip-dim  { color: var(--faint); }

.set-card { max-width: 640px; border: 1px solid var(--hairline); border-radius: 12px;
  background: var(--bg); padding: 16px 18px; margin-bottom: 14px; }
.set-card h3 { font-size: 14.5px; font-weight: 800; margin: 0 0 4px; letter-spacing: -0.01em; }
.set-live { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.set-card input[type="text"], .set-card input[type="number"], .set-card input[type="time"] {
  font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--hairline);
  border-radius: 8px; background: var(--wash); max-width: 100%; }
.set-card input[type="text"] { width: 320px; }
.set-l { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 10px 0 4px; }
.set-l input { display: block; margin-top: 4px; }
.band-row, .win-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.band-row .band-label { width: 220px; }
.band-row .band-price { width: 90px; }
.day-chips { display: inline-flex; gap: 3px; }
.day-chip { font: inherit; font-size: 11px; font-weight: 800; padding: 4px 7px;
  border-radius: 7px; border: 1px solid var(--hairline); background: var(--bg);
  color: var(--muted); cursor: pointer; }
.day-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.set-actions { display: flex; gap: 10px; align-items: center; margin: 18px 0; flex-wrap: wrap; }
.btn { font: inherit; font-size: 13.5px; font-weight: 800; padding: 9px 18px;
  border-radius: 9px; border: 1px solid var(--hairline); background: var(--bg); cursor: pointer; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn:disabled, .mini-btn:disabled { opacity: 0.5; cursor: default; }
.diff-panel { max-width: 720px; border: 1.5px solid rgba(0, 117, 255, 0.35);
  border-radius: 12px; padding: 16px 18px; margin-bottom: 20px; background: var(--wash); }
.diff-panel h3 { margin: 0 0 10px; font-size: 15px; font-weight: 800; }

.ft-table { border-collapse: separate; border-spacing: 4px; }
.ft-table td, .ft-table th { border-top: none; }
.ft-table td { font-variant-numeric: tabular-nums; text-align: center; }
.ft-table td:first-child { text-align: left; }
.ft-cell { font-weight: 800; border-radius: 6px; }
.ft-none { color: var(--faint); font-size: 12px; }

/* ── Interactivity: scrub, brush, sortable, calendar, replay ───────── */
svg.viz.scrub { touch-action: pan-y; cursor: crosshair; }
.wk-cell svg { touch-action: pan-y; }
table.etable.sortable th { cursor: pointer; user-select: none; white-space: nowrap; }
table.etable.sortable th[data-dir="asc"]::after { content: " \2191"; color: var(--brand); }
table.etable.sortable th[data-dir="desc"]::after { content: " \2193"; color: var(--brand); }
.mini-btn.quiet { color: var(--muted); }
.mini-btn.quiet:hover { background: #eef0f4; color: var(--ink); }
tr.fill-row { cursor: pointer; }
tr.fill-row:hover td { background: var(--wash); }

.cal-wrap { display: flex; flex-direction: column; gap: 5px; margin: 6px 0 2px; }
.cal-row { display: flex; align-items: center; gap: 10px; }
.cal-lab { flex: none; width: 30px; font-size: 11px; font-weight: 800;
  color: var(--faint); text-transform: uppercase; }
.cal-cells { display: flex; gap: 2px; flex-wrap: wrap; }
.cal-day { width: 13px; height: 13px; border-radius: 3px;
  background: var(--brand); cursor: pointer; border: none; padding: 0; }
.cal-day:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.cal-day.na { background: var(--hairline); }

.replay-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 4px 0 10px; }
.replay-bar input[type="date"] { font: inherit; font-size: 13px; padding: 6px 9px;
  border: 1px solid var(--hairline); border-radius: 8px; background: var(--bg);
  color: var(--ink); }
.replay-bar input[type="range"] { flex: 1 1 200px; min-height: 30px;
  accent-color: var(--brand); }
#home-pulse { max-width: 1100px; }
.home-meta { margin: 14px 0 4px; font-size: 13.5px; gap: 26px; }
.home-meta a { color: inherit; }
.home-meta a:hover b { color: var(--brand); }
/* Merged overview: header, live grid, pulse and estate stack without
   double page-padding between them. */
.page.home-head { padding-top: 20px; padding-bottom: 10px; }
.page.home-mid { padding-bottom: 4px; }
#estate.page { padding-top: 0; }
#estate.page:empty { display: none; }
a.mbar { color: inherit; }
a.mbar:hover .mbar-bar { opacity: 1; }
td.ft-cell, td.ft-none { cursor: pointer; }

/* ── Print (PLATFORM.md A14, phase-1 reports) ──────────────────────── */
@media print {
  .side, .topbar, .scrim, .ptabs, .row-tools, .mini-btn, .btn,
  #org-switch, .set-actions { display: none !important; }
  .shell { display: block; }
  .page { max-width: none; padding: 0; }
  body { background: #fff; }
  .page::after {
    content: "carparks.je platform — licensed report — " attr(data-permalink);
    display: block; margin-top: 24px; font-size: 10px; color: #888;
  }
}

/* ── Overview grid ────────────────────────────────────────────────── */

/* Aggregate status band: quiet when healthy, red-washed when degraded. */
.topline {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  padding: 18px 30px 20px;
}
.topline.degraded { background: color-mix(in srgb, var(--full) 5%, white); }
.topline .tl-word {
  font-size: clamp(22px, 2.4vw, 30px); font-weight: 800; letter-spacing: -0.02em;
  line-height: 1.15;
}
.topline.degraded .tl-word { color: var(--full-text); }
.topline .tl-sub { font-size: 14px; margin-top: 2px; }
.topline .tl-note { color: var(--muted); font-size: 13px; margin-top: 1px; }
.topline .tl-sub a { color: var(--full-text); font-weight: 700; }
.topline .tl-stats { display: flex; gap: 38px; align-items: flex-end; }
.topline .stat .n { font-size: clamp(20px, 2vw, 26px); }

/* Hairline lattice via inset shadows — no background patches on the
   ragged last row, tiles stretch to fill the viewport on desktop. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  min-height: calc(100vh - 172px);
  grid-auto-rows: 1fr;
  border-top: 1px solid var(--hairline);
}
.tile {
  background: var(--bg);
  box-shadow: inset -1px -1px 0 var(--hairline);
  padding: clamp(18px, 2vw, 30px) clamp(20px, 2.2vw, 34px);
  cursor: pointer; transition: background .15s;
  display: flex; flex-direction: column; min-height: 200px;
}
.tile:hover { background: #fafafc; }
.tile h2 {
  margin: 0 0 2px; font-weight: 700; letter-spacing: -0.01em;
  font-size: clamp(16px, 1.4vw, 20px);
}
/* Health is the hero on a health dashboard; spaces are supporting data. */
.tile .hero {
  font-size: clamp(30px, 2.9vw, 44px); font-weight: 800;
  letter-spacing: -0.025em; line-height: 1.15;
}
.tile .hero.ok { color: var(--safe-text); }
.tile .hero.bad { color: var(--full-text); }
.tile .sub {
  color: var(--muted); font-size: clamp(13px, 1.05vw, 15.5px);
  min-height: 46px; margin-top: 2px;
  /* Whole line shares the odometer's tabular digit widths, so "66" and
     "137" space identically. */
  font-variant-numeric: tabular-nums;
}
.tile .sub b { color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.tile .sub .fault-line { color: var(--full-text); font-weight: 700; display: block; }

/* Odometer digits (Apple .contentTransition(.numericText()) feel).
   Row height MUST equal the surrounding line-height (1.5) so the
   rolling digits share the text baseline exactly. */
.od { display: inline-flex; overflow: hidden; height: 1.5em; vertical-align: bottom;
  font-variant-numeric: tabular-nums; }
.od .ch { display: inline-block; }
.od .col { display: inline-block; width: 1ch; text-align: center; }
.od .col .strip {
  display: block; transition: transform .5s cubic-bezier(.25, .8, .25, 1);
}
.od .col .strip span { display: block; height: 1.5em; line-height: 1.5em; }

/* Skeleton shimmer */
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel {
  border-radius: 6px;
  background: linear-gradient(90deg, #f0f0f3 25%, #fafafb 50%, #f0f0f3 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  color: transparent !important; user-select: none;
}
.skel-block { display: block; }
/* Clamped: tall desktop tiles stop growing bars into towers (extra
   height becomes breathing room above), short phone tiles get a real
   chart instead of a strip. */
.tile .spark { flex: 1; min-height: 72px; max-height: 150px;
  margin-top: auto; padding-top: 12px; position: relative; }
/* The caption strip is reserved: bars can never overlap the labels. */
.tile .spark svg { position: absolute; inset: 0 0 30px 0; width: 100%; height: calc(100% - 30px); }
/* b-pred retired with sparkline v7 (history-only portal) */
.tile .spark rect.b-stale { opacity: 0.8; }
.spark-cap {
  position: absolute; bottom: 12px; font-size: 10.5px; font-weight: 700;
  color: var(--faint); letter-spacing: .04em; text-transform: uppercase;
  pointer-events: none;
}
/* Second caption line, under the time row, leading edge. */
.spark-cap.cap-sub { bottom: -2px; }

/* Shared hover tooltip for charts */
#tip {
  position: fixed; z-index: 10; pointer-events: none;
  background: var(--ink); color: #fff; border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; line-height: 1.35;
  transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap; display: none;
}
#tip b { font-size: 15px; }
#tip .k { color: #b9b9c0; }

/* Ongoing-incident banner on the park page */
a.incident {
  display: block; background: color-mix(in srgb, var(--full) 7%, white);
  padding: 16px 20px; border-radius: 12px; margin: 0 0 26px;
  color: var(--ink);
}
a.incident .head { color: var(--full-text); font-weight: 800; font-size: 16px; }
a.incident .body { color: var(--muted); font-size: 13.5px; margin-top: 1px; }
a.incident:hover { background: color-mix(in srgb, var(--full) 10%, white); }

/* ── Park page ────────────────────────────────────────────────────── */

.page { padding: 18px 30px 80px; }
.crumb { font-size: 13.5px; font-weight: 700; margin-bottom: 18px; display: inline-block; }
.page h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 2px; }
.page .status { color: var(--muted); margin: 0 0 26px; }
.page .status.fault { color: var(--full-text); font-weight: 700; }

.stats { display: flex; gap: 46px; margin: 26px 0 34px; flex-wrap: wrap; }
.stat .n { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 12.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; }
.stat .l .sm { display: none; }   /* short label variant — shown on mobile only */

h2.sect { font-size: 15px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); margin: 34px 0 12px; }

svg.viz { width: 100%; display: block;
  -webkit-user-select: none; user-select: none; }
svg.viz text { pointer-events: none; }
body.brushing, body.brushing * {
  -webkit-user-select: none !important; user-select: none !important;
  cursor: crosshair;
}
.mark { cursor: pointer; }
.mark:hover { opacity: 1 !important; }
.legend { display: flex; gap: 22px; font-size: 12.5px; font-weight: 700; margin: 2px 0 8px; }
.legend .t-sync, .legend .t-single, .legend .t-drop { font-weight: 700; }
.legend span span { color: var(--muted); font-weight: 600; }

table.eps, table.etable { width: 100%; border-collapse: collapse; }
table.eps th, table.etable th {
  text-align: left; font-size: 11.5px; font-weight: 800; color: var(--faint);
  text-transform: uppercase; letter-spacing: .05em; padding: 6px 10px 8px;
}
table.eps td, table.etable td {
  padding: 11px 10px; border-top: 1px solid var(--hairline);
  font-size: 14px; font-variant-numeric: tabular-nums;
}
table.etable { max-width: 900px; }
table.etable td.k {
  color: var(--muted); font-size: 12.5px; max-width: 300px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
td.num { font-variant-numeric: tabular-nums; }
table.eps tr.rowlink { cursor: pointer; }
table.eps tr.rowlink:hover td { background: var(--wash); }
.t-sync { color: var(--full-text); font-weight: 700; }
.t-feed { color: var(--ink); font-weight: 700; }
.t-single { color: var(--busy-text); font-weight: 700; }
.t-drop { color: var(--brand); font-weight: 700; }
.t-open { color: var(--full-text); font-weight: 800; }
/* One incident, several counters: the marker on collapsed rows. */
.shared-badge {
  display: inline-block; background: var(--ink); color: var(--bg);
  font-size: 10px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; border-radius: 6px; padding: 2px 7px 1px;
  vertical-align: 1.5px; margin-left: 2px;
}

/* ── Episode page ─────────────────────────────────────────────────── */

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 20px; margin: 20px 0 8px; }
.kv dt { color: var(--muted); font-size: 13.5px; padding-top: 2px; }
.kv dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

.footnote { color: var(--faint); font-size: 12.5px; margin-top: 14px; }

/* ── Responsive shell ──────────────────────────────────────────────
   > 980px: leading sidebar (desktop, iPad landscape).
   <= 980px: sticky top bar with a hamburger; the sidebar becomes an
   off-canvas drawer carrying the FULL nav (parks group, org switcher,
   account) — nothing is amputated on mobile. */

.topbar { display: none; }
.scrim {
  position: fixed; inset: 0; z-index: 35;
  background: rgba(17, 17, 20, 0.35);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}

@media (max-width: 980px) {
  .shell { display: block; }
  .topbar {
    display: flex; align-items: center; gap: 6px;
    position: sticky; top: 0; z-index: 30;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--hairline);
    padding: 8px 10px;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-top: max(8px, env(safe-area-inset-top));
  }
  .nav-burger {
    display: flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border: none; border-radius: 10px;
    background: none; cursor: pointer; color: var(--ink);
  }
  .nav-burger svg {
    width: 22px; height: 22px; stroke: currentColor; stroke-width: 2;
    fill: none; stroke-linecap: round;
  }
  .nav-burger:active { background: #eef0f4; }
  .lockup-top { margin: 0; padding: 0; gap: 9px; }
  .lockup-top img { height: 27px; }

  .side {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
    width: min(304px, 85vw); height: 100dvh;
    padding: 18px 14px 16px;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    transform: translateX(-104%);
    transition: transform .22s ease;
    border-right: 1px solid var(--hairline);
  }
  body.nav-open .side {
    transform: translateX(0);
    box-shadow: 0 14px 44px rgba(17, 17, 20, 0.22);
  }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  /* Drawer links are thumb targets. */
  .side-nav a { padding: 11px 12px; font-size: 14.5px; }
  #nav-parks a { padding: 10px 10px 10px 27px; font-size: 13.5px; }
  #nav-parks a::before { top: 10px; bottom: 10px; }
  .side .lockup { margin-bottom: 20px; }
  main#view { min-height: calc(100dvh - 59px); }
}

/* ── Content at tablet width ───────────────────────────────────────── */
@media (max-width: 980px) {
  .page { padding: 16px 22px 70px; }
  .stats { gap: 34px; }
  .tiles { min-height: 0; }
}

/* ── Content at phone width ────────────────────────────────────────── */
@media (max-width: 640px) {
  .tiles { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .tile { min-height: 205px; }
  .tile .spark { min-height: 92px; }
  .topline { padding: 14px 16px 16px; }
  .topline .tl-stats { gap: 24px; }
  .stat .l .lg { display: none; }
  .stat .l .sm { display: inline; }
  .stats { gap: 20px 26px; margin: 20px 0 26px; }
  .stat .n { font-size: 24px; }
  .page { padding: 12px 14px 56px; padding-bottom: max(56px, env(safe-area-inset-bottom)); }
  .page h1 { font-size: 25px; }
  .page .status { font-size: 14px; margin-bottom: 18px; }
  .crumb { margin-bottom: 12px; }
  h2.sect { margin-top: 26px; }
  .kv { grid-template-columns: 120px 1fr; }
  /* Tab strip scrolls instead of wrapping: five tabs stay one row. */
  .ptabs {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; margin: 12px -14px 18px; padding: 0 14px;
  }
  .ptabs::-webkit-scrollbar { display: none; }
  .ptabs a { padding: 10px 12px; white-space: nowrap; }
  /* Episode table: keep date/time/duration/type; details live one tap in */
  table.eps th:nth-child(n+5), table.eps td:nth-child(n+5) { display: none; }
  /* The all-episodes list instead drops "Started" and keeps "Affected" —
     who was hit matters more than the minute it began. */
  table.eps.all th:nth-child(5), table.eps.all td:nth-child(5) { display: table-cell; }
  table.eps.all th:nth-child(2), table.eps.all td:nth-child(2) { display: none; }
  /* Explorer tables scroll sideways inside the page, never the page. */
  table.etable {
    display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  table.etable td, table.etable th { padding: 10px 8px; font-size: 13px; }
  /* Settings editor: full-width fields, thumbable chips. */
  .set-card { padding: 14px; }
  .set-card input[type="text"] { width: 100%; }
  .band-row .band-label { flex: 1 1 140px; width: auto; }
  .day-chip { padding: 8px 8px; font-size: 11.5px; }
  .win-row input[type="time"] { flex: 1 1 96px; }
  .btn { padding: 12px 18px; }
  .mini-btn { padding: 7px 12px; }
  .sect-row select { padding: 8px 10px; }
  .mbars { gap: 10px; }
  .mbar { min-width: 36px; }
  .wk-grid { grid-template-columns: repeat(2, 1fr); }
  .home-grid { grid-template-columns: 1fr; }
  .diff-panel { padding: 12px; }
}

/* Section header + range dropdown on one line. */
.sect-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.sect-row .sect { margin-bottom: 0; }
.sect-row select {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--hairline); border-radius: 8px;
  padding: 4px 8px; background: var(--bg); cursor: pointer;
}
.sect-row select:focus { outline: none; box-shadow: 0 0 0 3px rgba(0,117,255,.2); }

/* ── All-incidents page ───────────────────────────────────────────── */

.inc-park { margin: 30px 0 6px; }
.inc-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 6px;
}
.inc-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.inc-head h2 a { color: var(--ink); }
.inc-head h2 a:hover { color: var(--brand); }
.mini-stats {
  display: flex; gap: 20px; flex-wrap: wrap;
  color: var(--muted); font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.mini-stats b { color: var(--ink); font-weight: 800; }
.mini-stats .t-open { font-weight: 700; }
a.stat-link { color: inherit; display: block; }
/* Feed heartbeat: an ECG trace with a dark segment travelling through it
   continuously while writes are arriving; a dead-flat grey line when the
   pipeline goes silent. Ink accent — chrome, not a data colour. */
a.stat.beat { color: inherit; display: block; text-decoration: none; }
a.stat.beat .n { display: flex; align-items: flex-end; }
.ecg { width: 52px; height: 24px; overflow: visible; display: block; }
.ecg .base {
  fill: none; stroke: color-mix(in srgb, var(--ink) 16%, white);
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.ecg .sweep {
  fill: none; stroke: var(--ink); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  /* Dash pattern period (16+100) shifted by exactly one period per
     cycle: the travelling segment wraps seamlessly — continuous, no
     beat-and-pause. */
  stroke-dasharray: 16 100;
  animation: ecg-sweep 6s linear infinite;
}
@keyframes ecg-sweep {
  from { stroke-dashoffset: 16; }
  to   { stroke-dashoffset: -100; }
}
.ecg .flatline {
  display: none; fill: none; stroke: var(--faint);
  stroke-width: 1.6; stroke-linecap: round;
}
.beat.flat .sweep { display: none; }
.beat.flat .base { display: none; }
.beat.flat .flatline { display: block; }
.beat.flat .l { color: var(--full-text); }
a.stat.beat:hover .l { color: var(--brand); }
@media (prefers-reduced-motion: reduce) {
  .ecg .sweep { animation: none; stroke-dasharray: none; }
}
a.stat-link:hover .n { color: var(--brand); }

/* Quiet empty state when a fault predates the whole 2-hour window. */
.spark-msg {
  position: absolute; inset: 0 0 18px 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12.5px; font-weight: 600;
}

/* ── Recovering (confirmation window) — grey, not green, not red ──── */
.tile .hero.mon { color: var(--muted); }
.tile .sub .mon-line { color: var(--muted); font-weight: 700; display: block; }
.status.mon { color: var(--muted); font-weight: 600; }
.topline.monitoring { background: #f7f7f9; }
.topline.monitoring .tl-sub a { color: var(--ink); font-weight: 700; }

/* ── Evidence extras: sibling minis (borderless, lattice-clean) ───── */

.minis-head {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--faint); margin: 18px 0 6px;
}
.minis {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 4px 20px;
}
.mini-name {
  font-size: 12px; font-weight: 700; color: var(--muted);
  display: block; margin-bottom: 2px;
}
.mini svg { display: block; width: 100%; height: 72px; }

/* Episode page: one quiet timing line under the title, stats row below. */
.ep-timing { color: var(--muted); font-size: 13.5px; margin: -6px 0 18px; }

/* ── Classification pills: toggleable type filters ────────────────── */
.legend.pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 10px; }
.pill {
  font-family: inherit; font-size: 12.5px; font-weight: 700;
  border-radius: 999px; padding: 4px 12px; cursor: pointer;
  border: 1px solid var(--hairline); background: var(--bg);
  transition: background .12s, color .12s, border-color .12s;
}
.pill span { font-weight: 600; opacity: 0.75; }
.pill.off { color: var(--faint); }
.pill.off span { opacity: 0.6; }
.pill.t-sync.on {
  color: var(--full-text);
  background: color-mix(in srgb, var(--full) 9%, white);
  border-color: color-mix(in srgb, var(--full) 30%, white);
}
.pill.t-single.on {
  color: var(--busy-text);
  background: color-mix(in srgb, var(--busy) 12%, white);
  border-color: color-mix(in srgb, var(--busy) 35%, white);
}
.pill.t-drop.on {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, white);
  border-color: color-mix(in srgb, var(--brand) 28%, white);
}
.pill.t-feed.on {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 7%, white);
  border-color: color-mix(in srgb, var(--ink) 25%, white);
}
svg.viz rect.mark { transition: opacity .15s; }
