:root {
  --bg: #0c1511;
  --surface: #122019;
  --surface-2: #182a21;
  --line: #24392e;
  --text: #dbe7df;
  --muted: #86a091;
  --green: #74d39c;
  --green-strong: #3dba78;
  --green-dim: #2a5a42;
  --red: #ec7a70;
  --amber: #e3b65c;
  --blue: #7fb8d6;
  --font: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
code, .code { font-family: var(--mono); font-size: 12.5px; }

.muted { color: var(--muted); }
.err { color: var(--red); }
.warn-text { color: var(--amber); }
.ok-text { color: var(--green); }

/* ---------- buttons */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font: 600 13.5px/1 var(--font);
  padding: 8px 14px;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
}
.btn:hover { border-color: var(--green-dim); }
.btn--primary { background: var(--green-strong); border-color: var(--green-strong); color: #06120c; }
.btn--primary:hover { background: var(--green); border-color: var(--green); }
.btn--danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn--danger:hover { background: rgba(236, 122, 112, .12); }
select.btn { padding-right: 10px; }

/* ---------- top bar */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px clamp(16px, 3vw, 36px);
  background: rgba(12, 21, 17, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top__host { font-weight: 700; font-size: 16px; }
.top__meta { color: var(--muted); font-size: 13.5px; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.top nav a {
  color: var(--muted); text-decoration: none; font-size: 13.5px;
  padding: 6px 10px; border-radius: 6px;
}
.top nav a:hover { color: var(--text); background: var(--surface-2); }
.top__controls { display: flex; gap: 8px; align-items: center; }
.pulse {
  width: 9px; height: 9px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 rgba(116, 211, 156, .6);
}
.pulse.is-live { animation: ping 1.2s ease-out 1; }
.pulse.is-stale { background: var(--amber); }
.pulse.is-down { background: var(--red); }
@keyframes ping { to { box-shadow: 0 0 0 10px rgba(116, 211, 156, 0); } }

main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 36px) 80px;
}

/* ---------- verdict (the hero) */
.verdict {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  gap: 28px;
  margin-bottom: 36px;
}
.verdict__headline {
  font-size: clamp(28px, 3.6vw, 44px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 4px 0 18px;
  max-width: 22ch;
}
.verdict__headline[data-level="ok"] { color: var(--green); }
.verdict__headline[data-level="warn"] { color: var(--amber); }
.verdict__headline[data-level="crit"] { color: var(--red); }

.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.finding {
  display: grid; grid-template-columns: 8px 1fr; gap: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius);
}
.finding::before { content: ""; border-radius: 4px; background: var(--muted); }
.finding[data-sev="crit"]::before { background: var(--red); }
.finding[data-sev="warn"]::before { background: var(--amber); }
.finding[data-sev="info"]::before { background: var(--blue); }
.finding__title { font-weight: 700; }
.finding__area { color: var(--muted); font-weight: 400; margin-left: 8px; font-size: 13px; }
.finding__detail { color: var(--text); opacity: .9; }
.finding__hint { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.finding__hint code { color: var(--green); }

/* ---------- waiting meters */
.waiting { padding: 18px 20px; }
.waiting h2 { margin-bottom: 4px; }
.meter { margin-top: 16px; }
.meter__row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.meter__val { font-weight: 700; }
.meter__track {
  margin-top: 6px; height: 10px; border-radius: 5px;
  background: var(--surface-2); overflow: hidden;
}
.meter__fill { height: 100%; width: 0; background: var(--green-strong); border-radius: 5px; transition: width .4s ease; }
.meter__fill[data-level="warn"] { background: var(--amber); }
.meter__fill[data-level="crit"] { background: var(--red); }
.meter__sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* ---------- panels and grid */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  min-width: 0;
}
.panel > h2, .waiting > h2 { font-size: 17px; margin: 0 0 12px; font-weight: 700; }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel__head h2 { font-size: 17px; margin: 0; }
.panel__head .muted { font-size: 13px; }

.section { margin-top: 40px; }
.section > h2 { font-size: 22px; margin: 0 0 4px; }
.section > p.muted { margin: 0 0 16px; max-width: 75ch; }

.grid { display: grid; gap: 16px; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--charts { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.stat { padding: 14px 16px; }
.stat__label { color: var(--muted); font-size: 13.5px; }
.stat__value { font-size: 28px; font-weight: 700; line-height: 1.15; margin-top: 2px; }
.stat__value small { font-size: 15px; font-weight: 400; color: var(--muted); margin-left: 3px; }
.stat__sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.stat[data-level="warn"] .stat__value { color: var(--amber); }
.stat[data-level="crit"] .stat__value { color: var(--red); }

/* ---------- charts */
.chart { position: relative; }
.chart canvas { width: 100%; height: 170px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; min-height: 19px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.legend b { color: var(--text); font-weight: 600; }

/* ---------- cores */
.cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 6px; }
.core { height: 52px; border-radius: 4px; background: var(--surface-2); position: relative; overflow: hidden; }
.core i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--green-strong); }
.core[data-level="warn"] i { background: var(--amber); }
.core[data-level="crit"] i { background: var(--red); }

/* ---------- tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.cmd { font-family: var(--mono); font-size: 12px; color: var(--muted); max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; background: var(--muted); vertical-align: 1px; }
.dot--ok { background: var(--green); }
.dot--warn { background: var(--amber); }
.dot--crit { background: var(--red); }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); min-width: 80px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--green-strong); }
.bar[data-level="warn"] i { background: var(--amber); }
.bar[data-level="crit"] i { background: var(--red); }
.spark { display: block; width: 120px; height: 26px; }
.timing { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-2); min-width: 120px; margin-top: 5px; }
.timing i { display: block; height: 100%; }

.tabs { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; }
.tabs button { border: 0; background: transparent; color: var(--muted); font: 600 13px var(--font); padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); }

.logline { font-family: var(--mono); font-size: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); word-break: break-word; }
.logline:last-child { border-bottom: 0; }
.logline .lvl { color: var(--red); margin-right: 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
.empty { color: var(--muted); padding: 10px 0; }

.banner {
  display: none; margin-bottom: 24px; padding: 14px 18px; border-radius: var(--radius);
  border: 1px solid var(--red); background: rgba(236, 122, 112, .08);
}
.banner.is-shown { display: block; }
.banner code { color: var(--text); }

@media (max-width: 900px) {
  .verdict { grid-template-columns: 1fr; }
  .grid--2, .grid--charts { grid-template-columns: 1fr; }
  .top nav { display: none; }
  .top { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse.is-live { animation: none; }
  .meter__fill { transition: none; }
}
