:root {
  color-scheme: light;
  --surface-0: #f4f3f0;
  --surface-1: #fcfcfb;
  --grid: #e4e3df;
  --border: #d6d5d0;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #77766f;
  --accent: #2a78d6;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --warning: #b26b00;
  --critical: #c62f2f;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface-0: #111110;
    --surface-1: #1a1a19;
    --grid: #2e2e2c;
    --border: #3a3a37;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #9b9a91;
    --accent: #3987e5;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --warning: #e0a030;
    --critical: #e66767;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--surface-0); color: var(--text-primary);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header { padding: 16px 24px 4px; }
h1 { margin: 0; font-size: 22px; }
h2 { margin: 0 0 10px; font-size: 16px; }
.sub, .muted { color: var(--text-secondary); }
.sub { margin: 2px 0 0; }
main { display: grid; grid-template-columns: 300px 1fr; gap: 16px; padding: 12px 24px 24px; align-items: start; }
@media (max-width: 860px) { main { grid-template-columns: 1fr; } }
.panel {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; margin-bottom: 16px;
}
form.panel { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 6px 0; }
label.check { justify-content: flex-start; }
label.inline { display: inline-flex; margin: 0 8px 0 0; }
input[type=number], input[type=text], select {
  font: inherit; color: inherit; background: var(--surface-0); border: 1px solid var(--border);
  border-radius: 4px; padding: 3px 6px;
}
label > input[type=number], label > input[type=text] { width: 110px; text-align: right; }
.gasrow { display: grid; grid-template-columns: 1fr 70px 26px; gap: 6px; margin: 4px 0; }
.gasrow select { min-width: 0; }
.gasrow input { width: 100%; text-align: right; }
button {
  font: inherit; color: inherit; background: var(--surface-0); border: 1px solid var(--border);
  border-radius: 4px; padding: 3px 10px; cursor: pointer;
}
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.buttons button { flex: 1; padding: 6px; }
.hint { margin: -2px 0 6px; font-size: 12px; color: var(--text-muted); }
#total.bad { color: var(--critical); }
#status { margin: 10px 0 0; min-height: 2.9em; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--grid); border-radius: 6px; padding: 8px 10px; }
.tile .label { color: var(--text-secondary); font-size: 12px; }
.tile .value { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .unit { color: var(--text-secondary); font-size: 12px; font-weight: 400; }
.warnings { margin: 10px 0 0; padding-left: 0; list-style: none; }
.warnings li { color: var(--warning); }
.warnings li::before { content: "⚠ "; }
.chart { width: 100%; height: 300px; display: block; }
.chart text { fill: var(--text-secondary); font-size: 11px; }
.chart .axis { stroke: var(--border); }
.chart .gridline { stroke: var(--grid); }
.chart .crosshair { stroke: var(--text-muted); }
.tablewrap { overflow-x: auto; margin: 10px 0; }
table { border-collapse: collapse; font-variant-numeric: tabular-nums; width: 100%; }
th, td { padding: 3px 8px; border-bottom: 1px solid var(--grid); text-align: right; white-space: nowrap; }
th { color: var(--text-secondary); font-weight: 600; }
th:first-child, td:first-child, td.text { text-align: left; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
details summary { cursor: pointer; font-weight: 600; }
details summary button { margin-left: 8px; font-weight: 400; }
pre { max-height: 480px; overflow: auto; font-size: 12px; margin: 10px 0 0; }
code { font-size: 12px; }
.tooltip {
  position: fixed; pointer-events: none; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 4px; padding: 4px 8px; font-size: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.15);
  font-variant-numeric: tabular-nums; z-index: 10;
}
label.stack { display: block; }
label.stack select { display: block; width: 100%; min-width: 0; margin-top: 4px; }
.hint.warn { color: var(--warning); }
