:root {
    color-scheme: light dark;
    --bg: #fafafa; --surface: #fff; --sunken: #f4f4f5; --line: #e4e4e7; --line-strong: #d4d4d8;
    --text: #18181b; --muted: #71717a; --faint: #a1a1aa;
    --accent: #4f46e5; --accent-hover: #4338ca; --accent-soft: #eef2ff; --on-accent: #fff;
    --ok: #15803d; --ok-soft: #f0fdf4; --warn: #b45309; --warn-soft: #fffbeb; --bad: #b91c1c; --bad-soft: #fef2f2; --info: #4338ca; --info-soft: #eef2ff;
    --shadow: 0 1px 2px rgb(24 24 27 / .04), 0 1px 3px rgb(24 24 27 / .06);
    --radius: 12px;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #09090b; --surface: #131316; --sunken: #1c1c21; --line: #27272a; --line-strong: #3f3f46;
        --text: #fafafa; --muted: #a1a1aa; --faint: #71717a;
        --accent: #818cf8; --accent-hover: #a5b4fc; --accent-soft: #1e1b4b; --on-accent: #0b0b12;
        --ok: #4ade80; --ok-soft: #052e16; --warn: #fbbf24; --warn-soft: #2b1d05; --bad: #f87171; --bad-soft: #2d0a0a; --info: #a5b4fc; --info-soft: #1e1b4b;
        --shadow: none;
    }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; letter-spacing: -.003em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1 { font-size: 22px; line-height: 1.25; font-weight: 650; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 14px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 14px; }
p { margin: 0 0 12px; }
code { font: 12.5px/1.5 ui-monospace, 'SF Mono', Menlo, monospace; background: var(--sunken); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; word-break: break-word; }

/* Schil: zijbalk links, inhoud rechts */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 650; font-size: 15px; letter-spacing: -.02em; padding: 4px 10px 18px; }
.brand:hover { color: var(--text); }
.brand .mark { width: 24px; height: 24px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; }
.brand .mark::before { content: ''; width: 10px; height: 10px; border: 2px solid var(--on-accent); border-left-color: transparent; border-radius: 50%; transform: rotate(-45deg); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.sidebar nav a { display: flex !important; align-items: center; gap: 10px; }
.sidebar nav a, .sidebar .logout button { display: block; width: 100%; text-align: left; color: var(--muted); padding: 7px 10px; border-radius: 8px; font: inherit; font-weight: 500; background: none; border: 0; cursor: pointer; }
.sidebar nav a:hover, .sidebar .logout button:hover { color: var(--text); background: var(--sunken); }
.sidebar nav a.active { color: var(--text); background: var(--sunken); font-weight: 600; }
.sidebar .group { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 18px 10px 6px; }
.sidebar .spacer { flex: 1; }
.sidebar .who { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line); margin-top: 8px; font-size: 13px; color: var(--muted); border-radius: 0 0 8px 8px; min-width: 0; }
.sidebar a.who:hover, .sidebar a.who.active { background: var(--sunken); color: var(--muted); }
.sidebar .who > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .who strong { display: block; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
main { padding: 32px 40px 80px; max-width: 1180px; width: 100%; }
.plain main { margin: 0 auto; }

.head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.sub { color: var(--muted); margin: 4px 0 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .value { font-size: 26px; line-height: 1.3; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 2px; }

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
th { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; padding-top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
td a { font-weight: 500; color: var(--text); }
td a:hover { color: var(--accent); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 1.6; background: var(--sunken); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }

.btn { display: inline-flex; align-items: center; justify-content: center; background: var(--text); color: var(--bg); border: 1px solid transparent; border-radius: 9px; padding: 8px 14px; font: inherit; font-weight: 550; line-height: 1.3; cursor: pointer; white-space: nowrap; transition: opacity .12s, background .12s, border-color .12s; }
.btn:hover { opacity: .86; color: var(--bg); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); box-shadow: var(--shadow); }
.btn.secondary:hover { opacity: 1; background: var(--sunken); color: var(--text); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: var(--line-strong); box-shadow: var(--shadow); }
.btn.danger:hover { opacity: 1; background: var(--bad-soft); color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], select {
    width: 100%; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 9px; font: inherit; color: var(--text); background: var(--surface); box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s; }
input::placeholder { color: var(--faint); }
input:focus, select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
button:focus-visible, a:focus-visible, input[type=checkbox]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.field { margin-bottom: 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.error { color: var(--bad); font-size: 13px; margin: 6px 0 0; }

.notice { border-radius: 10px; padding: 11px 14px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--surface); border-left-width: 3px; }
.notice.ok { border-left-color: var(--ok); background: var(--ok-soft); }
.notice.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.notice.bad { border-left-color: var(--bad); background: var(--bad-soft); }
.notice a { font-weight: 550; }

.filters { display: grid; grid-template-columns: 2fr repeat(3, 1fr) auto; gap: 12px; align-items: end; }
.filters label { margin-bottom: 6px; }
.days { display: flex; gap: 10px; flex-wrap: wrap; }
.days label { font-weight: 400; display: flex; gap: 5px; align-items: center; margin: 0; color: var(--muted); }
.brand.guest { justify-content: center; padding: 8vh 0 0; font-size: 17px; }
.auth { max-width: 400px; margin: 28px auto 0; padding: 28px; }
.auth h1 { margin-bottom: 18px; }
.auth .btn { padding: 9px 16px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); margin: 0; }
.card.empty h2 { color: var(--text); font-size: 16px; margin-bottom: 6px; }
.card.empty .btn { margin-top: 8px; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }

/* Instellingen: uitleg links, bediening rechts */
.section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px 40px; padding: 28px 0; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: 0; padding-top: 4px; }
.section > header h2 { margin: 0 0 4px; font-size: 15px; }
.section > header p { color: var(--muted); margin: 0; }
.section .card { margin: 0; }
.section .card + .card { margin-top: 12px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.row + .row { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.row .text strong { display: block; font-weight: 600; }
.row .text span { display: block; color: var(--muted); margin-top: 2px; }
.switch { position: relative; flex: none; width: 42px; height: 24px; border-radius: 999px; border: 0; padding: 0; background: var(--line-strong); cursor: pointer; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .15s; }
.switch[aria-checked=true] { background: var(--accent); }
.switch[aria-checked=true]::after { transform: translateX(18px); }
.meter { margin-bottom: 16px; }
.meter:last-child { margin-bottom: 0; }
.meter .top { display: flex; justify-content: space-between; margin-bottom: 6px; }
.meter .top span { color: var(--muted); font-variant-numeric: tabular-nums; }
.meter .bar { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.meter .bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.meter .bar i.full { background: var(--warn); }
.people { list-style: none; margin: 0 0 16px; padding: 0; }
.people li { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.people .who-name { font-weight: 500; }
.people .who-mail { color: var(--muted); font-size: 13px; }
.card.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.card.calm { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }

/* Regelformulier */
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 650; vertical-align: 1px; }
.blocks { display: grid; gap: 10px; margin-bottom: 14px; }
.blocks:empty { margin: 0; }
.block { background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 10px; }
.line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.line .word { color: var(--muted); }
.line input[type=time], .line input[type=date], .line select { width: auto; }
.line .note { flex: 1; min-width: 160px; }
.line .remove { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.line .remove:hover { background: var(--bad-soft); color: var(--bad); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { margin: 0; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: block; min-width: 38px; text-align: center; padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font-weight: 500; font-size: 13px; transition: background .12s, color .12s, border-color .12s; }
.chip:hover span { border-color: var(--accent); }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.empty-hint { color: var(--muted); margin: 0 0 14px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.choice { position: relative; margin: 0; padding: 14px 16px 14px 44px; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; font-weight: 400; font-size: 14px; transition: border-color .12s, background .12s; }
.choice input { position: absolute; left: 16px; top: 17px; accent-color: var(--accent); margin: 0; }
.choice strong { display: block; font-weight: 600; }
.choice span { display: block; color: var(--muted); margin-top: 2px; }
.choice:hover { border-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
input.short { width: 84px; text-align: right; flex: none; }
.with-unit { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); flex: none; }
.more { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.more summary { cursor: pointer; color: var(--accent); font-weight: 500; width: fit-content; }
.more[open] summary { margin-bottom: 16px; }
.savebar { position: sticky; bottom: 16px; z-index: 2; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 8px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(24 24 27 / .10); }
.savebar .btn { margin-left: auto; }
.check { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; font-size: 14px; cursor: pointer; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; padding-bottom: 0; }
.timeline li:first-child { padding-top: 0; }
.timeline .when { font-variant-numeric: tabular-nums; }

/* Overzichten */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.checklist li { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; padding-bottom: 2px; }
.checklist .dot { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; font-size: 12px; font-weight: 650; color: var(--muted); }
.checklist li.done .dot { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.checklist li.done .text strong { color: var(--muted); font-weight: 500; }
.checklist .text { flex: 1; min-width: 0; }
.checklist .text strong { display: block; font-weight: 600; }
.checklist .text span { color: var(--muted); }
.progress-line { height: 6px; border-radius: 999px; background: var(--sunken); overflow: hidden; margin: 4px 0 14px; }
.progress-line i { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); color: var(--text); transition: border-color .12s, transform .12s; }
a.tile:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
a.tile.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.summary .icon { font-size: 16px; }
.summary:not(.off) .icon { background: var(--warn-soft); color: var(--warn); }
.tile .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.tile .top strong { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.tile ul { list-style: none; margin: 0 0 12px; padding: 0; color: var(--muted); }
.tile ul li { padding: 2px 0; }
.tile .foot { color: var(--muted); font-size: 13px; padding-top: 10px; border-top: 1px solid var(--line); }
.stock { display: inline-flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.stock.zero { color: var(--bad); font-weight: 600; }
.bulkbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 14px; background: var(--sunken); border-radius: 10px; }
.bulkbar select { width: auto; }
.bulkbar .count { font-weight: 600; min-width: 110px; }
tbody tr.selectable:hover { background: color-mix(in srgb, var(--sunken) 60%, transparent); }
.summary { display: flex; gap: 16px; align-items: flex-start; padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); margin-bottom: 16px; }
.summary .icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.summary.off .icon { background: var(--sunken); color: var(--muted); }
.summary strong { display: block; font-size: 15px; font-weight: 600; }
.summary p { margin: 2px 0 0; color: var(--muted); }
.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; }
.steps li { counter-increment: step; position: relative; padding: 0 0 14px 34px; color: var(--muted); }
.steps li::before { content: counter(step); position: absolute; left: 0; top: -1px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 650; display: grid; place-items: center; }
.steps li strong { color: var(--text); font-weight: 600; }
pre.code { margin: 0; padding: 14px 16px; background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; font: 12.5px/1.6 ui-monospace, 'SF Mono', Menlo, monospace; overflow-x: auto; }
.endpoints { display: grid; gap: 0; }
.endpoints div { display: grid; grid-template-columns: minmax(230px, auto) 1fr; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.endpoints div:last-child { border-bottom: 0; }
.endpoints span { color: var(--muted); }
.endpoints code { background: none; border: 0; padding: 0; }
.verb { display: inline-block; min-width: 38px; font-weight: 650; font-size: 11px; letter-spacing: .03em; color: var(--accent); }

@media (max-width: 860px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: static; height: auto; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 8px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
    .brand { padding: 4px 6px; }
    .sidebar .logout { grid-row: 1; }
    .sidebar .logout button { width: auto; }
    .sidebar nav { grid-column: 1 / -1; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
    .sidebar nav a { white-space: nowrap; width: auto; }
    .sidebar .group, .sidebar .spacer { display: none; }
    .sidebar .who { grid-row: 1; grid-column: 2; border: 0; margin: 0; padding: 4px 6px; border-radius: 8px; }
    .sidebar .who > span:last-child { display: none; }
    .sidebar .logout { grid-column: 3; }
    .sidebar { grid-template-columns: 1fr auto auto; }
    main { padding: 20px 16px 64px; }
    .filters { grid-template-columns: 1fr 1fr; }
    .notice { overflow-wrap: anywhere; }
    .section { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 22px 0; }
    .endpoints div { grid-template-columns: 1fr; gap: 2px; }
    .sidebar nav a svg { display: none; }
}
