:root {
  --bg: #f6f7f9; --panel: #ffffff; --panel-2: #f0f2f5; --line: #dde1e7; --text: #16202b; --muted: #5b6776; --accent: #0f6e8c; --accent-ink: #ffffff;
  --healthy: #1c7c54; --healthy-bg: #e3f4ec; --warning: #8a5a00; --warning-bg: #fdf1d6; --critical: #b3261e; --critical-bg: #fbe4e2; --unknown: #5b6776; --unknown-bg: #eceff3;
  --high: #c2410c; --high-bg: #fde9dc; --medium: #8a5a00; --medium-bg: #fdf1d6; --low: #3d5a80; --low-bg: #e4ebf5;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151c; --panel: #161e27; --panel-2: #1c2632; --line: #2a3644; --text: #e5ebf1; --muted: #9aa8b7; --accent: #4fb3d4; --accent-ink: #081218;
    --healthy: #5fd3a4; --healthy-bg: #123326; --warning: #f2c14e; --warning-bg: #3a2d0d; --critical: #ff8a80; --critical-bg: #3d1614; --unknown: #9aa8b7; --unknown-bg: #232e3a;
    --high: #ffab76; --high-bg: #3d2112; --medium: #f2c14e; --medium-bg: #3a2d0d; --low: #9cc0ec; --low-bg: #1a2a40;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }
h3 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
nav.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; }
nav.side .brand { display: flex; align-items: center; gap: 10px; font-weight: 650; padding: 4px 8px 18px; }
nav.side .brand img { width: 26px; height: 26px; }
nav.side a { color: var(--text); padding: 7px 10px; border-radius: 6px; }
nav.side a.on { background: var(--panel-2); font-weight: 600; }
nav.side a:hover { text-decoration: none; background: var(--panel-2); }
nav.side .foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 8px; }
main { padding: 24px 28px 64px; max-width: 1280px; width: 100%; }
.sub { color: var(--muted); margin: 0 0 20px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel + .panel, .panel + .grid, .grid + .panel { margin-top: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 12px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.s-Healthy, .p-passed { color: var(--healthy); background: var(--healthy-bg); }
.s-Warning, .p-suspect, .p-noise, .p-held, .p-pending { color: var(--warning); background: var(--warning-bg); }
.s-Critical, .p-failed, .pr-critical { color: var(--critical); background: var(--critical-bg); }
.s-Unknown, .p-queued, .p-running, .p-error { color: var(--unknown); background: var(--unknown-bg); }
.pr-high { color: var(--high); background: var(--high-bg); }
.pr-medium { color: var(--medium); background: var(--medium-bg); }
.pr-low { color: var(--low); background: var(--low-bg); }
.st { color: var(--text); background: var(--panel-2); border-color: var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 4px; font-weight: 600; cursor: help; }
.site-card h2 { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.site-card .url { color: var(--muted); font-size: 12px; word-break: break-all; }
.signal-list { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin-top: 12px; font-size: 13px; }
.signal-list .why { grid-column: 1 / -1; color: var(--muted); font-size: 12px; margin: -2px 0 4px; }
button, .btn { font: inherit; font-weight: 600; font-size: 13px; padding: 7px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
button:hover, a.btn:hover { border-color: var(--accent); }
a.btn { display: inline-block; text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { color: var(--critical); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); width: 100%; }
textarea { font-family: var(--mono); font-size: 12.5px; min-height: 160px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.error { color: var(--critical); background: var(--critical-bg); padding: 8px 12px; border-radius: 6px; margin: 8px 0; }
.error ul { margin: 4px 0 0; padding-left: 18px; }
.ok { color: var(--healthy); background: var(--healthy-bg); padding: 8px 12px; border-radius: 6px; margin: 8px 0; }
.warn { color: var(--warning); background: var(--warning-bg); padding: 8px 12px; border-radius: 6px; margin: 8px 0; }
.note { color: var(--muted); font-size: 12.5px; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 380px)); gap: 12px; }
.shots figure { margin: 0; }
.shots img { width: 100%; border: 1px solid var(--line); border-radius: 6px; display: block; background: var(--panel-2); }
.shots figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 6px 0 6px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline time { color: var(--muted); font-size: 12px; margin-right: 8px; font-variant-numeric: tabular-nums; }
.cause { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.evidence { margin: 0; padding-left: 18px; }
.evidence li { margin-bottom: 4px; }
.evidence a { font-family: var(--mono); font-size: 11.5px; }
.finding { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.finding:target { outline: 2px solid var(--accent); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; padding: 6px 0 6px 30px; position: relative; border-bottom: 1px solid var(--line); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--panel-2); font-size: 11px; text-align: center; line-height: 20px; }
.tag-write { color: var(--high); font-weight: 700; font-size: 11px; }
.tag-read { color: var(--muted); font-size: 11px; }
.login { max-width: 360px; margin: 12vh auto; }
.login .brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 18px; margin-bottom: 18px; }
.login h1 { font-size: 16px; margin: 0 0 12px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.tabs a { padding: 6px 12px; border-radius: 6px; color: var(--text); }
.tabs a.on { background: var(--panel); border: 1px solid var(--line); font-weight: 600; }
.empty { color: var(--muted); padding: 12px 0; }
.secret-once { font-family: var(--mono); background: var(--panel-2); padding: 10px; border-radius: 6px; word-break: break-all; user-select: all; }
pre { background: var(--panel-2); padding: 10px 12px; border-radius: 6px; overflow: auto; font-size: 12px; margin: 0; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  nav.side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 16px; }
  nav.side .brand { padding: 4px 8px; width: 100%; }
  nav.side .foot { display: none; }
  main { padding: 16px; }
  .kv { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
}
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
td.mono { word-break: break-all; min-width: 140px; }
p.mono { word-break: break-all; }
/* "Skip to content": the first stop for keyboard users, out of sight until it has focus. */
.skip { position: absolute; left: -10000px; top: 8px; z-index: 20; }
.skip:focus { left: 8px; }
.panel { min-width: 0; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; font-size: 13px; margin: 4px 0 12px; }
label.check input { width: auto; }
.step-rows { list-style: none; padding: 0; margin: 0 0 8px; counter-reset: st; }
.step-row { counter-increment: st; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 10px 10px 36px; margin-bottom: 8px; position: relative; }
.step-row::before { content: counter(st); position: absolute; left: 10px; top: 12px; width: 18px; height: 18px; border-radius: 50%; background: var(--panel-2); font-size: 11px; text-align: center; line-height: 18px; }
.step-row.is-write { border-color: var(--high); }
.step-fields { display: grid; grid-template-columns: 170px repeat(auto-fit, minmax(160px, 1fr)); gap: 6px; margin-bottom: 6px; }
.step-fields select:last-of-type { max-width: 100px; }
.step-status { font-size: 12.5px; margin-top: 4px; }
.error-inline { color: var(--critical); }
.rule-row { display: grid; grid-template-columns: 210px 1fr auto 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
@media (max-width: 860px) { .step-fields, .rule-row { grid-template-columns: 1fr; } }

/* Reconciliation note on an incident, in any state. */
.notebox { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.notebox h3 { margin: 0 0 4px; font-size: 14px; }
.notebox textarea { width: 100%; margin: 8px 0; padding: 8px 10px; font: inherit; color: inherit;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; resize: vertical; }
