:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e1dc;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #8a8984;
  --accent: #2a78d6;
  --in: #2a78d6;      /* serie 1: inkomsten */
  --out: #eb6834;     /* serie 2: uitgaven */
  --pos: #0b7a3b;
  --neg: #b4362f;
  --warn-bg: #fff4d6;
  --row-hover: #f2f6fc;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --border: #33332f;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e86; --accent: #3987e5;
    --in: #3987e5; --out: #d95926; --pos: #4cc27a; --neg: #ef7b72;
    --warn-bg: #3a3014; --row-hover: #1f2733;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --border: #33332f;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e86; --accent: #3987e5;
  --in: #3987e5; --out: #d95926; --pos: #4cc27a; --neg: #ef7b72;
  --warn-bg: #3a3014; --row-hover: #1f2733;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Ubuntu, Cantarell, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
nav.top { display: flex; gap: 4px; align-items: center; padding: 8px 20px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
nav.top .logo { font-weight: 700; margin-right: 16px; color: var(--text); }
nav.top a.item { padding: 6px 10px; border-radius: 6px; color: var(--text-2); }
nav.top a.item.actief, nav.top a.item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
nav.top .badge { background: var(--out); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: 4px; }
nav.top .rechts { margin-left: auto; display: flex; gap: 8px; align-items: center; }
main { padding: 20px; max-width: 1500px; margin: 0 auto; }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.kaart { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.raster { display: grid; gap: 16px; }
.raster.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.raster.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .raster.k3, .raster.k2 { grid-template-columns: 1fr; } }
.kpi .label { color: var(--text-2); font-size: 13px; }
.kpi .rij { display: flex; justify-content: space-between; padding: 3px 0; }
.kpi .groot { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.muted { color: var(--muted); }
.klein { font-size: 12px; }

table { border-collapse: collapse; width: 100%; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-weight: 600; color: var(--text-2); font-size: 12px; background: var(--surface); position: sticky; top: 49px; z-index: 5; }
tbody tr:hover { background: var(--row-hover); }
.tabelwrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.tabelwrap th { top: 0; }

form.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 14px; }
form.filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--text-2); gap: 2px; }
input, select, textarea, button { font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; }
button, .knop { cursor: pointer; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 12px; color: var(--text); display: inline-block; }
button.primair, .knop.primair { background: var(--accent); color: #fff; border-color: var(--accent); }
button:hover, .knop:hover { filter: brightness(0.96); text-decoration: none; }
select.cat { max-width: 250px; padding: 3px 4px; font-size: 13px; }
select.scope { padding: 3px 4px; font-size: 13px; }
select.leeg { background: var(--warn-bg); }
.manueel { border-color: var(--accent); }

.flash { background: var(--warn-bg); border: 1px solid var(--border); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
.omschr { max-width: 460px; color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp { font-weight: 550; }
tr.detail td { background: var(--surface-2); }
.detailraster { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; font-size: 13px; }
.detailraster .lang { word-break: break-word; }
.chip { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); display: none; gap: 10px;
  align-items: center; z-index: 50; max-width: 90vw; }
#toast button { background: transparent; color: var(--bg); border-color: var(--muted); }
#toast button.primair { background: var(--accent); border-color: var(--accent); color: #fff; }

.bulkbalk { display: none; gap: 8px; align-items: center; background: var(--warn-bg); padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; flex-wrap: wrap; }

/* draaitabel */
table.draai td, table.draai th { padding: 4px 6px; font-size: 12.5px; }
table.draai tr.groep td { font-weight: 650; background: var(--surface-2); }
table.draai tr.cat td:first-child { padding-left: 22px; }
table.draai tr.tot td { font-weight: 700; border-top: 2px solid var(--text-2); }
table.draai td a { color: inherit; }
table.draai tr.cat.verborgen { display: none; }
table.draai tr.groep td:first-child { cursor: pointer; }
.balk { height: 8px; background: var(--out); border-radius: 0 4px 4px 0; min-width: 2px; }
.balk.in { background: var(--in); }
.grafiek { position: relative; height: 300px; }
.paginering { display: flex; gap: 6px; margin: 12px 0; align-items: center; }
ul.lijst { margin: 0; padding-left: 18px; line-height: 1.8; }
