:root {
    color-scheme: light;
    --surface-0: #f4f3f0;
    --surface-1: #fcfcfb;
    --surface-raised: #ffffff;
    --border: #dcdad5;
    --grid: #ecebe7;
    --text-primary: #0b0b0b;
    --text-secondary: #52514e;
    --text-muted: #77756f;
    --series-1: #2a78d6;
    --series-1-hover: #1c5cab;
    --series-1-light: #86b6ef;
    --on-series: #ffffff;
    --accent-soft: #cde2fb;
    --warning: #9a6200;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --surface-0: #121211;
        --surface-1: #1a1a19;
        --surface-raised: #242423;
        --border: #3a3936;
        --grid: #2a2a28;
        --text-primary: #f0efec;
        --text-secondary: #c3c2b7;
        --text-muted: #96958c;
        --series-1: #3987e5;
        --series-1-hover: #5598e7;
        --series-1-light: #1c5cab;
        --on-series: #ffffff;
        --accent-soft: #184f95;
        --warning: #e0a030;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --surface-0: #121211;
    --surface-1: #1a1a19;
    --surface-raised: #242423;
    --border: #3a3936;
    --grid: #2a2a28;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #96958c;
    --series-1: #3987e5;
    --series-1-hover: #5598e7;
        --series-1-light: #1c5cab;
    --on-series: #ffffff;
    --accent-soft: #184f95;
    --warning: #e0a030;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--surface-0);
    color: var(--text-primary);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

.page { max-width: 1400px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.sub { color: var(--text-secondary); margin: 0 0 16px; }

.filters {
    display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center;
    padding: 12px 16px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px;
    margin-bottom: 16px; position: sticky; top: 0; z-index: 5;
}
.filters label { display: inline-flex; gap: 6px; align-items: center; color: var(--text-secondary); }
.filters .group { display: inline-flex; gap: 10px; align-items: center; }
.filters .group > span { font-weight: 600; color: var(--text-primary); }
select {
    font: inherit; color: var(--text-primary); background: var(--surface-raised);
    border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px;
}

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
.kpi .label { color: var(--text-secondary); font-size: 13px; }
.kpi .value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.card h2 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 10px; font-size: 15px; }
.crumbs button {
    background: none; border: none; padding: 2px 4px; color: var(--series-1); cursor: pointer; font: inherit;
    border-radius: 4px;
}
.crumbs button:hover { background: var(--accent-soft); }
.crumbs .sep { color: var(--text-muted); }
.crumbs .current { font-weight: 600; }
.hint { color: var(--text-muted); font-size: 13px; }

.treemap { height: 480px; }
.barchart { height: 280px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
th { color: var(--text-secondary); font-weight: 600; position: sticky; top: 0; background: var(--surface-1); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--accent-soft); }
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; border: 1px solid var(--border); color: var(--text-secondary); font-size: 12px; }
.warn { color: var(--warning); }

#blazor-error-ui {
    background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); display: none;
    left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; color: #000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* Zoeken */
.search { flex: 1 1 260px; }
.search input {
    width: 100%; font: inherit; color: var(--text-primary); background: var(--surface-raised);
    border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px;
}
.search input:focus { outline: 2px solid var(--series-1); outline-offset: -1px; }

button.link {
    background: none; border: none; padding: 0; font: inherit; color: var(--series-1); cursor: pointer; text-align: left;
}
button.link:hover { text-decoration: underline; }
a { color: var(--series-1); }

/* Detailpaneel */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .25); z-index: 20; }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100%); z-index: 21; overflow-y: auto;
    background: var(--surface-1); border-left: 1px solid var(--border); padding: 16px 20px 40px;
    box-shadow: -8px 0 24px rgba(0, 0, 0, .15);
}
.drawer-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.drawer-kind { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.drawer-head .close { margin-left: auto; font-size: 18px; color: var(--text-secondary); }
.drawer h2 { font-size: 20px; margin: 0 0 4px; }
.drawer h3 { font-size: 14px; margin: 18px 0 6px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.drawer section p { margin: 0 0 8px; }
.amounts { display: flex; gap: 24px; margin: 12px 0; }
.amounts .label { color: var(--text-secondary); font-size: 13px; }
.amounts .value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
dl { display: grid; grid-template-columns: 150px 1fr; gap: 4px 12px; margin: 0; }
dt { color: var(--text-secondary); }
dd { margin: 0; }
@media (max-width: 600px) { dl { grid-template-columns: 1fr; } dt { margin-top: 6px; } }

.barchart.tall { height: 560px; }
input.gemeente {
    font: inherit; color: var(--text-primary); background: var(--surface-raised);
    border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; width: 170px;
}
.notice {
    border: 1px solid var(--warning); border-left-width: 4px; border-radius: 8px;
    background: var(--surface-1); padding: 10px 14px; margin-bottom: 12px;
}
.notice strong { color: var(--warning); }

.barchart.short { height: 200px; }
details.reference { margin-top: 14px; border-top: 1px solid var(--grid); padding-top: 10px; }
details.reference summary { cursor: pointer; font-weight: 600; color: var(--text-secondary); }
details.reference p { margin: 8px 0; }
tr.total td { font-weight: 600; border-top: 2px solid var(--border); }

.segmented { float: right; display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.segmented button { font: inherit; font-size: 13px; padding: 3px 12px; border: none; background: var(--surface-raised); color: var(--text-secondary); cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.active { background: var(--series-1); color: var(--on-series); }

.toplink { float: right; margin-top: 4px; }
.btn { font: inherit; font-size: 13px; padding: 3px 10px; margin-top: 4px; border: 1px solid var(--series-1); border-radius: 6px; background: var(--series-1); color: var(--on-series); cursor: pointer; }
.btn:hover { background: var(--series-1-hover); }
table.review td.actions select { max-width: 260px; }
table.review tr.done td { opacity: .6; }
code { font-size: 12px; background: var(--surface-raised); border: 1px solid var(--grid); border-radius: 4px; padding: 0 4px; }
