:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #14171f; --muted: #646b7a; --line: #e4e7ec; --accent: #3b5bdb; --accent-soft: #e8edff;
  --good: #1a7f4b; --bad: #c0392b; --warn: #b7791f; --chip: #f0f2f5;
  --c1: #3b5bdb; --c2: #e8590c; --c3: #2b8a3e; --c4: #ae3ec9; --c5: #1098ad; --c6: #f08c00;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --panel: #171a21; --ink: #e8eaf0; --muted: #9aa1b1; --line: #262b36; --accent: #7c95ff; --accent-soft: #1e2647;
    --good: #4cc38a; --bad: #ff6b6b; --warn: #f5b74e; --chip: #20242e; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
.top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.brand small { font-weight: 400; color: var(--muted); font-size: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
select, input, button { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
button { cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.tabs { display: flex; gap: 2px; overflow-x: auto; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 12px 12px; color: var(--muted); white-space: nowrap; background: none; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
main { padding: 20px; max-width: 1500px; margin: 0 auto; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.card h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.card h3 small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 24px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; margin-top: 2px; }
.up { color: var(--good); } .down { color: var(--bad); }
.row2 { grid-template-columns: 2fr 1fr; }
@media (max-width: 900px) { .row2 { grid-template-columns: 1fr; } main { padding: 12px 16px; } }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; min-width: 180px; }
th { color: var(--muted); font-weight: 500; font-size: 12px; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--panel); }
tr:hover td { background: var(--chip); }
.sub { color: var(--muted); font-size: 12px; }
.chip { display: inline-block; background: var(--chip); border-radius: 999px; padding: 2px 9px; font-size: 12px; margin: 2px 4px 2px 0; }
.chip.paid { background: var(--accent-soft); color: var(--accent); }
.chip.dim { opacity: .45; }
.chip.syn { border: 1px dashed var(--muted); background: none; }
.arrow { color: var(--muted); margin: 0 2px; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; border: 1px solid; }
.alert.warn { color: var(--warn); border-color: currentColor; }
.alert.error { color: var(--bad); border-color: currentColor; }
.alert.ok { color: var(--good); border-color: currentColor; }
.bar { height: 8px; background: var(--accent); border-radius: 4px; min-width: 2px; }
.empty { color: var(--muted); padding: 40px; text-align: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.heat { border-radius: 4px; }
.journey { border-bottom: 1px solid var(--line); padding: 12px 0; }
.journey:last-child { border: 0; }
.jhead { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; justify-content: space-between; }
.login { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 10; }
.login form { background: var(--panel); border: 1px solid var(--line); padding: 28px; border-radius: 14px; display: grid; gap: 10px; width: min(360px, 90vw); }
.login h2 { margin: 0; }
canvas { max-width: 100%; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
pre { background: var(--chip); padding: 10px; border-radius: 8px; overflow-x: auto; }
