:root {
  color-scheme: light;
  --surface-0: #f3f3f1;
  --surface-1: #fcfcfb;
  --border: #dddcd7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6d6c67;
  --series-1: #2a78d6;
  --grid: #e8e7e3;
  --good: #1f7a3a;
  --warning: #9a6200;
  --critical: #b3261e;
  --info: #3d5a80;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #111110;
    --surface-1: #1a1a19;
    --border: #34332f;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #9d9c93;
    --series-1: #3987e5;
    --grid: #2a2a27;
    --good: #5cc27a;
    --warning: #e0a23a;
    --critical: #f07167;
    --info: #9bb7de;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #111110;
  --surface-1: #1a1a19;
  --border: #34332f;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #9d9c93;
  --series-1: #3987e5;
  --grid: #2a2a27;
  --good: #5cc27a;
  --warning: #e0a23a;
  --critical: #f07167;
  --info: #9bb7de;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--surface-0); color: var(--text-primary); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-1); }
h1 { font-size: 18px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 8px; }
.tag { font-size: 11px; font-weight: 500; color: var(--text-muted); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
.muted { color: var(--text-muted); }
.semantics { font-size: 13px; margin: 6px 0 12px; }
.login { max-width: 420px; margin: 40px auto; }
label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
input, select, button { font: inherit; color: inherit; background: var(--surface-1); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
button { cursor: pointer; }
button.primary, .login button { background: var(--series-1); border-color: var(--series-1); color: #fff; }
button.link { border: 0; background: none; color: var(--series-1); padding: 0; }
.login input { width: 100%; margin-bottom: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; }
.presets { flex-direction: row; gap: 4px; align-items: center; }
.presets .label { font-size: 12px; color: var(--text-secondary); margin-right: 2px; }
.freshness { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.badge { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; border-radius: 999px; padding: 2px 10px; border: 1px solid currentColor; }
.badge.fresh { color: var(--good); }
.badge.stale { color: var(--warning); }
.badge.unknown, .badge.error { color: var(--critical); }
.badge.held { color: var(--info); }
.banner { border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid currentColor; }
.banner.warn { color: var(--warning); }
.banner.error { color: var(--critical); }
.banner.info { color: var(--info); }
.banner button { margin-left: 10px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.metrics[aria-busy="true"] .v { opacity: .45; }
.metrics.is-stale .v { color: var(--text-secondary); }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.tile .k { font-size: 12px; color: var(--text-secondary); }
.tile .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: 240px; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis text { fill: var(--text-muted); font-size: 11px; }
.chart .bar { fill: var(--series-1); }
.chart .bar.hover { opacity: .8; }
.chart .hit { fill: transparent; }
.tooltip { position: fixed; pointer-events: none; background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.15); z-index: 10; font-variant-numeric: tabular-nums; }
details { margin-top: 8px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
.order-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.order-form label { width: 100%; }
.order-form input { flex: 1 1 320px; min-width: 0; font-family: ui-monospace, monospace; }
.order-detail dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0; }
.order-detail dt { color: var(--text-secondary); }
.order-detail dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.error { color: var(--critical); }
.who { font-size: 13px; color: var(--text-secondary); }
@media (max-width: 600px) {
  .tile .v { font-size: 18px; }
  .filters .field, .filters .primary { width: 100%; }
}
