/* ==========================================================================
   CF Insights — private traffic/security instrument for the acidalchamy estate.
   Dark-first, near-monochrome + ONE accent (Cloudflare ember), hairline
   borders, feTurbulence grain, high data density. Square edges everywhere
   (owner law: no rounded corners — enforced globally below).
   Auth-page class names (auth-body/auth-card/auth-logo/auth-error/muted/
   totp-box/qr/secret/loading) are load-bearing for the frozen pages.
   ========================================================================== */

:root {
  --bg: #0a0b0e;
  --bg-elev: #101218;
  --bg-elev-2: #161923;
  --fg: #e9eaf0;
  --fg-dim: #9aa1b2;
  --fg-faint: #676e80;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  --accent: #f6821f;            /* the one accent */
  --accent-soft: rgba(246, 130, 31, 0.13);
  --accent-dim: rgba(246, 130, 31, 0.55);

  /* status — reserved for state, never decoration */
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.10);
  --warn: #f2b544;
  --warn-soft: rgba(242, 181, 68, 0.10);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.10);

  --sans: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", ui-monospace, Consolas, monospace;
  --maxw: 1280px;
  color-scheme: dark;
  font-synthesis: none;
}

/* Owner law: square 90° edges on every element, no exceptions. */
*, *::before, *::after { box-sizing: border-box; border-radius: 0 !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

/* grain — the one texture, fixed behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.3'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
/* one faint ember glow up top */
body::after {
  content: "";
  position: fixed;
  top: -30vh;
  left: 50%;
  width: 90vw;
  height: 55vh;
  transform: translateX(-50%);
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(246, 130, 31, 0.07), transparent 70%);
}

#app, .auth-body { position: relative; z-index: 1; }

a { color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--accent-dim); }
a:hover { background: var(--accent-soft); }

.muted { color: var(--fg-dim); }
.loading { padding: 72px 20px; text-align: center; color: var(--fg-faint); font-family: var(--mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; }
.num, .tnum { font-variant-numeric: tabular-nums; }

/* ---- inputs & buttons ---------------------------------------------------- */
input, select, textarea, button {
  font: inherit;
  color: var(--fg);
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  padding: 8px 10px;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); outline-offset: -1px; }
select { cursor: pointer; }

button {
  cursor: pointer;
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0b0e;
  font-weight: 650;
  letter-spacing: 0.01em;
  transition: filter 0.12s ease;
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.55; cursor: default; }
button.ghost { background: transparent; color: var(--fg-dim); border-color: var(--line-strong); font-weight: 500; }
button.ghost:hover { color: var(--fg); border-color: var(--fg-faint); filter: none; }
button.small { padding: 5px 10px; font-size: 12.5px; }

/* ==========================================================================
   AUTH PAGES (frozen markup — class names must not change)
   ========================================================================== */
.auth-body {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.auth-card.wide { max-width: 480px; }
.auth-logo { font-size: 34px; text-align: center; filter: grayscale(0.2); }
.auth-card h1 {
  margin: 0;
  text-align: center;
  font-size: 21px;
  letter-spacing: -0.02em;
  font-weight: 650;
}
.auth-card > p.muted {
  margin: 0 0 4px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.auth-card input { font-size: 16px; } /* ≥16px stops iOS zoom-on-focus */
.auth-card button { padding: 11px; font-size: 15px; }
.auth-error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.3);
  padding: 8px 10px;
  margin: 0;
  font-size: 13px;
}
.totp-box {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 12px;
}
.totp-box .qr {
  width: 180px;
  height: 180px;
  display: grid;
  place-items: center;
  background: #fff;
  flex: 0 0 auto;
}
.totp-box .qr canvas { display: block; }
.totp-meta { flex: 1; min-width: 0; }
.totp-meta p.muted { font-family: var(--sans); font-size: 12.5px; text-transform: none; letter-spacing: 0; color: var(--fg-dim); margin: 0 0 4px; }
.secret {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 8px;
  background: var(--bg-elev-2);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  word-break: break-all;
  color: var(--fg);
}

/* ==========================================================================
   APP CHROME
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 clamp(14px, 3vw, 28px);
  height: 52px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.02em;
  cursor: pointer;
  white-space: nowrap;
  border: 0;
}
.brand em { font-style: normal; color: var(--accent); }
.brand small {
  margin-left: 8px;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.nav { display: flex; gap: 2px; margin-left: 10px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.navlink {
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 6px 12px;
  color: var(--fg-dim);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  background: none;
}
.navlink:hover { color: var(--fg); background: none; filter: none; }
.navlink.on { color: var(--fg); border-bottom-color: var(--accent); }
.topbar .spacer { flex: 1; }
.topmeta { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; color: var(--fg-faint); white-space: nowrap; }

.container { max-width: var(--maxw); margin: 0 auto; padding: clamp(16px, 3vw, 28px); position: relative; z-index: 1; }

/* ---- status lights / chips ---------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  color: var(--fg-dim);
  white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; background: currentColor; flex: 0 0 auto; }
.chip.ok { color: var(--ok); border-color: rgba(74, 222, 128, 0.35); background: var(--ok-soft); }
.chip.warn { color: var(--warn); border-color: rgba(242, 181, 68, 0.35); background: var(--warn-soft); }
.chip.bad { color: var(--danger); border-color: rgba(248, 113, 113, 0.35); background: var(--danger-soft); }
.chip.acc { color: var(--accent); border-color: rgba(246, 130, 31, 0.4); background: var(--accent-soft); }
.chip.flat { color: var(--fg-faint); }
.chip.noDot::before { display: none; }

/* delta chips inside tables/tiles */
.delta { font-family: var(--mono); font-size: 11px; letter-spacing: 0.02em; padding: 1px 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); background: var(--ok-soft); }
.delta.down { color: var(--danger); background: var(--danger-soft); }
.delta.flat { color: var(--fg-faint); background: var(--bg-elev-2); }

/* ---- section scaffolding ------------------------------------------------- */
/* ---- Workers daily budget ------------------------------------------------
   One allowance per UTC day for the whole account, so this reads as a single
   gauge with the per-day history under it. Tone is state, never decoration:
   ok < 60% < warm < 80% < near < 100% <= over. */
.budget { display: flex; flex-direction: column; gap: 16px; }
.budget-head { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.budget-now { display: flex; flex-direction: column; gap: 2px; flex: 0 0 auto; }
.budget-pct { font-family: var(--mono); font-size: 40px; line-height: 1; letter-spacing: -0.03em; }
.budget-now.ok    .budget-pct { color: var(--ok); }
.budget-now.warm  .budget-pct { color: var(--warn); }
.budget-now.near  .budget-pct { color: var(--accent); }
.budget-now.over  .budget-pct { color: var(--danger); }
.budget-sub { font-family: var(--mono); font-size: 11.5px; color: var(--fg-faint); }
.budget-note { flex: 1 1 340px; font-size: 13px; line-height: 1.55; color: var(--fg-dim); }
.budget-note b { color: var(--fg); }
.bstate {
  display: inline-block; padding: 1px 7px; margin-right: 4px;
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  border: 1px solid var(--line-strong);
}
.bstate.ok   { color: var(--ok);     background: var(--ok-soft);     border-color: var(--ok); }
.bstate.near { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-dim); }
.bstate.over { color: var(--danger); background: var(--danger-soft); border-color: var(--danger); }

.budget-bars { display: flex; flex-direction: column; gap: 3px; }
.bbar { display: flex; align-items: center; gap: 10px; font-size: 11.5px; }
.bbar-d { font-family: var(--mono); color: var(--fg-faint); flex: 0 0 42px; }
.bbar-track { flex: 1 1 auto; height: 13px; background: var(--bg-elev-2); border: 1px solid var(--line); position: relative; }
.bbar-fill { display: block; height: 100%; background: var(--fg-faint); }
.bbar.ok   .bbar-fill { background: var(--ok); }
.bbar.warm .bbar-fill { background: var(--warn); }
.bbar.near .bbar-fill { background: var(--accent); }
.bbar.over .bbar-fill { background: var(--danger); }
.bbar-v { flex: 0 0 68px; text-align: right; color: var(--fg-dim); font-family: var(--mono); }
.bbar-p { flex: 0 0 42px; text-align: right; color: var(--fg-faint); font-family: var(--mono); }
.bbar.over .bbar-p { color: var(--danger); }
.bbar.near .bbar-p { color: var(--accent); }
.bbar.warm .bbar-p { color: var(--warn); }
/* The cap line: where 100% sits on every track. */
.bbar-track::after {
  content: ""; position: absolute; top: -1px; right: 0; width: 1px; height: 13px;
  background: var(--line-strong);
}
@media (max-width: 640px) {
  .bbar-v { flex-basis: 54px; }
  .budget-pct { font-size: 32px; }
}

.sect { padding: 26px 0 8px; }
.sect + .sect { border-top: 1px solid var(--line); margin-top: 18px; }
.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--accent); flex: 0 0 auto; }
.eyebrow .spacer { flex: 1; }
.eyebrow .sub { letter-spacing: 0.08em; color: var(--fg-faint); text-transform: none; }

.panel { background: var(--bg-elev); border: 1px solid var(--line); padding: 16px 18px; }

.pending {
  border: 1px dashed var(--line-strong);
  color: var(--fg-faint);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  padding: 26px 16px;
}

/* ==========================================================================
   TODAY STRIP — hairline-joined stat tiles
   ========================================================================== */
.strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 20px;
}
.tile { background: var(--bg-elev); padding: 16px 18px 14px; min-width: 0; }
.tile .k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
}
.tile .v {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
}
.tile.hero .v { font-size: clamp(34px, 4vw, 48px); }
.tile .v small { font-size: 0.45em; font-weight: 400; color: var(--fg-faint); letter-spacing: 0; margin-left: 2px; }
.tile .d { margin-top: 8px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--fg-faint); flex-wrap: wrap; }
.tile.t-warn .v { color: var(--warn); }
.tile.t-bad .v { color: var(--danger); }
.tile.t-dim .v { color: var(--fg-dim); font-size: 15px; font-weight: 500; letter-spacing: 0; line-height: 1.4; white-space: normal; }

/* ---- awaiting-token banner ---------------------------------------------- */
.token-banner {
  border: 1px solid rgba(242, 181, 68, 0.35);
  background: linear-gradient(180deg, var(--warn-soft), transparent 90%);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.token-banner h2 { margin: 0 0 8px; font-size: 17px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
.token-banner p { margin: 0 0 10px; color: var(--fg-dim); font-size: 13.5px; max-width: 78ch; }
.token-banner ul { margin: 0 0 12px; padding-left: 18px; color: var(--fg-dim); font-size: 13.5px; }
.token-banner li { margin: 2px 0; }
.token-banner code.inline { background: var(--bg-elev-2); border: 1px solid var(--line); padding: 1px 6px; font-family: var(--mono); font-size: 12px; color: var(--fg); }
.token-banner pre {
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--fg);
  overflow-x: auto;
}

/* ==========================================================================
   CHARTS (inline SVG only)
   ========================================================================== */
.chartwrap { position: relative; background: var(--bg-elev); border: 1px solid var(--line); padding: 14px 10px 6px; }
.chartwrap svg { display: block; width: 100%; height: auto; }
.chartwrap .tip {
  display: none;
  position: absolute;
  top: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  padding: 5px 9px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--fg-dim);
  white-space: nowrap;
  z-index: 5;
}
.chartwrap .tip b { display: block; color: var(--fg); font-weight: 600; margin-bottom: 1px; }

.ax { font-family: var(--mono); font-size: 10px; fill: var(--fg-faint); letter-spacing: 0.04em; }
.grid-l { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.s-line { stroke: var(--accent); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.s-area { fill: var(--accent); opacity: 0.1; }
.s-bar { fill: var(--accent); opacity: 0.85; }
.s-bar.warnbar { fill: var(--warn); }
.cross { stroke: var(--line-strong); stroke-width: 1; shape-rendering: crispEdges; }
.hoverdot { fill: var(--accent); stroke: var(--bg-elev); stroke-width: 2; }

/* sparklines (in tables/cards) */
.spark { display: block; }
.spark .sp-l { stroke: var(--accent); stroke-width: 1.5; fill: none; stroke-linejoin: round; }
.spark .sp-a { fill: var(--accent); opacity: 0.1; }
.spark .sp-d { fill: var(--accent); }
.spark .sp-flat { stroke: var(--line-strong); stroke-width: 1; }
tr.inactive .spark .sp-l, .zcard.inactive .spark .sp-l { stroke: var(--fg-faint); }
tr.inactive .spark .sp-a, .zcard.inactive .spark .sp-a { fill: var(--fg-faint); }
tr.inactive .spark .sp-d, .zcard.inactive .spark .sp-d { fill: var(--fg-faint); }

/* inline bar inside table cells */
.ibar { display: inline-block; vertical-align: middle; width: 90px; height: 5px; background: var(--bg-elev-2); margin-right: 8px; }
.ibar i { display: block; height: 100%; background: var(--accent); }
.ibar.warn i { background: var(--warn); }

/* ==========================================================================
   DATA TABLES
   ========================================================================== */
.tablewrap { border: 1px solid var(--line); background: var(--bg-elev); overflow-x: auto; }
table.dtable { width: 100%; border-collapse: collapse; font-size: 13px; }
table.dtable th {
  text-align: left;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-faint);
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev-2);
  white-space: nowrap;
}
table.dtable th.r, table.dtable td.r { text-align: right; }
table.dtable td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--fg-dim);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.dtable tr:last-child td { border-bottom: 0; }
table.dtable tbody tr { transition: background 0.15s; }
table.dtable tbody tr:hover { background: var(--bg-elev-2); }
table.dtable td.name { color: var(--fg); font-weight: 560; letter-spacing: -0.01em; }
table.dtable td .sub { display: block; font-size: 11.5px; color: var(--fg-faint); white-space: normal; max-width: 34ch; line-height: 1.35; }
table.dtable tr.inactive td { color: var(--fg-faint); }
table.dtable tr.inactive td.name { color: var(--fg-dim); font-weight: 400; }
table.dtable tr.hl td { background: var(--warn-soft); }
td.zero { color: var(--fg-faint); }

/* count chips in estate rows */
.cchip { font-family: var(--mono); font-size: 11px; padding: 1px 6px; font-variant-numeric: tabular-nums; }
.cchip.warn { color: var(--warn); background: var(--warn-soft); }
.cchip.bad { color: var(--danger); background: var(--danger-soft); }
.cchip.zero { color: var(--fg-faint); }

/* ==========================================================================
   FOCUS FEED — brief + insight leads
   ========================================================================== */
.focus { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; }
@media (max-width: 980px) { .focus { grid-template-columns: 1fr; } }

.brief { background: var(--bg-elev); border: 1px solid var(--line); padding: 18px 20px; }
.brief-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg-faint); }
.brief-md { font-size: 13.5px; color: var(--fg-dim); }
.brief-md h3, .brief-md h4, .brief-md h5 { margin: 14px 0 6px; color: var(--fg); font-size: 14px; letter-spacing: -0.01em; }
.brief-md p { margin: 0 0 10px; }
.brief-md ul { margin: 0 0 10px; padding-left: 18px; }
.brief-md li { margin: 3px 0; }
.brief-md strong { color: var(--fg); }
.brief-md code { background: var(--bg-elev-2); border: 1px solid var(--line); padding: 0 5px; font-family: var(--mono); font-size: 12px; }
.brief-md pre { background: var(--bg); border: 1px solid var(--line); padding: 10px 12px; overflow-x: auto; font-family: var(--mono); font-size: 12px; }
.brief-leads { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.brief-leads li { font-size: 13px; color: var(--fg-dim); margin: 4px 0; }

.leadgrid { display: flex; flex-direction: column; gap: 10px; }
.lead { background: var(--bg-elev); border: 1px solid var(--line); border-left: 2px solid var(--accent); padding: 12px 16px; }
.lead.k-security, .lead.k-traffic-drop, .lead.k-error-rate { border-left-color: var(--warn); }
.lead-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.lead-rank { font-family: var(--mono); font-size: 10px; color: var(--accent); letter-spacing: 0.1em; }
.lead-kind { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-faint); border: 1px solid var(--line-strong); padding: 1px 6px; }
.lead-src { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-faint); margin-left: auto; }
.lead-title { font-size: 14px; font-weight: 600; color: var(--fg); letter-spacing: -0.01em; }
.lead-body { font-size: 13px; color: var(--fg-dim); margin-top: 3px; }
.lead-body.pre { white-space: pre-wrap; margin-top: 8px; line-height: 1.55; }
.lead-ev { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* A triaged concern: green rail, resolved badge, write-up behind a click. */
.lead.resolved { border-left-color: var(--ok); }
.lead-resolved {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ok); border: 1px solid rgba(74, 222, 128, 0.35); background: var(--ok-soft);
  padding: 1px 6px;
}
.lead-fold { margin-top: 6px; }
.lead-fold > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-dim); border-bottom: 1px solid var(--line-strong); padding-bottom: 2px;
}
.lead-fold > summary::-webkit-details-marker { display: none; }
.lead-fold > summary::before {
  content: "\25B8"; color: var(--accent); font-size: 11px; transition: transform 0.12s ease;
}
.lead-fold[open] > summary::before { transform: rotate(90deg); }
.lead-fold > summary:hover { color: var(--fg); border-bottom-color: var(--accent); }
.fold-hint { color: var(--fg-faint); letter-spacing: 0.08em; }
.lead-fold[open] > summary .fold-hint { opacity: 0; }
.ev {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-dim);
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  padding: 2px 7px;
  font-variant-numeric: tabular-nums;
}
.ev b { color: var(--fg); font-weight: 600; margin-right: 5px; }

/* ==========================================================================
   ZONES
   ========================================================================== */
.segbtns { display: inline-flex; border: 1px solid var(--line-strong); }
.segbtns button { background: none; border: 0; border-right: 1px solid var(--line-strong); color: var(--fg-dim); font-size: 12px; padding: 5px 12px; font-weight: 500; }
.segbtns button:last-child { border-right: 0; }
.segbtns button:hover { color: var(--fg); filter: none; }
.segbtns button.on { background: var(--accent-soft); color: var(--accent); }

.zonegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.zcard { background: var(--bg-elev); border: 1px solid var(--line); padding: 14px 16px; min-width: 0; }
.zcard.inactive { opacity: 0.6; }
.zcard-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.zcard-head b { font-size: 13.5px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zcard-head .zv { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--fg); font-variant-numeric: tabular-nums; }
.zcard .spark { width: 100%; }
.zcard-foot { display: flex; gap: 14px; margin-top: 8px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.zcard-foot b { color: var(--fg-dim); font-weight: 500; }

/* -- zone card is now a control (click / Enter / Space → #/zone/<name>) -----
   The card is a link, so pointer-over has to read as one. The perimeter goes
   ember on hover — a transient affordance, not decoration — because a
   .08 → .16 white hairline is below threshold on the grained ground. A quiet
   card also drops its .inactive dimming while hovered or focused: quiet zones
   are exactly the ones this drill-down exists to surface, so they must answer
   as visibly as a busy one. */
.zcard { cursor: pointer; transition: border-color 0.12s, background 0.12s, opacity 0.12s; }
.zcard:hover { border-color: var(--accent-dim); background: var(--bg-elev-2); }
.zcard:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
.zcard.inactive:hover, .zcard.inactive:focus-visible { opacity: 1; }
.zcard:active { background: var(--bg-elev-2); }

/* the static go-glyph in the card head: faint at rest, ember with the card */
.zcard-go { color: var(--fg-faint); font-size: 11px; line-height: 1; flex: 0 0 auto; transition: color 0.12s; }
.zcard:hover .zcard-go, .zcard:focus-visible .zcard-go { color: var(--accent); }

/* zone-registry reconciliation strip — states out loud how many zones exist
   vs how many reported traffic in the window. Amber is STATE (stale sync /
   unregistered traffic), never decoration. */
.zrecon {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}
.zrecon b { color: var(--fg); font-weight: 600; }
.zrecon.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.zrecon.warn b { color: var(--warn); }
.zrecon .spacer { flex: 1; }
.zrecon-quiet {
  color: var(--fg-dim);
  letter-spacing: 0.04em;
  /* hairline divider so the tail clauses read as separate facts instead of
     running together into one line of undifferentiated mono text */
  border-left: 1px solid var(--line-strong);
  padding-left: 10px;
  max-width: 46ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* a zone Cloudflare no longer returns: keep the card, flag the rail */
.zcard.removed { border-left: 2px solid var(--danger); }
.zcard-foot .zc-quiet { color: var(--fg-faint); letter-spacing: 0.04em; }

/* Share column: pin the percentage to a fixed cell so every comparison bar
   starts at the same x. Right-aligned text of varying length (100% / 62.5% /
   0.4%) otherwise slides the bars ~20px and they stop being comparable. */
table[data-panel="zone-hosts"] td .ibar + .tnum {
  display: inline-block;
  min-width: 5ch;
  text-align: right;
}

/* ==========================================================================
   ZONE DETAIL  (#/zone/<name>)
   ========================================================================== */
.zd-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.zd-id { flex: 1 1 320px; min-width: 0; }
.zd-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 0; margin: 0 0 8px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--fg-faint); cursor: pointer; font-weight: 500;
}
.zd-back::before { content: "\2190"; color: var(--accent); }
.zd-back:hover { color: var(--fg); filter: none; }
.zd-name {
  margin: 0; font-size: clamp(22px, 3.2vw, 30px); font-weight: 650;
  letter-spacing: -0.03em; line-height: 1.1; color: var(--fg); overflow-wrap: anywhere;
}
/* min-height is one chip row: the loading header emits an empty .zd-meta and
   the loaded one fills it, so without a floor the whole page jumps when the
   data lands. */
.zd-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; min-height: 24px; }
.zd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-left: auto; }

/* external link out to the Cloudflare dashboard — overrides the global <a> underline */
.zd-ext {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-strong);
  padding: 5px 10px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--fg-dim); white-space: nowrap;
}
.zd-ext::after { content: "\2197"; color: var(--accent); }
.zd-ext:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-dim); }

/* derived-rate chip row under the KPI strip */
.zd-rates { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 4px; }

/* Small-multiples chart grid. The column COUNT is fixed per breakpoint rather
   than auto-fit, because timeChart() bakes its width into the SVG viewBox: if
   CSS and JS disagree on the count the SVG scales and the "small" charts end
   up with LARGER axis type than the hero chart above them. zdChartRow() mirrors
   these same two breakpoints — change them together or not at all. */
.zd-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 980px) { .zd-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .zd-charts { grid-template-columns: 1fr; } }
.zd-chart { min-width: 0; }
.zd-chart h4 {
  margin: 0 0 8px; font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--fg-faint);
}

/* an explanatory line (retention disclosure, truncation notice) */
.zd-note {
  border-left: 2px solid var(--line-strong);
  padding: 6px 0 6px 12px; margin: 0 0 12px;
  font-size: 12.5px; line-height: 1.45; color: var(--fg-faint); max-width: 88ch;
}

/* the security verdict callout */
.zd-verdict {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-left: 2px solid var(--line-strong);
  padding: 14px 18px; margin-bottom: 14px;
}
.zd-verdict.ok { border-left-color: var(--ok); }
.zd-verdict.warn { border-left-color: var(--warn); }
/* DIRECT child only: the .ev chips in .zd-split carry their own <b>, and
   `.zd-verdict b` would tie with `.ev b` on specificity and win on order,
   stacking the chip labels. `>` scopes this to the verdict headline. */
.zd-verdict > b {
  display: block; font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--fg-faint); margin-bottom: 6px;
}
.zd-verdict.ok > b { color: var(--ok); }
.zd-verdict.warn > b { color: var(--warn); }
.zd-verdict p { margin: 0; font-size: 13.5px; color: var(--fg-dim); max-width: 86ch; line-height: 1.5; }
.zd-split { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* registry key/value grid */
.zd-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; }
.zd-kv-k {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--fg-faint); align-self: center;
}
.zd-kv-v { font-size: 13px; color: var(--fg); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.zd-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* zone with nothing collected at all */
.zd-empty { border: 1px dashed var(--line-strong); background: var(--bg-elev); padding: 30px 24px; margin-bottom: 18px; }
.zd-empty-k {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--fg-faint); margin-bottom: 12px;
}
.zd-empty p { margin: 0 0 8px; font-size: 14px; color: var(--fg-dim); max-width: 76ch; line-height: 1.55; }
.zd-empty p:last-child { margin-bottom: 0; }

/* ==========================================================================
   SECURITY
   ========================================================================== */
.secgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-top: 14px; }
.listcard { background: var(--bg-elev); border: 1px solid var(--line); padding: 12px 14px; min-width: 0; }
.listcard h3 { margin: 0 0 10px; font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--fg-faint); }
.lrow { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12.5px; color: var(--fg-dim); }
.lrow .lk { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
.lrow .lv { font-family: var(--mono); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.lrow .ibar { width: 64px; flex: 0 0 auto; }

/* ==========================================================================
   MISC
   ========================================================================== */
.ops { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; color: var(--fg-faint); }
.ops .spacer { flex: 1; }

#toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elev-2);
  border: 1px solid var(--line-strong);
  color: var(--fg);
  padding: 9px 16px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 60;
  font-size: 13px;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
#toast.err { border-color: var(--danger); color: var(--danger); }

.spacer { flex: 1; }

/* ==========================================================================
   RESPONSIVE — the Klaxon push deep-links here; half the views are phones
   ========================================================================== */
@media (max-width: 900px) {
  .strip { grid-template-columns: repeat(2, 1fr); }
  .tile.t-dim { grid-column: span 2; }

  /* zone detail: range control drops under the zone name */
  .zd-head { align-items: flex-start; }
  .zd-actions { margin-left: 0; width: 100%; }

  /* The zone KPI strip is 5 tiles; in a 2-column grid the 5th would leave a
     bare cell showing the strip's own --line background as a grey block.
     Span it, the way .tile.t-dim does on the Overview strip. */
  .strip[data-panel="zone-kpi"] .tile:last-child { grid-column: span 2; }
}
@media (max-width: 760px) {
  .topmeta .hidesm, .ops .hidesm, .brand small { display: none; }
  .container { padding: 14px; }

  /* the quiet-zone list wraps instead of truncating on a phone */
  .zrecon-quiet { max-width: 100%; white-space: normal; }

  /* zone detail: key/value grid stacks */
  .zd-name { font-size: 20px; }
  .zd-rates { gap: 6px; }
  .zd-kv { grid-template-columns: 1fr; gap: 2px 0; }
  .zd-kv-v { margin-bottom: 8px; }

  /* estate table → stacked cards */
  table.estate thead { display: none; }
  table.estate, table.estate tbody, table.estate tr, table.estate td { display: block; width: 100%; }
  table.estate tr { border-bottom: 1px solid var(--line); padding: 10px 4px; }
  table.estate td { border: none; padding: 3px 10px; display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 8px; white-space: normal; }
  table.estate td::before { content: attr(data-label); font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-faint); }
  table.estate td.name::before { display: none; }
  table.estate td.name { grid-template-columns: 1fr; font-size: 14px; }
  table.estate td .sub { max-width: none; }
}
@media (max-width: 480px) {
  .strip { grid-template-columns: 1fr 1fr; }
  .tile .v { font-size: 22px; }
  .tile.hero .v { font-size: 30px; }

  /* zone detail: full-width range control + link buttons */
  .zd-ext { flex: 1 1 auto; justify-content: center; }
  .segbtns#zd-range { width: 100%; }
  .segbtns#zd-range button { flex: 1; text-align: center; }
}
