/* dnsmon — styles. CSP forbids inline styles, so everything lives here.
   Colour tokens follow the dataviz reference palette; dark mode is its
   own selected steps (validated), not an automatic inversion. */
:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --ink: #0b0b0b; --ink-2: #52514e; --muted: #73716b;   /* #73716b: ≥ 4.6:1 on every light background (was #898781 = 3.4:1) */
  --grid: #e1e0d9; --axis: #c3c2b7; --ring: rgba(11,11,11,.10);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
  --critical: #d03b3b; --warning: #fab219; --good: #0ca30c; --good-ink: #0a7a0a;
  --cmp-before: rgba(11,11,11,.035); --cmp-settle: rgba(11,11,11,.08); --cmp-after: rgba(42,120,214,.07);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* Dark tokens apply when the device prefers dark unless the viewer chose Light,
   or when the viewer chose Dark (assets/theme.js sets <html data-theme>).
   --critical is brighter on dark (#ea6a6a): error text needs ≥ 4.5:1, #d03b3b gave 3.6:1. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --ring: rgba(255,255,255,.10);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
    --critical: #ea6a6a; --good-ink: #3fbf5a; --cmp-before: rgba(255,255,255,.035); --cmp-settle: rgba(255,255,255,.09); --cmp-after: rgba(57,135,229,.12);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --ring: rgba(255,255,255,.10);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
  --critical: #ea6a6a; --good-ink: #3fbf5a; --cmp-before: rgba(255,255,255,.035); --cmp-settle: rgba(255,255,255,.09); --cmp-after: rgba(57,135,229,.12);
}
body { margin: 0; background: var(--page); color: var(--ink); }
[hidden] { display: none !important; }   /* a component's own display (flex/grid) must never override el.hidden */
main { max-width: 90rem; margin: 0 auto; padding: 1rem clamp(1rem, 3vw, 2rem) 3rem; }
a { color: inherit; }
.muted { color: var(--muted); }
header.top { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.5rem; margin-bottom: .75rem; }
header.top h1 { font-size: 1.25rem; margin: 0; }

/* filter row: one row, above everything it scopes */
.filters { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 0 1rem; }
.filters button { font: inherit; padding: .3rem .75rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--ring); background: var(--surface); color: var(--ink-2); }
.filters button:hover { background: color-mix(in srgb, var(--ink) 6%, var(--surface)); }
.filters button[aria-pressed="true"] { color: var(--ink); font-weight: 600; border-color: var(--axis); }
.filters button[aria-pressed="true"]::before { content: "✓ "; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 38rem), 1fr)); gap: 1rem; }
.card { background: var(--surface); border: 1px solid var(--ring); border-radius: 10px; padding: .9rem 1rem 1rem; min-width: 0; }
.card h2 { font-size: 1rem; margin: 0; }
.card p.note { margin: .15rem 0 .5rem; font-size: .85rem; color: var(--ink-2); }
.card .meta { font-size: .75rem; color: var(--muted); }
.chart { position: relative; width: 100%; min-height: 240px; transition: opacity .2s; }
.chart.loading { opacity: .5; }
.chart .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }

/* legend + table view under each chart (identity never colour-alone) */
table.legend { width: 100%; border-collapse: collapse; margin-top: .5rem; font-size: .82rem; }
table.legend th { text-align: right; font-weight: 500; color: var(--muted); padding: .15rem .4rem; border-bottom: 1px solid var(--grid); }
table.legend th:first-child, table.legend td:first-child { text-align: left; }
table.legend td { text-align: right; padding: .2rem .4rem; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; color: var(--ink); }
table.legend tr { cursor: pointer; }
table.legend tr.off td { opacity: .4; }
table.legend td .via { color: var(--muted); font-size: .75rem; margin-left: .35rem; }
.key { display: inline-block; width: 18px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: .45rem; }

/* hover tooltip: values lead, names follow, line keys */
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--ring); border-radius: 8px; padding: .4rem .55rem; font-size: .8rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.15); white-space: nowrap; }
.tip .t { color: var(--muted); margin-bottom: .2rem; }
.tip .r { display: flex; align-items: center; gap: .4rem; }
.tip .r b { font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: right; }
.tip .r span.n { color: var(--ink-2); }

/* latest-values page */
table.flat { border-collapse: collapse; width: 100%; margin-bottom: 1.5rem; }
table.flat th, table.flat td { text-align: left; padding: .2rem .5rem; border-bottom: 1px solid var(--grid); }
table.flat td.n { text-align: right; font-variant-numeric: tabular-nums; }
.err { color: var(--critical); }

/* change log */
.changes { margin-top: 1rem; }
.mark-form { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: end; margin: .5rem 0; }
.mark-form label { display: flex; flex-direction: column; gap: .15rem; font-size: .8rem; color: var(--ink-2); }
.mark-form label.grow { flex: 1 1 18rem; }
.mark-form input, .mark-form select, .mark-form button, table.marks button {
  font: inherit; font-size: .85rem; padding: .3rem .5rem; border-radius: 6px;
  border: 1px solid var(--ring); background: var(--page); color: var(--ink); }
.mark-form button, table.marks button { cursor: pointer; background: var(--surface); }
.mark-form button:hover, table.marks button:hover { border-color: var(--axis); }
table.marks td { vertical-align: top; }
table.marks td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.marks button.confirm { border-color: var(--critical); color: var(--critical); }
code { font-size: .85em; }
.tip .mk { margin-top: .25rem; padding-top: .25rem; border-top: 1px solid var(--grid); color: var(--ink-2); white-space: normal; max-width: 22rem; }
.tip .mk b { color: var(--ink); }

/* public door: header actions, login / account pages */
header.top .spacer { flex: 1; }
form.inline { display: inline; margin: 0; }
button.link { font: inherit; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
main.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; box-sizing: border-box; }
.auth-card { width: min(100%, 22rem); display: flex; flex-direction: column; gap: .75rem; }
.auth-card h1 { margin: 0; font-size: 1.3rem; }
.auth-card p { margin: 0; }
.auth-card label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--ink-2); }
.auth-card input { font: inherit; padding: .45rem .55rem; border-radius: 6px; border: 1px solid var(--ring); background: var(--page); color: var(--ink); }
.auth-card button { font: inherit; padding: .5rem; border-radius: 6px; cursor: pointer; border: 1px solid var(--axis); background: var(--surface); color: var(--ink); font-weight: 600; }
.ok { color: var(--ink); border-left: 3px solid #0ca30c; padding-left: .5rem; }
p.err { border-left: 3px solid var(--critical); padding-left: .5rem; }

/* step 7: findings (status colours always paired with icon + label) */
.findings { margin-bottom: 1rem; }
.findings-list { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .5rem; }
.finding { border-left: 3px solid var(--muted); padding: .35rem .6rem; background: var(--page); border-radius: 0 6px 6px 0; }
.finding.sev-critical { border-left-color: #d03b3b; }
.finding.sev-warning  { border-left-color: #fab219; }
.finding p { margin: .2rem 0 .3rem; font-size: .85rem; color: var(--ink-2); }
.finding .badge { font-size: .75rem; font-weight: 600; padding: .05rem .4rem; border-radius: 4px; border: 1px solid var(--ring); white-space: nowrap; }
.finding.sev-critical .badge { border-color: #d03b3b; }
.finding.sev-warning .badge { border-color: #fab219; }
.finding .actions { display: flex; gap: .4rem; }
.finding .actions button { font: inherit; font-size: .78rem; padding: .15rem .5rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--ring); background: var(--surface); color: var(--ink-2); }
.finding .actions button.confirm { border-color: var(--critical); color: var(--critical); }
.card.flash { outline: 2px solid var(--axis); outline-offset: 2px; transition: outline-color .3s; }
td.effect .eff { display: block; white-space: nowrap; }
td.effect .eff.good::before { content: ""; }
td.effect .eff.bad { color: var(--critical); }
details.accepted { margin-top: .6rem; }
details.accepted summary { cursor: pointer; color: var(--ink-2); font-size: .85rem; }
.finding.accepted { border-left-color: #0ca30c; }
.finding.accepted p.muted { font-size: .78rem; }
/* step 7c: agent proposals */
.proposals { margin-bottom: 1rem; }
.finding.proposal { border-left-color: var(--s1); }
.finding p b { font-weight: 600; }
.finding p.check { color: var(--ink); background: color-mix(in srgb, var(--s1) 8%, transparent); padding: .15rem .35rem; border-radius: 4px; }
.finding .actions button:disabled { opacity: .5; cursor: default; }
pre.req { margin: .25rem 0 0; padding: .3rem .45rem; font-size: .75rem; white-space: pre-wrap; word-break: break-all;
  background: var(--surface); border: 1px solid var(--grid); border-radius: 4px; color: var(--ink-2); max-height: 8rem; overflow: auto; }
/* step 8a: weekly reports */
.reports { margin-bottom: 1rem; }
details.report { border-top: 1px solid var(--grid); padding: .35rem 0; }
details.report summary { cursor: pointer; font-size: .88rem; color: var(--ink-2); }
.report-body { white-space: pre-wrap; font-size: .85rem; line-height: 1.5; margin: .4rem 0 .2rem; max-width: 80ch; }
/* step 8b: explain */
.explain { margin-top: .3rem; }
.explain > button, .explain-box button { font: inherit; font-size: .78rem; padding: .15rem .5rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--ring); background: var(--surface); color: var(--ink-2); }
.explain-box { margin-top: .4rem; padding: .5rem .6rem; border: 1px solid var(--grid); border-radius: 6px; background: var(--surface); }
.explain-answer { white-space: pre-wrap; font-size: .85rem; line-height: 1.5; max-width: 80ch; margin: .3rem 0; }
.explain-box details summary { cursor: pointer; font-size: .78rem; color: var(--muted); }
.host-prompt { margin: .5rem 0; padding: .45rem .55rem; border-left: 3px solid var(--s1); background: var(--page); border-radius: 0 6px 6px 0; }
.host-prompt p { margin: 0 0 .3rem; font-size: .82rem; }
.host-prompt textarea { width: 100%; box-sizing: border-box; font: .8rem/1.45 ui-monospace, monospace; padding: .4rem;
  border: 1px solid var(--grid); border-radius: 4px; background: var(--surface); color: var(--ink); resize: vertical; }

/* UIX 1: health strip — one tile per host; status = icon + word + colour */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.health { margin-bottom: 1rem; }
.health-meta { margin: 0 0 .4rem; font-size: .78rem; }
.health-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr)); gap: .6rem; }
.tile { background: var(--surface); border: 1px solid var(--ring); border-top: 3px solid var(--good); border-radius: 8px;
  padding: .55rem .7rem .6rem; display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.tile.st-warning { border-top-color: var(--warning); }
.tile.is-down { border-color: var(--critical); background: color-mix(in srgb, var(--critical) 10%, var(--surface)); }
.tile .down-msg { margin: .4rem 0 0; font-weight: 600; color: var(--critical); }
.down-banner { margin: 0 0 .7rem; padding: .55rem .8rem; border-radius: 8px; font-weight: 600;
               color: #fff; background: var(--critical); }
.down-banner > div + div { margin-top: .25rem; }
.tile.st-critical { border-top-color: var(--critical); }
.tile.st-info { border-top-color: var(--s1); }
.tile-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.tile-head h3 { margin: 0; font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-head .key { width: 12px; margin-right: .35rem; }
.tile .st { font-size: .75rem; font-weight: 600; white-space: nowrap; color: var(--ink-2); }
.tile.st-critical .st { color: var(--critical); }
.tile-main { display: flex; align-items: end; justify-content: space-between; gap: .5rem; }
.tile .big { display: flex; flex-direction: column; }
.tile .big .lbl { font-size: .72rem; color: var(--muted); }
.tile .big b { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.spark-wrap { flex: 0 1 7.5rem; min-width: 4rem; }
svg.spark { display: block; width: 100%; height: 2.1rem; overflow: visible; }
.tile-vals { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; column-gap: 1rem; margin: 0; font-size: .78rem; }
.tile-vals dt { color: var(--muted); grid-row: 1; }
.tile-vals dd { margin: 0; grid-row: 2; font-variant-numeric: tabular-nums; color: var(--ink); }
.ep { display: flex; flex-direction: column; gap: .45rem; }
.ep-pairs { display: grid; grid-template-columns: auto 1fr; column-gap: .8rem; row-gap: .15rem; margin: 0; font-size: .8rem; }
.ep-pairs dt { color: var(--muted); white-space: nowrap; }
.ep-pairs dd { margin: 0; color: var(--ink-2); font-variant-numeric: tabular-nums; }   /* may wrap on narrow cards */
.ep-pairs dd b { color: var(--ink); font-weight: 600; }
.ep-pairs .nw { white-space: nowrap; }
.ep-gauge-top { display: flex; justify-content: space-between; align-items: baseline; font-size: .8rem; }
.ep-gauge-top .lbl { color: var(--muted); }
.ep-gauge-top b { font-variant-numeric: tabular-nums; }
.ep-gauge .bar { position: relative; height: .5rem; margin: .2rem 0 .15rem; background: var(--grid); border-radius: 4px; overflow: hidden; }
.ep-gauge .bar span { position: absolute; inset: 0 auto 0 0; background: var(--good); border-radius: 4px; }
.ep-gauge.st-filling .bar span { background: var(--warning); }
.ep-gauge.st-full .bar span { background: var(--critical); }
.ep-gauge .warn-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--warning); opacity: .8; }
.ep-note { font-size: .74rem; color: var(--muted); }
.verdict.v-ok { color: var(--good-ink); }
.verdict.v-warning { color: var(--warning); }
.verdict.v-critical { color: var(--critical); }
.verdict.v-unknown { color: var(--muted); }
.top-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); gap: 1rem; }
.top-list { list-style: none; counter-reset: top; margin: .3rem 0 0; padding: 0; font-size: .82rem; }
.top-list li { counter-increment: top; display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: .4rem; padding: .22rem 0; border-top: 1px solid var(--grid); }
.top-list li:first-child { border-top: 0; }
.top-list li::before { content: counter(top); color: var(--muted); font-variant-numeric: tabular-nums; grid-row: 1 / 3; }
.top-list li.muted::before, .top-list li.err::before { content: ''; }
.top-list .dom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink);
                 direction: rtl; text-align: left; }        /* too long → cut at the START, the domain end stays visible */
.top-list .dom bdi { direction: ltr; unicode-bidi: isolate; }
.top-list .cnt { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.top-list .bar { grid-column: 2 / 4; height: 3px; margin-top: .15rem; background: var(--grid); border-radius: 2px; overflow: hidden; }
.top-list .bar i { display: block; height: 100%; background: var(--good); }
.top-list .bar.blocked i { background: var(--critical); }
.tile-foot { display: flex; flex-wrap: wrap; gap: .2rem .7rem; font-size: .74rem; }
.tile-foot a { color: var(--ink-2); }

/* UIX 4: compare mode */
.compare-bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; margin: 0 0 1rem;
  background: var(--surface); border: 1px solid var(--axis); border-left: 4px solid var(--s1); border-radius: 8px;
  padding: .6rem .8rem; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.compare-head { display: flex; justify-content: space-between; align-items: start; gap: .4rem 1rem; flex-wrap: wrap; }
.compare-head h2 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.compare-bar .note { margin: .25rem 0 .3rem; font-size: .82rem; color: var(--ink-2); }
.compare-effects { font-size: .82rem; display: flex; flex-wrap: wrap; gap: .1rem .9rem; align-items: baseline; }
.compare-effects .eff.bad { color: var(--critical); }
#compare-exit { font: inherit; font-size: .85rem; padding: .3rem .65rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--axis); background: var(--page); color: var(--ink); white-space: nowrap; }
#compare-exit:hover { border-color: var(--ink-2); }
kbd { font: .72rem ui-monospace, monospace; padding: 0 .3rem; border: 1px solid var(--axis); border-radius: 3px; color: var(--muted); margin-left: .25rem; }
body.comparing .filters button { opacity: .7; }
.u-over.on-marker { cursor: pointer; }
.tip .hint { color: var(--muted); font-size: .72rem; margin-top: .1rem; }
p.cmp-note { margin: 0 0 .4rem; font-size: .78rem; padding: .25rem .5rem; border-left: 3px solid var(--warning);
  background: color-mix(in srgb, var(--warning) 8%, transparent); border-radius: 0 4px 4px 0; color: var(--ink-2); }
table.legend td.chg.good, table.legend td.verdict.good { color: var(--good-ink); }
table.legend td.chg.bad, table.legend td.verdict.bad { color: var(--critical); }
table.legend td.verdict { white-space: nowrap; }
table.legend td.muted { color: var(--muted); }
.card.cmp-rolling .chart { opacity: .55; }
td.row-actions { white-space: nowrap; }
td.row-actions button + button { margin-left: .3rem; }
table.marks tr.cmp-current td { background: color-mix(in srgb, var(--s1) 9%, transparent); }
.table-scroll { overflow-x: auto; margin-bottom: 1rem; }
.table-scroll table.flat { margin-bottom: 0; }
@media (max-width: 40rem) {
  table.marks td:nth-child(4) { min-width: 12rem; }
  .compare-bar { padding: .5rem .6rem; }
  .compare-bar .note { font-size: .78rem; }
}
/* legend: numbers never wrap; the long "tested via / clients" note does */
table.legend td:not(:first-child) { white-space: nowrap; }
table.legend td:first-child { overflow-wrap: anywhere; }
table.legend td.chg .adj { display: block; font-size: .72rem; color: var(--muted); }

/* UIX 2: host filter */
.filter-bar { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; align-items: start; margin: 0 0 1rem; }
.filter-bar .filters { margin: 0; }
.filters.hosts button .key { width: 12px; margin-right: .35rem; }
.filters.hosts button[aria-pressed="true"]::before { content: ""; }
.filters.hosts button[aria-pressed="false"] { color: var(--muted); }
.filters.hosts button[aria-pressed="false"] .key { opacity: .45; }
.filter-note { margin: -.6rem 0 1rem; font-size: .78rem; }
.tile.filtered { opacity: .45; }
.tile.filtered:hover { opacity: .8; }
.filters.hosts.all button[aria-pressed="false"] { color: var(--ink-2); }
.filters.hosts.all button[aria-pressed="false"] .key { opacity: 1; }

/* UIX 3: linked zoom */
.zoom-bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9; display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .6rem;
  margin: 0 0 1rem; padding: .45rem .7rem; font-size: .85rem; background: var(--surface);
  border: 1px solid var(--axis); border-left: 4px solid var(--ink-2); border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
#zoom-reset { font: inherit; font-size: .82rem; padding: .2rem .55rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--axis); background: var(--page); color: var(--ink); }
body.comparing .zoom-bar { position: static; }   /* the compare bar already sticks to the top */

/* UIX 5: collapsible chart groups */
details.group { margin: 0 0 1.25rem; }
details.group > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .75rem;
  padding: .35rem .2rem .45rem; margin-bottom: .6rem; border-bottom: 1px solid var(--grid); }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::before { content: "▸"; color: var(--muted); width: 1rem; transition: transform .15s; display: inline-block; }
details.group[open] > summary::before { transform: rotate(90deg); }
details.group > summary h2 { font-size: 1.05rem; margin: 0; }
details.group > summary .group-charts { font-size: .8rem; }
details.group[open] > summary .group-charts { display: none; }
details.group > summary .group-note { flex-basis: 100%; padding-left: 1.75rem; font-size: .8rem; color: var(--ink-2); }
details.group:not([open]) > summary .group-note { display: none; }
details.group > summary:hover h2 { text-decoration: underline; text-underline-offset: 3px; }
details.group > summary:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; border-radius: 4px; }

/* UIX 6: "+ Marker" dialog */
button.open-mark { font: inherit; font-size: .85rem; padding: .25rem .65rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--axis); background: var(--surface); color: var(--ink); }
button.open-mark:hover { border-color: var(--ink-2); }
button.header-mark { align-self: center; font-weight: 600; }
.changes-actions { margin: .5rem 0; display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; font-size: .82rem; }
dialog#mark-dialog { width: min(36rem, calc(100vw - 2rem)); box-sizing: border-box; padding: 1rem 1.1rem;
  border: 1px solid var(--axis); border-radius: 10px; background: var(--surface); color: var(--ink);
  box-shadow: 0 12px 40px rgba(0,0,0,.25); }
dialog#mark-dialog::backdrop { background: rgba(0,0,0,.35); }
dialog#mark-dialog h2 { margin: 0 0 .2rem; font-size: 1.05rem; }
dialog#mark-dialog .note { margin: 0 0 .6rem; font-size: .82rem; color: var(--ink-2); }
dialog#mark-dialog .mark-form { margin: 0; }
dialog#mark-dialog .mark-form label.wide { flex: 1 1 100%; }
.dialog-actions { flex: 1 1 100%; display: flex; justify-content: end; gap: .5rem; margin-top: .3rem; }
.dialog-actions button.primary { font-weight: 600; border-color: var(--ink-2); }
.dialog-actions button:disabled { opacity: .5; cursor: default; }
#mark-dialog-msg:empty { display: none; }

/* Polish: stale-data banner (both doors) */
.stale-banner { margin: 0 0 1rem; padding: .55rem .8rem; border-radius: 8px; font-size: .88rem;
  border: 1px solid var(--critical); border-left: 4px solid var(--critical);
  background: color-mix(in srgb, var(--critical) 8%, var(--surface)); color: var(--ink); }
.stale-banner b { color: var(--critical); }

/* Polish: phone — tiles in two compact columns instead of five full-width rows */
@media (max-width: 40rem) {
  .health-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
  .health-tiles .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .tile { padding: .45rem .55rem .5rem; gap: .25rem; }
  .tile-head h3 { font-size: .82rem; }
  .tile .st { font-size: .7rem; }
  .tile-main { flex-direction: column; align-items: stretch; gap: .15rem; }
  .tile .big b { font-size: 1.15rem; }
  .spark-wrap { flex: none; width: 100%; }
  svg.spark { height: 1.5rem; }
  .tile-vals { column-gap: .45rem; font-size: .68rem; }
  .tile-foot { font-size: .68rem; gap: .1rem .5rem; }
}

/* Polish: chart explanations behind an (i) button */
button.info { font: italic 600 .72rem/1 Georgia, "Times New Roman", serif; width: 1.15rem; height: 1.15rem; padding: 0; margin-left: .3rem;
  border-radius: 50%; border: 1px solid var(--axis); background: var(--surface); color: var(--ink-2); cursor: pointer; vertical-align: .12em; }
button.info:hover { border-color: var(--ink-2); color: var(--ink); }
button.info[aria-expanded="true"] { background: var(--ink-2); border-color: var(--ink-2); color: var(--surface); }
button.info:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; }
.card p.chart-note { margin: .3rem 0 .5rem; padding: .3rem .5rem; border-left: 3px solid var(--axis); background: var(--page); border-radius: 0 4px 4px 0; }

/* Theme switch (Auto / Light / Dark): a native radio group styled as a segmented
   control — arrow keys, "radio, 2 of 3" for screen readers. 32 px targets,
   outline ≥ 3:1 (--muted), solid background so the banner graph can't show through. */
fieldset.theme-switch { display: inline-flex; margin: 0; padding: 0; min-inline-size: 0; align-self: start;
  border: 1px solid var(--muted); border-radius: 8px; overflow: hidden; background: var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.theme-switch label { position: relative; display: flex; cursor: pointer; }
.theme-switch label + label { border-left: 1px solid var(--muted); }
.theme-switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.theme-switch input + span { display: inline-flex; align-items: center; gap: .3rem; min-height: 2.3rem; box-sizing: border-box;
  padding: .3rem .75rem; font-size: .85rem; color: var(--ink-2); }
.theme-switch .ti { font-size: .95rem; line-height: 1; }
.theme-switch label:hover input:not(:checked) + span { background: color-mix(in srgb, var(--ink) 7%, var(--surface)); color: var(--ink); }
.theme-switch input:checked + span { background: var(--ink); color: var(--page); font-weight: 600; }
.theme-switch input:focus-visible + span { outline: 2px solid var(--s1); outline-offset: -3px; }
header.top .theme-switch { margin-left: auto; }

/* Host location labels (internal door) */
.loc { color: var(--muted); font-weight: 400; }
.tile-head h3 .loc { font-size: .78rem; }

/* Header banner: fake full-chain chart fading out behind the title (src/banner.php) */
header.top.banner { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "brand theme"; align-items: center; gap: .7rem 1rem; min-height: 5.6rem; box-sizing: border-box;
  padding: 1.1rem 1.1rem 1rem; margin: 0 0 .6rem; border: 1px solid var(--ring); border-radius: 12px;
  background: linear-gradient(180deg, var(--surface), var(--page)); }
header.top.banner .brand-wrap { grid-area: brand; }
header.top.banner .theme-switch { grid-area: theme; margin-left: 0; }
/* page tools (+ Marker, status, links / account) in their own row below the banner */
.header-tools { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1.2rem; margin: 0 0 .9rem; padding: 0 .25rem; }
.tagline { margin: .15rem 0 0; font-size: .8rem; color: var(--muted); letter-spacing: .02em; }
header.top.banner > :not(.banner-graph) { position: relative; z-index: 1; }
.banner-graph { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: .7;
  /* faded out where the title and the controls sit (left third), and towards the right edge */
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, transparent 22%, #000 45%, #000 82%, transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0%, transparent 22%, #000 45%, #000 82%, transparent 100%); }
.banner-graph .bg-line { fill: none; stroke-width: 1.4; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.banner-graph .bg-line.s1 { stroke: var(--s1); } .banner-graph .bg-line.s2 { stroke: var(--s2); }
.banner-graph .bg-line.s3 { stroke: var(--s3); } .banner-graph .bg-line.s4 { stroke: var(--s4); }
.banner-graph .bg-grid { stroke: var(--grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.banner-graph .bg-marker { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.banner-graph .bg-dot { stroke: var(--ink-2); stroke-width: 6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
header.top h1.brand { margin: 0; font-size: 1.9rem; font-weight: 750; letter-spacing: -.01em; line-height: 1.1; }
h1.brand .brand-mon { color: var(--s1); }
@media (max-width: 40rem) {
  header.top h1.brand { font-size: 1.55rem; }
  header.top.banner { padding: .9rem .8rem .8rem; }
  /* narrow: the text takes most of the width — keep the graph to the upper right,
     faded out before the second row (two masks, intersected) */
  .banner-graph { opacity: .6;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, transparent 40%, #000 70%, #000 100%), linear-gradient(180deg, #000 0%, #000 30%, transparent 55%);
    -webkit-mask-composite: source-in;
            mask-image: linear-gradient(90deg, transparent 0%, transparent 40%, #000 70%, #000 100%), linear-gradient(180deg, #000 0%, #000 30%, transparent 55%);
            mask-composite: intersect; }
}
.tip .r .bx { color: var(--muted); font-size: .74rem; margin-left: .2rem; }
