:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, .10);
  --wash: rgba(11, 11, 11, .05);
  --series-1: #2a78d6;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --up: #006300;
  --down: #b42f2f;
  --ramp-1: #86b6ef;
  --ramp-2: #5598e7;
  --ramp-3: #2a78d6;
  --ramp-4: #1c5cab;
  --ramp-5: #184f95;
  --ramp-6: #0d366b;
  --heat-0: #f0efec;
  --heat-1: #cde2fb;
  --heat-2: #9ec5f4;
  --heat-3: #5598e7;
  --heat-4: #256abf;
  --heat-5: #104281;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #9a988f;
    --grid: #2c2c2a;
    --axis: #383835;
    --ring: rgba(255, 255, 255, .10);
    --wash: rgba(255, 255, 255, .07);
    --series-1: #3987e5;
    --up: #0ca30c;
    --down: #e66767;
    --ramp-1: #184f95;
    --ramp-2: #1c5cab;
    --ramp-3: #256abf;
    --ramp-4: #3987e5;
    --ramp-5: #5598e7;
    --ramp-6: #86b6ef;
    --heat-0: #262624;
    --heat-1: #104281;
    --heat-2: #1c5cab;
    --heat-3: #2a78d6;
    --heat-4: #5598e7;
    --heat-5: #9ec5f4;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #9a988f;
  --grid: #2c2c2a;
  --axis: #383835;
  --ring: rgba(255, 255, 255, .10);
  --wash: rgba(255, 255, 255, .07);
  --series-1: #3987e5;
  --up: #0ca30c;
  --down: #e66767;
  --ramp-1: #184f95;
  --ramp-2: #1c5cab;
  --ramp-3: #256abf;
  --ramp-4: #3987e5;
  --ramp-5: #5598e7;
  --ramp-6: #86b6ef;
  --heat-0: #262624;
  --heat-1: #104281;
  --heat-2: #1c5cab;
  --heat-3: #2a78d6;
  --heat-4: #5598e7;
  --heat-5: #9ec5f4;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.loading { padding: 48px 0; text-align: center; }

.top, .tabs, .filters, main, .foot {
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: 24px;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-block: 16px 8px;
}
.brand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 16px; }
.bot-state { font-size: 13px; color: var(--ink-2); }
.top-actions { display: flex; gap: 4px; }
.top-actions form { margin: 0; }
.ghost {
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--ink-2);
  cursor: pointer;
}
.ghost:hover { background: var(--wash); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--grid); overflow-x: auto; }
.tabs button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 12px;
  margin-bottom: -1px;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--series-1); font-weight: 600; }

.filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
  flex-wrap: wrap;
  padding-block: 16px;
}
.segmented { display: inline-flex; background: var(--wash); border-radius: 8px; padding: 2px; }
.segmented button {
  background: none;
  border: 0;
  border-radius: 6px;
  padding: 5px 12px;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--ring); }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); cursor: pointer; }
:is(button, a, input, select, [tabindex]):focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

main { padding-bottom: 24px; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }

.card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--ring);
  padding: 16px 20px;
  min-width: 0;
}
.card > h2 { font-size: 15px; font-weight: 600; }
.card > .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card > .body { margin-top: 14px; }
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .peak { fill: var(--ink-2); font-weight: 600; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .bar { fill: var(--series-1); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .hit:focus + .bar { opacity: .8; }
.chart .hit:focus { outline: none; }

details.table-view { margin-top: 10px; color: var(--ink-2); font-size: 13px; }
details.table-view summary { cursor: pointer; color: var(--muted); }
details.table-view .scroll { margin-top: 8px; max-height: 260px; overflow-y: auto; }

.hero .value { font-size: 52px; line-height: 1.1; font-weight: 600; letter-spacing: -.02em; margin-top: 8px; }
.hero .note { color: var(--ink-2); margin-top: 8px; }
.tile .label { color: var(--ink-2); font-size: 13px; }
.tile .value { font-size: 28px; line-height: 1.2; font-weight: 600; margin-top: 4px; }
.tile .note { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.delta-up { color: var(--up); }
.delta-down { color: var(--down); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--grid); align-items: flex-start; }
.alert-list li:first-child { border-top: 0; padding-top: 0; }
.alert-list .icon {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: #0b0b0b;
  margin-top: 1px;
}
.icon.critical { background: var(--critical); color: #fff; }
.icon.warning { background: var(--warning); }
.icon.serious { background: var(--serious); }
.icon.good { background: var(--good); color: #fff; }
.alert-list .who { margin-top: 3px; color: var(--ink-2); font-size: 13px; }
.linkish {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--axis);
  text-underline-offset: 2px;
}
.linkish:hover { text-decoration-color: currentColor; }

.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(96px, 34%) minmax(0, 1fr); gap: 4px 12px; align-items: center; }
.bar-row .name { color: var(--ink-2); font-size: 13px; }
.bar-row .track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-row .fill { height: 16px; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--series-1); flex: none; max-width: calc(100% - 92px); }
.bar-row .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-row .num small { color: var(--muted); font-size: 12px; }

.table-wrap { overflow-x: auto; margin-inline: -20px; padding-inline: 20px; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--muted);
  padding: 6px 12px 6px 0;
  border-bottom: 1px solid var(--axis);
  white-space: nowrap;
}
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--ink); }
td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--grid); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nw { white-space: nowrap; }
tr[data-user] { cursor: pointer; }
tr[data-user]:hover td { background: var(--wash); }
.handle { color: var(--muted); font-size: 12.5px; display: block; }
.empty { color: var(--muted); padding: 16px 0; }

.pill { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--axis); flex: none; }
.pill.good::before { background: var(--good); }
.pill.warning::before { background: var(--warning); }
.pill.critical::before { background: var(--critical); }
.pill.accent::before { background: var(--series-1); }

.toolbar { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type="search"] {
  flex: 1 1 220px;
  max-width: 320px;
  background: var(--page);
  border: 1px solid var(--axis);
  border-radius: 8px;
  padding: 6px 10px;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button {
  background: none;
  border: 1px solid var(--grid);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}
.chips button[aria-pressed="true"] { border-color: var(--series-1); color: var(--ink); background: var(--wash); }
.btn {
  background: var(--surface);
  border: 1px solid var(--axis);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--wash); }
.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 12px; color: var(--muted); }

.heat { display: grid; grid-template-columns: 22px repeat(24, minmax(0, 1fr)); gap: 2px; }
.heat .cell { aspect-ratio: 1; border-radius: 2px; background: var(--heat-0); min-width: 0; }
.heat .lv1 { background: var(--heat-1); }
.heat .lv2 { background: var(--heat-2); }
.heat .lv3 { background: var(--heat-3); }
.heat .lv4 { background: var(--heat-4); }
.heat .lv5 { background: var(--heat-5); }
.heat .lab { color: var(--muted); font-size: 11px; line-height: 1; align-self: center; font-variant-numeric: tabular-nums; }
.heat .hour { grid-column: span 3; }
.scale { display: flex; align-items: center; gap: 4px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.scale i { width: 16px; height: 10px; border-radius: 2px; }

.foot { color: var(--muted); font-size: 12.5px; padding-block: 8px 28px; display: flex; gap: 6px 18px; flex-wrap: wrap; }

#scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 10; }
#drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--ring), -12px 0 32px rgba(0, 0, 0, .14);
  z-index: 11;
  overflow-y: auto;
  padding: 20px;
}
#drawer h2 { font-size: 18px; }
#drawer dl { display: grid; grid-template-columns: 44% 1fr; gap: 8px 12px; margin: 16px 0; }
#drawer dt { color: var(--muted); }
#drawer dd { margin: 0; overflow-wrap: anywhere; }
#drawer h3 { font-size: 14px; margin: 18px 0 8px; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.drawer-links .btn { text-decoration: none; display: inline-block; }

#tip {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  background: var(--ink);
  color: var(--surface);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12.5px;
  white-space: pre-line;
  max-width: 240px;
}

body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card {
  width: min(340px, 100%);
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--ring);
  padding: 24px;
  display: grid;
  gap: 10px;
}
.login-card h1 { font-size: 20px; }
.login-card label { margin-top: 10px; color: var(--ink-2); }
.login-card input { background: var(--page); border: 1px solid var(--axis); border-radius: 8px; padding: 9px 11px; }
.login-card button { background: var(--series-1); color: #fff; border: 0; border-radius: 8px; padding: 10px; font-weight: 600; cursor: pointer; }
.login-error { color: var(--down); }

@media (max-width: 900px) {
  .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; }
  .span-3 { grid-column: span 6; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .top, .tabs, .filters, main, .foot { padding-inline: 16px; }
  .card { padding: 14px 16px; }
  .table-wrap { margin-inline: -16px; padding-inline: 16px; }
  .hero .value { font-size: 44px; }
  .tile .value { font-size: 24px; }
  .hide-sm { display: none; }
  td .pill { white-space: normal; }
  .tiles { gap: 10px; }
}
@media (forced-colors: active) {
  .chart .bar, .bar-row .fill { fill: CanvasText; background: CanvasText; }
}
