@font-face {
    font-family: "Inter";
    src: url("inter.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --bg: #0b0a12;
    --surface: #15132a;
    --surface-2: #1d1a38;
    --border: #2f2b52;
    --grid: #25224a;
    --text: #f1effa;
    --muted: #a7a2c3;
    --purple: #7c3aed;
    --purple-light: #b79cff;
    --blue: #2563eb;
    --series: #7fb2ff;
    --red: #d92d3a;
    --red-light: #ff9199;
    --gradient: linear-gradient(100deg, var(--purple), var(--blue));
    --q0: #24214a;
    --q1: #463b96;
    --q2: #5a4cb4;
    --q3: #7562dc;
    --q4: #9886f3;
    --q5: #c9bdff;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Inter", system-ui, sans-serif; }
h1, h2, h3 { margin: 0; font-weight: 650; line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: 1.625rem; }
h2 { font-size: 1rem; }
h3 { margin-bottom: 8px; font-size: .875rem; color: var(--muted); font-weight: 600; letter-spacing: 0; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code { padding: 1px 5px; background: var(--surface-2); border-radius: 4px; font-size: .8125rem; }
:focus-visible { outline: 2px solid var(--series); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }

/* Schil */
.shell { min-height: 100vh; }
.side { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.0625rem; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; background: var(--gradient); border-radius: 8px; color: #fff; font-size: 1rem; }
.side-nav { order: 3; display: flex; gap: 4px; width: 100%; overflow-x: auto; scrollbar-width: none; }
.side-nav a, .side-foot a, .side-foot button { padding: 7px 10px; background: none; border: 0; border-radius: 8px; color: var(--muted); font-size: .875rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.side-nav a:hover, .side-foot a:hover, .side-foot button:hover { background: var(--surface-2); color: var(--text); }
.side-nav a[aria-current], .side-foot a[aria-current] { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--purple-light); }
.side-foot { display: flex; margin-left: auto; gap: 2px; }
.main { min-width: 0; padding: 20px 16px 48px; display: grid; gap: 16px; align-content: start; }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.flash { padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--purple); border-radius: 10px; }
.alert { margin-bottom: 12px; padding: 10px 14px; background: rgba(217, 45, 58, .14); border: 1px solid var(--red); border-radius: 10px; }

.card { min-width: 0; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.card > h2, .card-head { margin-bottom: 14px; }
.card-flush { padding: 0; overflow: hidden; }
.card-narrow { max-width: 480px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.card-head a { color: var(--series); font-size: .875rem; text-decoration: none; }
.card-head h2 { margin: 0; }
.cols-2, .cols-3, .form-grid { display: grid; gap: 16px; align-items: start; }
.cols-flat { margin-top: 16px; }
.stack { display: grid; gap: 16px; }

.btn { display: inline-block; padding: 9px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; font-weight: 600; font-size: .875rem; line-height: 1.3; text-align: center; text-decoration: none; }
.btn:hover { border-color: var(--purple-light); }
.btn-primary { background: var(--gradient); border-color: transparent; color: #fff; }
.btn-primary:hover { filter: brightness(1.14); border-color: transparent; }
.btn-danger { color: var(--red-light); }
.btn-danger:hover { border-color: var(--red-light); }
.btn-block { display: block; width: 100%; }
.link { padding: 0; background: none; border: 0; color: var(--series); font-size: .8125rem; text-decoration: underline; }
.link-danger { color: var(--red-light); }

.segmented { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.segmented a, .segmented button { padding: 5px 12px; background: none; border: 0; border-radius: 7px; color: var(--muted); font-size: .8125rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.segmented a[aria-current], .segmented button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.segmented-small { background: var(--bg); }
.segmented-wrap { flex-wrap: wrap; justify-self: start; }

/* Kerncijfers */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { min-width: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.tile-label { color: var(--muted); font-size: .8125rem; }
.tile-value { margin-top: 2px; font-size: 1.5rem; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile-note { margin-top: 2px; color: var(--muted); font-size: .75rem; line-height: 1.3; }

/* Grafieken */
.chart { position: relative; min-height: 220px; }
.chart svg { display: block; }
.grid { stroke: var(--grid); stroke-width: 1; }
.axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bar { fill: var(--series); }
.cursor { stroke: var(--muted); stroke-width: 1; }
.marker { fill: var(--series); stroke: var(--surface); stroke-width: 2; }
.chart-empty { display: grid; place-items: center; height: 220px; }
.tip { position: fixed; z-index: 50; padding: 5px 9px; background: #000; border: 1px solid var(--border); border-radius: 6px; font-size: .8125rem; pointer-events: none; white-space: nowrap; }
.table-view { margin-top: 8px; }
.table-view summary { color: var(--muted); font-size: .8125rem; cursor: pointer; }
.table-view .table-scroll { max-height: 260px; overflow-y: auto; }

.hbars { display: grid; gap: 10px; }
.hbars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; font-size: .875rem; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-value { font-variant-numeric: tabular-nums; }
.hbar-track { grid-column: 1 / -1; display: block; height: 6px; background: var(--surface-2); border-radius: 3px; }
.hbar-fill { display: block; height: 100%; min-width: 3px; background: var(--series); border-radius: 3px; }
.table-sources .hbar-track { margin-top: 4px; min-width: 120px; }

.map-wrap { background: var(--bg); border-radius: 10px; overflow: hidden; }
.map { display: block; width: 100%; height: auto; }
.map path { stroke: var(--bg); stroke-width: .6px; vector-effect: non-scaling-stroke; }
.map .dot { fill: var(--text); stroke: var(--bg); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.q0 { fill: var(--q0); background: var(--q0); }
.q1 { fill: var(--q1); background: var(--q1); }
.q2 { fill: var(--q2); background: var(--q2); }
.q3 { fill: var(--q3); background: var(--q3); }
.q4 { fill: var(--q4); background: var(--q4); }
.q5 { fill: var(--q5); background: var(--q5); }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 10px; color: var(--muted); font-size: .75rem; }
.map-legend i { display: block; width: 22px; height: 10px; }
.map-legend i.q1 { border-radius: 3px 0 0 3px; margin-left: 4px; }
.map-legend i.q5 { border-radius: 0 3px 3px 0; margin-right: 4px; }
.legend-dot { display: inline-flex; align-items: center; gap: 6px; margin-left: 14px; }
.map-legend .dot-key { width: 10px; height: 10px; background: var(--text); border-radius: 50%; }
.source-note { margin-top: 12px; color: var(--muted); font-size: .75rem; }

/* Tabellen en lijsten */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { padding: 10px 14px; color: var(--muted); font-size: .75rem; font-weight: 500; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
td { padding: 10px 14px; border-bottom: 1px solid var(--grid); }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { border-top: 1px solid var(--border); border-bottom: 0; color: var(--muted); }
.row-total td { color: var(--text); font-weight: 650; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td a { text-decoration: none; }
td a:hover { color: var(--series); }
.card:not(.card-flush) th:first-child, .card:not(.card-flush) td:first-child { padding-left: 0; }
.card:not(.card-flush) th:last-child, .card:not(.card-flush) td:last-child { padding-right: 0; }
.product-cell { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.product-cell img, .no-photo { flex: none; width: 40px; height: 40px; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.no-photo { display: grid; place-items: center; color: var(--muted); font-size: .5625rem; line-height: 1.1; text-align: center; }
.product-cell small { display: block; color: var(--muted); font-size: .75rem; }
.pill { display: inline-block; padding: 1px 8px; background: var(--surface-2); border-radius: 10px; color: var(--muted); font-size: .75rem; white-space: nowrap; }
.pill-on { color: var(--series); }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--grid); font-size: .875rem; }
.list li:last-child { border-bottom: 0; }
.list li span:last-child { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.list a { text-decoration: none; }
.list a:hover { color: var(--series); }
.empty { color: var(--muted); font-size: .875rem; }

/* Formulieren */
.field { margin-bottom: 14px; min-width: 0; }
.field label, .login-card label { display: block; margin-bottom: 4px; font-size: .8125rem; font-weight: 500; }
input:not([type="checkbox"]):not([type="file"]), select, textarea { width: 100%; padding: 9px 11px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
input:focus, select:focus, textarea:focus { border-color: var(--purple-light); }
input[type="file"] { width: 100%; font-size: .875rem; }
textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hint { margin-top: 4px; color: var(--muted); font-size: .75rem; }
.error { margin-top: 4px; color: var(--red-light); font-size: .8125rem; }
.has-error input, .has-error select { border-color: var(--red-light); }
.check { display: flex; align-items: center; gap: 9px; padding: 4px 0; font-size: .875rem; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--purple-light); }
dl { margin: 0; }
.margin-box, .meta { display: grid; gap: 5px; font-size: .8125rem; }
.margin-box { padding: 10px 12px; background: var(--bg); border-radius: 8px; }
.meta { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--grid); }
.margin-box div, .meta div { display: flex; justify-content: space-between; gap: 12px; }
dt { color: var(--muted); }
dd { margin: 0; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; gap: 8px; max-width: 480px; }
.inline-form { display: grid; gap: 10px; align-items: end; }
.inline-form .field { margin: 0; }
.inline-row { padding-block: 12px; border-top: 1px solid var(--grid); }
.inline-row:first-of-type { padding-top: 0; border-top: 0; }
.count { font-size: .8125rem; white-space: nowrap; padding-bottom: 10px; }
.status-form { display: flex; gap: 8px; }
.spaced { margin-top: 10px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.photos img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.photo-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; margin-top: 6px; }
.danger-zone { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.danger-zone h2 { margin-bottom: 2px; }

.bad { color: var(--red-light); font-weight: 500; }
.clip { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.server-grid dd { font-size: 1.125rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.server-grid dd.sub { color: var(--muted); font-size: .75rem; font-weight: 400; }
.log-filter { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; margin-bottom: 12px; }
.log-filter .field { margin: 0; }
.log-filter .grow, .log-filter .btn { grid-column: 1 / -1; }
.log-scroll { max-height: 520px; overflow-y: auto; }
.log-table { font-size: .8125rem; font-variant-numeric: tabular-nums; }
.log-table td, .log-table th { padding: 6px 12px 6px 0; white-space: nowrap; }
.log-table .log-path { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.row-bad td { color: var(--red-light); }
.error-log { display: grid; gap: 10px; max-height: 420px; overflow-y: auto; font-size: .75rem; }
.error-log li { display: grid; gap: 2px; }
.error-log code { display: block; padding: 6px 8px; overflow-wrap: anywhere; background: var(--bg); color: var(--text); }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: radial-gradient(60% 70% at 20% 10%, rgba(124, 58, 237, .25), transparent 70%), radial-gradient(55% 60% at 85% 90%, rgba(37, 99, 235, .22), transparent 70%), var(--bg); }
.login-card { width: 100%; max-width: 380px; padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.login-card h1 { margin: 20px 0 16px; }
.login-card input { margin-bottom: 14px; }

@media (min-width: 620px) {
    .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .inline-form { grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) auto auto auto; }
}

@media (min-width: 900px) {
    .log-filter { grid-template-columns: 220px 110px 190px minmax(0, 1fr) auto; }
    .log-filter .grow, .log-filter .btn { grid-column: auto; }
    .shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); }
    .side { position: sticky; top: 0; flex-direction: column; flex-wrap: nowrap; align-items: stretch; height: 100vh; padding: 18px 12px; border-right: 1px solid var(--border); border-bottom: 0; }
    .brand { padding: 0 8px 10px; }
    .side-nav { order: 0; flex-direction: column; flex: 1; }
    .side-foot { flex-direction: column; margin-left: 0; }
    .side-foot button { width: 100%; text-align: left; }
    .main { padding: 28px; }
    .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: minmax(0, 1fr) 340px; }
}

@media (min-width: 1200px) {
    .tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
