/*
 * Site Monitor dashboard styles.
 * Colours are declared once with light-dark(); `color-scheme` picks the side
 * (system by default, or <html data-theme="light|dark"> from the theme cookie).
 * Status colours: up uses Geeks in the Woods' aurora green.
 */
:root {
  color-scheme: light dark;
  --bg: light-dark(#f6f6f2, #121211);
  --panel: light-dark(#ffffff, #1b1b19);
  --panel-2: light-dark(#efefe9, #262623);
  --text: light-dark(#1d1c19, #ecebe6);
  --muted: light-dark(#5f5d56, #a6a49c);
  --line: light-dark(#e2e1da, #31312d);
  --up: light-dark(#08765a, #4fd8ac);
  --warn: light-dark(#8f5d00, #f2c94c);
  --down: light-dark(#c4302b, #ff7b72);
  --accent: light-dark(#2453c7, #8ab4f8);
  --on-status: light-dark(#ffffff, #121211);
  --focus: var(--accent);
  --shadow: light-dark(rgb(0 0 0 / 0.07), rgb(0 0 0 / 0.4));
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-quick: 150ms;
  --t-move: 300ms;
  --t-reveal: 600ms;
  --radius: 10px;
  --wide: 1200px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---- base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; overflow-x: clip; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }
h1 { font-size: 22px; margin: 4px 0 12px; text-wrap: balance; }
h2 { font-size: 16px; margin: 28px 0 8px; text-wrap: balance; }
p { text-wrap: pretty; }
code { font-size: 0.95em; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.bad { color: var(--down); }
.warn { color: var(--warn); }
.ok { color: var(--up); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.skip { position: absolute; left: 12px; top: -48px; z-index: 20; padding: 8px 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); transition: top var(--t-quick) var(--ease); }
.skip:focus { top: 12px; }

/* ---- header & footer ----------------------------------------------------- */
header.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: var(--panel);
}
@supports (backdrop-filter: blur(1px)) {
  header.top { background: color-mix(in oklab, var(--panel) 82%, transparent); backdrop-filter: blur(12px) saturate(180%); }
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
header nav { display: flex; gap: 4px 16px; align-items: center; flex-wrap: wrap; }
header nav a { color: var(--muted); padding: 6px 0; }
header nav a[aria-current="page"] { color: var(--text); font-weight: 650; }
header form { margin: 0; }
main { max-width: var(--wide); margin: 0 auto; padding: 16px; }
footer { max-width: var(--wide); margin: 0 auto; padding: 16px; display: flex; gap: 8px 20px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
footer > span:last-child { margin-left: auto; }
html.stale [data-live="updated"] { color: var(--warn); }
html.stale [data-live="updated"]::after { content: " · can't reach the server, retrying"; }
.theme-switch { margin: 0; display: inline-flex; gap: 4px; align-items: center; }
.theme-switch button { background: none; border: 0; padding: 4px 2px; color: var(--accent); font: inherit; cursor: pointer; }
.theme-switch button[aria-pressed="true"] { color: var(--text); font-weight: 650; }

/* ---- status tones -------------------------------------------------------- */
[data-tone="up"] { --tone: var(--up); }
[data-tone="warn"] { --tone: var(--warn); }
[data-tone="down"] { --tone: var(--down); }
[data-tone="unknown"], [data-tone="paused"], [data-tone="stale"] { --tone: var(--muted); }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; background: var(--panel-2); color: var(--muted); }
.pill[data-tone] { background: color-mix(in oklab, var(--tone) 15%, transparent); color: var(--tone); font-weight: 550; }
.pill[data-tone="unknown"], .pill[data-tone="paused"] { background: var(--panel-2); font-weight: 400; }
.badge { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 700; font-size: 14px; background: var(--panel-2); color: var(--muted); }
.badge[data-tone="up"], .badge[data-tone="warn"], .badge[data-tone="down"], .badge[data-tone="stale"] { background: var(--tone); color: var(--on-status); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--tone, var(--muted)); }

/* ---- status banner & tiles ---------------------------------------------- */
.status-banner {
  display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; padding: 14px 16px;
  border-radius: var(--radius); border: 1px solid color-mix(in oklab, var(--tone) 35%, var(--line));
  background: color-mix(in oklab, var(--tone) 9%, var(--panel));
}
.status-banner p { margin: 0; font-size: 17px; font-weight: 650; }
.status-banner .badge { width: 30px; height: 30px; font-size: 16px; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 8px 0; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-width: 0; }
.tile-label { color: var(--muted); font-size: 12px; }
.tile-value { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile[data-tone] .tile-value { color: var(--tone); }
.tile-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- toolbar, segmented links, filter ----------------------------------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; margin: 22px 0 0; }
.site-filter { flex: 1 1 220px; max-width: 360px; margin-right: auto; font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button, .seg a { background: none; color: var(--muted); border: 0; border-radius: 0; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.seg button + button, .seg a + a { border-left: 1px solid var(--line); }
.seg .on, .seg [aria-current="page"] { background: var(--panel-2); color: var(--text); font-weight: 600; }
.seg a:hover { text-decoration: none; color: var(--text); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty h1 { color: var(--text); }

/* ---- tables -------------------------------------------------------------- */
/* Scroll hint: shadows at the edges while there is more to scroll (no JS). */
.table-wrap {
  overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  background:
    linear-gradient(to right, var(--panel) 30%, transparent) left / 40px 100% no-repeat local,
    linear-gradient(to left, var(--panel) 30%, transparent) right / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--shadow), transparent) left / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--shadow), transparent) right / 14px 100% no-repeat scroll,
    var(--panel);
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.page { min-width: 150px; max-width: 420px; overflow-wrap: anywhere; }
td.site { white-space: nowrap; }
tr.paused { opacity: 0.55; }
a.ext { font-size: 12px; color: var(--muted); }
table.compare tr.ours td { background: var(--panel-2); font-weight: 600; }
td.compare-spark { min-width: 160px; width: 22%; }
td.compare-spark .spark { height: 28px; }
td[data-tone] { color: var(--tone); font-weight: 600; }
table.compare th.group { text-align: center; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); }
th a { color: inherit; }
.rank { color: var(--accent); }
td.page-spark { min-width: 100px; }
td.page-spark .spark { height: 22px; width: 120px; }
tr.fresh, .site-row.fresh, .card.fresh, .hist-row.fresh, .attention.fresh { animation: fresh 2.4s var(--ease); }
@keyframes fresh { from { background: color-mix(in oklab, var(--accent) 16%, transparent); } }

/* ---- disclosures --------------------------------------------------------- */
details.fold { margin: 16px 0 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
details.fold > summary { cursor: pointer; padding: 10px 12px; min-height: 44px; display: flex; align-items: center; gap: 8px; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: ""; width: 7px; height: 7px; flex: none; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform var(--t-quick) var(--ease); }
details.fold[open] > summary::before { transform: rotate(45deg); }
details.fold[open] > summary { border-bottom: 1px solid var(--line); }
details.fold > .table-wrap { border: 0; border-radius: 0 0 var(--radius) var(--radius); }
.explorer details.numbers { margin-top: 12px; background: none; }
.explorer details.numbers .table-wrap { max-height: 360px; overflow-y: auto; }

/* ---- site cards ---------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column; gap: 8px; padding: 12px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--tone, var(--line)); border-radius: var(--radius);
  transition: border-color var(--t-quick) var(--ease), box-shadow var(--t-quick) var(--ease), translate var(--t-quick) var(--ease);
}
.card:hover { text-decoration: none; border-color: var(--accent); border-left-color: var(--tone, var(--accent)); box-shadow: 0 4px 16px var(--shadow); translate: 0 -1px; }
.card[data-tone="paused"] { opacity: 0.6; }
.card[data-tone="unknown"] { border-left-color: var(--line); }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.card-name b, .card-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-num { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.card-num b { font-size: 18px; line-height: 1.1; }
.card-up { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.marks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; }
.marks li { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.marks i { font-style: normal; display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; font-size: 10px; font-weight: 700; background: var(--panel-2); color: var(--muted); }
.marks .ok i { background: var(--up); color: var(--on-status); }
.marks .warn i { background: var(--warn); color: var(--on-status); }
.marks .bad i { background: var(--down); color: var(--on-status); }
.marks .ok, .marks .warn { color: var(--text); }
.marks .na { color: var(--muted); }
.marks .bad { color: var(--down); font-weight: 600; }

/* ---- sparklines & strips ------------------------------------------------- */
.spark { width: 100%; height: 40px; display: block; }
.spark.empty { display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 6px; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark-area { fill: var(--accent); opacity: 0.1; }
/* One cell per bucket. No data = a low dashed tick (a gap, never a zero);
   partial = striped, so it reads without colour; the current bucket is faded. */
.strip { display: flex; gap: 1px; height: 8px; align-items: stretch; }
.strip i { flex: 1; border-radius: 1px; }
.strip i.none { background: none; border-bottom: 2px dotted var(--line); }
.strip i.ok { background: var(--up); opacity: 0.75; }
.strip i.partial { background: repeating-linear-gradient(135deg, var(--warn) 0 2px, color-mix(in oklab, var(--warn) 35%, transparent) 2px 4px); }
.strip i.down { background: var(--down); }
.strip i.now { opacity: 0.5; }
.strip.big { height: 22px; margin-top: 4px; cursor: pointer; }
.strip.big i:hover { outline: 1px solid var(--text); }
.strip.big i.sel { outline: 2px solid var(--text); outline-offset: -1px; }

/* ---- page heads ---------------------------------------------------------- */
.crumbs { margin: 0; color: var(--muted); }
.site-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }

/* ---- check timing bars --------------------------------------------------- */
td.timing { min-width: 180px; }
.bar { display: flex; height: 10px; border-radius: 3px; overflow: hidden; background: var(--panel-2); }
.bar i, .legend i { display: inline-block; height: 10px; }
.legend { font-weight: 400; margin-left: 8px; }
.legend i { width: 10px; margin: 0 3px 0 8px; vertical-align: -1px; border-radius: 2px; }
i.redir { background: #a78bfa; } i.dns { background: #60a5fa; } i.conn { background: #34d399; } i.tls { background: #fbbf24; } i.srv { background: var(--accent); } i.dl { background: #f472b6; }

/* ---- explorer ------------------------------------------------------------ */
.explorer { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; transition: opacity 0.2s; }
.explorer.loading .ex-chart { opacity: 0.5; }
.ex-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ex-pick { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 220px; }
.ex-pick select { font: inherit; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); min-width: 0; max-width: 100%; flex: 1; }
.ex-open { margin-left: auto; }
.ex-stats { margin: 12px 0 4px; }
.ex-stats .tile { padding: 6px 10px; }
.ex-stats .tile-value { font-size: 17px; }
.ex-wrap { position: relative; }
.ex-chart { min-height: 220px; cursor: crosshair; }
.ex-chart svg { display: block; }
.ex-empty { display: grid; place-items: center; min-height: 220px; margin: 0; }
.ex-chart .grid { stroke: var(--line); }
.ex-chart .lbl { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; paint-order: stroke; stroke: var(--panel); stroke-width: 3px; }
.ex-chart .line { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linejoin: round; }
.ex-chart .area { fill: var(--accent); opacity: 0.1; }
.ex-chart .avg { stroke: var(--muted); stroke-dasharray: 4 4; }
.ex-chart .band.down { fill: var(--down); opacity: 0.3; }
.ex-chart .band.partial { fill: var(--warn); opacity: 0.3; }
.ex-chart .cross { stroke: var(--muted); }
.ex-chart .cache-cell { fill: var(--accent); }
.ex-chart .push { stroke: var(--text); stroke-opacity: 0.35; stroke-dasharray: 2 3; }
.ex-chart .push-mark { fill: var(--text); fill-opacity: 0.7; cursor: pointer; }
.ex-chart .push-link:hover .push-mark { fill-opacity: 1; }
.ex-tip .push-tip { color: var(--muted); }
.ex-tip.pinned { pointer-events: auto; }
.ex-chart:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.ex-chart .sel-band { fill: var(--accent); opacity: 0.18; }
.ex-chart .dot { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.ex-tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; box-shadow: 0 4px 14px var(--shadow); white-space: nowrap; z-index: 2; }
.ex-hint { margin: 6px 0 0; }
.ex-panel { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.ex-panel h3 { margin: 0; font-size: 15px; }
.ex-panel h4 { margin: 12px 0 6px; font-size: 13px; }
.ex-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.ex-panel-nav { display: flex; gap: 6px; align-items: center; }
.ex-panel-nav button { background: var(--panel-2); color: var(--text); padding: 3px 10px; }
.ex-incidents { margin: 0 0 10px; padding-left: 18px; }
.ex-incidents li { margin: 3px 0; }
.ex-errors { margin: 4px 0 10px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- forms & login ------------------------------------------------------- */
button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--accent); color: var(--on-status); cursor: pointer; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; }
.login { max-width: 360px; margin: 12vh auto; padding: 16px; }
.login form { display: grid; gap: 12px; }
.login label { display: grid; gap: 4px; }
.login input { font: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }

/* ---- phones -------------------------------------------------------------- */
@media (max-width: 640px) {
  main { padding: 12px 16px; }
  .tile-value { font-size: 18px; }
  .toolbar { justify-content: flex-start; }
  .site-filter { max-width: none; flex-basis: 100%; }
  .ex-open { margin-left: 0; }
  header.top { padding: 8px 16px; }
  .brand img { width: 26px; height: 26px; }
  /* Tables marked .stack become one card per row; each cell shows its column name. */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 8px 12px; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { padding: 3px 0; border: 0; text-align: right; max-width: none; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  table.stack td::before { content: attr(data-label); float: left; margin-right: 12px; color: var(--muted); font-size: 12px; line-height: 21px; }
  /* The first cell is the card's title: full width, no label. */
  table.stack td:first-child { text-align: left; font-weight: 600; padding-bottom: 6px; }
  table.stack td:first-child::before { content: none; }
  table.stack td:first-child .muted { font-weight: 400; }
}
/* Comfortable touch targets. */
@media (pointer: coarse) {
  header nav a, .seg a, .seg button, .theme-switch button { min-height: 44px; display: inline-flex; align-items: center; }
}

/* ---- motion (only for people who haven't asked for less) ----------------- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 200ms; }
  @supports (animation-timeline: scroll()) {
    header.top { animation: header-lift linear both; animation-timeline: scroll(root); animation-range: 0 40px; }
    @keyframes header-lift { to { box-shadow: 0 6px 18px var(--shadow); } }
  }
  html:not(.live) .cards .card { animation: rise var(--t-reveal) var(--ease) both; }
  @keyframes rise { from { opacity: 0; translate: 0 6px; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---- time bar (date range, grouping, timezone) ---------------------------- */
.timebar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin: 4px 0 6px; }
.timebar .seg a, .timebar .seg span { padding: 5px 10px; font-size: 13px; color: var(--muted); }
.timebar .seg a + a, .timebar .seg a + span, .timebar .seg span + a { border-left: 1px solid var(--line); }
.timebar .seg .on { background: var(--panel-2); color: var(--text); font-weight: 600; }
.timebar .seg .disabled { opacity: 0.35; }
.tb-now { font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 8px; background: color-mix(in oklab, var(--accent) 14%, transparent); }
.tb-field { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.tb-field input, .tb-field select { font: inherit; font-size: 13px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.tb-tz select { max-width: 190px; }
.tb-apply { padding: 5px 12px; font-size: 13px; }
.tb-custom { display: inline-flex; align-items: center; }
.tb-custom[open] { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tb-custom summary { cursor: pointer; font-size: 13px; color: var(--accent); list-style: none; padding: 5px 2px; }
.tb-custom summary::-webkit-details-marker { display: none; }
.tb-custom summary::after { content: " ▾"; }
.tb-custom[open] summary::after { content: " ▴"; }
.tb-note { margin: 0 0 8px; }
/* The bucket still filling: dashed line segment (strip cells use .now). */
.ex-chart .line.in-progress, .spark-line.in-progress { stroke-dasharray: 4 3; }
@media (max-width: 640px) {
  .tb-custom[open] { width: 100%; }
  .tb-custom .tb-field { flex: 1 1 100%; }
  .timebar > .tb-field { flex: 1 1 40%; min-width: 0; }
  .tb-field input, .tb-field select { flex: 1; min-width: 0; }
  .tb-tz select { max-width: none; }
}

/* ---- dashboard focus: header freshness, attention list, quiet rows, history, waterfall, overlays ---- */
.status-banner .freshness { margin-left: auto; white-space: nowrap; }
.attention-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
details.fold .attention-list { margin: 0; padding: 8px 12px 12px; }
.attention {
  display: grid; grid-template-columns: auto auto minmax(120px, auto) 1fr auto auto; align-items: center; gap: 6px 12px;
  padding: 10px 14px; border-radius: var(--radius); border: 1px solid color-mix(in oklab, var(--tone) 30%, var(--line));
  background: color-mix(in oklab, var(--tone) 7%, var(--panel));
}
.att-what { color: var(--tone); }
.att-site { font-weight: 600; color: var(--text); }
.att-cause { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.att-for { font-variant-numeric: tabular-nums; color: var(--muted); }
.att-go { white-space: nowrap; font-weight: 600; }

.site-rows { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.site-row + .site-row { border-top: 1px solid var(--line); }
.row-link {
  display: grid; grid-template-columns: auto minmax(160px, 1.1fr) minmax(180px, 1.4fr) 88px 104px; align-items: center; gap: 14px;
  padding: 10px 14px; color: var(--text); border-left: 3px solid var(--tone, transparent);
}
.row-link:hover { text-decoration: none; background: var(--panel-2); }
.site-row[data-tone="up"] .row-link { border-left-color: transparent; }
.site-row[data-tone="paused"] { opacity: 0.6; }
.row-name { display: flex; flex-direction: column; min-width: 0; }
.row-name b, .row-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-status { color: var(--muted); }
.site-row[data-tone="down"] .row-status, .site-row[data-tone="warn"] .row-status { color: var(--tone); }
.row-graphs { display: grid; gap: 4px; min-width: 0; }
.row-graphs .spark { height: 28px; }
.row-num, .row-up { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; font-weight: 600; }
.row-num small, .row-up small { font-weight: 400; color: var(--muted); font-size: 11px; white-space: nowrap; }

.history { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.hist-row { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; align-items: center; gap: 12px; }
.hist-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.hist-group { font-size: 13px; margin: 12px 0 2px; color: var(--muted); font-weight: 600; }
.hist-labels { display: flex; justify-content: space-between; }
.hist-cells .strip { height: 14px; cursor: pointer; }
.hist-cells .strip i:hover { outline: 1px solid var(--text); }
.strip.failing { height: 28px; align-items: flex-end; }
.strip.failing i { background: var(--down); opacity: 0.8; border-radius: 2px 2px 0 0; min-height: 0; }

.waterfall { margin: 8px 0 12px; }
.waterfall figcaption { margin-bottom: 4px; }
.wf-bar { display: flex; height: 26px; border-radius: 4px; overflow: hidden; background: var(--panel-2); }
.wf-seg { position: relative; display: flex; align-items: center; min-width: 2px; }
.wf-seg > i { position: absolute; inset: 0; opacity: 0.85; }
.wf-seg.redir > i { background: #a78bfa; } .wf-seg.dns > i { background: #60a5fa; } .wf-seg.conn > i { background: #34d399; }
.wf-seg.tls > i { background: #fbbf24; } .wf-seg.srv > i { background: var(--accent); } .wf-seg.dl > i { background: #f472b6; }
.wf-seg.stopped > i { background: repeating-linear-gradient(135deg, var(--down) 0 6px, color-mix(in oklab, var(--down) 55%, transparent) 6px 12px); }
.wf-lbl { position: relative; padding: 0 6px; font-size: 11px; font-weight: 600; color: #15151a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-says { margin: 4px 0 0; font-size: 13px; }

.ex-chart .incident.down { fill: var(--down); opacity: 0.12; }
.ex-chart .incident.warning { fill: var(--warn); opacity: 0.12; }
.ex-chart .inc-lbl { font-size: 11px; font-weight: 600; cursor: pointer; paint-order: stroke; stroke: var(--panel); stroke-width: 3px; }
.ex-chart .inc-lbl.down { fill: var(--down); }
.ex-chart .inc-lbl.warning { fill: var(--warn); }

@media (max-width: 640px) {
  .status-banner { flex-wrap: wrap; }
  .status-banner .freshness { margin-left: 0; width: 100%; }
  .attention { grid-template-columns: auto auto 1fr auto; grid-auto-flow: row dense; }
  .att-site { justify-self: start; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .att-cause { grid-column: 1 / -1; white-space: normal; }
  .att-go { grid-column: 1 / -1; }
  .row-link { grid-template-columns: auto 1fr auto; gap: 8px 12px; }
  .row-graphs { grid-column: 1 / -1; }
  .row-up { grid-column: 3; grid-row: 1; }
  .row-num { display: none; }
  .hist-row { grid-template-columns: 96px 1fr; gap: 8px; }
}
.wf-seg.srv .wf-lbl, .wf-seg.stopped .wf-lbl { color: #ffffff; }

/* Site insights: weekly real-reader trend lines in one row. */
.vitals-trend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 6px 0 4px; }
.vitals-trend .spark { width: 140px; height: 28px; }

/* ---- public status pages ------------------------------------------------- */
.hero { display: flex; gap: 20px; align-items: center; margin: 8px 0 18px; }
/* The tree's column is wide enough for it to land in when it falls. */
.hero > [data-live="tree"] { flex: none; width: 150px; }
.hero .riddle { min-width: 0; }
.hero .riddle p { margin: 0 0 6px; }
.hero .riddle .q { font-size: 17px; font-weight: 650; text-wrap: balance; }
.hero .riddle .q + p { margin-bottom: 12px; }
/* The tree (the logo) stands while every site is up, falls when one is down, and fades into fog when the monitor is behind. */
.tree { flex: none; width: 96px; height: 96px; transform-origin: 50% 96%; transition: transform 900ms cubic-bezier(0.5, 0, 0.75, 0), opacity 600ms var(--ease), filter 600ms var(--ease); }
.tree[data-state="down"] { transform: rotate(84deg) translate(4px, -6px); }
.tree[data-state="stale"] { opacity: 0.35; filter: blur(1.5px) grayscale(0.6); }
.tree[data-state="unknown"] { opacity: 0.6; }
.public-chart { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.public-chart .spark { height: 64px; margin-bottom: 8px; }
.public-chart .strip { height: 18px; }
.outages { padding-left: 18px; }
.outages li { margin: 4px 0; }
.listening { margin-top: 10px; }
@media (max-width: 560px) {
  .hero { flex-direction: column; align-items: flex-start; gap: 8px; }
  .hero > [data-live="tree"] { width: 110px; }
  .tree { width: 64px; height: 64px; }
}
