:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #14181f;
  --muted: #667085;
  --line: #e4e7ec;
  --grid: #eef0f3;
  --accent: #0f766e;
  --ok: #12805c;
  --ok-bg: #e7f6ef;
  --warn: #b25e09;
  --warn-bg: #fdf1e3;
  --bad: #c4320a;
  --bad-bg: #fdeceb;
  --s1: #0f766e;
  --s2: #4f46e5;
  --s3: #d9480f;
  --s4: #9333ea;
  --s5: #0284c7;
  --s6: #ca8a04;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --card: #151b23;
    --text: #e6e9ee;
    --muted: #8b95a5;
    --line: #262e3a;
    --grid: #1c232d;
    --accent: #2dd4bf;
    --ok: #3ccf91;
    --ok-bg: #12291f;
    --warn: #f0a03c;
    --warn-bg: #2e2112;
    --bad: #f97066;
    --bad-bg: #331816;
    --s1: #2dd4bf;
    --s2: #818cf8;
    --s3: #fb923c;
    --s4: #c084fc;
    --s5: #38bdf8;
    --s6: #facc15;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 18px; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand p { font-size: 12px; }
.logo { width: 28px; height: 28px; border-radius: 8px; flex: none; background: url(/favicon.svg) center / cover; }

section { margin-top: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

.ranges { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.ranges button {
  border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px;
  padding: 4px 10px; border-radius: 7px; cursor: pointer;
}
.ranges button[aria-selected='true'] { background: var(--bg); color: var(--text); font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 0; min-width: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile .label { font-size: 12px; color: var(--muted); }
.tile .value { font-size: 22px; font-weight: 650; margin-top: 2px; white-space: nowrap; }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 5px; background: var(--grid); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.warn > span { background: var(--warn); }
.bar.bad > span { background: var(--bad); }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px; margin-top: 10px; }
figcaption { font-size: 13px; font-weight: 600; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; }
.chart { min-width: 0; }
.chart .plot { height: 150px; position: relative; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.axis { fill: var(--muted); font-size: 10px; }
.gridline { stroke: var(--grid); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--grid);
}
.pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ok { color: var(--ok); }
.pill.ok { background: var(--ok-bg); }
.warn { color: var(--warn); }
.pill.warn { background: var(--warn-bg); }
.bad { color: var(--bad); }
.pill.bad { background: var(--bad-bg); }
.pill.small { font-size: 12px; padding: 2px 8px; }

.apps { display: grid; gap: 12px; }
.app-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.app-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 820px) { .app-grid { grid-template-columns: minmax(0, 1fr); } }
.app h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.app .block + .block { margin-top: 14px; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 0 8px 6px 0; white-space: nowrap; }
td { padding: 6px 8px 6px 0; border-top: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
td.num, th.num { text-align: right; }

.strip { display: flex; gap: 1px; height: 22px; margin-top: 6px; }
.strip span { flex: 1; border-radius: 1px; background: var(--grid); min-width: 1px; }
.strip span.ok { background: var(--ok); opacity: 0.75; }
.strip span.warn { background: var(--warn); }
.strip span.bad { background: var(--bad); }
.check + .check { margin-top: 12px; }
.check-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.check-row .meta { font-size: 12px; color: var(--muted); }

.events { list-style: none; margin: 0; padding: 0; }
.events li { display: grid; grid-template-columns: 110px 14px minmax(0, 1fr); gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); align-items: baseline; }
.events li:first-child { border-top: 0; }
.events time { color: var(--muted); font-size: 12px; }
.events .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.events .info { color: var(--muted); }
.events b { font-weight: 600; margin-right: 6px; }
.events .msg { overflow-wrap: anywhere; }

footer { padding-top: 24px; padding-bottom: 32px; font-size: 12px; }

.tooltip {
  position: fixed; z-index: 10; pointer-events: none; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 9px; font-size: 12px; box-shadow: 0 6px 20px rgb(0 0 0 / 0.15); max-width: 260px;
}
.tooltip .t { color: var(--muted); margin-bottom: 3px; }
.tooltip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

@media (max-width: 520px) {
  .events li { grid-template-columns: 14px minmax(0, 1fr); }
  .events time { grid-column: 1 / -1; }
  .tile .value { font-size: 19px; }
}
