/* zerohour: white, hairline, exact. Light only. One screen per tab at laptop size, no page scroll.
   Palette "white-link-blue", type Host Grotesk + JetBrains Mono, sharp radius (tasteskill deal for a developer tool). */
:root {
  color-scheme: light;
  --page: #ffffff; --card: #ffffff; --fill: #f4f4f4; --fill-2: #e8e8e8; --hair: rgb(17 17 17 / .09); --line: rgb(17 17 17 / .12);
  --text: #111111; --text-2: #3a3a3a; --muted: #555555; --faint: #9a9a9a;
  --accent: #1a4be0;
  --tuned: #1a4be0; --plan: #c2410c;                       /* after / before */
  --alert: #d70015; --alert-bg: #fff1f0; --clear: #1f7a36; --clear-bg: #edf8f0; --notice: #a15c00;
  --shadow: 0 0 0 1px var(--line);
  --sans: "Host Grotesk", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --r-sm: 4px; --r-md: 6px; --r-lg: 8px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--page); color: var(--text); font: 14px/1.45 var(--sans); letter-spacing: -0.005em;
  font-size-adjust: from-font; -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: underline 1px transparent; text-underline-offset: 3px; transition: text-decoration-color .15s var(--ease); }
a:hover { text-decoration-color: currentColor; }
button { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0; }

/* page to page: a short cross-fade; the bar stays put */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
  /* the page title arrives once on load */
  .head h1, .head h1 + p { animation: rise .52s cubic-bezier(.22, 1, .36, 1) both; }
  .head h1 + p { animation-delay: 60ms; }
}
.topbar { view-transition-name: topbar; }
@keyframes rise { from { opacity: 0; translate: 0 12px; } }
.muted { color: var(--muted); } .faint { color: var(--faint); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; height: 52px; flex: none; background: rgb(255 255 255 / .86);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); border-bottom: 1px solid var(--hair); }
.topbar .in { max-width: 1280px; height: 100%; margin: 0 auto; padding: 0 32px; display: flex; align-items: center; gap: 36px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font: 600 15px var(--mono); letter-spacing: -0.03em; }
.brand svg { image-rendering: pixelated; shape-rendering: crispEdges; }
.topbar nav { display: flex; gap: 26px; font-size: 13px; flex: none; align-self: stretch; }
/* nav words: a 1px line draws under on hover; the current page holds a 2px bar on the bar's edge */
.topbar nav a { color: var(--muted); white-space: nowrap; position: relative; display: flex; align-items: center; transition: color .15s var(--ease); }
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 13px; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right; transition: transform .12s var(--ease); }
.topbar nav a:hover::after { transform: scaleX(1); transform-origin: left; transition-duration: .15s; }
.topbar nav a[aria-current="page"] { color: var(--text); font-weight: 500; }
.topbar nav a[aria-current="page"]::after { bottom: -1px; height: 2px; transform: none; }
.topbar .grow { flex: 1; }

/* page */
main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 32px 24px; display: flex; flex-direction: column; min-height: 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; }
.head h1 { font-size: 36px; line-height: 1.08; font-weight: 500; letter-spacing: -0.035em; margin: 0; text-wrap: balance; }
.head p { margin: 8px 0 0; color: var(--text-2); font-size: 15px; max-width: 70ch; text-wrap: pretty; }
.panel { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 16px; }
.panel[hidden] { display: none; }

/* segmented control (tabs) */
.seg { display: inline-flex; background: var(--fill); border-radius: var(--r-md); padding: 3px; gap: 2px; box-shadow: inset 0 0 0 1px var(--hair); }
.seg button { border: 0; background: none; padding: 6px 16px; border-radius: var(--r-sm); cursor: pointer; color: var(--text-2); font-size: 13px; font-weight: 500;
  transition: background .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease); }
.seg button:hover { color: var(--text); }
.seg button[aria-selected="true"], .seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgb(17 17 17 / .06); }
.tabs { margin-bottom: 22px; align-self: flex-start; flex: none; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: var(--r-sm); padding: 8px 16px; min-height: 36px; cursor: pointer;
  font-size: 14px; font-weight: 500; background: var(--card); color: var(--text); box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .12s var(--ease), background-color .15s var(--ease), box-shadow .15s var(--ease); }
.btn:hover { background: var(--fill); box-shadow: inset 0 0 0 1px rgb(17 17 17 / .22); text-decoration: none; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: none; }
.btn.primary:hover { background: color-mix(in oklab, var(--accent) 86%, #000); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .btn:not(:disabled):hover { transform: translateY(-1px); transition-duration: .15s; }
}
.btn:not(:disabled):active { transform: translateY(1px) scale(.985); transition-duration: .09s; }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn svg { width: 12px; height: 12px; }
.controls { display: flex; gap: 8px; align-items: center; }
.controls.wrap { flex-wrap: wrap; flex: none; }
form.controls { flex: none; }
.grow { flex: 1; }
.fill { flex: 1; }

/* live page: site field, score gauge */
.field { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: var(--r-sm); padding: 0 6px 0 14px; min-height: 36px; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .14s var(--ease); }
.field span { font-size: 13px; color: var(--muted); }
.field input { flex: 1; border: 0; background: none; font: 13px var(--mono); color: var(--text); min-width: 0; padding: 8px 0; outline: none; }
.field:focus-within { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px rgb(26 75 224 / .14); }
.bar-track { height: 6px; border-radius: 3px; background: var(--fill-2); overflow: hidden; margin: 10px 0 6px; }
.bar-track span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .35s var(--ease); }
.kpi .next { margin: 12px 0 8px; }
.kpis.wide-first { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); }
.score-row { display: flex; align-items: center; gap: 24px; }
.kpi .num.big { font-size: 56px; min-width: 3.6ch; }
.gauge { flex: 1; position: relative; height: 10px; border-radius: 5px; background: var(--fill-2); margin: 0 4px 18px; }
.gauge .zone { position: absolute; top: 0; bottom: 0; width: 12.3%; }  /* 1.5 / (4.60 + 1.5) of each half: live.js setScore */
.gauge .clear-z { left: 0; background: var(--clear-bg); box-shadow: inset -2px 0 0 var(--clear); border-radius: 5px 0 0 5px; }
.gauge .alert-z { right: 0; background: var(--alert-bg); box-shadow: inset 2px 0 0 var(--alert); border-radius: 0 5px 5px 0; }
.gauge i { position: absolute; top: -5px; width: 4px; height: 20px; margin-left: -2px; border-radius: 2px; background: var(--text); left: 50%; transition: left .35s var(--ease); }
.gauge .mark { position: absolute; top: 16px; font: 500 11px var(--sans); color: var(--muted); white-space: nowrap; }
.gauge .lo { left: 12.3%; transform: translateX(-50%); } .gauge .mid { left: 50%; transform: translateX(-50%); } .gauge .hi { right: 12.3%; transform: translateX(50%); }

/* cards */
.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px 22px; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.card h2 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -0.015em; }
.card .sub { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.card .top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.scroll { overflow: auto; min-height: 0; flex: 1; }
.row { display: grid; gap: 16px; min-height: 0; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); flex: none; }
.main2 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); flex: 1; }
.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 1; }

.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .num { font-size: 34px; font-weight: 500; letter-spacing: -0.04em; line-height: 1.15; font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi .num small { font-size: 16px; font-weight: 500; color: var(--muted); letter-spacing: -0.01em; margin-left: 3px; }
.kpi .foot { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.kpi.good .num { color: var(--clear); } .kpi.bad .num { color: var(--alert); }

/* progress */
.progress { display: flex; align-items: center; gap: 14px; flex: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress .track { flex: 1; height: 4px; border-radius: 2px; background: var(--fill-2); overflow: hidden; }
.progress .track span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width .35s var(--ease); }

/* client tiles */
.clients { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 12px; }
.tile { border-radius: var(--r-md); background: var(--fill); padding: 18px 18px 16px; position: relative; display: flex; flex-direction: column; transition: background .3s var(--ease), box-shadow .3s var(--ease); }
.tile .ip { font: 600 15px var(--mono); letter-spacing: 0; }
.tile .state { font-size: 13px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 5px; }
.tile .state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.tile.alert { background: var(--alert-bg); box-shadow: inset 0 0 0 1.5px var(--alert); }
.tile.alert .state { color: var(--alert); font-weight: 600; } .tile.alert .state::before { background: var(--alert); }
.tile.clear .state { color: var(--clear); } .tile.clear .state::before { background: var(--clear); }
.tile .truth { align-self: flex-start; white-space: nowrap; margin-top: 10px; font-size: 11px; color: var(--alert); font-weight: 600; background: #fff; padding: 2px 8px; border-radius: var(--r-sm); box-shadow: inset 0 0 0 1px rgb(215 0 21 / .25); }
.meter { height: 4px; background: var(--fill-2); border-radius: 2px; margin-top: auto; position: relative; }
.meter::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--faint); }
.meter span { position: absolute; top: 0; bottom: 0; border-radius: 2px; transition: left .35s var(--ease), width .35s var(--ease); }

/* feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 0; border-bottom: 1px solid var(--hair); font-size: 13px; }
.feed li:last-child { border-bottom: 0; }
.feed .what { font-weight: 500; }
.feed .meta { color: var(--muted); font-size: 12px; grid-column: 1 / -1; }
.feed li.alert .what { color: var(--alert); }
.feed li.fresh { animation: fresh 1.2s var(--ease); }
@keyframes fresh { from { background: rgb(26 75 224 / .07); } }

.chips { display: inline-flex; gap: 3px; }
.chip { font: 600 10px var(--mono); width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 3px; background: var(--fill-2); color: var(--muted); }
.chip.bad { background: var(--alert); color: #fff; }
.chip.na { background: none; box-shadow: inset 0 0 0 1px var(--fill-2); color: var(--faint); }

.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--r-sm); }
.pill.alert { color: var(--alert); background: var(--alert-bg); } .pill.clear { color: var(--clear); background: var(--clear-bg); }
.pill.none { color: var(--muted); background: var(--fill); }

/* tables */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--hair); white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0; } th:last-child, td:last-child { padding-right: 0; }
thead th { position: sticky; top: 0; background: var(--card); color: var(--muted); font-weight: 500; font-size: 12px; z-index: 1; }
tbody tr:last-child td { border-bottom: 0; }
.num-c { text-align: right; }
tr.sel td { background: rgb(26 75 224 / .07); }
tr.edited td { background: var(--alert-bg); }
td.forged { color: var(--alert); font-weight: 600; }

/* charts */
.chart { width: 100%; flex: 1; min-height: 0; display: block; }
.chart text { fill: var(--muted); font: 11px var(--sans); }
.chart .grid-l { stroke: var(--hair); }
.chart .thr { stroke-width: 1.25; stroke-dasharray: 4 4; }
.legend { display: flex; gap: 18px; font-size: 12.5px; color: var(--text-2); margin-top: 10px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 14px; height: 0; border-top: 2px solid; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--card); border-radius: var(--r-md); padding: 7px 10px; font-size: 12.5px;
  box-shadow: 0 0 0 1px var(--line), 0 8px 24px rgb(17 17 17 / .1); white-space: nowrap; }
.tip[hidden] { display: none; }

/* bars */
.bars { display: grid; gap: 12px; }
.bar { display: grid; grid-template-columns: 150px minmax(0, 1fr) 84px; gap: 12px; align-items: center; font-size: 13px; }
.bar .track { height: 10px; background: var(--fill); border-radius: 5px; position: relative; }
.bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 5px; min-width: 3px; transition: width .4s var(--ease); }
.bar .val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar .limit { position: absolute; top: -5px; bottom: -5px; width: 2px; border-radius: 1px; background: var(--alert); }

/* big comparison numbers */
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.vs .big { font-size: 52px; font-weight: 500; letter-spacing: -0.045em; line-height: 1; font-variant-numeric: tabular-nums; }
.vs .cap { font-size: 13px; color: var(--muted); margin-top: 8px; }
.vs .before .big { color: var(--plan); } .vs .after .big { color: var(--tuned); }
.badge { display: inline-block; margin-top: 10px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--r-sm); }
.badge.pass { color: var(--clear); background: var(--clear-bg); } .badge.fail { color: var(--alert); background: var(--alert-bg); }

.formula-card .eq { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: baseline; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--fill); font: 13.5px/1.5 var(--mono); letter-spacing: 0; margin-bottom: 10px; }
.formula-card .eq .when { font: 500 12px var(--sans); color: var(--muted); }
.formula-card.before .eq b { color: var(--plan); } .formula-card.after .eq b { color: var(--tuned); }
.formula-card.before { box-shadow: var(--shadow), inset 3px 0 0 var(--plan); } .formula-card.after { box-shadow: var(--shadow), inset 3px 0 0 var(--tuned); }
.vs.compact .big { font-size: 40px; }
pre.tree { margin: 0; padding: 14px 16px; background: var(--fill); border-radius: var(--r-md); overflow: auto; flex: 1; min-height: 0; font: 11.5px/1.6 var(--mono);
  color: var(--text-2); }
pre.tree mark { background: var(--alert-bg); color: var(--alert); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.formula { background: var(--fill); border-radius: var(--r-md); padding: 12px 14px; font: 12.5px/1.6 var(--mono); color: var(--text-2); white-space: pre; overflow-x: auto; margin: 0; }
.note { font-size: 13px; color: var(--text-2); margin: 0; }
.note b { color: var(--text); }
.steps-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--r-sm); background: var(--text); color: #fff; font: 600 11px var(--mono); margin-right: 8px; }
[hidden] { display: none !important; }
/* reduced motion: nothing travels or scales; colour changes stay */
@media (prefers-reduced-motion: reduce) {
  .feed li.fresh { animation: none; }
  .btn:not(:disabled):active { transform: none; }
  .bar-track span, .gauge i, .progress .track span, .meter span, .bar .fill, .topbar nav a::after { transition: none; }
}
/* Under 1100px the columns stack, so the page scrolls instead of fitting one screen. */
@media (max-width: 1100px) {
  .clients { grid-template-columns: repeat(2, minmax(0, 1fr)); } .main2, .halves { grid-template-columns: minmax(0, 1fr); }
  html, body { height: auto; }
  main, .panel, .row, .card, .scroll, .fill { flex: none !important; }   /* !important: some pages set flex inline */
  .row.halves[style] { height: auto !important; }
  .chart { flex: none; height: 280px; }
  .btn, .seg button { min-height: 44px; }   /* touch-sized once the layout reflows */
  pre.tree { flex: none; max-height: 70vh; }
}

/* Tablet and phone: the nav is its own row and swipes sideways. */
@media (max-width: 900px) {
  .topbar { height: auto; }
  .topbar .in { flex-wrap: wrap; gap: 0 24px; padding: 0 16px; }
  .brand { min-height: 48px; }
  .topbar nav { order: 1; flex: 1 0 100%; overflow-x: auto; scrollbar-width: none; gap: 22px; margin: 0 -16px; padding: 0 16px; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { min-height: 44px; flex: none; }
  .topbar nav a::after { bottom: 12px; }
  .topbar nav a[aria-current="page"]::after { bottom: 0; }
  main { padding: 20px 16px 32px; }
}

/* Phone */
@media (max-width: 640px) {
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { flex: none; white-space: nowrap; }
  .tabs { margin-bottom: 18px; }
  .head { flex-direction: column; align-items: stretch; gap: 16px; }
  .head h1 { font-size: 30px; }
  .controls { flex-wrap: wrap; }
  .controls > .btn { flex: 1 1 auto; justify-content: center; }
  form.controls .field, .head .controls > .seg { flex: 1 0 100%; }
  .head .controls > .seg button { flex: 1; }
  .card { padding: 16px; }
  .card .top { flex-wrap: wrap; }
  .card > table { display: block; overflow-x: auto; }
  .kpis, .kpis.wide-first { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpis.wide-first > :first-child { grid-column: 1 / -1; }
  .kpi .num { font-size: 28px; }
  .kpi .num.big { font-size: 44px; }
  .score-row { flex-wrap: wrap; gap: 12px; }
  .gauge { flex: 1 0 100%; }
  .clients { gap: 8px; }
  .tile { padding: 14px; }
  .bar { grid-template-columns: 100px minmax(0, 1fr) 64px; gap: 8px; }
  .vs .big { font-size: 40px; } .vs.compact .big { font-size: 32px; }
  .formula-card .eq { grid-template-columns: minmax(0, 1fr); }
}
