:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #16181d;
  --muted: #646a76;
  --border: #e3e6eb;
  --track: #eceef2;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --accent: #2563eb;
  --accent2: #7c3aed;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1015;
    --card: #171a21;
    --text: #e8eaf0;
    --muted: #9198a6;
    --border: #262a33;
    --track: #232731;
    --ok: #22c55e;
    --warn: #f59e0b;
    --bad: #f87171;
    --accent: #60a5fa;
    --accent2: #a78bfa;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
header, main, footer { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
header {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 12px; flex-wrap: wrap; padding-top: 28px; padding-bottom: 18px;
}
h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { margin: 0 0 12px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
h2.mt { margin-top: 18px; }
.sub { margin: 2px 0 0; color: var(--muted); }

.live { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.live.ok .dot { background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2s infinite; }
.live.stale .dot { background: var(--bad); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .live.ok .dot { animation: none; } }

main { display: grid; gap: 16px; }
.card, .tile {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
}
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 4px; }
.tile .label { color: var(--muted); font-size: 0.85rem; }
.tile .value { font-size: 1.9rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.value.ok { color: var(--ok); } .value.warn { color: var(--warn); } .value.bad { color: var(--bad); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.meter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

.meter .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; gap: 8px; }
.meter .name { font-weight: 600; }
.meter .figs { color: var(--muted); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.bar { height: 10px; background: var(--track); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--accent); transition: width 0.6s ease; }
.bar.mem > span { background: var(--accent2); }
.bar.hot > span { background: var(--warn); }
.bar.crit > span { background: var(--bad); }
.bar.small { height: 6px; }

.nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.node { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: grid; gap: 10px; }
.node .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.node .nm { font-weight: 650; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.95rem; }
.badge { font-size: 0.72rem; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.node .meta { color: var(--muted); font-size: 0.8rem; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.node .meter .top { margin-bottom: 4px; }
.node .meter .name { font-weight: 500; font-size: 0.85rem; }
.node .meter .figs { font-size: 0.8rem; }

.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 0.8rem; padding: 0 0 6px; border-bottom: 1px solid var(--border); }
.table td { padding: 7px 0; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
td.ok { color: var(--ok); } td.warn { color: var(--warn); } td.bad { color: var(--bad); }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.big { font-size: 1.15rem; margin: 0 0 8px; }
.problems { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.problems li { font-size: 0.9rem; display: flex; justify-content: space-between; gap: 8px; }
.problems li .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.problems li .st { color: var(--warn); }
.note { color: var(--muted); font-size: 0.85rem; margin: 12px 0 0; }

footer { color: var(--muted); font-size: 0.82rem; padding-top: 20px; padding-bottom: 32px; }

@media (max-width: 800px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .grid2, .meter-row { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .tile .value { font-size: 1.5rem; }
}
