/* ==========================================================================
   Motor Theorie A – stijlen
   Rustig, veel witruimte, grote leesbare tekst. Licht/donker via data-theme.
   ========================================================================== */

:root {
  /* Vriendelijk lichtblauw palet (eigen vormgeving) */
  --bg: #eef5fb;
  --surface: #ffffff;
  --surface-2: #e9f2fa;
  --text: #17324d;
  --text-muted: #557089;
  --border: #c9dcee;
  --primary: #1d6fb8;
  --primary-ink: #ffffff;
  --primary-soft: #dcebf8;
  --header-bg: linear-gradient(180deg, #d4e8f8 0%, #e7f2fb 100%);
  --focus: #f0a400;
  --ok: #2e7d32;
  --ok-soft: #e4f3e5;
  --bad: #c62828;
  --bad-soft: #fbe8e8;
  --warn: #b26a00;
  --warn-soft: #fff3d6;
  --mark: #e0a100;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 50, 77, .06), 0 4px 14px rgba(29, 111, 184, .08);
  --fs: 18px;
  --maxw: 900px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0f1822;
  --surface: #172331;
  --surface-2: #1e2d3e;
  --text: #e5eef7;
  --text-muted: #9bb1c6;
  --border: #2d4157;
  --primary: #6fb2ec;
  --primary-ink: #0b1a28;
  --primary-soft: #1b3550;
  --header-bg: linear-gradient(180deg, #16293c 0%, #132232 100%);
  --ok: #66bb6a;
  --ok-soft: #1b3321;
  --bad: #ef6b6b;
  --bad-soft: #3a1f23;
  --warn-soft: #3d3115;
  --shadow: none;
  color-scheme: dark;
}

[data-font="large"] { --fs: 20px; }
[data-font="xlarge"] { --fs: 23px; }

* { box-sizing: border-box; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; background: var(--bg); min-height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
}
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Layout ---------- */
.app-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 1rem; background: var(--header-bg); border-bottom: 1px solid var(--border);
}
.brand a { color: inherit; text-decoration: none; }
.brand { color: var(--primary); }
[data-theme="dark"] .brand { color: var(--text); }
.brand { font-weight: 800; letter-spacing: .06em; font-size: 1rem; margin: 0; }
.brand small { font-weight: 500; color: var(--text-muted); letter-spacing: 0; margin-left: .4rem; }
.header-actions { display: flex; gap: .5rem; align-items: center; }
main { max-width: var(--maxw); margin: 0 auto; padding: 1.25rem 1rem 6rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem;
}
.muted { color: var(--text-muted); }
.error { color: var(--bad); }

/* ---------- Knoppen ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1.1rem; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); font-weight: 600;
}
.btn:hover { background: var(--surface-2); }
a.btn { text-decoration: none; color: inherit; }
a.btn-primary { color: var(--primary-ink); }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn-primary:hover { filter: brightness(1.07); background: var(--primary); }
.btn-ghost { background: transparent; }
.btn-small { min-height: 36px; padding: .3rem .8rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Vraag ---------- */
.q-text { font-size: 1.15rem; font-weight: 600; line-height: 1.45; margin: 0 0 1rem; }
.media { margin: 0 0 1rem; display: flex; justify-content: center; }
.media svg.scene { width: 100%; max-width: 520px; height: auto; border-radius: 10px; display: block; }
.q-sign .media svg.scene, .media svg.scene[aria-label="Verkeersbord"] { max-width: 180px; }
.hint { color: var(--text-muted); font-size: .9rem; margin: .25rem 0 .75rem; }

/* Opties */
.opts { display: grid; gap: .6rem; }
.opt {
  display: flex; align-items: center; gap: .75rem; width: 100%; text-align: left;
  min-height: 52px; padding: .7rem .9rem; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 2px solid var(--border);
}
.opt:hover:not(:disabled) { border-color: var(--primary); }
.opt-key {
  flex: 0 0 auto; width: 1.8rem; height: 1.8rem; border-radius: 6px; display: grid; place-items: center;
  font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--text-muted);
}
.opt-mark {
  flex: 0 0 auto; width: 1.15rem; height: 1.15rem; border-radius: 50%; border: 2px solid var(--border);
}
.opts-multi .opt-mark { border-radius: 4px; }
.opt-text { flex: 1 1 auto; }
.opt.is-selected { border-color: var(--primary); background: var(--primary-soft); }
.opt.is-selected .opt-mark { background: var(--primary); border-color: var(--primary); box-shadow: inset 0 0 0 3px var(--surface); }
.opt.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt:disabled { cursor: default; opacity: 1; }
.opts:has(.opt:disabled) .opt:not(.is-selected):not(.is-correct) { opacity: .7; }

/* Numeriek */
.num-wrap { display: inline-flex; align-items: center; gap: .6rem; padding: .3rem; border-radius: 12px; border: 2px solid transparent; }
.num-input {
  width: 7rem; min-height: 52px; padding: .5rem .75rem; font-size: 1.3rem; font-weight: 700; text-align: center;
  border: 2px solid var(--border); border-radius: 10px; background: var(--surface);
}
.num-input:focus { border-color: var(--primary); outline: none; }
.num-unit { font-size: 1.1rem; font-weight: 600; color: var(--text-muted); }
.num-msg { color: var(--bad); font-size: .9rem; min-height: 1.3em; }
.num-wrap.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.num-wrap.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.solution { font-weight: 600; }

/* Hotspot */
.media-hotspot.is-clickable svg { cursor: crosshair; touch-action: manipulation; }
.hs-marker { fill: rgba(31, 95, 139, .25); stroke: #1f5f8b; stroke-width: 3; }
.hs-marker.is-correct { fill: rgba(46, 125, 50, .3); stroke: #2e7d32; }
.hs-marker.is-wrong { fill: rgba(198, 40, 40, .3); stroke: #c62828; }
.hs-dot { fill: #fff; stroke: #222; stroke-width: 1; }
.hs-solution { fill: rgba(46, 125, 50, .18); stroke: #2e7d32; stroke-width: 2.5; stroke-dasharray: 6 4; }

/* Volgorde */
.order-list { list-style: none; padding: 0; margin: 0 0 .9rem; display: grid; gap: .45rem; }
.order-item {
  display: flex; align-items: center; gap: .7rem; min-height: 50px; padding: .45rem .7rem;
  border: 2px solid var(--primary); background: var(--primary-soft); border-radius: 10px;
  touch-action: none; user-select: none; cursor: grab;
}
.order-item.is-empty { border-style: dashed; border-color: var(--border); background: transparent; cursor: default; color: var(--text-muted); }
.order-item.is-dragging { box-shadow: 0 6px 18px rgba(0,0,0,.18); cursor: grabbing; }
.order-item.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.order-item.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.order-num { width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface); }
.order-label { flex: 1; font-weight: 600; }
.order-handle { color: var(--text-muted); letter-spacing: -2px; }
.order-remove { border: 0; background: transparent; font-size: 1.4rem; line-height: 1; cursor: pointer; min-width: 36px; min-height: 36px; border-radius: 8px; }
.order-remove:hover { background: var(--surface-2); }
.order-pool { display: grid; gap: .5rem; margin-bottom: .6rem; }

/* Gevaarherkenning */
.hz-bar { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-bottom: .8rem; }
.hz-fill { height: 100%; width: 100%; background: var(--primary); transition: width .1s linear; }
.hz-timeout { color: var(--warn); font-weight: 600; margin-top: .6rem; }

/* Uitleg */
.explain { margin-top: 1.1rem; padding: 1rem 1.1rem; border-radius: 10px; border-left: 5px solid; background: var(--surface-2); }
.explain.is-correct { border-color: var(--ok); }
.explain.is-wrong { border-color: var(--bad); }
.explain p { margin: .35rem 0; }
.explain .verdict { font-weight: 800; font-size: 1.05rem; }
.explain.is-correct .verdict { color: var(--ok); }
.explain.is-wrong .verdict { color: var(--bad); }
.explain .meta { color: var(--text-muted); font-size: .85rem; }

/* ---------- Demo/browser (fase 1) ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.toolbar select { min-height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); padding: 0 .6rem; font: inherit; color: inherit; max-width: 100%; }
.qmeta { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.tag { font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.tag-warn { background: #fff3d6; color: #7a4b00; }
[data-theme="dark"] .tag-warn { background: #3d3115; color: #f3c56b; }

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; gap: .6rem; justify-content: center; padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.bottom-bar .btn { flex: 1 1 0; max-width: 220px; white-space: nowrap; }

/* ---------- Mobiel ---------- */
@media (max-width: 600px) {
  main { padding: .9rem .75rem 6rem; }
  .card { padding: 1rem; border-radius: 10px; }
  .q-text { font-size: 1.05rem; }
  .brand small { display: none; }
  .bottom-bar { gap: .4rem; padding-left: .5rem; padding-right: .5rem; }
  .bottom-bar .btn { padding: .5rem .6rem; font-size: .9rem; min-width: 0; }
  .hide-sm { display: none; }
  .bottom-bar .btn-mark, .bottom-bar .btn[aria-label="Vorige vraag"], .bottom-bar .btn[aria-label^="Volgende vraag (overslaan)"] { flex: 0 0 52px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }


/* ==========================================================================
   Fase 3: schermen
   ========================================================================== */
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; }
.page-title { font-size: 1.4rem; margin: .2rem 0 1rem; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.spacer { flex: 1; }
.center { text-align: center; }

/* Hoofdmenu */
.hero { text-align: center; padding: 1.4rem 1rem .6rem; }
.hero h1 { font-size: 2rem; letter-spacing: .08em; margin: 0; color: var(--primary); }
[data-theme="dark"] .hero h1 { color: var(--text); }
.hero p { margin: .3rem 0 0; color: var(--text-muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .9rem; }
.tile {
  display: flex; gap: .9rem; align-items: center; text-align: left; width: 100%;
  padding: 1.1rem 1.15rem; border-radius: var(--radius); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  text-decoration: none; color: inherit; font: inherit;
}
.tile:hover:not(:disabled) { border-color: var(--primary); transform: translateY(-1px); }
.tile:disabled { opacity: .55; cursor: default; }
.tile-icon { flex: 0 0 auto; width: 3rem; height: 3rem; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.tile-icon svg { width: 1.7rem; height: 1.7rem; }
.tile-title { font-weight: 800; font-size: 1.05rem; display: block; }
.tile-sub { color: var(--text-muted); font-size: .85rem; display: block; }
.tile-main { border-color: var(--primary); background: linear-gradient(135deg, var(--surface) 55%, var(--primary-soft)); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; }
.stat b { display: block; font-size: 1.45rem; color: var(--primary); }
[data-theme="dark"] .stat b { color: var(--text); }
.stat span { font-size: .8rem; color: var(--text-muted); }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; padding: .9rem 1.1rem; border-radius: var(--radius); background: var(--warn-soft); border: 1px solid #f0d48a; }
[data-theme="dark"] .banner { border-color: #6b5520; }
.banner p { margin: 0; flex: 1 1 220px; }
.small-links { display: flex; gap: 1.2rem; justify-content: center; font-size: .9rem; }

/* Sessiebalk (examen / oefenexamen / oefenen) */
.runbar {
  position: sticky; top: 0; z-index: 9; display: flex; align-items: center; gap: .6rem;
  padding: .5rem .8rem; margin: -1.25rem -1rem 1rem; background: var(--primary-soft); border-bottom: 1px solid var(--border);
}
.runbar .run-title { font-weight: 800; color: var(--primary); }
[data-theme="dark"] .runbar .run-title { color: var(--text); }
.runbar .run-progress { font-weight: 600; color: var(--text); }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.05rem; padding: .25rem .7rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.timer.is-warning { background: var(--warn-soft); color: var(--warn); border-color: #e7b85a; }
.timer.is-critical { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .65; } }
.progressbar { height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: -.4rem 0 1rem; }
.progressbar > div { height: 100%; background: var(--primary); transition: width .2s; }
.warmup-note { padding: .7rem 1rem; border-radius: 10px; background: var(--primary-soft); margin-bottom: 1rem; font-weight: 600; }
.qbadges { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.badge { font-size: .75rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.badge-mark { background: #fff1c7; color: #7a5600; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-test { background: #e8e3f7; color: #4b3a8c; }
[data-theme="dark"] .badge-mark { background: #3d3115; color: #f3c56b; }
[data-theme="dark"] .badge-test { background: #2c2546; color: #c6b8ff; }

.bottom-bar .btn-mark.is-on { background: #fff1c7; border-color: var(--mark); color: #7a5600; }
[data-theme="dark"] .bottom-bar .btn-mark.is-on { background: #3d3115; color: #f3c56b; }

/* Vragenoverzicht */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(15, 30, 45, .45); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .overlay { align-items: center; } }
.sheet { background: var(--surface); width: 100%; max-width: 640px; max-height: 88vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 1.1rem 1.2rem 1.4rem; box-shadow: 0 -4px 24px rgba(0,0,0,.2); }
@media (min-width: 700px) { .sheet { border-radius: 18px; } }
.sheet h2 { margin: 0 0 .6rem; font-size: 1.15rem; }
.grid-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: .4rem; margin: .8rem 0; }
.gbox {
  position: relative; height: 44px; border-radius: 8px; border: 2px solid var(--border); background: var(--surface);
  font-weight: 700; font-size: .85rem; cursor: pointer; color: var(--text);
}
.gbox.is-answered { background: var(--primary-soft); border-color: var(--primary); }
.gbox.is-current { outline: 3px solid var(--focus); outline-offset: 1px; }
.gbox.is-marked::after { content: ""; position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--mark); }
.gbox.is-ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.gbox.is-bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.gbox.is-test { background: #ece8f8; border-color: #9b8fd0; color: #4b3a8c; }
[data-theme="dark"] .gbox.is-test { background: #2c2546; color: #c6b8ff; }
.legend { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .8rem; color: var(--text-muted); }
.legend i { display: inline-block; width: .9rem; height: .9rem; border-radius: 4px; border: 2px solid var(--border); vertical-align: -2px; margin-right: .3rem; }
.legend .l-ans { background: var(--primary-soft); border-color: var(--primary); }
.legend .l-mark { background: var(--mark); border-color: var(--mark); border-radius: 50%; }
.legend .l-ok { background: var(--ok-soft); border-color: var(--ok); }
.legend .l-bad { background: var(--bad-soft); border-color: var(--bad); }
.legend .l-test { background: #ece8f8; border-color: #9b8fd0; }

/* Modaal venster */
.modal { background: var(--surface); border-radius: 16px; padding: 1.3rem; width: min(92vw, 460px); box-shadow: 0 10px 40px rgba(0,0,0,.25); margin: auto; }
.modal h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
.modal p { margin: .3rem 0 1rem; color: var(--text-muted); }
.modal .row { justify-content: flex-end; }
.overlay.is-center { align-items: center; }
.toast { position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%); z-index: 60; background: #17324d; color: #fff; padding: .6rem 1rem; border-radius: 10px; font-size: .9rem; box-shadow: var(--shadow); }

/* Uitslag */
.verdict-big { text-align: center; padding: 1.6rem 1rem; border-radius: var(--radius); }
.verdict-big h1 { font-size: 2.6rem; letter-spacing: .12em; margin: 0; }
.verdict-big p { margin: .4rem 0 0; font-size: 1.15rem; font-weight: 600; }
.verdict-big.is-pass { background: var(--ok-soft); color: var(--ok); border: 2px solid var(--ok); }
.verdict-big.is-fail { background: var(--bad-soft); color: var(--bad); border: 2px solid var(--bad); }
.verdict-big .muted { font-weight: 400; font-size: .95rem; }
.cat-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.cat-table td { padding: .45rem .3rem; border-bottom: 1px solid var(--border); }
.cat-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.cat-bar { height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: .25rem; }
.cat-bar > div { height: 100%; background: var(--ok); }
.cat-bar.is-weak > div { background: var(--bad); }
details.card summary { cursor: pointer; font-weight: 700; }

/* Lijsten */
.hist { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.hist li { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.hist .h-score { font-size: 1.3rem; font-weight: 800; min-width: 3.6rem; text-align: center; }
.hist .h-main { flex: 1; min-width: 0; }
.hist .h-main b { display: block; }
.hist .h-main span { font-size: .85rem; color: var(--text-muted); }
.pill { font-size: .75rem; font-weight: 800; padding: .2rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); white-space: nowrap; }
.pill-pass { background: var(--ok-soft); color: var(--ok); }
.pill-fail { background: var(--bad-soft); color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { min-height: 38px; padding: .3rem .85rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; font-size: .9rem; }
.chip.is-on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
a.chip { text-decoration: none; color: inherit; display: inline-flex; align-items: center; }
a.chip.is-on { color: var(--primary-ink); }

/* Formulieren */
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.form-row:last-child { border-bottom: 0; }
.form-row label { font-weight: 600; }
.form-row small { display: block; color: var(--text-muted); font-weight: 400; font-size: .82rem; }
.form-row select { min-height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); padding: 0 .6rem; font: inherit; color: inherit; }
.switch { position: relative; width: 52px; height: 30px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.catlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .4rem; }
.catlist label { display: flex; align-items: center; gap: .55rem; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.catlist input { width: 1.15rem; height: 1.15rem; accent-color: var(--primary); }
.catlist small { margin-left: auto; color: var(--text-muted); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-big { min-height: 54px; font-size: 1.05rem; padding: .7rem 1.6rem; }

@media (max-width: 600px) {
  .runbar { margin: -.9rem -.75rem .8rem; padding: .45rem .6rem; gap: .4rem; }
  .runbar .run-title { display: none; }
  .hero h1 { font-size: 1.6rem; }
  .verdict-big h1 { font-size: 2rem; }
  .hist li { flex-wrap: wrap; }
}

.back-link { display: inline-block; margin: 0 0 .7rem; font-weight: 600; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* Grafiek en categorieën */
.chart { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-ax { fill: var(--text-muted); font-size: 11px; font-family: system-ui, sans-serif; }
.ch-pass { stroke: var(--ok); stroke-width: 2; stroke-dasharray: 6 5; }
.ch-pass-t { fill: var(--ok); font-weight: 700; }
.ch-line { fill: none; stroke-width: 2.5; }
.ch-line.ch-exam { stroke: var(--primary); }
.ch-line.ch-mock { stroke: #8aa4bd; stroke-dasharray: 5 4; }
.ch-dot.ch-exam { fill: var(--primary); }
.ch-dot.ch-mock { fill: var(--surface); stroke: #8aa4bd; stroke-width: 2.5; }
.legend .l-exam { background: var(--primary); border-color: var(--primary); border-radius: 50%; }
.legend .l-mock { background: var(--surface); border-color: #8aa4bd; border-radius: 50%; }
.cat-bar.is-mid > div { background: #e08a00; }
.cat-table td:nth-child(2) { color: var(--text-muted); font-weight: 600; }

/* Rijlessen */
.small { font-size: .82rem; }
.pill-mid { background: var(--warn-soft); color: var(--warn); }
.banner-info { background: var(--primary-soft); border-color: var(--border); }
.progressbar.big { height: 12px; margin: 0; border-radius: 8px; }
.focus-card { border-left: 5px solid var(--primary); }
ul.plain { margin: 0; padding-left: 1.1rem; }
ul.plain li + li { margin-top: .3rem; }
.trend { display: inline-flex; gap: 3px; vertical-align: middle; }
.trend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.trend i.r1 { background: #d64545; } .trend i.r2 { background: #e8a33b; } .trend i.r3 { background: #7cbf5a; } .trend i.r4 { background: #2e7d32; }
.items-table td:nth-child(2) { text-align: right; white-space: nowrap; }
.items-table td:last-child { width: 1%; }
.stack-sm > * + * { margin-top: .45rem; }
.lbl { display: block; font-weight: 700; font-size: .95rem; margin: 0; }
.text-in, .text-area, .num-small, input[type="date"] {
  font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .5rem .7rem; min-height: 44px;
}
.text-in { width: min(100%, 22rem); }
.rate-item .text-in { width: 100%; margin-top: .5rem; }
.text-area { width: 100%; resize: vertical; }
.num-small { width: 6.5rem; }
.text-in:focus, .text-area:focus, .num-small:focus, input[type="date"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.error-box { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad); border-radius: 10px; padding: .7rem 1rem; font-weight: 600; }
.rate-list { display: grid; gap: .45rem; }
.rate-item { border: 1px solid var(--border); border-radius: 12px; padding: .35rem .5rem .5rem; background: var(--surface); }
.rate-item.is-on { border-color: var(--primary); background: var(--primary-soft); }
.rate-head { display: flex; align-items: center; gap: .7rem; width: 100%; min-height: 46px; background: none; border: 0; text-align: left; font: inherit; color: inherit; font-weight: 600; cursor: pointer; padding: 0 .2rem; }
.rate-check { width: 1.6rem; height: 1.6rem; border-radius: 7px; border: 2px solid var(--border); display: grid; place-items: center; font-weight: 900; background: var(--surface); flex: 0 0 auto; }
.rate-item.is-on .rate-check { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.rate-chips { margin: .3rem 0 0 2.4rem; }
.rate-chips .chip.is-on.rate-1 { background: #d64545; border-color: #d64545; color: #fff; }
.rate-chips .chip.is-on.rate-2 { background: #e8a33b; border-color: #e8a33b; color: #1d1d1d; }
.rate-chips .chip.is-on.rate-3 { background: #7cbf5a; border-color: #7cbf5a; color: #10240a; }
.rate-chips .chip.is-on.rate-4 { background: #2e7d32; border-color: #2e7d32; color: #fff; }
.edit-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.edit-list li { display: flex; gap: .4rem; align-items: center; }
.edit-list li .text-in { flex: 1; width: auto; }
.edit-list li.is-hidden .text-in { opacity: .5; text-decoration: line-through; }
@media (max-width: 600px) {
  .rate-chips { margin-left: 0; }
  .form-row { flex-wrap: wrap; }
  .items-table td:nth-child(2) .muted { display: none; }
}

/* Afdrukken (overzicht voor de instructeur) */
@media print {
  .app-header, .bottom-bar, .no-print, .back-link, .toast, .overlay { display: none !important; }
  html, body { background: #fff !important; color: #000; }
  main { max-width: none; padding: 0; }
  .card { box-shadow: none; border-color: #bbb; break-inside: avoid; }
}

.group-row td { text-align: left !important; padding-top: .9rem; font-weight: 800; color: var(--primary); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 2px solid var(--border); }
.group-head { font-weight: 800; color: var(--primary); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; margin-top: .4rem; }
.badge.req { background: var(--primary-soft); color: var(--primary-strong, #155a96); margin-left: .5rem; vertical-align: middle; }

/* Accounts */
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.field { display: grid; gap: .3rem; }
.text-in.wide { width: 100%; }
select.text-in { width: auto; }
.ok-box { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok); border-radius: 10px; padding: .7rem 1rem; font-weight: 600; }
.avatar { width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--primary-ink); font-weight: 800; font-size: 1.1rem; }
.sync-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--border); margin-right: .4rem; flex: 0 0 auto; }
.sync-dot.is-ok { background: var(--ok); }
.sync-dot.is-bezig { background: var(--primary); animation: pulse 1s infinite; }
.sync-dot.is-offline, .sync-dot.is-uitgelogd { background: #e08a00; }
.sync-dot.is-fout { background: var(--bad); }
#accountLink { display: inline-flex; align-items: center; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#accountLink[hidden] { display: none; }
.invite-code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .08em; }
.invite-code { font-size: 1.5rem; font-weight: 800; }

/* ---------- PWA: update-melding, offline-strook ---------- */
.update-bar { position: fixed; top: calc(env(safe-area-inset-top, 0px) + .6rem); left: 50%; transform: translateX(-50%); z-index: 70; display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem .5rem 1rem; border-radius: 12px; background: #17324d; color: #fff; box-shadow: var(--shadow); max-width: calc(100% - 1.2rem); font-size: .95rem; }
.update-bar > span { white-space: nowrap; }
.update-bar .btn-ghost { color: #fff; border-color: transparent; }
.offline-strip { background: var(--warn-soft); color: var(--text); text-align: center; font-size: .85rem; padding: .35rem .8rem; border-bottom: 1px solid var(--border); }
.install-steps { margin: .2rem 0 0; padding-left: 1.2rem; }
.install-steps li { margin: .2rem 0; }
@media (display-mode: standalone) { .app-header { padding-top: calc(env(safe-area-inset-top, 0px) + .6rem); } }

/* ---------- Single-sleepvraag (vinkje slepen) ---------- */
.dm-tray { display: flex; align-items: center; gap: .8rem; margin: 0 0 .6rem; flex-wrap: wrap; }
.dm-token, .dm-ghost { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 1.5rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; border: 3px solid #fff; box-shadow: var(--shadow); }
.dm-token { cursor: grab; touch-action: none; user-select: none; }
.dm-token.is-placed { opacity: .45; }
.dm-ghost { position: fixed; z-index: 90; pointer-events: none; transform: translate(-50%, -50%); }
.dm-mark circle { fill: var(--primary, #1d6fb8); stroke: #fff; stroke-width: 3; }
.dm-mark path { fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.dm-mark.is-correct circle { fill: #2e7d32; }
.dm-mark.is-wrong circle { fill: #c62828; }
.scene.scene-sign { display: block; max-width: 210px; max-height: 210px; margin: 0 auto; }
.pill-near { background: #e3f1e4; color: #2e6b33; border: 1px dashed #6aa86f; }
[data-theme="dark"] .badge.req { color: #cfe4f7; }
[data-theme="dark"] .btn-danger { background: #b83434; border-color: #b83434; color: #fff; }

/* ---------- Leren, begrippen, examenkaart ---------- */
.topic-list { display: grid; gap: .5rem; }
.topic-item { display: grid; gap: .15rem; padding: .8rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.topic-item:hover { border-color: var(--primary); }
.topic-name { font-weight: 700; }
.topic-meta { font-size: .85rem; }
.cat-bar > span { display: block; height: 100%; background: var(--ok); }
.cat-bar.is-weak > span { background: var(--bad); }
.cat-bar.is-mid > span { background: #e08a00; }
.theory .lead { font-size: 1.08rem; margin: 0; }
.theory h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
.theory-points { margin: 0; padding-left: 1.2rem; display: grid; gap: .45rem; line-height: 1.5; }
.theory-signs { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0 0 .7rem; }
.theory-signs figure { margin: 0; text-align: center; font-size: .75rem; color: var(--text-muted); }
.theory-signs img { width: 56px; height: 56px; object-fit: contain; display: block; }
.pager { justify-content: space-between; }
.flashcard { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; min-height: 240px; width: 100%; padding: 1.4rem; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: center; cursor: pointer; box-shadow: var(--shadow); }
.flashcard.is-flipped { border-color: var(--primary); }
.fc-term { font-size: 1.5rem; font-weight: 800; }
.fc-def { font-size: 1.05rem; line-height: 1.5; max-width: 34rem; }
.fc-actions { justify-content: center; }
.btn-danger-soft { background: var(--surface-2); color: var(--bad); border-color: var(--bad); }
.field.inline { display: flex; align-items: center; gap: .6rem; }
.exam-card-top { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.exam-card .progress { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.exam-card .progress > span { display: block; height: 100%; background: var(--primary); }
.check-list { list-style: none; padding: 0; margin: .4rem 0 0; display: grid; gap: .6rem; }
.check-list li { display: flex; gap: .6rem; align-items: flex-start; }
.check-mark { font-weight: 800; color: var(--text-muted); width: 1.2rem; flex: none; }
.check-list li.is-ok .check-mark { color: var(--ok); }
.field.inline { flex-wrap: wrap; }
.field.inline select { flex: 1 1 12rem; min-width: 0; max-width: 100%; min-height: 40px; }
.exam-card-top a.pill { text-decoration: none; }
.sol-num circle { fill: #2e7d32; stroke: #fff; stroke-width: 2.5; }
.sol-num text { fill: #fff; font: 800 14px system-ui, Arial, sans-serif; }
.sol-caption { font-size: .85rem; color: var(--text-muted); margin: .4rem 0 0; }
.report-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.report-table th { text-align: left; font-size: .75rem; text-transform: uppercase; color: var(--text-muted); padding: .3rem .4rem; border-bottom: 2px solid var(--border); }
.report-table td { padding: .35rem .4rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.report-lessons { margin: 0; padding-left: 1.3rem; display: grid; gap: .6rem; }
@media (max-width: 560px) { .report-table td:nth-child(n+3), .report-table th:nth-child(n+3) { display: none; } }
.report .card { overflow-x: auto; }
@media print { .report-table td:nth-child(n), .report-table th:nth-child(n) { display: table-cell !important; } .report .stats { grid-template-columns: repeat(4, 1fr); } }
@media print { .report .card { break-inside: auto; overflow: visible; } .report-table tr { break-inside: avoid; } .report h1 { margin-top: 0; } }
/* ---------- Situatie A en B naast elkaar ---------- */
.scene-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; width: 100%; max-width: 620px; }
.pair-item { position: relative; margin: 0; display: flex; justify-content: center; align-items: center; background: var(--surface-2); border-radius: 10px; padding: .4rem; }
.pair-item svg.scene { width: 100%; height: auto; max-width: 300px; }
.pair-item svg.scene-sign { max-width: 150px; }
.pair-label { position: absolute; left: 50%; bottom: -.2rem; transform: translate(-50%, 50%); width: 2rem; height: 2rem; border-radius: 50%; background: var(--surface); border: 2px solid var(--text); color: var(--text); font-weight: 800; display: grid; place-items: center; z-index: 1; }
.media:has(.scene-pair) { margin-bottom: 1.6rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
/* ---------- Volgorde kiezen in de tekening ---------- */
.veh-pick { cursor: pointer; }
.veh-pick rect { transition: stroke-width .1s; }
.veh-pick:hover rect, .veh-pick:focus-visible rect, .veh-pick.is-drop rect { stroke: var(--primary, #1565c0); stroke-width: 3; }
.veh-pick:focus { outline: none; }
.veh-pick.is-picked rect { stroke: var(--primary, #1565c0); stroke-width: 2.5; }
.pick-num circle { fill: var(--primary, #1565c0); stroke: #fff; stroke-width: 2.5; }
.pick-num text { fill: #fff; font: 800 14px system-ui, Arial, sans-serif; pointer-events: none; }
.pick-layer { pointer-events: none; }
.order-tokens { display: flex; gap: .5rem; justify-content: center; margin: -.4rem 0 .8rem; touch-action: none; }
.order-token { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--primary, #1565c0); color: #fff; cursor: grab; user-select: none; touch-action: none; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.order-token.is-ghost { position: fixed; z-index: 1000; pointer-events: none; width: 2.25rem; height: 2.25rem; opacity: .9; }
.pick-zone { fill: transparent; stroke: none; }
.veh-pick:hover rect.pick-zone, .veh-pick.is-picked rect.pick-zone, .veh-pick.is-drop rect.pick-zone, .veh-pick:focus-visible rect.pick-zone { stroke: none; }
.veh-pick:focus-visible rect.pick-zone { fill: rgba(29,111,184,.15); }
