/* witty-hawk dashboard. One typeface, slate ink on a cool sky page; colour only where it means something. */
@font-face { font-family: "Hyperlegible"; src: url("/fonts/ahn-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Hyperlegible"; src: url("/fonts/ahn-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --page: #eef1f4;
  --surface: #fbfcfd;
  --ink: #14202a;
  --ink-2: #44525f;
  --muted: #5d6a77;
  --hair: #d8dfe6;
  --track: #dfe5eb;
  --s1: #2a78d6;
  --s2: #eb6834;
  --good: #0ca30c;
  --warn: #fab219;
  --serious: #ec835a;
  --crit: #d03b3b;
  --focus: #2a78d6;
  --radius: 10px;
  font-family: "Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--page);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0f171e;
    --surface: #16212b;
    --ink: #e8eef3;
    --ink-2: #b4c0cb;
    --muted: #8f9cab;
    --hair: #26333f;
    --track: #24323e;
    --s1: #3987e5;
    --s2: #d95926;
    --focus: #6aa8f0;
  }
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; padding: 0 max(16px, env(safe-area-inset-left)) 32px max(16px, env(safe-area-inset-right)); }
main, .top, .foot, .gate { max-width: 960px; margin: 0 auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
a { color: inherit; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 0 6px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.brand img { border-radius: 7px; }
.fresh { color: var(--muted); font-size: 14px; text-align: right; }
.fresh.stale { color: var(--ink); }
.fresh .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--good); }
.fresh.stale .dot { background: var(--warn); }

/* The verdict: the one loud thing on the page */
.hero { padding: 22px 0 10px; }
h1 { font-size: clamp(34px, 8.5vw, 52px); line-height: 1.04; letter-spacing: -0.03em; margin: 0; font-weight: 700; max-width: 16ch; }
.summary { font-size: 20px; line-height: 1.35; color: var(--ink-2); margin: 12px 0 0; max-width: 42ch; }
.alerts { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.alerts li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; background: var(--surface); border-radius: var(--radius); padding: 11px 14px; font-size: 16px; }
.alerts .area { color: var(--muted); font-size: 14px; display: block; }

/* Status marks: shape + colour + word, never colour alone */
.mark { width: 16px; height: 16px; margin-top: 3px; flex: none; }
.mark.ok { fill: var(--good); }
.mark.warn { fill: var(--warn); }
.mark.crit { fill: var(--crit); }
.mark.idle { fill: none; stroke: var(--muted); stroke-width: 2; }

/* Sections */
section { margin-top: 34px; }
h2 { font-size: 22px; letter-spacing: -0.015em; margin: 0 0 12px; font-weight: 700; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.note { color: var(--muted); font-size: 14px; margin: -6px 0 10px; }

/* Server right now: four quiet readouts */
.now { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--hair); border-radius: var(--radius); overflow: hidden; }
@media (min-width: 720px) { .now { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.reading { background: var(--surface); padding: 14px 14px 16px; min-width: 0; }
.reading .label { color: var(--ink-2); font-size: 14px; }
.reading .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin-top: 2px; }
.reading .detail { color: var(--muted); font-size: 14px; margin-top: 2px; }
.meter { height: 6px; border-radius: 3px; background: var(--track); margin-top: 10px; overflow: hidden; }
.meter > span { display: block; height: 100%; width: var(--w, 0%); background: var(--ink-2); border-radius: 3px; }
.meter.warn > span { background: var(--warn); }
.meter.crit > span { background: var(--crit); }

/* Range control */
.segmented { display: inline-flex; background: var(--track); border-radius: 999px; padding: 3px; }
.segmented button { font: inherit; font-size: 14px; border: 0; background: transparent; color: var(--ink-2); padding: 6px 14px; border-radius: 999px; cursor: pointer; min-height: 32px; }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--ink); font-weight: 700; }

.select { color: var(--ink-2); font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.select select { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--hair); border-radius: 999px; padding: 6px 12px; min-height: 32px; }

/* Charts */
.charts { display: grid; gap: 12px; }
@media (min-width: 720px) { .charts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.chart { background: var(--surface); border-radius: var(--radius); padding: 14px 14px 10px; position: relative; min-width: 0; margin: 0; }
.chart h3 { font-size: 16px; margin: 0; font-weight: 700; }
.chart .sub { color: var(--muted); font-size: 14px; margin: 2px 0 8px; min-height: 20px; }
.chart svg { display: block; max-width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart svg:focus-visible { outline-offset: 4px; }
.chart .grid { stroke: var(--hair); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .wash { opacity: 0.1; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.legend { display: flex; gap: 14px; font-size: 14px; color: var(--ink-2); margin: -2px 0 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }
.c1 { stroke: var(--s1); fill: var(--s1); background: var(--s1); }
.c2 { stroke: var(--s2); fill: var(--s2); background: var(--s2); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--page); border-radius: 8px; padding: 7px 10px; font-size: 13px; line-height: 1.35; white-space: nowrap; transform: translate(-50%, 0); z-index: 2; }
.tip .row { display: flex; align-items: center; gap: 7px; }
.tip strong { font-size: 14px; }
.tip i { width: 12px; height: 2px; display: inline-block; border-radius: 1px; }
.tip .when { opacity: 0.75; }

/* Apps */
details.group { background: var(--surface); border-radius: var(--radius); margin-bottom: 10px; }
details.group > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-weight: 700; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); margin-right: 6px; flex: none; align-self: center; transition: transform 0.15s; }
details.group[open] > summary::before { transform: rotate(45deg); }
details.group > summary .count { color: var(--muted); font-weight: 400; font-size: 14px; margin-left: auto; }
.app { border-top: 1px solid var(--hair); }
.app > button { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; padding: 11px 14px; cursor: pointer; }
.app > button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.app .name { font-weight: 700; overflow-wrap: anywhere; }
.app .state { color: var(--muted); font-size: 14px; grid-column: 2; }
.app .use { text-align: right; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.app .use strong { color: var(--ink); font-size: 15px; display: block; }
.app .meter { grid-column: 2 / 4; margin-top: 4px; height: 4px; }
.app .more { padding: 0 14px 14px 44px; color: var(--ink-2); font-size: 14px; }
.app .more dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0 0 8px; }
.app .more dt { color: var(--muted); }
.app .more dd { margin: 0; overflow-wrap: anywhere; }
.spark { width: 100%; height: 44px; display: block; overflow: visible; }
.spark .line { fill: none; stroke: var(--s1); stroke-width: 2; stroke-linejoin: round; }
.spark .wash { fill: var(--s1); opacity: 0.1; }
.spark-label { margin: 4px 0; color: var(--muted); }

/* Rows: addresses, backups */
.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius); }
.rows li { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 2px 10px; padding: 11px 14px; border-top: 1px solid var(--hair); align-items: start; }
.rows li:first-child { border-top: 0; }
.rows .main { font-weight: 700; overflow-wrap: anywhere; }
.rows .sub { color: var(--muted); font-size: 14px; grid-column: 2; }
.rows .end { text-align: right; font-size: 14px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rows .more-row { display: block; text-align: center; padding: 10px; }
.linkish { all: unset; cursor: pointer; color: var(--ink-2); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }

/* Facts */
.facts { display: grid; grid-template-columns: minmax(0, 1fr) auto; margin: 0; background: var(--surface); border-radius: var(--radius); }
.facts dt, .facts dd { padding: 11px 14px; border-top: 1px solid var(--hair); margin: 0; }
.facts dt:first-of-type, .facts dd:first-of-type { border-top: 0; }
.facts dd { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* Footer, gate, notices */
.foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--hair); color: var(--muted); font-size: 14px; }
.foot p { margin: 0 0 4px; }
.foot-actions { display: flex; gap: 10px; margin-top: 12px; }
.foot form { margin: 0; }
button.ghost, a.button { font: inherit; font-size: 15px; border-radius: 999px; padding: 10px 18px; cursor: pointer; text-decoration: none; display: inline-block; min-height: 44px; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--hair); }
a.button { background: var(--ink); color: var(--page); font-weight: 700; border: 0; }
.gate { padding-top: 18vh; }
.gate p { font-size: 20px; color: var(--ink-2); max-width: 30ch; }
body.notice main { max-width: 34rem; margin: 18vh auto 0; }
body.notice h1 { font-size: 40px; }
body.notice p { font-size: 18px; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (forced-colors: active) { .meter > span, .legend i, .tip i { background: CanvasText; } }
