:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #efede7;
  --text: #1c1b19;
  --muted: #6b6860;
  --line: #dedbd2;
  --accent: #e85d04;
  --accent-ink: #ffffff;
  --ok: #1f8a4c;
  --ok-bg: #e3f4ea;
  --warn: #a15c00;
  --warn-bg: #fdf0d9;
  --bad: #b42318;
  --bad-bg: #fde8e6;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141412; --surface: #1e1d1b; --surface-2: #2a2926; --text: #f1efe9; --muted: #a39f95;
    --line: #34322e; --ok: #5cc98a; --ok-bg: #173323; --warn: #f0b45a; --warn-bg: #3a2a12;
    --bad: #f28b82; --bad-bg: #3d1a17; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141412; --surface: #1e1d1b; --surface-2: #2a2926; --text: #f1efe9; --muted: #a39f95;
  --line: #34322e; --ok: #5cc98a; --ok-bg: #173323; --warn: #f0b45a; --warn-bg: #3a2a12;
  --bad: #f28b82; --bad-bg: #3d1a17; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 520px; }

.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1000;
}
.topbar .grow { flex: 1; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.brand-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--c, var(--accent)); flex: none; overflow: hidden;
}
.brand-icon.logo { background: #fff; border: 1px solid var(--line); }
.brand-icon.app { background: none; border-radius: 22%; }
.wordmark { font-weight: 800; letter-spacing: -.02em; }
.wordmark span { color: var(--accent); }
/* Reclame: vast blok met label, vooraf gereserveerde hoogte (niets verspringt) */
.ad-slot { min-height: 118px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 0 8px; overflow: hidden; }
.ad-slot .ad-label { display: block; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.ad-slot ins.adsbygoogle { min-height: 90px; }
.ad-slot:has(ins[data-ad-status="unfilled"]) { display: none; }
.ad-slot.ad-demo .ad-box { height: 90px; border: 1px dashed var(--line); border-radius: 10px; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.todo { background: #fde68a; color: #1c1b19; padding: 0 4px; border-radius: 4px; }

.credit { text-align: center; font-size: .78rem; color: var(--muted); padding: 18px 16px 22px; }
.credit a { color: inherit; font-weight: 650; text-decoration: none; border-bottom: 1px solid currentColor; }
.credit a:hover { color: var(--accent); }
.brand-icon img { width: 100%; height: 100%; object-fit: contain; }
.logo-preview { width: 72px; height: 72px; border-radius: 14px; }
.school-card { display: flex; gap: 12px; align-items: center; }
.school-card .grow { flex: 1; min-width: 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); margin-bottom: 6px; }
.admin-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 12px; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } }

button, .btn {
  font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 9px 14px; border-radius: 10px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px;
}
button:hover, .btn:hover { background: var(--surface-2); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.06); }
button.danger { color: var(--bad); }
button.ghost { background: transparent; border-color: transparent; }
button:disabled { opacity: .5; cursor: default; }
button.small, .btn.small { padding: 5px 10px; min-height: 32px; font-size: .82rem; }

label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
input, textarea, select {
  font: inherit; width: 100%; padding: 9px 11px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
input[type="checkbox"] { width: auto; }
input[type="color"] { padding: 2px; height: 40px; width: 64px; }
textarea { resize: vertical; min-height: 70px; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 650;
  padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.ok .dot { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

.banner { padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-weight: 550; }
.banner.info { background: var(--surface-2); color: var(--text); }
.demo-bar { background: #2b2a27; color: #f4d58d; font-size: .8rem; text-align: center; padding: 6px 12px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: #1c1b19; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 5000;
  transition: .2s; pointer-events: none; font-size: .9rem;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Kaart & markers */
.map { height: 340px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); z-index: 0; }
.bus-marker { position: relative; width: 44px; height: 44px; }
.bus-dot {
  position: absolute; inset: 6px; border-radius: 50%; background: var(--c); display: grid; place-items: center;
  border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.bus-marker.stale .bus-dot { filter: grayscale(.8); opacity: .75; }
.bus-arrow { position: absolute; inset: 0; }
.bus-arrow span {
  position: absolute; left: 50%; top: -5px; transform: translateX(-50%);
  border: 7px solid transparent; border-bottom: 10px solid var(--c); border-top: 0;
}
.leaflet-container { font: inherit; }

/* Statuspagina */
.status-page { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.status-page .map-full { flex: 1; min-height: 52vh; z-index: 0; }
.status-sheet {
  background: var(--surface); border-top: 1px solid var(--line); padding: 16px;
  box-shadow: 0 -6px 20px rgba(0,0,0,.06);
}
.status-side { display: contents; }
.status-page .topbar { order: -1; }
.status-page .map-wrap { order: 0; min-height: 52vh; }
.status-page .status-sheet { order: 1; }
@media (min-width: 900px) {
  .status-page { flex-direction: row; height: 100vh; }
  .status-side { display: flex; flex-direction: column; order: 0; width: 400px; height: 100vh; border-right: 1px solid var(--line); background: var(--surface); }
  .status-page .topbar { position: static; }
  .status-page .status-sheet { flex: 1; overflow-y: auto; border-top: 0; box-shadow: none; }
  .status-page .map-wrap { order: 1; height: 100vh; }
}
.big-stat { font-size: 1.9rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.stat .label { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.15rem; font-weight: 700; }
.message-box {
  border-left: 4px solid var(--accent); background: var(--warn-bg); color: var(--text);
  padding: 10px 12px; border-radius: 8px;
}
.map-btn {
  position: absolute; right: 12px; bottom: 24px; z-index: 500; box-shadow: var(--shadow);
}
.map-wrap { position: relative; flex: 1; display: flex; }
.map-wrap .map-full { flex: 1; }

/* Chauffeur */
.driver-main { max-width: 520px; margin: 0 auto; padding: 16px; }
.track-btn {
  width: 100%; min-height: 120px; font-size: 1.5rem; border-radius: 22px; font-weight: 750;
  background: #1f8a4c; border-color: #1f8a4c; color: #fff;
}
.track-btn.stop { background: #b42318; border-color: #b42318; }
.track-btn:hover { filter: brightness(1.08); background: #1f8a4c; }
.track-btn.stop:hover { background: #b42318; }
.state-light { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); flex: none; }
.state-light.on { background: var(--ok); box-shadow: 0 0 0 6px var(--ok-bg); animation: pulse 1.6s infinite; }
.state-light.idle { background: var(--warn); box-shadow: 0 0 0 6px var(--warn-bg); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Beheer */
.bus-list { display: grid; gap: 12px; }
@media (min-width: 760px) { .bus-list { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); } }
.bus-card { display: flex; flex-direction: column; gap: 10px; }
.bus-card .head { display: flex; gap: 10px; align-items: flex-start; }
.bus-card .head .grow { flex: 1; min-width: 0; }
.bus-card h3 { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; }

dialog {
  border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text);
  width: min(760px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
dialog::backdrop { background: rgba(10,10,8,.5); }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 10; }
.dlg-head h2 { flex: 1; }
.dlg-body { padding: 16px; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); z-index: 10; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0 0 14px; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }
.win-row { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: var(--surface-2); margin-bottom: 8px; }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.days label {
  margin: 0; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 34px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; user-select: none;
}
.days input { display: none; }
.days label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; }
.times { display: flex; gap: 8px; align-items: center; }
.times input { width: 120px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--surface-2); font-size: .85rem; }
.chip button { min-height: 0; padding: 0 6px; border: 0; background: transparent; }
.link-box { display: flex; gap: 6px; align-items: center; }
.link-box input { font-size: .82rem; font-family: ui-monospace, Consolas, monospace; }
.qr { display: grid; place-items: center; padding: 16px; background: #fff; border-radius: 12px; }
.qr img, .qr canvas { max-width: 100%; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

/* Ritten met ouders */
.progress { height: 14px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.progress span { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #ffb21a, #e2470b); transition: width .5s; }
.progress span.done { background: linear-gradient(90deg, #5cc98a, #1f8a4c); }
.progress-row + .progress-row { margin-top: 10px; }
.choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice label { margin: 0; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface); font-size: 1.5rem; text-align: center; transition: .15s; }
.choice span b { font-size: .95rem; }
.choice span small { font-size: .72rem; color: var(--muted); font-weight: 500; }
.choice input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 48px; height: 48px; font-size: 1.4rem; border-radius: 12px; }
.stepper input { width: 80px; text-align: center; font-size: 1.4rem; font-weight: 700; height: 48px; }
.ev-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.ev-line { display: flex; gap: 10px; align-items: flex-start; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.ev-line > span { font-size: 1.3rem; }
.ride-card .progress { height: 10px; }
.ride-card .mini { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; font-size: .85rem; }

/* Marketing (hoofdadmin) */
.super-tabs { display: flex; gap: 4px; padding: 10px 16px 0; max-width: 1100px; margin: 0 auto; }
.super-tabs button { border-radius: 10px 10px 0 0; border-bottom: 0; }
.super-tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.kpi .label { font-size: .75rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.kpi .sub { font-size: .78rem; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 150px; position: relative; padding-bottom: 20px; }
.chart-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.chart-bar span { display: block; width: 100%; background: linear-gradient(180deg, #ffb21a, #e2470b); border-radius: 3px 3px 0 0; min-height: 0; }
.chart-bar:hover span { filter: brightness(1.15); }
.bars-axis { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.mk-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.mk-table th, .mk-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.mk-table th { color: var(--muted); font-weight: 650; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.mk-table code { font-size: .8rem; }
.announce { border-left: 4px solid var(--accent); background: var(--surface); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; }
.announce .grow { flex: 1; min-width: 0; }

/* QR-voorbeeld in huisstijl */
.qr-card { background: #fff; border: 4px solid #ff7a18; border-radius: 22px; padding: 10px 10px 12px; box-shadow: 0 8px 24px rgba(232,93,4,.18); }
.qr-card img { display: block; width: 100%; aspect-ratio: 1; min-height: 200px; }
.qr-brand { display: flex; align-items: center; justify-content: center; gap: 8px; color: #6b6860; font-size: .82rem; margin-top: 6px; }
.qr-brand b { color: #1c1b19; }
.qr-brand .brand-icon { width: 22px; height: 22px; }
