:root {
  color-scheme: light;
  --surface-0: #f4f4f2;
  --surface-1: #fcfcfb;
  --border: #e2e1dc;
  --grid: #ebeae6;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #77766f;
  --series-1: #2a78d6;
  --accent: #1f5fae;
  --critical: #b42318;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #121211;
    --surface-1: #1a1a19;
    --border: #2e2e2c;
    --grid: #262624;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #9a998f;
    --series-1: #3987e5;
    --accent: #7fb2f0;
    --critical: #f97066;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #121211;
  --surface-1: #1a1a19;
  --border: #2e2e2c;
  --grid: #262624;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #9a998f;
  --series-1: #3987e5;
  --accent: #7fb2f0;
  --critical: #f97066;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
.muted { color: var(--text-muted); font-weight: 400; }
.note { color: var(--text-secondary); font-size: 13px; margin: 6px 0 0; }
.error { color: var(--critical); font-weight: 500; }

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; background: var(--surface-1); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 650; font-size: 18px; letter-spacing: -0.01em; }
.who { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); }
#customer { color: var(--text-primary); font-weight: 600; }
.badge {
  font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--text-secondary);
}
button {
  font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 8px; border: 0;
  background: var(--accent); color: var(--surface-1); cursor: pointer;
}
button.link { background: none; color: var(--accent); padding: 4px 0; font-weight: 500; }
button:focus-visible, input:focus-visible, summary:focus-visible, .hit:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

main { max-width: 1100px; margin: 0 auto; padding: 24px; }
section { margin: 0 0 36px; }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.narrow { max-width: 520px; margin: 48px auto; }
form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 16px 0 8px; }
form label { grid-column: 1 / -1; font-size: 13px; color: var(--text-secondary); }
input {
  font: inherit; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-0); color: var(--text-primary); min-width: 0;
}

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile .label { font-size: 13px; color: var(--text-secondary); }
.tile .value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; }
.tile .sub { font-size: 13px; color: var(--text-muted); }

.scroll { overflow-x: auto; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { font-weight: 600; color: var(--text-secondary); font-size: 13px; }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: 0; }
td.empty { color: var(--text-muted); text-align: center; padding: 16px; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin-top: 12px; }
.chart { margin: 0; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 8px; }
.chart figcaption { font-size: 13px; color: var(--text-secondary); font-weight: 600; margin-bottom: 6px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--text-muted); font-size: 11px; }
.chart .mark { fill: var(--series-1); pointer-events: none; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .mark, .chart .hit:focus + .mark { opacity: 0.75; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--accent); font-size: 14px; margin-bottom: 8px; }

.tip {
  position: fixed; z-index: 10; pointer-events: none; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 13px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.12);
}
.tip .k { color: var(--text-secondary); }

@media (max-width: 600px) {
  .bar { padding: 12px 16px; }
  main { padding: 16px; }
  .narrow { margin: 16px auto; }
}
#tiles { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } /* six measures: two rows of three */
