/* Rubriq — gedeelde stijl voor alle schermen.
   Kleuren, lettertypes en maten staan in theme.css (enkel daar aanpassen).
   Opbouw: basis → app-layout → zijbalk → componenten → schermen → afdrukken. */

@import url("theme.css");

* { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--head-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--font-size)/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 4px; }
h3 { font-size: 14px; margin: 0; }
p { margin: 0 0 10px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
svg.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.hint { font-size: 13px; color: var(--muted); }
.error { color: var(--error); }
.warn { color: var(--warn); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* --- App-layout: zijbalk links, wit paneel rechts ------------------------- */

body.app {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  min-height: 100vh;
}

.content {
  min-width: 0; display: flex; flex-direction: column;
  margin: 8px 8px 8px 0; min-height: calc(100vh - 16px);
  background: var(--page); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.pagehead {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap;
  min-height: var(--head-h);
  padding: 8px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
/* Kop als broodkruimel: Toetsen › toetsnaam › functie */
.pagehead > div:first-of-type { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.pagehead h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
.eyebrow, .crumb {
  margin: 0; font-size: 15px; color: var(--muted); font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px; max-width: 32em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.eyebrow::after, .crumb::after { content: "›"; color: var(--faint); font-weight: 400; }
.eyebrow:empty { display: none; }
a.crumb { color: var(--muted); }
a.crumb:hover { color: var(--text); text-decoration: none; }
.crumb .icon { color: var(--accent-strong); }
.eyebrow.renamable { cursor: text; border-radius: var(--radius-sm); padding: 2px 4px; margin: -2px -4px; }
.eyebrow.renamable:hover { background: var(--hover); color: var(--text); }
.inline-input { font: inherit; font-size: 14px; padding: 3px 7px; min-width: 14em; }
.pagehead-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Donkere balk: kop (broodkruimel, titel, belangrijkste knoppen) en de stappen vormen samen één balk
   bovenaan, zodat het oog meteen naar de inhoud eronder gaat. */
.pagehead { background: var(--bar); border-bottom-color: var(--bar); color: var(--on-bar); }
.pagehead h1 { color: var(--on-bar); font-size: 16px; }
.pagehead .eyebrow, .pagehead .crumb, .pagehead a.crumb { color: var(--on-bar-muted); }
.pagehead a.crumb:hover { color: var(--on-bar); }
.pagehead .eyebrow::after, .pagehead .crumb::after { color: var(--bar-border); }
.pagehead .crumb .icon, .pagehead .help-btn .icon { color: var(--bar-accent); }
.pagehead .eyebrow.renamable:hover { background: var(--bar-2); color: var(--on-bar); }
.pagehead .hint, .pagehead label.check, .pagehead .field > span { color: var(--on-bar-muted); }
.pagehead button, .pagehead .button,
.pagehead button.ghost, .pagehead .button.ghost, .pagehead button.secondary, .pagehead .button.secondary {
  background: var(--bar-2); color: var(--on-bar); border-color: var(--bar-border); box-shadow: none;
}
.pagehead button:hover, .pagehead .button:hover { background: var(--bar-border); border-color: var(--on-bar-muted); color: var(--on-bar); }
.pagehead button.danger { background: transparent; color: #fca5a5; border-color: var(--bar-border); }
.pagehead button.danger:hover { background: var(--bar-2); color: #fecaca; }
/* Belangrijkste vervolgactie in de balk (bv. Feedbackfiches bij Analyse): groen, zoals 'Volgende stap' als die klaar is. */
.pagehead .button.cta { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); font-weight: 600; padding: 7px 14px; }
.pagehead .button.cta:hover { background: var(--accent-strong-hover); border-color: var(--accent-strong-hover); color: var(--on-accent); }
.pagehead .button.cta .icon { color: var(--on-accent); }
.pagehead .button.next-step.ready { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.pagehead .button.next-step.ready:hover { background: var(--accent-strong-hover); border-color: var(--accent-strong-hover); }
.pagehead select, .pagehead input:not([type="checkbox"]) { background: var(--bar-2); color: var(--on-bar); border-color: var(--bar-border); }
.pagehead input[type="checkbox"] { accent-color: var(--bar-accent); }
.pagehead .badge.grey { background: var(--bar-2); color: var(--on-bar-muted); border-color: var(--bar-border); }
nav.tabs { background: var(--bar); border-bottom-color: var(--bar); }
nav.tabs .tab { color: var(--on-bar-muted); }
nav.tabs .tab:hover { color: var(--on-bar); }
nav.tabs .tab.active { color: var(--on-bar); box-shadow: inset 0 -2px 0 var(--bar-accent); }
nav.tabs .tab .icon { color: inherit; }

/* Tabs met de stappen van een toets, onder de kop (renderTestTabs in common.js) */
.tabs {
  display: flex; align-items: stretch; gap: 2px; padding: 0 14px; overflow-x: auto; overflow-y: hidden;
  background: var(--surface); border-bottom: 1px solid var(--border); scrollbar-width: none;
}
.tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 11px 12px;
  color: var(--muted); font-size: 13.5px; font-weight: 500; white-space: nowrap;
}
.tab .icon { width: 15px; height: 15px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent-strong); box-shadow: inset 0 -2px 0 var(--accent-strong); font-weight: 600; }

.page { padding: 20px 24px 48px; display: grid; gap: 16px; align-content: start; }
.page.narrow { max-width: 860px; }
.page.flush { padding: 0; gap: 0; }

/* --- Zijbalk (zoals Notion): merk, zoeken, werkruimte, boom met toetsen --- */

.sidenav {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 14px;
  padding: 14px 10px 12px;
  background: var(--bg);
}

/* Breedte en inklappen (initNavLayout in common.js): greep op de rand, knop « in de zijbalk, » in de kop */
body.app.nav-anim { transition: grid-template-columns 0.18s ease; }
body.app.nav-collapsed { grid-template-columns: 0px minmax(0, 1fr); }
body.app.nav-collapsed .sidenav { visibility: hidden; padding-left: 0; padding-right: 0; }
body.app.nav-collapsed .content { margin-left: 8px; grid-column: 2; }
/* Ingeklapt + muis op »: zijbalk zwevend boven de pagina (nav-peek) */
body.app.nav-collapsed.nav-peek .sidenav {
  visibility: visible; position: fixed; z-index: 40; left: 8px; top: calc(var(--head-h) + 4px); bottom: 16px;
  width: var(--nav-w); height: auto; padding: 12px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: nav-peek-in 0.14s ease-out;
}
.nav-peek .nav-collapse { display: none; }
@keyframes nav-peek-in { from { opacity: 0; transform: translateX(-12px); } }
body.nav-resizing, body.nav-resizing * { cursor: col-resize !important; user-select: none; }

.nav-handle {
  position: fixed; top: 0; bottom: 0; left: calc(var(--nav-w) - 6px); width: 12px; z-index: 30;
  cursor: col-resize;
}
.nav-handle::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 5px; width: 2px;
  background: var(--border-strong); opacity: 0; transition: opacity 0.12s;
}
.nav-handle:hover::after, .nav-resizing .nav-handle::after { opacity: 1; }
.nav-collapsed .nav-handle { display: none; }
.nav-tip {
  position: fixed; left: calc(var(--nav-w) + 10px); top: 0; z-index: 1200; pointer-events: none;
  padding: 5px 9px; border-radius: var(--radius-sm); white-space: nowrap;
  background: var(--tip-bg); color: var(--tip-text); font-size: 12px; line-height: 1.45; box-shadow: var(--shadow);
  opacity: 0; transition: opacity 0.1s;
}
.nav-tip b { color: var(--tip-strong); font-weight: 500; }
.nav-handle:hover .nav-tip { opacity: 1; transition-delay: 0.5s; }
.nav-resizing .nav-tip { opacity: 0 !important; }

.nav-top { display: flex; align-items: center; gap: 4px; }
.nav-top .brand { flex: 1; min-width: 0; }
.nav-collapse { width: 26px; height: 26px; opacity: 0; transition: opacity 0.12s; }
.sidenav:hover .nav-collapse, .nav-collapse:focus-visible { opacity: 1; }
.nav-open { display: none; width: 28px; height: 28px; margin-left: -8px; }
.nav-collapsed .nav-open { display: inline-flex; align-items: center; justify-content: center; }
.pagehead button.nav-open { color: var(--on-bar-muted); }  /* op de donkere balk */
.pagehead button.nav-open:hover { color: var(--on-bar); background: var(--bar-2); }
/* Zijbalk ingeklapt: het logo in de kop, zodat je altijd naar het overzicht kan. */
a.nav-home { display: none; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: var(--radius-sm); }
.nav-collapsed a.nav-home { display: inline-flex; }
a.nav-home:hover { background: var(--bar-2); }

.brand {
  display: flex; align-items: center; gap: 0.45em; padding: 2px 8px;
  font-weight: 700; font-size: 17px; letter-spacing: -0.02em; color: var(--text);
}
.brand { border-radius: var(--radius-sm); transition: background 0.12s; }
a.brand:hover { text-decoration: none; background: var(--hover); }
/* Logo: kader in --logo-color, vinkje in een verloop (twee maskers, zodat de kleuren in theme.css blijven) */
.brand-mark { flex: none; position: relative; width: 26px; height: 26px; }
.brand .brand-mark { width: 1.36em; height: 1.36em; }  /* verhouding uit het ontwerp: 30 px logo bij 22 px tekst */
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; inset: 0; }
.brand-mark::before { background: var(--logo-color); -webkit-mask: var(--logo-frame) center / contain no-repeat; mask: var(--logo-frame) center / contain no-repeat; }
.brand-mark::after {
  background: linear-gradient(to top right, var(--logo-check-1), var(--logo-check-2));
  -webkit-mask: var(--logo-check) center / contain no-repeat; mask: var(--logo-check) center / contain no-repeat;
}

.nav-search {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 8px 6px 10px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  font-weight: 400; font-size: 13.5px; box-shadow: var(--shadow-sm);
}
.nav-search:hover { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.nav-search kbd { margin-left: auto; }

.nav-group, .tree { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.nav-label {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; color: var(--faint); padding: 4px 10px 4px;
}
.nav-label .icon-btn { margin-left: auto; width: 22px; height: 22px; }
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 450; font-size: 14px;
}
.nav-link .icon { color: var(--muted); }
.nav-link:hover { background: var(--hover); text-decoration: none; }
.nav-link.active { background: var(--selected); font-weight: 550; }
.nav-link.active .icon { color: var(--text); }

/* Boom met mappen en toetsen */
.tree-head { display: flex; align-items: center; gap: 2px; padding-right: 2px; border-radius: var(--radius-sm); }
.tree-head a.nav-link { flex: 1; }
.tree-head .icon-btn { width: 26px; height: 26px; }
.tree-row {
  position: relative; display: flex; align-items: center; gap: 6px; min-height: 30px;
  padding: 4px 4px 4px calc(6px + var(--depth, 0) * 16px); border-radius: var(--radius-sm);
  color: var(--text); font-size: 13.5px; cursor: pointer; user-select: none;
}
.tree-row:hover { background: var(--hover); text-decoration: none; }
.tree-row.active { background: var(--selected); font-weight: 550; }
.tree-row .icon { color: var(--muted); }
.tree-row.test .icon { color: var(--faint); }
.tree-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-twisty {
  width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--faint);
  display: grid; place-items: center; flex: none;
}
.tree-twisty:hover { background: var(--border); color: var(--text); }
.tree-twisty .icon { width: 13px; height: 13px; transition: transform 0.12s; color: inherit; }
.tree-row.open > .tree-twisty .icon { transform: rotate(90deg); }
.tree-spacer { width: 18px; flex: none; }
.tree-actions { display: none; align-items: center; gap: 1px; }
.tree-row:hover .tree-actions, .tree-row.menu-open .tree-actions { display: flex; }
.tree-actions .icon-btn { width: 22px; height: 22px; }
.tree-actions .icon-btn .icon { width: 14px; height: 14px; }
.tree-row.drop { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-border); }
.tree-row.dragging { opacity: 0.4; }
.tree-empty { padding: 4px 10px 4px calc(30px + var(--depth, 0) * 16px); font-size: 12.5px; color: var(--faint); }
.tree-row .inline-input { width: 100%; min-width: 0; font-size: 13.5px; padding: 1px 6px; }
.tree-meta { flex: none; font-size: 11.5px; color: var(--faint); font-weight: 400; }
.tree-row:hover .tree-meta, .tree-row.menu-open .tree-meta { display: none; }

.nav-foot:empty { display: none; }
.nav-foot { margin-top: auto; display: grid; gap: 2px; font-size: 12px; color: var(--faint); padding: 8px 10px 0; border-top: 1px solid var(--border); }
.nav-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.link-button {
  background: none; border: 0; padding: 0; min-height: 0; font: inherit; color: var(--accent);
  cursor: pointer; justify-self: start;
}
.link-button:hover { background: none; color: var(--accent-hover); text-decoration: underline; }

@media (max-width: 900px) {
  body.app, body.app.nav-collapsed { grid-template-columns: 1fr; }
  body.app.nav-collapsed .sidenav { visibility: visible; padding: 10px 12px; }
  .nav-handle, .nav-collapse, .nav-open, .nav-collapsed .nav-open, .nav-collapsed a.nav-home { display: none; }
  body.app.nav-collapsed .content { margin: 0; grid-column: auto; }
  .sidenav { position: static; height: auto; max-height: 46vh; padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .nav-foot { display: none; }
  .content { margin: 0; border-radius: 0; border: none; min-height: 0; }
  .pagehead { position: static; padding: 10px 16px; border-radius: 0; }
  .page { padding: 16px 16px 40px; }
}

/* --- Menu (drie puntjes) ------------------------------------------------- */

.menu {
  position: fixed; z-index: 1100; min-width: 200px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); display: grid; gap: 1px; animation: pop 0.12s ease-out;
}
.menu button {
  justify-content: flex-start; gap: 9px; width: 100%; padding: 6px 10px; font-weight: 450; font-size: 13.5px;
  background: none; border: 0; color: var(--text); border-radius: var(--radius-sm);
}
.menu button:hover { background: var(--hover); color: var(--text); }
.menu button .icon { color: var(--muted); }
.menu button.danger { color: var(--error); background: none; }
.menu button.danger .icon { color: var(--error); }
.menu button.danger:hover { background: var(--error-soft); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 3px 0; }

/* --- Aanmelden ----------------------------------------------------------- */
/* Licht, links uitgelijnd: tekst en knop links, een echte screenshot rechts. */
.login-page {
  min-height: 100vh; overflow-x: hidden; color: var(--ink);
  background:
    radial-gradient(900px 520px at 85% 8%, var(--login-glow), transparent 70%),
    radial-gradient(700px 480px at -5% 95%, var(--login-glow-2), transparent 70%),
    var(--login-bg);
}
.lp-nav, .lp, .lp-foot { width: min(1400px, 100% - 64px); margin-inline: auto; }
.lp-nav { display: flex; align-items: center; justify-content: space-between; padding: 28px 0 0; }
.lp-nav .brand { padding: 0; font-size: 20px; }

.lp-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 64px; align-items: center; padding: 72px 0 88px;
}
.lp-eyebrow {
  display: inline-block; margin: 0 0 22px; padding: 5px 12px; border-radius: 999px;
  background: var(--login-card); border: 1px solid var(--login-line); color: var(--ink-muted);
  font-size: 13px; font-weight: 500;
}
/* Slogan altijd op twee regels ('feedbackgericht verbeteren' samen): de letter schaalt met de kolom,
   de langste regel is ± 13,3 em breed. */
.lp-intro { container-type: inline-size; }
.lp-intro h1 {
  font-size: clamp(20px, 7.2cqi, 56px); line-height: 1.1; letter-spacing: -0.035em;
  font-weight: 700; margin: 0 0 24px; color: var(--ink);
}
.lp-line { display: block; white-space: nowrap; }
.lp-hl {
  background: linear-gradient(90deg, var(--login-hl-1), var(--login-hl-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lp-lead { font-size: 18px; line-height: 1.6; color: var(--ink-muted); max-width: 31em; margin: 0 0 34px; text-wrap: pretty; }
.login-actions { display: grid; gap: 10px; justify-items: start; max-width: 30em; }
.login-actions .hint { margin: 0; color: var(--ink-muted); }
.login-error { margin: 0; color: var(--error); }
.google-btn {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 13px 24px 13px 18px; font-size: 15px; font-weight: 600;
  background: var(--login-card); color: var(--ink); border: 1px solid var(--login-line);
  border-radius: var(--radius); box-shadow: var(--login-shadow-sm);
}
.google-btn:hover { background: var(--login-card); color: var(--ink); border-color: var(--link-border); box-shadow: var(--login-shadow); }
.login-legal { margin: 6px 0 0; font-size: 13px; color: var(--ink-muted); }

/* Screenshot in een venster */
.lp-shot { margin: 0; position: relative; }
.lp-window {
  border-radius: var(--radius-lg); overflow: hidden; background: var(--bar);
  border: 1px solid var(--login-line); box-shadow: var(--login-shadow-lg);
}
.lp-window-bar { display: flex; gap: 6px; padding: 10px 14px; background: var(--bar); }
.lp-window-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--bar-border); }
.lp-window img { display: block; width: 100%; height: auto; }

/* Vier stappen, elk met een uitsnede van het echte scherm */
.lp-steps { padding: 0 0 72px; }
.lp-steps ol {
  list-style: none; margin: 0; padding: 0; counter-reset: step;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px;
}
.lp-steps li {
  counter-increment: step; display: grid; gap: 6px; align-content: start;
  padding: 12px 12px 20px; background: var(--login-card); border: 1px solid var(--login-line);
  border-radius: var(--radius-lg); box-shadow: var(--login-shadow-sm);
}
.lp-steps b { font-size: 15px; padding: 0 6px; color: var(--ink); }
.lp-steps b::before { content: counter(step) ". "; color: var(--link); }
.lp-steps span { font-size: 14px; color: var(--ink-muted); line-height: 1.5; padding: 0 6px; text-wrap: pretty; }
/* Beelden in web/login/, gemaakt met scripts/beelden.py */
.lp-thumb {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; margin-bottom: 10px;
  border-radius: var(--radius); border: 1px solid var(--login-line); background: var(--page);
}

.lp-foot {
  display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 22px 0 32px;
  border-top: 1px solid var(--login-line); font-size: 13px; color: var(--ink-muted);
}
.lp-foot span { margin-right: auto; font-weight: 600; color: var(--ink); }
.lp-foot a { color: var(--ink-muted); }
.lp-foot a:hover { color: var(--link); }

@media (max-width: 1080px) {
  .lp-hero { grid-template-columns: minmax(0, 1fr); gap: 48px; padding: 48px 0 64px; }
  .lp-steps ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .lp-nav, .lp, .lp-foot { width: calc(100% - 32px); }
  .lp-hero { padding: 32px 0 48px; }
  .lp-lead { font-size: 16px; }
  .lp-steps ol { grid-template-columns: minmax(0, 1fr); }
}

/* --- Kaarten en secties -------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-width: 0;
}
.card > header, .card-head {
  display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.card > header h2, .card-head h2 { margin: 0; }
.card > header .actions, .card-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > header { padding: 12px 16px 0; border-bottom: none; }

.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .cols-2 { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.stat .label { font-size: 12.5px; color: var(--muted); }
.stat .value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat .value small { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat.warn .value { color: var(--warn); }
.stat.ok .value { color: var(--ok); }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty p { margin-bottom: 14px; }

.notice {
  background: var(--warn-soft); border: 0; color: var(--warn);
  padding: 9px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin: 0;
}
.notice.info { background: var(--accent-soft); color: var(--accent-hover); }
#warnings:empty { display: none; }
#warnings { display: grid; gap: 8px; }

.badge {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; line-height: 18px;
  font-size: 11.5px; font-weight: 500; background: var(--ai-soft); color: var(--ai);
  border: 1px solid var(--ai-border); vertical-align: 1px;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.badge.grey { background: var(--surface-2); color: var(--muted); border-color: var(--border); }

/* Label voor klas of vak (kleur volgt uit de naam, zie tagClass() in common.js). */
.tag {
  display: inline-flex; align-items: center; max-width: 100%; padding: 0 7px; line-height: 20px;
  border-radius: 5px; font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--tag-1-soft); color: var(--tag-1); border: 1px solid var(--tag-1-border);
}
.tag.t2 { background: var(--tag-2-soft); color: var(--tag-2); border-color: var(--tag-2-border); }
.tag.t3 { background: var(--tag-3-soft); color: var(--tag-3); border-color: var(--tag-3-border); }
.tag.t4 { background: var(--tag-4-soft); color: var(--tag-4); border-color: var(--tag-4-border); }
.tag.t5 { background: var(--tag-5-soft); color: var(--tag-5); border-color: var(--tag-5-border); }
.tag.t6 { background: var(--tag-6-soft); color: var(--tag-6); border-color: var(--tag-6-border); }

.progress { height: 6px; background: var(--hover); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.25s; }
.progress.ok > span { background: var(--ok); }

/* --- Help (stappen van de pagina) en de knop naar de volgende stap ------- */

.step-bar {
  display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.help-btn .icon { color: var(--accent-strong); }
.step-bar .guide-actions { margin-left: 0; flex: 1; }
.step-bar #next-hint { margin-left: auto; }
.step-bar + .grade-toolbar { margin-top: 0; }
.help-pop {
  position: fixed; z-index: 1100; width: min(360px, calc(100vw - 16px)); padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); animation: pop 0.12s ease-out; display: grid; gap: 12px;
}
.help-pop-title { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.help-pop-title .icon { color: var(--accent-strong); width: 18px; height: 18px; }
.help-pop-foot { display: flex; justify-content: flex-end; padding-top: 10px; border-top: 1px solid var(--border); }
.guide-steps {
  margin: 0; padding: 0; list-style: none; counter-reset: guide; display: grid; gap: 10px;
}
.guide-steps li { counter-increment: guide; display: flex; align-items: baseline; gap: 10px; font-size: 13.5px; line-height: 1.45; }
.guide-steps li::before {
  content: counter(guide); flex: none; display: grid; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--accent-strong);
  font-size: 11.5px; font-weight: 600; transform: translateY(-1px);
}
.guide-actions { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-left: auto; }
.guide-actions .hint { margin: 0; }
.next-step { white-space: nowrap; }
.button.next-step.ready { background: var(--accent-strong); color: var(--on-accent); border-color: var(--accent-strong); }
.button.next-step.ready:hover { background: var(--accent-strong-hover); border-color: var(--accent-strong-hover); color: var(--on-accent); }

/* Opvallende knop voor voorstellen (potlood-kleur, gevuld). */
button.ai-primary { background: var(--ai); color: #fff; border-color: var(--ai); }
button.ai-primary:hover { background: var(--ai-hover); border-color: var(--ai-hover); }
.ai-status { font-size: 13px; color: var(--ai); }
.ai-status:empty { display: none; }
.ai-status.busy::before, #comment-status.busy::before {
  content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%;
  border: 2px solid var(--ai); border-right-color: transparent; animation: spin 0.8s linear infinite; vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Laden: Rubriq maakt een voorstel. .spinner = draaiend rondje (ook in een knop met .is-loading),
   .skeleton = grijze lijnen die zacht oplichten op de plaats waar het voorstel komt. */
.spinner {
  display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite;
  vertical-align: -2px;
}
button.is-loading { gap: 8px; opacity: 1 !important; }
button.is-loading::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite;
}
.skeleton { display: grid; gap: 8px; width: 100%; }
.skeleton span {
  display: block; height: 10px; border-radius: 99px;
  background: linear-gradient(90deg, var(--ai-border) 0%, var(--ai-soft) 50%, var(--ai-border) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton span:nth-child(1) { width: 40%; height: 18px; }
.skeleton span:nth-child(2) { width: 92%; }
.skeleton span:nth-child(3) { width: 75%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Plaatshouders terwijl de pagina laadt (data-skeleton, zie common.js): weg zodra body.ready of er inhoud is. */
body:not(.ready) [data-skeleton]:empty {
  display: block; min-height: 140px; border-radius: var(--radius);
  background-color: var(--surface-2);
  background-image: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.65) 50%, transparent 100%);
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
/* Rijen: grijze balken met witte tussenruimte, zoals een lijst of tabel die eraan komt. */
body:not(.ready) [data-skeleton="rows"]:empty {
  min-height: 220px;
  background-color: transparent;
  background-image: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.65) 50%, transparent 100%),
    repeating-linear-gradient(to bottom, var(--hover) 0 26px, transparent 26px 38px);
  background-size: 200% 100%, 100% 100%;
}
/* Items: hogere balken (naam + regel eronder), binnen de binnenrand van de lijst. */
body:not(.ready) [data-skeleton="items"]:empty {
  min-height: 200px; background-clip: content-box;
  background-color: transparent;
  background-image: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.65) 50%, transparent 100%),
    repeating-linear-gradient(to bottom, var(--hover) 0 40px, transparent 40px 46px);
  background-size: 200% 100%, 100% 100%;
}
/* Detail: een titel en daaronder een kaart (bv. een klas met haar klaslijst). */
body:not(.ready) [data-skeleton="detail"]:empty {
  min-height: 340px; background-color: transparent;
  background-image: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.65) 50%, transparent 100%),
    linear-gradient(var(--hover), var(--hover)), linear-gradient(var(--surface-2), var(--surface-2));
  background-size: 200% 100%, 30% 26px, 100% calc(100% - 48px);
  background-position: 0 0, 0 0, 0 48px; background-repeat: repeat, no-repeat, no-repeat;
  animation-name: shimmer-detail;  /* enkel de glans beweegt, titel en kaart blijven staan */
}
@keyframes shimmer-detail { from { background-position: 100% 0, 0 0, 0 48px; } to { background-position: -100% 0, 0 0, 0 48px; } }
body:not(.ready) [data-skeleton="block"]:empty { min-height: 320px; }
body:not(.ready) [data-skeleton="tiles"]:empty { min-height: 66px; }
[data-skeleton]:not(:empty), body.ready [data-skeleton]:empty { animation: none; }
body.ready [data-skeleton]:empty:not(table) { min-height: 0; }

/* Een beeld dat nog laadt: oplichtende plaats in de container (watchImage in common.js). */
.img-loading {
  background-color: var(--surface-2) !important;
  background-image: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.65) 50%, transparent 100%) !important;
  background-size: 200% 100% !important; animation: shimmer 1.4s ease-in-out infinite; min-height: 120px;
}
.img-loading > img { opacity: 0; }
@media (prefers-reduced-motion: reduce) { body:not(.ready) [data-skeleton]:empty, .img-loading, .page-sheet.is-loading { animation: none; } }
textarea.drafting {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--ai-soft) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .spinner, button.is-loading::before, .ai-status.busy::before, #comment-status.busy::before { animation-duration: 2.4s; }
  .skeleton span, textarea.drafting { animation: none; }
}

/* Resultaten: wat je met de scores doet. */
.action-tiles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.action-tile { display: grid; gap: 8px; align-content: start; }
.action-tile h2 { margin: 0; font-size: 15px; }
.action-tile p { margin: 0; color: var(--muted); font-size: 13.5px; }
.action-tile .btn-row { margin-top: 6px; align-items: center; }
@media (max-width: 900px) { .action-tiles { grid-template-columns: 1fr; } }

/* --- Gesplitst scherm: lijst links, detail rechts (Klassen) --------------- */

.bank { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.bank-list { position: sticky; top: calc(var(--head-h) + 16px); max-height: calc(100vh - var(--head-h) - 40px); overflow: auto; }
.bank-list > header { padding: 12px 14px 6px; }
.bank-items { padding: 4px 8px 12px; display: grid; gap: 2px; }
button.bank-skill {
  display: grid; gap: 3px; justify-content: start; justify-items: start; text-align: left; white-space: normal; width: 100%;
  padding: 7px 10px; background: transparent; color: var(--text); border: 1px solid transparent; font-weight: 500;
}
button.bank-skill:hover { background: var(--hover); border-color: transparent; color: var(--text); }
button.bank-skill.active { background: var(--accent-soft); border-color: var(--accent-border); }
button.bank-skill strong { font-size: 14px; font-weight: 550; }
.bank-detail { display: grid; gap: 16px; min-width: 0; }
.bank-head { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.bank-head h2 { font-size: 18px; }
.bank-head .hint { margin: 0; }
.bank-head .btn-row { margin-left: auto; }
@media (max-width: 900px) {
  .bank { grid-template-columns: 1fr; }
  .bank-list { position: static; max-height: none; }
}

/* --- Formulieren --------------------------------------------------------- */

form { margin: 0; }
.form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

.field { display: grid; gap: 5px; font-weight: 500; font-size: 13px; min-width: 0; }
.field > span { color: var(--text); }
.field small { font-weight: 400; color: var(--muted); }
.field.inline { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-head label { color: var(--text); }
textarea.drafting { color: var(--muted); }

input[type="text"], input[type="number"], input[type="date"], input[type="search"], input:not([type]), textarea, select {
  font: inherit; font-size: 13.5px; font-weight: 400;
  color: var(--text); background: var(--field);
  padding: 6px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  min-width: 0;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.field input[type="text"], .field input[type="date"], .field select, .field textarea { width: 100%; }
.field input[type="number"] { width: 110px; }
textarea { resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
textarea.plain { font-family: var(--font); font-size: 13.5px; }
select { padding-right: 28px; cursor: pointer; }
.invalid, input.invalid { border-color: var(--error) !important; box-shadow: 0 0 0 3px var(--error-soft) !important; }

.check { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; font-weight: 400; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }

/* Zoekveld met vergrootglas */
.search { position: relative; display: inline-flex; align-items: center; }
.search .icon { position: absolute; left: 9px; color: var(--faint); pointer-events: none; width: 15px; height: 15px; }
.search input { padding-left: 30px; width: 300px; max-width: 100%; }

/* Bestand kiezen als sleepvak */
.dropzone {
  position: relative; display: grid; place-items: center; gap: 4px; text-align: center;
  padding: 24px 16px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface-2); color: var(--muted); cursor: pointer; transition: 0.15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone strong { color: var(--text); font-size: 14px; font-weight: 600; }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .files { font-size: 13px; color: var(--accent); font-weight: 600; }

/* --- Knoppen ------------------------------------------------------------- */

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 13.5px; font-weight: 500; line-height: 1.2;
  padding: 7px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, color 0.12s;
}
button:hover, .button:hover { background: var(--primary-hover); border-color: var(--primary-hover); text-decoration: none; }
button:focus-visible, .button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
button:disabled { opacity: 0.5; cursor: default; pointer-events: none; }

button.secondary, .button.secondary { background: var(--field); color: var(--accent); border-color: var(--accent-border); }
button.secondary:hover, .button.secondary:hover { background: var(--accent-soft); border-color: var(--accent); }
button.ghost, .button.ghost { background: var(--field); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
button.ghost:hover, .button.ghost:hover { background: var(--hover); border-color: var(--faint); }
button.danger, .button.danger { background: var(--field); color: var(--error); border-color: var(--error-border); }
button.danger:hover { background: var(--error-soft); border-color: var(--error); }
button.danger-solid { background: var(--error); border-color: var(--error); color: #fff; }
button.danger-solid:hover { background: var(--error-hover); border-color: var(--error-hover); }
/* Resultaten: verwijderknop naast elk nummer, zichtbaar op de rij onder de muis (of met de toetsenbordfocus). */
.who-cell { display: flex; align-items: center; gap: 6px; }
button.icon-btn.row-delete { width: 26px; height: 26px; flex: none; opacity: 0.35; }
tr:hover button.icon-btn.row-delete, button.icon-btn.row-delete:focus-visible { opacity: 1; }
button.icon-btn.row-delete:hover { color: var(--error); background: var(--error-soft); }

button.small, .button.small { padding: 4px 10px; font-size: 13px; }
.icon-btn, button.icon-btn {
  width: 30px; height: 30px; padding: 0; font-size: 14px;
  background: transparent; color: var(--muted); border-color: transparent; box-shadow: none;
}
.icon-btn:hover, button.icon-btn:hover { background: var(--hover); color: var(--text); border-color: transparent; }
.icon-btn.danger:hover { color: var(--error); background: var(--error-soft); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Segmented control (pagina wisselen, vraag wisselen) */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--field); overflow: hidden; }
.stepper button { border: none; border-radius: 0; background: transparent; color: var(--text); padding: 6px 11px; }
.stepper button:hover { background: var(--hover); }
.stepper > span, .stepper select { padding: 0 10px; font-weight: 600; font-size: 13.5px; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); border-radius: 0; height: 30px; display: flex; align-items: center; }
.stepper select:focus { box-shadow: none; }

kbd {
  display: inline-block; min-width: 20px; text-align: center;
  font: 500 11px var(--font); color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; background: var(--surface-2);
}

/* --- Tabellen ------------------------------------------------------------ */

.table-scroll { overflow: auto; max-width: 100%; }
.table-scroll.tall { max-height: calc(100vh - 260px); }

table.list { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.tests { background: var(--surface); }
.tests-frame { margin: 0 20px 24px; border: 1px solid var(--border-strong); border-radius: var(--radius); }
.tests-frame:has(> table[hidden]) { border: 0; }
table.list th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 12.5px; white-space: nowrap;
  background: var(--surface); position: sticky; top: 0; z-index: 1;
}
table.list th, table.list td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list tbody tr:hover td { background: var(--surface-2); }
table.list tbody tr:last-child td { border-bottom: none; }
table.list td.actions { text-align: right; white-space: nowrap; }
/* Met kolomlijnen, zoals een spreadsheet */
table.list.lined th + th, table.list.lined td + td { border-left: 1px solid var(--border); }

table.grid td, table.grid th { text-align: center; white-space: nowrap; }
table.grid td:first-child, table.grid th:first-child {
  text-align: left; font-variant-numeric: tabular-nums;
  position: sticky; left: 0; background: var(--surface); z-index: 1;
}
table.grid th:first-child { z-index: 2; }
table.grid td.ok a, table.grid td.ok button { color: var(--ok); font-weight: 600; }
table.grid td.warn a, table.grid td.warn button { color: var(--warn); font-weight: 600; }
table.grid td.missing { color: var(--faint); }
.cell-btn { background: none; border: none; padding: 2px 8px; font-size: 14px; color: inherit; border-radius: 5px; }
.cell-btn:hover { background: var(--hover); }

/* --- Modals, toasts ------------------------------------------------------ */

dialog.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  color: var(--text); background: var(--surface);
}
dialog.modal[open] { display: flex; flex-direction: column; animation: pop 0.16s ease-out; }
dialog.modal::backdrop { background: rgba(15, 23, 42, 0.35); }
dialog.modal-wide { width: min(880px, calc(100vw - 32px)); }
.steps-list { margin: 16px 0 8px; padding-left: 20px; display: grid; gap: 6px; font-size: 13.5px; }
dialog.modal-full { width: calc(100vw - 48px); height: calc(100vh - 48px); max-width: 1400px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 15px; flex: 1; }
.modal-body { padding: 18px 20px; overflow: auto; flex: 1; }
.modal-body > p:last-child { margin-bottom: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(0.98); } }

.lightbox { display: grid; place-items: center; height: 100%; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 210px); box-shadow: var(--shadow); border: 1px solid var(--border); background: var(--paper); }

.toasts { position: fixed; right: 20px; bottom: 72px; z-index: 1000; display: grid; gap: 8px; justify-items: end; }
.toast {
  max-width: 420px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--primary); color: var(--on-primary); font-size: 13.5px; box-shadow: var(--shadow-lg);
  cursor: pointer; animation: pop 0.16s ease-out; transition: opacity 0.2s;
}
.toast.error { background: var(--error); }
.toast.leaving { opacity: 0; }

.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; align-items: center; font-size: 13.5px; }
.shortcuts dt { text-align: right; white-space: nowrap; }
.shortcuts dd { margin: 0; color: var(--muted); }

/* --- Namen -------------------------------------------------------------- */

/* Stap 'Namen koppelen' (namen.html): links de kop van de toets, rechts de klas en haar namen. */
.link-names { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.link-left, .link-right { display: grid; gap: 12px; min-width: 0; }
.link-right { position: sticky; top: calc(var(--head-h) + 16px); max-height: calc(100vh - var(--head-h) - 40px); grid-template-rows: auto auto minmax(0, 1fr); }
.link-head { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; }
.link-head h2 { margin: 0; font-size: 20px; font-variant-numeric: tabular-nums; }
.link-head .hint { margin: 0; }
.header-view { display: grid; place-items: center; min-height: 160px; background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; cursor: zoom-in; }
.header-view img { display: block; max-width: 100%; max-height: 60vh; }
.link-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.link-strip { display: flex; flex-wrap: wrap; gap: 4px; }
button.link-chip { min-height: 0; padding: 2px 8px; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums;
  background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
button.link-chip:hover { background: var(--hover); color: var(--text); }
button.link-chip.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
button.link-chip.current { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.link-classes { display: grid; gap: 6px; }
button.link-class { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 9px 12px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); font-weight: 500; }
button.link-class:hover, button.link-class.current { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.link-search { width: 100%; }
.link-list { display: grid; grid-auto-rows: max-content; gap: 4px; overflow-y: auto; min-height: 0; padding-right: 4px; }
button.link-name { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; text-align: left; white-space: normal; line-height: 1.3; font-weight: 450; font-size: 14px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); }
button.link-name:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
button.link-name.done { color: var(--faint); background: var(--surface-2); }
button.link-name.current { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
button.link-name .num { flex: none; font-size: 12.5px; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .link-names { grid-template-columns: 1fr; } .link-right { position: static; max-height: none; } }

/* Namen koppelen: links de nummers onder elkaar, rechts de klaslijst. */
.names-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin: 12px 0 14px; align-items: start; }
.names-left, .names-class { display: grid; gap: 8px; min-width: 0; }
/* grid-auto-rows: max-content, anders krimpen de rijen in de scrollbox onder de teksthoogte (lange klaslijst). */
.names-list, .names-students { display: grid; grid-auto-rows: max-content; gap: 4px; max-height: min(52vh, 520px); overflow-y: auto; padding-right: 4px; align-content: start; }
.names-row { display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 13.5px; }
.names-row .num { color: var(--muted); font-variant-numeric: tabular-nums; }
.names-row input.invalid { border-color: var(--error); background: var(--error-soft); }
.names-sep { margin: 8px 0 2px; }
.names-order { display: flex; align-items: center; gap: 8px; }
.names-order .hint { margin: 0; }
.names-class-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-height: 30px; }
.names-class-head .hint { margin: 0; }
button.names-student {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%;
  padding: 6px 10px; text-align: left; font-weight: 450; font-size: 13.5px; white-space: normal; line-height: 1.3;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
button.names-student:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
button.names-student.done, button.names-student.done:hover { background: var(--surface-2); color: var(--faint); border-color: var(--border); cursor: default; }
button.names-student .num { flex: none; font-variant-numeric: tabular-nums; font-size: 12.5px; }
button.names-student.done { opacity: 1; }  /* niet half doorzichtig zoals andere uitgeschakelde knoppen */
.names-import { margin-bottom: 12px; }
.names-import summary { cursor: pointer; color: var(--accent); font-size: 13.5px; }
.names-foot { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.names-foot .hint { margin: 0; }
.names-state { margin-left: auto !important; }
@media (max-width: 640px) { .names-cols { grid-template-columns: minmax(0, 1fr); } }
.who small { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }

/* --- Toetsen (overzicht) ------------------------------------------------- */

.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 20px; border-bottom: 1px solid var(--border);
}
.toolbar select { min-width: 140px; }
.toolbar .count { margin-left: auto; font-size: 12.5px; color: var(--muted); }
table.tests td { height: 44px; }
table.tests th.sortable { cursor: pointer; user-select: none; }
table.tests th.sortable:hover { color: var(--text); }
table.tests th .sort { color: var(--faint); margin-left: 4px; font-size: 11px; }
table.tests td.editable { cursor: pointer; }
table.tests td.editable:hover { box-shadow: inset 0 0 0 1px var(--border-strong); background: var(--surface); }
table.tests td.editable .placeholder { color: var(--faint); opacity: 0; }
table.tests tr:hover td.editable .placeholder { opacity: 1; }
table.tests td.editing { padding: 4px 6px; box-shadow: inset 0 0 0 2px var(--accent); }
table.tests td.editing input, table.tests td.editing select { width: 100%; padding: 4px 6px; }
table.tests td.pct { font-variant-numeric: tabular-nums; }
table.tests td.pct.full { color: var(--ok); font-weight: 600; }
.test-cell { display: flex; align-items: center; gap: 8px; min-width: 220px; }
.test-cell .icon { color: var(--faint); }
.test-name { font-weight: 550; color: var(--text); }
.test-name:hover { color: var(--accent); }
.test-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.test-cell .icon-btn { width: 24px; height: 24px; opacity: 0; margin-left: auto; }
.test-cell .icon-btn .icon { width: 14px; height: 14px; }
tr:hover .test-cell .icon-btn { opacity: 1; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; align-items: center; }
.row-actions .icon-btn { width: 28px; height: 28px; }
.test-progress { display: grid; gap: 4px; min-width: 130px; font-size: 12.5px; color: var(--muted); }
.result-links { display: grid; gap: 10px; }
#ids { columns: 6; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); margin: 6px 0 0; padding-left: 26px; }
@media (max-width: 600px) { #ids { columns: 3; } .search input { width: 100%; } .toolbar .search { flex: 1 1 100%; } }

/* --- Klassen ------------------------------------------------------------- */

.class-detail textarea { min-height: 320px; }
.skill-pick { display: flex; gap: 12px; flex-wrap: wrap; }
.skill-add-form { display: flex; gap: 8px; padding: 0 16px 14px; }
.skill-add-form input { flex: 1 1 auto; min-width: 0; }
.skill-name { cursor: text; border-radius: var(--radius-sm); padding: 2px 4px; margin: -2px -4px; }
.skill-name:hover { background: var(--hover); }
.skill-section { padding-top: 6px; border-top: 1px solid var(--border); }
.skill-section-head { display: flex; align-items: center; gap: 10px; padding: 8px 16px; }
.skill-section-head h2 { margin: 0; font-size: 14.5px; font-weight: 600; }
.skill-section-head .icon-btn { margin-left: auto; }
.skill-section .skill-add-form { padding-top: 10px; }
.skill-section .table-scroll table.list { width: 100%; table-layout: fixed; }  /* zelfde kolommen in elk onderdeel */
.skill-section td.num { width: 90px; }
.skill-section td.actions { width: 56px; }
.skill-move-cell { width: 260px; }
.skill-section td:first-child { padding-left: 16px; }  /* gelijk met de naam van het onderdeel */
.skill-move { width: 100%; font-size: 13px; }
.class-detail .bank-head h2 { cursor: text; border-radius: var(--radius-sm); padding: 2px 4px; margin: -2px -4px; }
.class-detail .bank-head h2:hover { background: var(--hover); }

/* --- Vragen afbakenen ---------------------------------------------------- */
/* Bovenaan de paginabalk over de volle breedte; daaronder de toets en het paneel, even hoog en
   bovenaan gelijk. De pagina past in het venster, het paneel neemt de rest van de breedte. */

.page.editor-page { padding-bottom: 20px; }
.editor {
  --sheet-h: max(460px, calc(100vh - 200px));
  display: grid;
  grid-template-columns: auto minmax(500px, 1fr);
  grid-template-rows: auto auto;
  gap: 12px 16px;
  align-items: start;
}
.viewer-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.viewer-bar .hint { margin: 0; }

.page-sheet {
  position: relative;
  width: fit-content; max-width: 100%;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  background: var(--paper);
  user-select: none;
}
.page-sheet img { display: block; max-width: 100%; max-height: var(--sheet-h); width: auto; height: auto; }
/* Eerste pagina nog niet binnen: oplichtend vlak zo groot als een A4, zonder het symbool van een ontbrekend beeld. */
.page-sheet.is-loading {
  height: var(--sheet-h); aspect-ratio: 210 / 297;
  background-color: var(--surface-2);
  background-image: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.65) 50%, transparent 100%);
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
.page-sheet.is-loading img { display: none; }
.page-sheet.is-loading .overlay { pointer-events: none; }

.page-sheet > .overlay { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }

.box {
  position: absolute;
  border: 2px solid var(--ai);
  background: var(--box-fill);
  border-radius: 3px;
  cursor: move;
}
.box:hover { border-color: var(--accent); background: var(--accent-ring); }
.box.selected { border-color: var(--accent-strong); background: var(--accent-ring); box-shadow: 0 0 0 3px var(--accent-ring); }
.box.drawing { border-style: dashed; pointer-events: none; }
.box .tag {
  position: absolute; top: -2px; left: -2px; line-height: 1.5;
  padding: 1px 8px; background: var(--ai); color: #fff; border: 0;
  font-size: 12px; font-weight: 600; border-radius: 3px 0 6px 0; pointer-events: none;
}
.box:hover .tag { background: var(--accent); }
.box.selected .tag { background: var(--accent-strong); }
.box .handle {
  position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px;
  background: var(--surface); border: 2px solid var(--accent-strong); border-radius: 3px; cursor: nwse-resize;
}

/* Het paneel neemt de hoogte van de pagina over (absoluut in de rij), en scrolt nooit als geheel. */
.sidebar { position: relative; align-self: stretch; min-width: 0; }
.qpanel {
  position: absolute; inset: 0; padding: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
.card > .qpanel-head {
  flex: none; display: flex; flex-wrap: nowrap; align-items: center; gap: 12px; margin: 0;
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.card > .qpanel-head > .icon-btn { margin-left: auto; }
.qpanel-empty { flex: 1; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); }
.qpanel-empty p { margin: 0; max-width: 26em; }

/* Open vraag onder haar rij: links het correctiemodel, rechts de vaardigheden, onderaan kader en verwijderen. */
.qform { display: grid; grid-template-columns: minmax(0, 7fr) minmax(220px, 5fr); grid-template-rows: 1fr auto; }
.qform[hidden] { display: none; }
.qsec { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; padding: 14px 16px; }
.qsec .section-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 0; font-size: 11.5px; }
.qsec-skills { background: var(--surface-2); border-left: 1px solid var(--border-strong); }  /* ander vlak: bijzaak naast het correctiemodel */
.qform-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 16px;
  background: var(--surface-2); border-top: 1px solid var(--border-strong); border-radius: 0 0 var(--radius) var(--radius);
  font-size: 12.5px; color: var(--muted); }
#q-delete .icon { width: 14px; height: 14px; }
.qsec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.qsec-label { font-weight: 600; font-size: 14px; color: var(--text); }
.qsec-sub { margin: 0; font-size: 12.5px; color: var(--muted); }
.qsec-sub.warn { color: var(--warn); }  /* concept nog niet nagekeken */
button.warn-solid { background: var(--warn); border-color: var(--warn); color: #fff; }
button.warn-solid:hover { background: var(--warn-hover); border-color: var(--warn-hover); }
/* Zelfde kleur als het '!' bij een kader dat nog nagekeken moet worden (bv. 'Kaders op deze pagina kloppen'). */
button.warn-soft { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
button.warn-soft:hover { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); box-shadow: 0 0 0 2px var(--warn-border); }

textarea.model {
  flex: 1 1 auto; min-height: 140px; width: 100%; resize: none;
  line-height: 1.6; padding: 10px 12px; background: var(--field);
}
textarea.model:focus { background: var(--field); }
textarea.model.concept { border-color: var(--warn-border); background: var(--warn-soft); }
.rubric { flex: none; display: flex; flex-direction: column; gap: 8px; }
/* Eén onderdeel als kaartje, zoals een feedbackpunt bij Verbeteren: punten | tekst | verwijderen. */
.rubric-rows { list-style: none; margin: 0; padding: 0; display: grid; align-content: start; gap: 6px; }
.rubric-rows:empty { display: none; }
.rubric-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 8px;
  background: var(--field); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.rubric-row:focus-within { border-color: var(--accent); }
.rubric-points-box { display: inline-flex; align-items: center; gap: 1px; height: 26px; padding: 0 7px;
  background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.rubric-row input.rubric-points { width: 3ch; field-sizing: content; min-width: 1ch; height: 100%; padding: 0; border: 0; background: transparent; box-shadow: none;
  text-align: center; font-size: 12.5px; font-weight: 600; color: inherit; font-variant-numeric: tabular-nums; }
.rubric-row input.rubric-points:focus { box-shadow: none; }
.rubric-points-box:has(.invalid) { background: var(--error-soft); border-color: var(--error-border); color: var(--error); }
.rubric-row .rubric-text { width: 100%; font-family: var(--font); font-size: 13.5px; line-height: 1.35; resize: none; overflow: hidden; min-height: 0; padding: 3px 6px;
  border-color: transparent; background: transparent; box-shadow: none; }
.rubric-row .rubric-text:hover { border-color: var(--border); }
.rubric-row .rubric-text:focus { border-color: var(--accent); background: var(--surface); }
.rubric-row .math-field > .math-view { border-color: transparent; background: transparent; box-shadow: none; }
.rubric-row button.icon-btn { width: 24px; height: 26px; }
.rubric-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rubric-sum { padding: 1px 8px; background: var(--ok-soft); border: 1px solid var(--ok-border); border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ok); font-variant-numeric: tabular-nums; }
.rubric-sum.off { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.rubric-label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.rubric-foot + *, .rubric + .rubric-label { margin-top: 6px; }
.qsec-model .math-field { flex: 1 1 auto; display: flex; min-height: 0; }
.math-field > .math-view.model { flex: 1 1 auto; min-width: 0; overflow-y: auto; font-size: 13.5px; line-height: 1.6; padding: 10px 36px 10px 12px;
  background: var(--field); }
.math-field > .math-view.model.concept { border-color: var(--warn-border); background: var(--warn-soft); }
/* Correctiemodel in delen (Antwoord, Ook juist, Let op): kopje met een gekleurd streepje en rechts een vuilbakje,
   vakje groeit mee met de tekst. */
.model-parts { flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.model-part { --part: var(--ok); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.model-part.is-also { --part: var(--accent); }
.model-part.is-watch { --part: var(--error); }
.model-part-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.qsec .model-part-label { justify-content: flex-start; gap: 6px; margin: 0; color: var(--text); }
.model-part-label::before { content: ""; flex: none; width: 3px; height: 12px; border-radius: 2px; background: var(--part); }
button.model-clear { width: 24px; height: 24px; color: var(--muted); }
button.model-clear:hover { color: var(--error); }
button.model-clear[hidden] { display: inline-flex; visibility: hidden; }  /* leeg vakje: plaats blijft, geen verspringen */
button.model-clear .icon { width: 14px; height: 14px; }
.qsec-model .model-part .math-field { flex: none; }
.model-parts textarea.model, .model-parts .math-view.model { flex: 1 1 auto; min-height: calc(1lh + 22px); max-height: 260px;
  field-sizing: content; resize: none; }
.model-parts .is-answer textarea.model, .model-parts .is-answer .math-view.model { min-height: calc(2lh + 22px); }
button.ai-btn { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.ai-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.ai-btn-ic { display: inline-flex; }
.ai-btn-ic .icon { width: 15px; height: 15px; }
button.ai-btn.is-loading .ai-btn-ic { display: none; }  /* tijdens het laden enkel de spinner */

.skill-search { display: flex; }
.skill-search input { width: 100%; }
.skill-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 1px; margin-right: -8px; padding-right: 8px; }
.skill-list { gap: 5px; }
.skill-list .check { font-size: 13px; align-items: center; padding: 6px 8px; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.skill-list .check:hover { border-color: var(--border-strong); }
.skill-list .check:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-border); font-weight: 500; color: var(--accent-strong); }
.skill-list .check input { appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin: 0; cursor: pointer;
  border: 1.5px solid var(--border-strong); border-radius: 5px; background: var(--field) center / 13px no-repeat; }
.skill-list .check input:checked { border-color: var(--accent-strong); background-color: var(--accent-strong); background-image: var(--check-mark-on); }
.skill-list .check input:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
#q-skill-count.none { color: var(--warn); font-weight: 600; }
.skill-none { margin: 4px 0; }
.skill-class { width: auto; min-width: 0; max-width: 60%; font-size: 13px; padding-top: 3px; padding-bottom: 3px; }
.skill-class.needed { border-color: var(--warn-border); background: var(--warn-soft); }
button.skill-new { justify-self: start; margin-top: 4px; font-size: 13px; font-weight: 500; white-space: normal; text-align: left;
  background: none; border: 0; color: var(--accent); padding: 3px 6px; }
button.skill-new:hover { background: var(--hover); color: var(--accent); }
.skill-other, .skill-group { margin-top: 10px; padding: 0 6px; }
.skill-group:first-child { margin-top: 0; }
.skill-del { margin-left: auto; padding: 0 6px; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 400; opacity: 0; box-shadow: none; }
.check:hover .skill-del { opacity: 1; }
.skill-del:hover { background: none; color: var(--error); }

/* Knop met enkel een pictogram (bv. het blauwe pijltje 'Verder naar de toets'); uitleg in de tooltip. */
.button.icon-only, button.icon-only { padding-left: 14px; padding-right: 14px; }
.icon-only .icon { width: 18px; height: 18px; }

/* Voorgesteld kader (toets gelezen door Rubriq), nog niet nagekeken: gestippeld in de waarschuwingskleur. */
.box.proposed { border-style: dashed; border-color: var(--warn); }
.box.proposed .tag { background: var(--warn); }
.box.proposed.selected { border-color: var(--accent-strong); }
.box.proposed.selected .tag { background: var(--accent-strong); }
.draw-hint { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--accent-strong); }
.page-sheet > .overlay.drawing-for { outline: 2px dashed var(--accent); outline-offset: -2px; }

/* Structuur van de toets: vragen, deelvragen, punten, kader en correctiemodel per rij. */
.qpanel-title { font-weight: 600; font-size: 14px; }
.ov-total { flex: 0 1 auto; min-width: 0; margin-right: auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qpanel-title, #ov-read, #ov-models, #ov-more { flex: none; white-space: nowrap; }
.card > .qpanel-head > #ov-more { margin-left: 0; }
.overview { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.overview[hidden] { display: none; }
.ov-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px 10px 12px; container-type: inline-size; }
@container (max-width: 600px) {
  .qform { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .qsec-skills { border-left: 0; border-top: 1px solid var(--border); }
}
.ov-list[hidden] { display: none; }
/* Tabel: alle kolommen op één lijn; een deelvraag springt in met een kleiner nummer. */
.ov-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13.5px; }
.ov-table col.c-num { width: 110px; }
.ov-table col.c-pts { width: 70px; }
.ov-table col.c-st { width: 52px; }
.ov-table col.c-act { width: 76px; }
.ov-table th {
  position: sticky; top: -8px; z-index: 1; background: var(--surface); padding: 6px 6px; text-align: left;
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  border-bottom: 1px solid var(--border-strong);
}
.ov-table th:nth-child(4), .ov-table th:nth-child(5), .ov-table th:nth-child(6) { text-align: center; }
.ov-table th.num, .ov-table td.num { text-align: right; }
.ov-table td { padding: 3px 6px; height: 40px; vertical-align: middle; }
.ov-table td.st { text-align: center; }
.ov-table td.act { text-align: right; white-space: nowrap; }
.ov-table th:first-child { padding-left: 15px; }
.ov-table th:last-child { padding-right: 15px; }
/* Elke hoofdvraag een eigen kaart met ronde hoeken, met marge binnenin: randen en hoeken op de cellen van de tbody. */
.ov-gap td { height: 12px; padding: 0; }
.ov-card > tr > td:first-child { padding-left: 14px; border-left: 1px solid var(--border-strong); }
.ov-card > tr > td:last-child { padding-right: 14px; border-right: 1px solid var(--border-strong); }
.ov-card > tr:first-child > td { padding-top: 9px; height: 48px; border-top: 1px solid var(--border-strong); }
.ov-card > tr:last-child > td { padding-bottom: 9px; height: 48px; border-bottom: 1px solid var(--border-strong); }
.ov-card > tr:first-child:last-child > td { height: 56px; }
.ov-card > tr:first-child > td:first-child { border-top-left-radius: var(--radius-lg); }
.ov-card > tr:first-child > td:last-child { border-top-right-radius: var(--radius-lg); }
.ov-card > tr:last-child > td:first-child { border-bottom-left-radius: var(--radius-lg); }
.ov-card > tr:last-child > td:last-child { border-bottom-right-radius: var(--radius-lg); }
.ov-group td { background: var(--surface-2); }
.ov-leaf { cursor: pointer; scroll-margin-top: 30px; }  /* niet onder de vaste kop van de tabel */
.ov-leaf td { background: var(--field); }  /* deelvragen licht; hoofdvragen in de tint van de kopregel */
.ov-leaf:not(.ov-sub) td { background: var(--surface-2); }
.ov-leaf:hover td { background: var(--hover); }
.ov-leaf.selected td { background: var(--accent-soft); }
.ov-leaf.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent-strong); }
.ov-num { display: inline-flex; align-items: center; gap: 2px; }
.ov-table .ov-open, .ov-open-gap { flex: none; width: 26px; height: 26px; }
.ov-open svg { transition: transform .12s; }
.ov-leaf.open .ov-open svg { transform: rotate(90deg); }
/* Open vraag: donkere kop, zoals de balk bovenaan, met de details als kaart eronder. */
.ov-leaf.open td { background: var(--bar); color: var(--on-bar); border-top-color: var(--bar); }
.ov-leaf.open .ov-open, .ov-leaf.open .ov-addsub { color: var(--on-bar); }
.ov-leaf.open .ov-open:hover, .ov-leaf.open .ov-addsub:hover { background: var(--bar-2); color: var(--on-bar); }
.ov-leaf.open .ov-edit { color: var(--on-bar); }
.ov-leaf.open .ov-edit:hover { background: var(--bar-2); color: var(--on-bar); }
.ov-leaf.open td:first-child { box-shadow: none; }
.ov-card > tr.ov-detail > td { height: auto; padding: 0; }
.ov-detail .qform { min-height: 420px; background: var(--surface); border-bottom: 1px solid var(--line); }
.ov-detail:last-child .qform { border-bottom: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.ov-card:has(.ov-leaf.open) > tr > td { border-color: var(--bar); }
.ov-detail .skill-list { max-height: 300px; }
/* Nummer in één neutrale kleur, punten als vakje. */
.ov-table input.ov-input { width: 36px; height: 24px; padding: 0 3px; font-size: 13px; font-weight: 700; text-align: center;
  background: var(--ai); border-color: var(--ai); color: #fff; box-shadow: none; border-radius: var(--radius-sm); }
.ov-table input.ov-input:focus { background: var(--field); border-color: var(--accent); color: var(--ink); }
.ov-table input.ov-input.invalid { border-color: var(--error); background: var(--error-soft); }
.ov-table input.ov-pts { width: 46px; height: 26px; padding: 0 7px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
.ov-subnr { padding-left: 12px; }
.ov-table .ov-subnr input.ov-input { width: 28px; height: 22px; font-size: 12.5px; }
.ov-sum { font-weight: 700; font-variant-numeric: tabular-nums; padding-right: 12px !important; }  /* op één lijn met de getallen in de vakjes */
.ov-group .ov-text input { font-weight: 600; color: var(--text); }
.ov-text input.ov-opgave {
  width: 100%; padding: 3px 6px; font-size: 13px; color: var(--ink-muted, var(--muted)); background: transparent;
  border: 1px solid transparent; border-radius: var(--radius-sm); box-shadow: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 0; line-height: 1.5;
}
/* Tekst + potloodje (bij de muis, op de open vraag altijd). */
.ov-title { display: flex; align-items: center; gap: 2px; min-width: 0; }
.ov-table .ov-edit { flex: none; width: 24px; height: 24px; opacity: 0; }
.ov-edit .icon { width: 14px; height: 14px; }
tr:hover .ov-edit, .ov-edit:focus-visible, .ov-leaf.open .ov-edit { opacity: 1; }
@media (hover: none) { .ov-table .ov-edit { opacity: 1; } }
.ov-opgave-text { flex: 0 1 auto; min-width: 0; padding: 4px 7px; font-size: 13px; line-height: 1.5; color: var(--ink-muted, var(--muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-opgave-text.empty { color: var(--faint); font-style: italic; }
.ov-leaf:hover .ov-opgave-text { color: var(--text); }
.ov-group .ov-opgave-text { font-weight: 600; color: var(--text); }
.ov-leaf.open .ov-opgave-text { color: var(--on-bar); }
.ov-leaf.open .ov-opgave-text.empty { color: var(--on-bar-muted); }
.ov-text input.ov-opgave:hover { border-color: var(--border); }
.ov-text input.ov-opgave:focus { background: var(--field); border-color: var(--accent); color: var(--text); }
.ov-opgave-text .katex { font-size: 1.02em; }
.ov-st { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 700; line-height: 1; }
.ov-st.ok { background: var(--ok-soft); color: var(--ok); }
.ov-st.warn { background: var(--warn-soft); color: var(--warn); }
.ov-st.none { background: var(--error-soft); color: var(--error); }
.ov-st.busy .spinner { width: 14px; height: 14px; }
/* Klikbaar symbool: '!' bij het kader (bij de muis een groene check = goedkeuren), ✗/! bij het model (= ernaartoe). */
button.ov-st { padding: 0; border: 0; box-shadow: none; font-size: 12px; font-weight: 700; cursor: pointer; }
button.ov-st:hover { box-shadow: 0 0 0 2px var(--accent-ring); }
.ov-box-ok .ov-st-hover { display: none; }
button.ov-box-ok:hover, button.ov-box-ok:focus-visible { background: var(--ok-soft); color: var(--ok); box-shadow: 0 0 0 2px var(--ok-border); }
.ov-box-ok:hover .ov-st-sym, .ov-box-ok:focus-visible .ov-st-sym { display: none; }
.ov-box-ok:hover .ov-st-hover, .ov-box-ok:focus-visible .ov-st-hover { display: inline; }
button.ov-to-model.none:hover { box-shadow: 0 0 0 2px var(--error-border); }
button.ov-to-model.warn:hover { box-shadow: 0 0 0 2px var(--warn-border); }
.ov-table .icon-btn { width: 26px; height: 26px; }
button.ov-addsub { opacity: 0; }
tr:hover button.ov-addsub, button.ov-addsub:focus-visible { opacity: 1; }
.ov-card > .ov-none > td { height: 64px; text-align: center; color: var(--muted); background: var(--field); }
.ov-none-busy { display: inline-flex; align-items: center; gap: 8px; }
.ov-pending td { background: var(--accent-soft); color: var(--accent-strong); font-weight: 500; }
.ov-pending td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.ov-foot { padding: 8px 6px 0; }

.qbox-info { margin-right: auto; }
.qbox-info.warn { color: var(--warn); font-weight: 500; }

@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .page-sheet { justify-self: center; }
  .sidebar { align-self: start; }
  .qpanel { position: static; }
  .skill-list { max-height: 320px; }
}

/* --- Scans --------------------------------------------------------------- */

.uploads { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; font-size: 13px; }
.uploads li { display: flex; gap: 10px; align-items: center; padding: 7px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.uploads li .state { margin-left: auto; color: var(--muted); }
.uploads:empty { display: none; }

.problems { display: grid; gap: 12px; }
.problem { display: grid; grid-template-columns: 130px 1fr; gap: 16px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.problem img { width: 100%; border: 1px solid var(--border); border-radius: 4px; cursor: zoom-in; background: var(--paper); }
.problem p { margin: 0 0 4px; }
.assign { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.crops { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.crops figure { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; background: var(--surface); cursor: zoom-in; }
.crops figure:hover { border-color: var(--accent); }
.crops img { width: 100%; display: block; background: var(--paper); }
.crops figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* --- Verbeteren ---------------------------------------------------------- */
/* Eén antwoord tegelijk: lijst links, scan + scoreknoppen in het midden, voorstel en feedback rechts. */

.grade-layout {
  --grade-top: calc(var(--head-h) + 140px);  /* onder de paginakop en de balk; juist gezet in verbeteren.js */
  --grade-fill: calc(var(--head-h) + 190px);  /* idem, met de stappen erbij: zo past alles zonder te scrollen */
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) minmax(320px, 340px);
  align-items: start;
  flex: 1;
}
.grade-layout.is-arrival { grid-template-columns: 240px minmax(0, 1fr); }
.grade-layout.is-arrival .grade-side, .grade-work[hidden] { display: none; }
.grade-center { min-width: 0; padding: 16px 20px 32px; }
.grade-work { display: grid; gap: 14px; min-width: 0; }

.grade-bar { position: sticky; top: var(--head-h); z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); }
.grade-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 12px 20px;
  background: var(--surface);
}
.toolbar-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tool-sep { width: 1px; height: 24px; background: var(--border); }

/* Voortgang als cirkel met het aantal erin */
.ring-box { display: flex; align-items: center; gap: 12px; padding-right: 14px; border-right: 1px solid var(--border); }
.ring { position: relative; flex: none; width: 52px; height: 52px; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3; }
.ring-track { stroke: var(--line); }
.ring-value { stroke: var(--accent-strong); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray 0.25s; }
.ring-value.ok { stroke: var(--ok); }
#ring-text { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ring-label { display: grid; line-height: 1.3; }
.ring-label strong { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ring-label span { font-size: 13px; color: var(--muted); white-space: nowrap; }

.question-pick { display: flex; align-items: center; height: 34px; padding-right: 10px; border-inline: 1px solid var(--border); font-size: 13.5px; color: var(--muted); }
.question-stepper.stepper select { appearance: none; -webkit-appearance: none; border: 0; height: 100%; padding: 0 4px 0 10px; background: transparent; color: var(--text); cursor: pointer; }
.question-stepper button { height: 34px; }
.q-title { flex: 1 1 0; display: grid; line-height: 1.3; min-width: 110px; }
.q-title strong { font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.q-title span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Filterknop: enkel een pictogram, met het aantal actieve filters als bolletje */
button.filter-btn { position: relative; width: 38px; height: 38px; padding: 0; border-color: transparent; background: transparent; box-shadow: none; }
button.filter-btn:hover { background: var(--hover); }
button.filter-btn.is-open, button.filter-btn.is-open:hover { background: var(--bar); color: var(--on-bar); }
.filter-count { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--bar); color: var(--on-bar); }
button.filter-btn.is-open .filter-count { display: none; }

/* Feedback voorbereiden: knop met keuzelijst */
button.prep-btn { gap: 8px; height: 38px; padding: 0 12px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent-border); }
button.prep-btn:hover, button.prep-btn.is-open { background: var(--tint-selected); color: var(--accent-strong); border-color: var(--accent); }
button.prep-btn .chev { width: 14px; height: 14px; transform: rotate(90deg); transition: transform 0.12s; }
button.prep-btn.is-open .chev { transform: rotate(-90deg); }
button.prep-btn:disabled { opacity: 1; }
button.prep-btn.is-loading .icon { display: none; }
.toolbar-end .next-step { display: inline-flex; align-items: center; gap: 6px; height: 38px; font-weight: 600; }
.toolbar-end .next-step .icon { width: 15px; height: 15px; }
.toolbar-end .next-step.ready .icon { color: inherit; }

.prep-pop, .filter-pop {
  position: fixed; z-index: 1100; padding: 12px 10px; animation: pop 0.12s ease-out;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.prep-pop { width: min(380px, calc(100vw - 16px)); display: grid; gap: 2px; }
.pop-label { margin: 2px 8px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.prep-pop hr { width: 100%; border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
button.prep-item {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 2px 12px; align-items: center; width: 100%; padding: 8px;
  text-align: left; white-space: normal; background: transparent; color: var(--text); border: 0; box-shadow: none; font-weight: 400;
}
button.prep-item:hover:not(:disabled) { background: var(--hover); color: var(--text); }
button.prep-item:disabled { opacity: 1; cursor: default; }
button.prep-item.done { background: var(--surface-2); }
button.prep-item:disabled:not(.done) { opacity: 0.55; }
.prep-ic { grid-row: span 2; width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--radius); background: var(--field); color: var(--accent-strong); }
.prep-ic .icon { width: 18px; height: 18px; }
.prep-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14.5px; font-weight: 600; }
.prep-sub { grid-column: 2; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.ready-tag { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: 99px; font-size: 11.5px; font-weight: 600; line-height: 19px;
  background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-border); }
.ready-tag .icon { width: 12px; height: 12px; }

/* Filter en volgorde: wordt pas toegepast met de knop */
.filter-pop { width: min(340px, calc(100vw - 16px)); padding: 14px 16px; display: grid; gap: 4px; }
.filter-pop .pop-label { margin: 0 0 4px; }
.filter-pop label.check { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; }
.filter-pop input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.filter-pop hr { width: 100%; border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
.filter-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }
.filter-foot button:last-child { flex: 1; }

/* Tweede rij: wat je per antwoord doet */
.grade-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 20px; border-top: 1px solid var(--border); background: var(--surface); }
.grade-actions[hidden] { display: none; }
.grade-actions kbd { font-size: 11px; }
button.link-btn { gap: 8px; background: transparent; border-color: transparent; box-shadow: none; color: var(--text); font-weight: 500; }
button.link-btn:hover { background: var(--hover); color: var(--text); }
.grade-actions button.ghost { gap: 8px; font-weight: 500; }
button.act-confirm { margin-left: auto; gap: 10px; height: 44px; padding: 0 18px; font-size: 15px; font-weight: 600;
  background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
button.act-confirm:hover { background: var(--accent-strong-hover); border-color: var(--accent-strong-hover); color: var(--on-accent); }
button.act-confirm .icon { width: 18px; height: 18px; }
button.act-confirm kbd { background: transparent; border-color: rgba(255, 255, 255, 0.4); color: var(--on-accent); }

.section-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}

.section-label .badge { text-transform: none; letter-spacing: 0; font-weight: 600; }

/* Lijst links: over de volle hoogte, tegen de rand van de pagina */
.answer-list {
  position: sticky; top: var(--grade-top);
  height: calc(100vh - var(--grade-fill) - 18px); overflow-y: auto;
  display: grid; align-content: start; gap: 2px;
  background: var(--surface); border-right: 1px solid var(--border); border-bottom-left-radius: var(--radius-lg);
  padding: 8px;
}
.answer-list .list-label {
  margin: 0; padding: 10px 8px 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
button.answer-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; width: 100%; min-height: 40px;
  padding: 6px 8px; border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--text); font-weight: 400; box-shadow: none; white-space: normal;
}
button.answer-item:hover { background: var(--hover); color: var(--text); }
button.answer-item.active { background: var(--selected); border-color: var(--border-strong); font-weight: 600; }
.answer-item strong { font-size: 14px; font-weight: inherit; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.3; min-width: 0; }
.a-chip { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600;
  line-height: 21px; font-variant-numeric: tabular-nums; border: 1px solid transparent; color: var(--muted); }
.a-chip .icon { width: 12px; height: 12px; }
.a-chip.none { font-weight: 400; color: var(--faint); }
.a-chip.sure { background: var(--field); border: 1px dashed var(--border-strong); color: var(--text); }
.a-chip.doubt { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.a-chip.stale { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); font-weight: 500; }
.a-chip.failed { background: var(--error-soft); border-color: var(--error-border); color: var(--error); font-weight: 500; }
.a-chip.graded { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.a-chip.busy { color: var(--ai); }
.a-chip.busy .spinner { width: 10px; height: 10px; border-width: 1.5px; }
.list-filter { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; margin-bottom: 4px;
  font-size: 13px; color: var(--muted); background: var(--field); border: 1px solid var(--border); border-radius: var(--radius); }
.list-filter .icon { width: 15px; height: 15px; flex: none; }
.list-filter span { flex: 1; }
button.list-wipe { padding: 0; min-height: 0; height: auto; background: transparent; border: 0; box-shadow: none; color: var(--text); font-size: 13px; font-weight: 500; text-decoration: underline; }
button.list-wipe:hover { background: transparent; color: var(--accent); }
button.list-group { display: flex; align-items: center; justify-content: flex-start; gap: 6px; width: 100%; margin-top: 10px; padding: 10px 8px 6px; background: transparent; border: 0; box-shadow: none;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
button.list-group:hover { background: transparent; color: var(--text); }
button.list-group .icon { width: 14px; height: 14px; transition: transform 0.12s; }
button.list-group.open .icon { transform: rotate(90deg); }
.list-note { margin: 8px 8px 4px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }

/* Keuze bij een vraag zonder voorstellen */
.arrival { width: min(700px, 100%); margin: 72px auto 32px; padding: 32px; display: grid; justify-items: center; gap: 12px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.arrival[hidden] { display: none; }
.arrival-ic { width: 54px; height: 54px; display: grid; place-items: center; border-radius: var(--radius-lg); background: var(--accent-soft); color: var(--accent-strong); }
.arrival-ic .icon { width: 26px; height: 26px; }
.arrival h2 { margin: 8px 0 0; font-size: 24px; letter-spacing: -0.015em; }
.arrival > p { margin: 0; max-width: 34em; font-size: 15px; line-height: 1.5; color: var(--muted); }
.arrival-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; width: 100%; margin-top: 14px; text-align: left; }
.arrival-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; background: var(--field); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.arrival-card.best { border-color: var(--accent-strong); box-shadow: 0 0 0 1px var(--accent-strong); }
.arrival-card h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; }
.arrival-card h3 .icon { width: 18px; height: 18px; color: var(--accent-strong); flex: none; }
.best-tag { margin-left: auto; padding: 0 8px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; line-height: 20px;
  background: var(--accent-soft); color: var(--accent-strong); }
.arrival-card .meta { font-size: 13px; color: var(--muted); }
.arrival-card p { margin: 6px 0 12px; font-size: 13.5px; line-height: 1.45; color: var(--muted); flex: 1; }
.arrival-card button { justify-content: center; gap: 8px; height: 44px; font-weight: 600; }
.arrival-card button .icon { width: 16px; height: 16px; }
.arrival-card button.go { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.arrival-card button.go:hover { background: var(--accent-strong-hover); border-color: var(--accent-strong-hover); color: var(--on-accent); }
.arrival .reassure { margin-top: 10px; font-size: 13px; }
button.arrival-self { gap: 8px; margin-top: 2px; background: transparent; border-color: transparent; box-shadow: none; color: var(--text); font-weight: 600; }
button.arrival-self:hover { background: var(--hover); color: var(--text); }
button.arrival-self .icon { width: 16px; height: 16px; }

/* Midden: één scan */
.grade-stage { display: grid; gap: 14px; min-width: 0; }
.stage-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.stage-head .stage-nr { margin: 0; font-size: 26px; font-variant-numeric: tabular-nums; }
.stage-head .hint { margin: 0; }
#stage-state { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#stage-state:empty { display: none; }
.stage-head .given { font-weight: 700; font-size: 17px; color: var(--ok); font-variant-numeric: tabular-nums; }
.stage-visual {
  display: grid; place-items: center; min-height: 280px; padding: 14px;
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  cursor: zoom-in;
}
/* Kaart met kop (naam, status) en scan; de bovenrand ligt gelijk met de lijst links en het totaal rechts. */
.grade-stage.stage-card {
  gap: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.stage-card .stage-head { align-items: center; flex-wrap: nowrap; min-height: 62px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.stage-card .stage-head .stage-nr { font-size: 15px; font-weight: 600; line-height: 1.3; }
.stage-avatar { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.stage-who { display: grid; min-width: 0; margin-right: auto; }
.stage-sub { font-size: 12.5px; font-weight: 400; color: var(--muted); }
#stage-page .icon { width: 18px; height: 18px; }
/* Correctiemodel onder de scan (M klapt open en dicht) */
.model-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.model-box summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-weight: 600; cursor: pointer; }
.model-box summary kbd { margin-left: auto; font-size: 11px; }
.model-body { padding: 0 16px 14px; }
.model-body .model-text { max-height: none; }
.stage-card .done { margin: 12px 16px 0; }
.stage-card .stage-visual { border: 0; border-radius: 0; box-shadow: none; }
.stage-visual img { display: block; max-width: 100%; max-height: calc(100vh - var(--grade-top) - 230px); min-height: 0; }
.stage-visual.no-scan, .stage-visual.empty { color: var(--muted); background: var(--surface-2); cursor: default; }
.stage-score { display: grid; gap: 8px; }
.score-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.score-row .hint { margin: 0 0 0 auto; }
.scores { display: flex; flex-wrap: wrap; gap: 8px; }

button.score {
  min-width: 62px; height: 50px; padding: 0 12px; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
}
button.score:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
button.score.chosen { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
button.score.suggested:not(.chosen) { border: 2px dashed var(--ai); background: var(--ai-soft); color: var(--ai); }
input.custom { width: 62px; height: 50px; text-align: center; padding: 6px 4px; font-size: 16px; }

/* Rechts: totaal en feedback, over de volle hoogte tegen de rand van de pagina */
.grade-side {
  position: sticky; top: var(--grade-top);
  height: calc(100vh - var(--grade-fill) - 18px); overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 14px; min-height: 0; min-width: 0;  /* nooit breder dan de kolom */
  padding: 16px 16px 64px;  /* onderaan ruimte voor de knop Uitleg */
  background: var(--surface); border-left: 1px solid var(--border); border-bottom-right-radius: var(--radius-lg);
}
.sugg {
  display: grid; gap: 8px; justify-items: start;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--ai-soft); border: 1.5px dashed var(--ai); color: var(--ai); font-size: 14px;
}
.sugg p { margin: 0; color: var(--text); }
.sugg .hint { color: var(--muted); font-size: 12.5px; }
.sugg-label { font-weight: 700; font-size: 13.5px; }
.sugg-score { display: flex; align-items: baseline; gap: 10px; }
.sugg-score strong { font-size: 26px; font-variant-numeric: tabular-nums; }
.sugg .conf { font-size: 13.5px; }
.sugg .conf.doubt { color: var(--warn); font-weight: 700; }
.sugg .etype { padding: 0 8px; border-radius: 3px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; color: var(--text); }
.sugg .stale { color: var(--error); font-size: 13px; }
.sugg .agree { color: var(--ok); font-weight: 700; }
.sugg details { width: 100%; }
.sugg details summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.sugg pre { white-space: pre-wrap; font-size: 12.5px; margin: 4px 0 0; font-family: var(--mono); color: var(--text); }
button.sugg-take { background: var(--ai); color: var(--on-primary); border-color: var(--ai); }
button.sugg-take:hover { background: var(--ai-hover); border-color: var(--ai-hover); color: var(--on-primary); }
.sugg.is-doubt { border-color: var(--mark); }
.sugg.is-stale { opacity: 0.65; }
.sugg.failed { background: var(--error-soft); border: 1px solid var(--error-border); color: var(--error); }
.sugg.loading .sugg-label { display: inline-flex; align-items: center; gap: 8px; }
.sugg.loading .skeleton { margin: 4px 0 2px; }
.sugg.none { background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--muted); }

.feedback-box { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.feedback-box .hint { margin: 0; font-size: 12.5px; }
textarea.feedback {
  width: 100%; font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--pen);
  padding: 8px 10px; min-height: 0; resize: vertical;
}
.fb-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.fb-chip {
  display: block; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 10px; font-size: 12.5px; font-weight: 500; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--pen); border: 1px solid var(--accent-border);
}
.fb-chip:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.fb-chip.ai { white-space: normal; text-align: left; background: var(--ai-soft); border-color: var(--ai-border); color: var(--ai); }
.fb-chip.ai:hover { border-color: var(--ai); }
.fb-keep { font-size: 13px; }
.fb-saved-list { display: grid; gap: 6px; min-width: 0; }
.fb-saved { display: inline-flex; align-items: stretch; min-width: 0; max-width: 100%; }
.fb-saved .fb-chip { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.fb-saved.on .fb-chip { border-color: var(--error); }
.fb-forget {
  padding: 0 7px; font-size: 13px; line-height: 1; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft); color: var(--pen); border: 1px solid var(--accent-border); border-left: 0;
}
.fb-forget:hover { color: var(--accent); border-color: var(--accent); }

/* Verbeteren, rechts van de scan: totaal en feedbackpunten met vinkje en aftrek. */
.fb-panel { display: grid; gap: 12px; align-content: start; min-width: 0; }
.fb-panel > * { min-width: 0; }
/* Totaal (groot, zelf aan te passen door erin te typen), Wissen en de knoppen per score. */
.fb-total { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 6px 14px;
  background: var(--field); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.fb-total.full { background: var(--ok-soft); border-color: var(--ok-border); }  /* alles juist */
.fb-total.zero { background: var(--error-soft); border-color: var(--error-border); }  /* alles fout */
.fb-total-main { display: flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
input.fb-score-input { min-width: 2ch; padding: 0 2px; height: 46px; border: 0; border-radius: var(--radius-sm); background: transparent; box-shadow: none;
  font-size: 38px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--text); text-align: left; }
input.fb-score-input:hover { background: var(--hover); }
input.fb-score-input:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--accent-ring); }
input.fb-score-input.invalid { background: var(--error-soft); }
.fb-total.full input.fb-score-input { color: var(--ok); }
.fb-total.zero input.fb-score-input { color: var(--error); }
.fb-score-max { font-size: 19px; color: var(--muted); }
button.fb-wipe { gap: 6px; padding: 4px 8px; background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); font-size: 13px; font-weight: 500; }
button.fb-wipe:hover { background: var(--hover); color: var(--text); }
.score-seg { display: flex; overflow: hidden; background: var(--field); border: 1px solid var(--border-strong); border-radius: var(--radius); }
button.score-opt { flex: 1 1 0; min-width: 0; height: 44px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none;
  color: var(--text); font-size: 14.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
button.score-opt + button.score-opt { border-left: 1px solid var(--border); }
button.score-opt:hover { background: var(--hover); color: var(--text); }
button.score-opt.chosen, button.score-opt.chosen:hover { background: var(--bar); color: var(--on-bar); font-weight: 700; }
.fb-basis { margin: -6px 0 0; font-size: 12.5px; color: var(--muted); }
.fb-basis.ok { color: var(--ok); font-weight: 600; }
.fb-basis.doubt { color: var(--warn); font-weight: 600; }
.fb-card { display: grid; gap: 10px; }
.fb-card .section-label { margin: 0; justify-content: space-between; font-size: 11.5px; }
.fb-active { font-weight: 400; letter-spacing: 0; text-transform: none; font-size: 12.5px; }
.fb-empty { margin: 0; }
.fb-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
/* Eén feedbackpunt als kaartje: vinkje | tekst | "− 0,5 pt" | verwijderen (bij de muis).
   Uitgevinkt = grijze achtergrond en doorstreept. */
.fb-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 8px 6px 8px 10px;
  background: var(--field); border: 1px solid var(--border); border-radius: var(--radius); }
.fb-item input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; margin: 0; cursor: pointer;
  border: 1.5px solid var(--border-strong); border-radius: 5px; background: var(--field) center / 14px no-repeat;
  transition: border-color 0.12s, background-color 0.12s;
}
.fb-item input[type="checkbox"]:hover { border-color: var(--muted); }
.fb-item input[type="checkbox"]:checked { border-color: var(--accent-strong); background-color: var(--accent-strong); background-image: var(--check-mark-on); }
.fb-item input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.fb-item .fb-text { width: 100%; color: var(--pen); font-size: 13.5px; font-family: var(--font); line-height: 1.4;
  resize: none; overflow: hidden; min-height: 24px; padding: 2px 4px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; box-shadow: none; }
.fb-item .fb-text:hover { border-color: var(--border); }
.fb-item .fb-text:focus { border-color: var(--accent); background: var(--surface); }
.fb-item .math-field > .math-view, .fb-item .math-field > .math-view:hover { border-color: transparent; background: transparent; box-shadow: none; font-size: 13.5px; padding: 2px 4px; min-height: 24px; }
.fb-item.off { background: var(--surface-2); }
.fb-item.off .fb-text, .fb-item.off .math-view { color: var(--faint); text-decoration: line-through; }
.fb-ded-box {
  display: inline-flex; align-items: center; gap: 1px; height: 24px; padding: 0 6px;
  border: 1px solid var(--error-border); border-radius: var(--radius-sm); background: var(--error-soft);
  font-size: 12.5px; font-weight: 600; color: var(--error); font-variant-numeric: tabular-nums; cursor: text;
}
.fb-ded-box:focus-within { border-color: var(--error); }
.fb-item.off .fb-ded-box { color: var(--faint); background: transparent; border-color: var(--border); text-decoration: line-through; }
.fb-item .fb-ded { width: 3ch; field-sizing: content; min-width: 1ch; height: 100%; padding: 0; border: 0; background: transparent; box-shadow: none;
  text-align: center; font-size: 12.5px; font-weight: 600; color: inherit; font-variant-numeric: tabular-nums; }
.fb-item .fb-ded:focus { box-shadow: none; }
.fb-item.off .fb-ded { color: var(--faint); }
.fb-unit { margin-left: 2px; }
.fb-ded-box:has(input.invalid) { border-color: var(--error); background: var(--error-soft); }
button.icon-btn.fb-drop { width: 22px; height: 22px; margin-left: -4px; opacity: 0; }
.fb-item:hover button.icon-btn.fb-drop { opacity: 0.5; }
button.icon-btn.fb-drop .icon { width: 15px; height: 15px; }
button.icon-btn.fb-drop:hover, button.icon-btn.fb-drop:focus-visible { opacity: 1; color: var(--error); background: var(--error-soft); }
button.fb-add { justify-self: stretch; gap: 8px; height: 44px; border-style: dashed; background: transparent; box-shadow: none; color: var(--text); font-weight: 500; }
button.fb-add .icon { width: 16px; height: 16px; }
button.fb-add:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.fb-reuse { display: grid; gap: 8px; margin-top: 6px; }
.fb-reuse .section-label { font-size: 11.5px; }
button.fb-reuse-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; text-align: left; white-space: normal; line-height: 1.35; font-size: 13px; font-weight: 450;
  background: var(--surface-2); color: var(--pen); border: 1px solid transparent; box-shadow: none; }
button.fb-reuse-item > .icon { width: 14px; height: 14px; color: var(--muted); }
button.fb-reuse-item:hover { background: var(--accent-soft); border-color: var(--accent-border); color: var(--pen); }
button.fb-reuse-item .num { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.fb-actions { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
button.fb-confirm { gap: 8px; padding: 9px 16px; }
button.fb-confirm kbd { background: transparent; border-color: rgba(255,255,255,0.35); color: inherit; }
.fb-clear { justify-self: start; font-size: 13px; }
.fb-why summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.fb-why p { margin: 6px 0 0; font-size: 13.5px; }
.fb-why pre { white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; margin: 8px 0 0; font-family: var(--font); }
.fb-loading { display: grid; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--ai-soft); color: var(--ai); font-size: 13.5px; }
.fb-loading-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.fb-loading .hint { margin: 0; }

.side-nav { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 4px; }
.side-nav button { height: 42px; }

.state-tag {
  padding: 0 7px; border-radius: 4px; font-size: 11.5px; font-weight: 500; white-space: nowrap; line-height: 19px;
  background: var(--ai-soft); color: var(--ai); border: 1px solid var(--ai-border);
}
.state-tag.doubt { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.state-tag.failed { background: var(--error-soft); color: var(--error); border-color: var(--error-border); }
.state-tag.sure { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent-border); font-weight: 600; }
.state-tag.confirmed { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); font-weight: 600; }
.state-tag.stale { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button {
  border: 0; border-radius: 0; background: var(--field); color: var(--muted); font-weight: 500; padding: 5px 11px;
  min-height: 0; font-size: 13px;
}
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--hover); color: var(--text); font-weight: 600; }
.seg button:hover { background: var(--surface-2); color: var(--text); }
.seg button.on:hover { background: var(--hover); color: var(--text); }
.seg-wide { display: flex; }
.seg-wide button { flex: 1; padding: 8px 12px; font-size: 14px; }
.print-tips summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.print-tips ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }

.model-rubric { margin: 0 0 10px; font-size: 13.5px; }
.model-rubric td { padding: 4px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.model-rubric td.num { white-space: nowrap; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.model-text {
  margin: 0; white-space: pre-wrap;
  font: 13.5px/1.6 var(--font); padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
/* Correctiemodel in delen om te lezen (modelView in common.js): kopje links, tekst rechts. */
.model-parts-view { display: grid; grid-template-columns: max-content minmax(0, 1fr); margin: 0;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font: 13.5px/1.6 var(--font); }
.model-parts-view .model-part { display: contents; }
.model-parts-view dt, .model-parts-view dd { margin: 0; padding: 8px 12px; border-top: 1px solid var(--border); }
.model-parts-view .model-part:first-child > * { border-top: 0; }
.model-parts-view dt { display: flex; align-items: baseline; gap: 6px; font-weight: 700; color: var(--text); white-space: nowrap; }
.model-parts-view dt::before { content: ""; flex: none; align-self: center; width: 3px; height: 12px; border-radius: 2px; background: var(--part); }
.model-parts-view dd { white-space: pre-wrap; }
.q-meta-line { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.done {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius);
  background: var(--ok-soft); border: 0; color: var(--ok); font-weight: 600;
}
.done button { margin-left: auto; }

@media (max-width: 1250px) {
  .grade-layout, .grade-layout.is-arrival { grid-template-columns: 180px minmax(0, 1fr); }
  .grade-side { grid-column: 2; position: static; height: auto; border-left: 0; border-top: 1px solid var(--border); padding-bottom: 16px; border-radius: 0 0 var(--radius-lg) 0; }
  .side-nav { margin-top: 0; }
}
@media (max-width: 760px) {
  .grade-layout, .grade-layout.is-arrival { grid-template-columns: minmax(0, 1fr); }
  .grade-side { grid-column: auto; }
  .answer-list { position: static; height: auto; max-height: 220px; border-right: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
  .grade-bar { position: static; }
  .grade-toolbar, .grade-actions { padding-inline: 16px; }
  .arrival { margin-top: 16px; padding: 20px; }
  .arrival-cards { grid-template-columns: minmax(0, 1fr); }
  .score-row .hint { margin-left: 0; }
}
@media (max-width: 1400px) { .grade-actions button.ghost kbd, button.link-btn kbd { display: none; } }

/* --- Resultaten ---------------------------------------------------------- */

table.results th small { font-weight: 400; }
table.results td { font-variant-numeric: tabular-nums; }
table.results td.total, table.results th.total { font-weight: 600; background: var(--surface-2); border-left: 1px solid var(--border); }
table.results td.partial { color: var(--muted); }
table.results tr.muted td { color: var(--muted); }
table.results tfoot td { font-weight: 600; color: var(--muted); background: var(--surface-2); border-top: 1px solid var(--border-strong); position: sticky; bottom: 0; }
table.results td.low { color: var(--error); }

/* --- Analyse ------------------------------------------------------------- */

.bar { display: inline-block; width: 90px; height: 6px; background: var(--hover); border-radius: 99px; vertical-align: middle; overflow: hidden; margin-right: 6px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.skills-table td, .skills-table th { text-align: left; }
.skills-table td.n { text-align: center; font-variant-numeric: tabular-nums; }

.st-tekort { background: var(--error-soft) !important; color: var(--error); font-weight: 600; }
.st-inoefenen { background: var(--warn-soft) !important; color: var(--warn); }
.st-verdiepen { background: var(--ok-soft) !important; color: var(--ok); }
.st-onvolledig { color: var(--faint); }
table.heat td { text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .a-chip::before { display: none; }
.stat .value .a-chip { padding: 0 8px; font-size: inherit; line-height: 1.35; vertical-align: baseline; }
.legend .l-tekort::before { background: var(--error-border); }
.legend .l-inoefenen::before { background: var(--warn-border); }
.legend .l-verdiepen::before { background: var(--ok-border); }

/* --- Feedbackfiches (afdrukbaar) ---------------------------------------- */

.fiche {
  width: 100%; max-width: 820px; margin: 0 auto; padding: 36px 40px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.fiche header { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--text); margin-bottom: 14px; padding-bottom: 4px; }
.fiche h2 { margin: 0 0 4px; font-size: 18px; }
#fiches { display: grid; gap: 20px; }
.fiche-score { font-size: 22px; font-weight: 700; }
.fiche h3 { margin: 16px 0 6px; font-size: 14px; }
.fiche table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.fiche table td, .fiche table th { border: 1px solid var(--border-strong); padding: 5px 8px; }
.fiche-questions td, .fiche-questions th { text-align: center; }
.fiche-skills td.icon { width: 28px; text-align: center; font-weight: 700; }
.fiche-comment textarea { width: 100%; font-family: inherit; font-size: 14px; line-height: 1.5; resize: vertical; }
.fiche-comment-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.fiche-comment-print { display: none; margin: 0; line-height: 1.5; }
.fiche-feedback { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--pen); }
.fiche-feedback strong { color: var(--text); font-weight: 600; }
.fiche-fb-proposed { color: var(--ai); }  /* voorstel: potlood, nog niet bevestigd */
.fiche-preview { margin-left: 8px; }
.fiche-questions .a-chip, .fiche-skills .a-chip { margin-right: 3px; }
.fiche-score .a-chip { padding: 0 8px; font-size: inherit; line-height: 1.35; }
.fiche-fb-lines { white-space: pre-line; }  /* één feedbackpunt per regel: '• … (−0,5)' */

/* Wiskunde in LaTeX (mathNodes, mathField in common.js) */
.math .katex { font-size: 1.08em; }
.math-display { display: block; margin: 4px 0; overflow-x: auto; overflow-y: hidden; }
.math-field { position: relative; min-width: 0; }
.math-field > [hidden] { display: none !important; }
.math-field.has-math > :not(.math-toggle) { padding-right: 36px; }
button.math-toggle { position: absolute; top: 4px; right: 4px; height: 20px; padding: 0 5px; font-size: 11px;
  font-weight: 500; line-height: 1; background: var(--field); color: var(--muted); border: 1px solid var(--border); }
button.math-toggle:hover { background: var(--hover); color: var(--text); border-color: var(--border-strong); }
/* smalle feedbackkolom: het knopje neemt geen breedte in en verschijnt bij de muis of tijdens het typen */
.fb-item .math-field.has-math > :not(.math-toggle), .rubric-row .math-field.has-math > :not(.math-toggle) { padding-right: 8px; }
.fb-item button.math-toggle, .rubric-row button.math-toggle { opacity: 0; }
.fb-item .math-field:hover button.math-toggle, .fb-item .math-field:focus-within button.math-toggle,
.rubric-row .math-field:hover button.math-toggle, .rubric-row .math-field:focus-within button.math-toggle { opacity: 1; }
.math-view { padding: 7px 10px; font-family: var(--font); font-size: 13.5px; line-height: 1.5; }
.math-field > .math-view { cursor: text; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 2.2em;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--field); }
.math-field > .math-view:hover { border-color: var(--border-strong); }
.math-field > .math-view:focus { outline: none; }
.comment-loading {
  display: grid; gap: 10px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--ai-soft); border: 1.5px dashed var(--ai); color: var(--ai); font-size: 13.5px;
}
.comment-loading .sugg-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }

@media print {
  body, body.app { display: block; }
  .content { margin: 0; border: none; box-shadow: none; }
  .no-print, .sidenav, .nav-handle, .pagehead, .toasts, nav { display: none !important; }
  .page { padding: 0; display: block; }
  .fiche { border: none; box-shadow: none; margin: 0 auto; padding: 0; max-width: none; border-radius: 0; }
  .fiche { break-after: page; }
  .fiche-comment-print { display: block; }
  .st-tekort, .st-inoefenen, .st-verdiepen, .fiche-feedback { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.badge:empty { display: none; }
.card .stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
table.results tfoot td:first-child { background: var(--surface-2); }

/* --- Uitleg: zwevende knop en pagina -------------------------------------- */
body.app.no-sidenav { display: block; }
body.no-sidenav .sidenav { display: none; }
body.no-sidenav .content { margin: 8px; }
a.tutorial-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px;
  background: var(--primary); color: var(--on-primary); border-radius: 999px; box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 600; text-decoration: none;
}
a.tutorial-fab:hover { background: var(--primary-hover); color: var(--on-primary); text-decoration: none; }
a.tutorial-fab:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring), var(--shadow-lg); }
a.tutorial-fab .icon { width: 16px; height: 16px; }

/* Verwijzing naar de knop Uitleg (showTutorialHint in common.js) */
.tutorial-hint { position: fixed; inset: 0; z-index: 900; background: var(--scrim); }
.tutorial-hint-open a.tutorial-fab { z-index: 901; }
.tutorial-hint-box { position: absolute; color: var(--on-bar); }
.tutorial-hint-text { margin: 0 0 12px; font-family: var(--handwriting); font-size: 32px; font-weight: 700; line-height: 1.2; text-align: right; text-shadow: 0 1px 10px var(--bg); }
.tutorial-hint-row { display: flex; align-items: flex-start; justify-content: flex-end; gap: 12px; }
.tutorial-hint-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
button.tutorial-hint-off { background: none; border-color: transparent; color: var(--on-bar-muted); font-weight: 500; }
button.tutorial-hint-off:hover { background: none; border-color: transparent; color: var(--on-bar); text-decoration: underline; }
.tutorial-hint-arrow { flex: none; width: 120px; height: 96px; fill: none; stroke: var(--on-bar); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }

.tutorial-page { padding-bottom: 16px; }
.tutorial { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px; height: calc(100vh - var(--head-h) - 54px); min-height: 480px; }
.tutorial-bar { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.tutorial-bar select { min-width: min(340px, 70vw); font-weight: 500; }
.tutorial-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tutorial-stage { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 0; }
.tutorial-slides { height: 100%; min-height: 0; }
button.slide-arrow {
  width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 24px; line-height: 1;
  background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: var(--shadow);
}
button.slide-arrow:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.tutorial-section {
  display: flex; flex-direction: column; height: 100%; max-width: 1180px; margin-inline: auto; overflow-y: auto;
  padding: 18px 26px 16px; border-radius: 18px; font-size: 14px; line-height: 1.5;
}
.tutorial-section[hidden] { display: none; }
.tutorial-section:not(:has(.tutorial-shot)) { height: auto; max-height: 100%; }  /* naslag: de slide is zo hoog als haar inhoud */
.tutorial-section > * { flex: none; }
.tutorial-day { margin: 0 0 2px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.tutorial-section h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 18px; }
.tutorial-section p { margin: 0 0 6px; }
.tutorial-section ul { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 2px; }
.tutorial-section > :last-child { margin-bottom: 0; }
.tutorial-step {
  display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none;
  background: var(--primary); color: var(--on-primary); border-radius: 50%; font-size: 13px; font-weight: 600;
}
.tutorial-tip { padding: 8px 12px; background: var(--surface-2); border-left: 3px solid var(--primary); border-radius: var(--radius-sm); font-size: 13.5px; }
.tutorial-section > .tutorial-shot { flex: 1 1 0; min-height: 260px; display: flex; flex-direction: column; margin: 6px 0 0; }
button.tutorial-shot-open {
  flex: 1 1 0; min-height: 0; display: flex; justify-content: center; align-items: center; width: 100%; padding: 0;
  background: none; border: 0; box-shadow: none; cursor: zoom-in;
}
button.tutorial-shot-open:hover { background: none; }
button.tutorial-shot-open:hover img { border-color: var(--accent); }
.tutorial-shot img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
  border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.tutorial-shot figcaption { flex: none; margin-top: 6px; text-align: center; font-size: 13px; color: var(--muted); }
.tutorial-keys { border-collapse: collapse; margin-bottom: 10px; }
.tutorial-keys td { padding: 4px 16px 4px 0; border-bottom: 1px solid var(--border); }
.tutorial-keys tr:last-child td { border-bottom: 0; }
.tutorial-keys th { text-align: left; padding: 14px 0 4px; }
.tutorial-keys tr:first-child th { padding-top: 0; }
.tutorial-keys tr:has(+ tr > th) td { border-bottom: 0; }
.tutorial-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; align-items: start; }
.tutorial-cols .tutorial-keys { width: 100%; }
.tutorial-math, .tutorial-cols code { white-space: nowrap; }
@media (max-width: 1100px) { .tutorial-cols { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .tutorial { height: auto; min-height: 0; }
  .tutorial-stage { grid-template-columns: 1fr 1fr; }
  .tutorial-slides { grid-column: 1 / -1; grid-row: 1; height: auto; }
  .tutorial-section { height: auto; overflow: visible; padding: 16px; }
  .tutorial-section > .tutorial-shot { flex: none; min-height: 0; }
  button.tutorial-shot-open { flex: none; }
  #slide-prev { justify-self: start; }
  #slide-next { justify-self: end; }
}

/* Donkerblauw kader rond de pdf, scans en screenshots */
.page-sheet, .stage-card .stage-visual, .header-view, .lightbox img, .problem img, .crops img, .tutorial-shot img { border: 2px solid var(--frame); }
.stage-card .stage-visual.no-scan, .stage-card .stage-visual.empty { border: 0; }  /* geen beeld: geen kader */
button.tutorial-shot-open:hover img { border-color: var(--frame); }

/* Privacyverklaring en gebruiksvoorwaarden: openbaar, zonder aanmelden */
.legal-page { min-height: 100vh; padding: 32px 16px; background: var(--page); }
.legal { max-width: 760px; margin-inline: auto; padding: 28px 32px; font-size: 14.5px; line-height: 1.6; }
.legal .brand { display: inline-flex; padding: 0; margin-bottom: 20px; }
.legal h1 { margin: 0; font-size: 26px; }
.legal h2 { margin: 24px 0 6px; font-size: 16px; }
.legal p { margin: 0 0 10px; }
.legal ul { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 4px; }
.legal-date { color: var(--muted); font-size: 13px; }
.legal-foot { margin: 28px 0 0 !important; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13.5px; }
@media (max-width: 600px) { .legal { padding: 20px; } }

/* --- Verbruik ------------------------------------------------------------- */
.usage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.usage-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .usage-cols { grid-template-columns: minmax(0, 1fr); } }
.usage-wide { grid-column: 1 / -1; }
.usage-seg button.on { background: var(--primary); color: var(--on-primary); }
.usage-chart { padding: 8px 16px 14px; }
.usage-chart svg { display: block; width: 100%; overflow: visible; }
.usage-chart text { fill: var(--muted); font-size: 11.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.usage-chart .grid { stroke: var(--line); stroke-width: 1; }
.usage-chart .col:focus { outline: none; }
.usage-chart .col:hover .hit, .usage-chart .col:focus .hit { fill: var(--tint-hover); }
.usage-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0 16px 4px; font-size: 13px; color: var(--muted); }
.usage-legend span { display: inline-flex; align-items: center; gap: 6px; }
.usage-key { flex: none; display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.usage-tip { position: fixed; z-index: 1200; pointer-events: none; min-width: 170px; padding: 8px 10px; display: grid; gap: 3px;
  background: var(--bar); color: var(--on-bar); border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 12.5px; }
.usage-tip[hidden] { display: none; }
.usage-tip .when { color: var(--on-bar-muted); }
.usage-tip .row { display: grid; grid-template-columns: 12px auto 1fr; align-items: center; gap: 6px; }
.usage-tip .row i { height: 2px; border-radius: 2px; }
.usage-tip .row strong { font-variant-numeric: tabular-nums; }
.usage-tip .row span { color: var(--on-bar-muted); justify-self: end; }
table.usage-table td.n, table.usage-table th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.usage-table .share { display: flex; align-items: center; gap: 8px; min-width: 90px; }
table.usage-table .share > span { flex: 1; height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; }
table.usage-table .share > span > i { display: block; height: 100%; border-radius: 3px; }
.usage-name { display: inline-flex; align-items: center; gap: 8px; }
.usage-note { margin: 0; padding: 0 16px 12px; font-size: 12.5px; color: var(--muted); }
.nav-foot .nav-link { margin: 0 -10px 4px; font-size: 14px; }

/* Proefbudget per gebruiker op Verbruik */
.usage-budget { display: flex; align-items: center; gap: 8px; }
.usage-budget .share { flex: 1; min-width: 90px; }

/* Proefbudget onderaan de zijbalk (enkel met een limiet) */
.nav-budget { display: grid; gap: 4px; margin-bottom: 8px; color: var(--muted); }
.nav-budget-row { display: flex; justify-content: space-between; gap: 8px; }
.nav-budget-bar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.nav-budget-bar span { display: block; height: 100%; background: var(--accent); }
.nav-budget.is-out, .nav-budget.is-out .nav-budget-row span:last-child { color: var(--title-warn); }
.nav-budget.is-out .nav-budget-bar span { background: var(--title-warn); }
.nav-budget-msg { color: var(--text); line-height: 1.4; }

/* --- Vragenlijst en reacties ------------------------------------------------ */
.survey { width: min(760px, 100%); margin-inline: auto; display: grid; gap: 16px; }
.survey-intro h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.01em; }
.survey-intro p { margin: 0; color: var(--muted); }
.survey-section { display: grid; gap: 18px; }
.survey-section > h3 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.survey-q { display: grid; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.survey-q > legend, .survey-q > label.q-label { padding: 0; font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.survey-q.missing > legend, .survey-q.missing > label.q-label { color: var(--error); }
.survey-q textarea { width: 100%; }
.survey-q select { max-width: 100%; }
.survey-q .options { display: grid; gap: 4px; }
.survey-q .check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.survey-q .check input { margin: 0; accent-color: var(--primary); }
.rating-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.rating-row .hint { margin: 0; font-size: 12.5px; }
.rating-row .seg button { min-width: 36px; padding: 7px 0; justify-content: center; }
.rating-row .seg button.on, .rating-row .seg button.on:hover { background: var(--accent-strong); color: var(--on-accent); }
.survey-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.survey-thanks { text-align: center; display: grid; gap: 12px; justify-items: center; padding: 32px; }
.survey-thanks h2 { margin: 0; }
.survey-thanks p { margin: 0; color: var(--muted); }

.reaction-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.reaction-bar > div { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.q-summaries { display: grid; gap: 12px; }
.q-summary { display: grid; gap: 10px; }
.q-summary-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; }
.q-summary-head h3 { margin: 0; font-size: 14.5px; }
.q-summary-head .figure { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-summary-head .figure small { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.team-tags { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: 1px; }
.dist { display: grid; gap: 4px; font-size: 13px; }
.dist-row { display: grid; grid-template-columns: minmax(90px, 220px) minmax(0, 1fr) 62px; align-items: center; gap: 10px; }
.dist-row .bar { display: block; width: auto; margin: 0; height: 8px; border-radius: 4px; background: var(--hover); overflow: hidden; }
.dist-row .bar > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.dist-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.quotes { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 14px; }
.quotes li { padding: 8px 12px; background: var(--field); border-radius: var(--radius-sm); overflow-wrap: anywhere; white-space: pre-wrap; }
.quotes small { display: block; margin-top: 4px; color: var(--muted); white-space: normal; }
.reactions { display: grid; gap: 12px; }
.reaction { display: grid; gap: 10px; }
.reaction-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.reaction-head .hint { margin: 0; font-size: 13px; }
.reaction-head .icon-btn { margin-left: auto; }
.reaction-answers { display: grid; grid-template-columns: minmax(160px, 320px) minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 14px; }
.reaction-answers dt { color: var(--muted); }
.reaction-answers dd { margin: 0; overflow-wrap: anywhere; }
.reaction-answers dd.long { white-space: pre-wrap; }
@media (max-width: 700px) { .reaction-answers { grid-template-columns: minmax(0, 1fr); } .reaction-answers dt { font-weight: 600; } .dist-row { grid-template-columns: minmax(0, 1fr) 80px 50px; } }
