:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #d55181;
  --track: #e9e8e2;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --on-accent: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --series-1: #d55181;
    --track: #2c2c2a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; margin: 20px 4px 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--critical); font-size: 14px; }

#app { max-width: 720px; margin: 0 auto; padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(16px + env(safe-area-inset-top)) 4px 12px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.card + .card { margin-top: 10px; }

/* Status: always an icon and a label, never colour on its own */
.badge { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; font-weight: 700; line-height: 1; color: #fff; }
.badge.good { background: var(--good); }
.badge.warning { background: var(--warning); color: #0b0b0b; }
.badge.critical { background: var(--critical); }
.badge.neutral { background: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 14px; font-weight: 600; white-space: nowrap; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.tile .label { font-size: 13px; color: var(--ink-2); }
.tile .value { font-size: 24px; font-weight: 650; margin-top: 2px; white-space: nowrap; }
.tile .value small { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.tile .sub { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.meter { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; border-radius: 4px; background: var(--series-1); }
.meter.warning > i { background: var(--warning); }
.meter.critical > i { background: var(--critical); }

.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--grid); min-width: 0; }
.list { padding: 2px 14px; }
.list .row:first-child { border-top: 0; }
.row .main { flex: 1; min-width: 0; }
.row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub b { font-weight: 600; color: var(--ink-2); }
.row .side { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .side .sub { font-size: 12px; }
button.row { width: 100%; background: none; border: 0; border-top: 1px solid var(--grid); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.disk .head { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.disk .head span:last-child { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.disk + .disk { margin-top: 14px; }
.empty { padding: 18px 4px; color: var(--muted); text-align: center; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
input[type="search"], input[type="password"], select {
  flex: 1; min-width: 0; height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--axis);
  background: var(--surface); color: var(--ink); font: inherit;
}
.chips { display: flex; gap: 6px; }
.chip { height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--axis); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--page); font-weight: 600; }

.btn { height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--axis); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--series-1); border-color: var(--series-1); color: var(--on-accent); }
.btn:disabled { opacity: 0.5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.tab { position: relative; flex: 1; max-width: 180px; height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: none; border: 0; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--ink); font-weight: 600; }
.count { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--critical); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
.login-card h1 { margin-bottom: 8px; }
.login-card label { font-size: 14px; color: var(--ink-2); }
.login-card input { flex: none; }

/* Chart */
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.chart-head .figure { font-size: 28px; font-weight: 650; white-space: nowrap; }
.chart-head .when { font-size: 13px; color: var(--muted); text-align: right; }
.chart { position: relative; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: 200px; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.chart .dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.stats { display: flex; gap: 20px; margin-top: 10px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.stats b { color: var(--ink); font-weight: 600; }
