:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --hover-wash: rgba(11, 11, 11, 0.05);
  --delta-good: #006300;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-muted: #c3c2b7;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --page: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --hover-wash: rgba(255, 255, 255, 0.08);
    --delta-good: #0ca30c;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-muted: #52514e;
  }
}
* { box-sizing: border-box; }
html, body { background: var(--page); }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text-primary); }
.viz-root { max-width: 1040px; margin: 0 auto; padding: 32px 20px 64px; }
h1 { font-size: 20px; margin: 0 0 4px; }
.subtitle { color: var(--text-secondary); margin: 0 0 28px; font-size: 14px; }
.chart-note { margin-bottom: 16px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; margin-bottom: 24px; }
.card h2 { font-size: 15px; margin: 0 0 16px; color: var(--text-primary); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 600; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.chart-svg { width: 100%; height: auto; display: block; }
.gridline { stroke: var(--gridline); stroke-width: 1; }
.baseline { stroke: var(--baseline); stroke-width: 1; }
.axis-label { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.bar-seg { pointer-events: none; }
.hit-rect { fill: transparent; cursor: pointer; outline: none; }
.hit-rect:hover, .hit-rect:focus-visible { fill: var(--hover-wash); }
.hit-rect:focus-visible { outline: 2px solid var(--series-1); outline-offset: -2px; }
.chart-tooltip {
  position: fixed; display: none; z-index: 10; pointer-events: none;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 12px; min-width: 170px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.tooltip-title { font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.tooltip-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.tooltip-key { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.tooltip-label { color: var(--text-secondary); flex: 1; }
.tooltip-value { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.tooltip-total { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--gridline); }
.tooltip-total .tooltip-label { color: var(--text-primary); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--text-secondary); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--gridline); white-space: nowrap; }
th { color: var(--text-secondary); font-weight: 500; position: sticky; top: 0; background: var(--surface-1); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { max-height: 480px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.month-band-b { background: var(--page); }
.month-start td { border-top: 2px solid var(--baseline); }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; color: var(--text-primary); background: var(--gridline); }
.badge[data-cat="Uren"] { background: color-mix(in srgb, var(--series-1) 20%, var(--surface-1)); }
.badge[data-cat="Inkoop"] { background: color-mix(in srgb, var(--series-2) 20%, var(--surface-1)); }
.badge[data-cat="Abonnementen"] { background: color-mix(in srgb, var(--series-3) 20%, var(--surface-1)); }
.badge[data-cat="Overig"] { background: color-mix(in srgb, var(--series-4) 20%, var(--surface-1)); }
.bar-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.bar-row-label { width: 190px; flex-shrink: 0; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.bar-track { flex: 1; background: var(--gridline); border-radius: 3px; height: 20px; display: flex; gap: 2px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 2px; }
.bar-value { width: 120px; flex-shrink: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.bar-row-total { padding-bottom: 13px; margin-bottom: 6px; border-bottom: 1px solid var(--gridline); }
.bar-row-total .bar-row-label { font-weight: 600; }
.bar-row-total .bar-track { height: 24px; }
footer { color: var(--text-muted); font-size: 12px; margin-top: 8px; }
.month-nav { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.month-nav-controls { display: flex; align-items: center; gap: 10px; }
.nav-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.nav-btn:hover:not(:disabled) { background: var(--hover-wash); }
.nav-btn:disabled { opacity: 0.35; cursor: default; }
.month-position { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 40px; text-align: center; }
.tab-bar { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--gridline); }
.tab { padding: 8px 14px; font-size: 13px; color: var(--text-secondary); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--series-1); }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 22px; }
.topbar-title { font-size: 13px; color: var(--text-secondary); }
.month-form, .logout-form, .topbar-actions { display: flex; align-items: center; gap: 8px; margin: 0; }
.month-form label { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
input[type="month"], input[type="text"], input[type="password"] {
  font: inherit; font-size: 14px; color: var(--text-primary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
.btn {
  font: inherit; font-size: 13px; font-weight: 600; color: #fff; background: var(--series-1);
  border: 0; border-radius: 8px; padding: 8px 12px; cursor: pointer;
}
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.btn:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--hover-wash); color: var(--text-primary); filter: none; }
.btn-danger { background: var(--series-2); }
.reset-card { margin-top: 24px; }
.confirm { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; font-size: 13px; color: var(--text-secondary); }
.confirm input { margin-top: 2px; }
.alert, .notice {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 20px; font-size: 14px;
}
.alert { background: color-mix(in srgb, var(--series-2) 12%, var(--surface-1)); }
.notice { background: color-mix(in srgb, var(--series-3) 14%, var(--surface-1)); }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: min(420px, 100%); margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; color: var(--text-secondary); }
.field input { width: 100%; }
.auth-card .btn { width: 100%; padding: 10px 12px; }
.hint { color: var(--text-muted); font-size: 12px; margin: 12px 0 0; }
.csv-row { margin: 0 0 8px; }
.csv-link { color: var(--series-1); font-size: 13px; }
@media (max-width: 720px) {
  .viz-root { padding: 20px 14px 48px; }
  .card { padding: 16px; }
  .bar-row { flex-wrap: wrap; }
  .bar-row-label, .bar-value { width: auto; }
  .bar-track { flex-basis: 100%; }
  .stat-value { font-size: 20px; }
}
