/*
 * tempono house style for the demo app. Palette and mark: packages/core/src/style.ts.
 * One typeface (Atkinson Hyperlegible), warm paper, blue-black ink, tempo orange as the
 * brand colour. Compact+ is tempo orange too: that is where tempono's bundles come in.
 */
:root {
  --paper: #faf6ef;
  --paper-2: #f2ece1;
  --surface: #fffdf9;
  --ink: #1f2233;
  --ink-2: #3d4152;
  --muted: #5b5f6e;
  --faint: #9a9ca6;
  --line: #e4ddd0;
  --line-2: #d2c9b8;

  --tempo: #e8592a;
  --tempo-ink: #bf4318;
  --tempo-tint: #fde8de;
  --zee: #1d6b87;
  --zee-tint: #e1eff4;
  --bes: #a03a6e;
  --bes-tint: #f6e5ee;

  --focus: #1d6b87;
  --bad: #b3261e;
  --warn: #8a6100;
  --ok: #2f7a52;

  /* Compacting routes: grey, then two blues of rising depth, then tempo orange. */
  --r-regular: #6f7381;
  --r-regular-bg: #ecebe6;
  --r-partly: #3f7fb5;
  --r-partly-bg: #e2eef8;
  --r-compact: #23518f;
  --r-compact-bg: #d9e3f2;
  --r-compact-plus: #bf4318;
  --r-compact-plus-bg: #fde3d6;

  /* Weeks of a blok */
  --w1: #1d6b87;
  --w2: #6b4aad;
  --w3: #2f7a52;
  --w4: #9a9ca6;

  --shadow-sm: 0 1px 0 rgba(31, 34, 51, 0.05);
  --shadow: 0 1px 0 rgba(31, 34, 51, 0.05), 0 8px 24px -14px rgba(31, 34, 51, 0.28);
  --radius: 12px;
  --radius-sm: 8px;
  --body: "tempono-body", "Atkinson Hyperlegible", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --page-w: 1320px;
  --top-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14161d;
    --paper-2: #1a1d26;
    --surface: #1e212b;
    --ink: #ecebe6;
    --ink-2: #cfcfd6;
    --muted: #a1a5b3;
    --faint: #6f7381;
    --line: #2d3140;
    --line-2: #3b4052;
    --tempo: #f2784f;
    --tempo-ink: #ff9b74;
    --tempo-tint: #3a2219;
    --zee: #6cb8d4;
    --zee-tint: #17303a;
    --bes: #e08bb6;
    --bes-tint: #3a1c2b;
    --focus: #6cb8d4;
    --bad: #f2b8b5;
    --warn: #e3b341;
    --ok: #74c69d;
    --r-regular: #a1a5b3;
    --r-regular-bg: #2a2d38;
    --r-partly: #8cbde6;
    --r-partly-bg: #1c3044;
    --r-compact: #a9c1f0;
    --r-compact-bg: #24345a;
    --r-compact-plus: #ff9b74;
    --r-compact-plus-bg: #43261b;
    --w1: #6cb8d4;
    --w2: #b39ce8;
    --w3: #74c69d;
    --w4: #6f7381;
    --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 26px -14px rgba(0, 0, 0, 0.75);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--body); color: var(--ink); background: var(--paper); min-height: 100vh; overflow-x: clip; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--tempo-tint); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code, kbd { font: 0.88em var(--mono); background: var(--paper-2); padding: 1px 5px; border-radius: 5px; }
kbd { border: 1px solid var(--line-2); border-bottom-width: 2px; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.01em; }

/* ------------------------------------------------------------ app shell */

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--top-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: var(--page-w); margin: 0 auto; height: 100%; padding: 0 24px; display: flex; align-items: center; gap: 32px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; flex: none; }
.brand svg { height: 17px; width: auto; display: block; }
.brand b { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.brand .tagline { font-size: 12px; color: var(--muted); padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--line-2); }
.nav { display: flex; gap: 4px; align-self: stretch; }
.nav a {
  display: flex; align-items: center; gap: 8px; text-decoration: none; padding: 0 14px;
  font-weight: 700; font-size: 15px; color: var(--muted); position: relative;
}
.nav a:hover { color: var(--ink); }
.nav a .ico { width: 18px; height: 18px; flex: none; }
.nav a.on { color: var(--ink); }
.nav a.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--tempo); }
.nav a.on .ico { color: var(--tempo); }
.school { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.school .avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--zee-tint); color: var(--zee); font-weight: 700; font-size: 13px; }
.school b { display: block; color: var(--ink); font-size: 14px; line-height: 1.2; }
.school .live { display: inline-flex; align-items: center; gap: 5px; line-height: 1.2; }
.school .live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

/* Second bar: where you are, the tabs of what you have open, and its actions. */
.ctxbar {
  position: sticky; top: var(--top-h); z-index: 25;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.ctxbar-in { max-width: var(--page-w); margin: 0 auto; padding: 0 24px; display: flex; align-items: stretch; gap: 24px; min-height: 52px; }
.crumb { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; flex: 0 1 auto; }
.crumb a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.crumb a:hover { color: var(--ink); text-decoration: underline; }
.crumb .sep { color: var(--faint); }
.crumb b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.crumb .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--acc, var(--tempo)); flex: none; }
.ctx-tabs { display: flex; gap: 2px; align-items: stretch; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; }
.ctx-tabs > a, .ctx-tabs > button {
  display: flex; align-items: center; gap: 7px; padding: 0 12px; border: 0; background: none; cursor: pointer;
  text-decoration: none; white-space: nowrap; font-size: 14px; font-weight: 700; color: var(--muted); position: relative;
}
.ctx-tabs > a:hover, .ctx-tabs > button:hover { color: var(--ink); }
.ctx-tabs > .on { color: var(--ink); }
.ctx-tabs > .on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--ink); }
.ctx-tabs .n { font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--paper-2); color: var(--muted); }
.ctx-tabs .on .n { background: var(--ink); color: var(--paper); }
.ctx-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }

main.page { max-width: var(--page-w); margin: 0 auto; padding: 28px 24px 80px; }
.ctxbar + main.page { padding-top: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.eyebrow a { text-decoration: none; } .eyebrow a:hover { text-decoration: underline; }
h1.title { font-size: 32px; font-weight: 700; letter-spacing: -0.025em; margin: 4px 0 6px; }
h2.section { font-size: 19px; font-weight: 700; margin: 36px 0 14px; display: flex; align-items: center; gap: 10px; }
h2.section .count { font-size: 12px; color: var(--muted); background: var(--paper-2); border-radius: 999px; padding: 1px 8px; }
.lead { color: var(--ink-2); max-width: 70ch; margin: 0; font-size: 16px; }

/* Hero on the overview pages */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center; padding: 28px 30px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.hero h1.title { margin-top: 6px; }
.hero .eyebrow { color: var(--tempo-ink); display: flex; align-items: center; gap: 8px; }
.hero .eyebrow svg { height: 10px; width: auto; }
.hero-art { width: 210px; height: auto; color: var(--tempo); opacity: 0.95; }
.steps { display: flex; gap: 18px; flex-wrap: wrap; margin: 16px 0 0; padding: 0; list-style: none; counter-reset: s; font-size: 14px; color: var(--ink-2); }
.steps li { display: flex; align-items: center; gap: 8px; counter-increment: s; }
.steps li::before { content: counter(s); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--tempo-tint); color: var(--tempo-ink); font-weight: 700; font-size: 12px; }

/* ------------------------------------------------------------ cards */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.card {
  --acc: var(--tempo-ink); --acc-tint: var(--tempo-tint);
  display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow-sm); transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
}
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--acc); }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.card b { display: block; font-size: 17px; line-height: 1.25; }
.card .meta { font-size: 13px; color: var(--muted); }
.card .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; }
.card .kicker { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--acc); }
.card .stats { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; color: var(--muted); margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--line); }
.card .stats > span { white-space: nowrap; }
.card .stats b { display: inline; font-size: 14px; color: var(--ink); }
.acc-rekenen { --acc: var(--zee); --acc-tint: var(--zee-tint); }
.acc-taal { --acc: var(--bes); --acc-tint: var(--bes-tint); }
.acc-tempo { --acc: var(--tempo-ink); --acc-tint: var(--tempo-tint); }
.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--acc-tint, var(--paper-2)); color: var(--acc, var(--ink-2)); }
.tag.plain { background: var(--paper-2); color: var(--ink-2); }

.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.empty { padding: 28px; text-align: center; }
.empty-line { padding: 22px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); }

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; text-decoration: none; white-space: nowrap;
  padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface);
  font-size: 14px; font-weight: 700; color: var(--ink); transition: background 0.12s, border-color 0.12s;
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--tempo); border-color: var(--tempo); color: #fff; }
.btn.primary:hover { background: color-mix(in srgb, var(--tempo) 88%, #000); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--paper-2); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn[disabled] { opacity: 0.45; cursor: default; }
.btn.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
button.link { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 700; text-align: left; }
button.link:hover { text-decoration: underline; color: var(--tempo-ink); }

.seg-toggle { display: inline-flex; padding: 3px; gap: 2px; background: var(--paper-2); border-radius: 10px; }
.seg-toggle a { padding: 4px 12px; border-radius: 7px; text-decoration: none; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg-toggle a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }

/* ------------------------------------------------------------ route chips */

.chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 2px 10px 2px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  color: var(--rc, var(--ink-2)); background: var(--rbg, var(--paper-2));
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--rc, var(--faint)); }
.r-regular { --rc: var(--r-regular); --rbg: var(--r-regular-bg); }
.r-partly { --rc: var(--r-partly); --rbg: var(--r-partly-bg); }
.r-compact { --rc: var(--r-compact); --rbg: var(--r-compact-bg); }
.r-compact-plus { --rc: var(--r-compact-plus); --rbg: var(--r-compact-plus-bg); }
.r-class { --rc: var(--faint); --rbg: var(--paper-2); }

/* ------------------------------------------------------------ bundle pages */

.paper-view { overflow-x: auto; padding: 28px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; justify-content: center; }
.paper-view .t-doc { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.16); border-radius: 2px; }
iframe.pdf { width: 100%; height: calc(100vh - 230px); min-height: 500px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; display: block; }
.overview { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.ov-main, .ov-side { display: flex; flex-direction: column; gap: 16px; }
.overview .sheet { padding: 20px 22px; }
.overview h3 { margin: 0 0 10px; font-size: 16px; }
.ov-about { border-top: 4px solid var(--acc); }
.ov-about h1.title { margin: 4px 0 10px; }
.ov-about .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.ov-summary { font-size: 16px; color: var(--ink-2); max-width: 68ch; }
.ov-summary p { margin: 0 0 10px; }
.ov-about h3 { margin-top: 18px; }
ul.goals { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
ul.goals li::marker { color: var(--acc); }
ol.ov-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
ol.ov-list li { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
ol.ov-list li:last-child { border-bottom: 0; }
ol.ov-list .num { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--acc); color: #fff; font-size: 12px; font-weight: 700; }
ol.ov-list li > div { display: flex; flex-direction: column; }
.ov-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ov-stats .stat-num { font-size: 26px; margin-top: 0; }
ul.ov-docs { list-style: none; margin: 0; padding: 0; }
ul.ov-docs li { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.ov-docs li:last-child { border-bottom: 0; }
ul.ov-docs li > a:first-child { font-weight: 700; text-decoration: none; }
ul.ov-docs li > a:first-child:hover { color: var(--tempo-ink); text-decoration: underline; }
ul.ov-docs .muted { grid-column: 1; grid-row: 2; }
ul.ov-docs .btn { grid-column: 2; grid-row: 1 / span 2; }
.diag { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; font: 13px/1.6 var(--mono); margin: 12px 0; }
.error { color: var(--bad); } .warning { color: var(--warn); }
details.source { margin-top: 18px; }
details.source summary { cursor: pointer; font-weight: 700; color: var(--muted); font-size: 14px; }
details.source pre { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; overflow: auto; font: 12.5px/1.5 var(--mono); }

/* ------------------------------------------------------------ compacting app */

.app-head { align-items: flex-end; }
.weeks-line { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.wk { display: inline-flex; align-items: center; gap: 6px; }
.wk::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--wc); }
.wk b { color: var(--ink); }
.w1 { --wc: var(--w1); } .w2 { --wc: var(--w2); } .w3 { --wc: var(--w3); } .w4 { --wc: var(--w4); } .verd { --wc: var(--tempo); }
.head-actions { display: flex; gap: 8px; align-items: center; }

.save { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding: 0 4px; }
.save::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.save-saved::before { background: var(--ok); }
.save-saving::before { background: var(--warn); animation: pulse 0.8s ease-in-out infinite alternate; }
.save-error { color: var(--bad); } .save-error::before { background: var(--bad); }
.save-example::before { background: var(--tempo); }
@keyframes pulse { to { opacity: 0.3; } }

.settings { padding: 18px 20px; margin-bottom: 18px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 28px; align-items: end; }
.settings label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.settings label.check { flex-direction: row; align-items: center; gap: 10px; }
.settings input[type="range"] { accent-color: var(--tempo); width: 100%; }
.settings input[type="checkbox"] { accent-color: var(--tempo); width: 18px; height: 18px; }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.summary { display: grid; grid-template-columns: minmax(300px, 2fr) repeat(3, minmax(160px, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stat-num { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-num small { font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.stat-sub { font-size: 13px; color: var(--muted); }
.stat.plus { background: var(--tempo-tint); border-color: color-mix(in srgb, var(--tempo) 30%, var(--line)); }
.stat.plus .stat-label, .stat.plus .stat-num { color: var(--tempo-ink); }
.split-bar { display: flex; height: 26px; border-radius: 7px; overflow: hidden; margin: 10px 0 8px; gap: 2px; }
.split-bar span { background: var(--rc); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; min-width: 22px; }
@media (prefers-color-scheme: dark) { .split-bar span { color: var(--paper); } }
.split-legend { display: flex; gap: 4px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.split-legend span { display: inline-flex; align-items: center; gap: 5px; }
.split-legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--rc); }

.blok-overview { display: flex; flex-direction: column; gap: 16px; }
.blok-overview .ov-about { padding: 22px 24px; }
.blok-overview .ov-about h3 { margin: 20px 0 8px; font-size: 16px; }
.blok-overview .summary { margin-bottom: 0; }
.ov-list .num.wnum { background: var(--wc); border-radius: 7px; width: 30px; }
.next-steps { display: flex; gap: 8px; flex-wrap: wrap; }
.blok-overview .assumptions { margin-top: 8px; }
.tab-body { animation: rise 0.18s ease-out; scroll-margin-top: calc(var(--top-h) + 68px); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.assumptions { margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--line); max-width: 100ch; }

.scroll-x { overflow-x: auto; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar p { margin: 0; }
.toolbar-actions { display: flex; gap: 8px; }

/* Tables shared by voortoets, klasoverzicht and rooster */
.results, .matrix, .rooster { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
.results th, .matrix th, .rooster th { font-weight: 700; text-align: left; vertical-align: bottom; color: var(--ink-2); }
.results td, .results th, .matrix td, .matrix th, .rooster td, .rooster th { border-bottom: 1px solid var(--line); }
.results tbody tr:last-child td, .matrix tbody tr:last-child td, .rooster tbody tr:last-child td, .rooster tbody tr:last-child th { border-bottom: 0; }
.name-col { position: sticky; left: 0; z-index: 2; background: var(--surface); min-width: 150px; padding: 8px 12px; }
thead .name-col { z-index: 3; }

/* Voortoets */
.results thead th { padding: 8px 6px; background: var(--surface); }
.results .grp { border-top: 3px solid var(--wc); font-size: 12px; max-width: 170px; vertical-align: top; padding-top: 7px; }
.results .grp-label, .matrix .grp-label { display: block; font-weight: 700; color: var(--wc, var(--ink)); }
.results .grp-text { display: block; font-weight: 400; color: var(--muted); line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.results .items th { text-align: center; font-size: 12px; color: var(--muted); font-weight: 400; padding: 4px 0; min-width: 34px; }
.results .items th.first, .results td.first { border-left: 1px solid var(--line); }
.results td { padding: 4px 6px; }
.results input.name { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 4px 6px; font-weight: 700; width: 100%; min-width: 120px; }
.results input.name:hover { border-color: var(--line-2); }
.results input.name:focus { border-color: var(--focus); outline: none; background: var(--paper); }
select.flag { border: 1px solid var(--line-2); border-radius: 6px; padding: 4px 6px; background: var(--surface); font-size: 13px; color: var(--muted); }
select.flag.on-plus { color: var(--r-compact-plus); border-color: var(--r-compact-plus); font-weight: 700; }
select.flag.on-regular { color: var(--ink); border-color: var(--ink-2); font-weight: 700; }
td.cell { text-align: center; padding: 3px; background: color-mix(in srgb, var(--rbg, transparent) 55%, transparent); }
td.cell button {
  width: 28px; height: 28px; border-radius: 7px; border: 1.5px solid var(--line-2); background: var(--surface); cursor: pointer;
  display: inline-grid; place-items: center; padding: 0; transition: transform 0.08s, border-color 0.1s;
}
td.cell button:hover { border-color: var(--rc, var(--ink-2)); }
td.cell button:active { transform: scale(0.92); }
td.cell button.ok { border-color: var(--rc, var(--ink)); }
td.cell button svg { width: 19px; height: 19px; fill: none; stroke: var(--rc, var(--ink)); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
td.cell.verd button.ok svg { stroke: var(--tempo); }
.route-col { min-width: 150px; padding-left: 12px !important; }
.row-actions { white-space: nowrap; text-align: right; opacity: 0; transition: opacity 0.12s; }
tr:hover .row-actions, .row-actions:focus-within { opacity: 1; }
.add-row { margin-top: 12px; border-style: dashed; }

dialog.dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 22px; width: min(640px, 92vw); box-shadow: var(--shadow); }
dialog.dialog::backdrop { background: rgba(20, 22, 29, 0.45); backdrop-filter: blur(2px); }
dialog.dialog h3 { margin: 0 0 6px; }
dialog.dialog textarea { width: 100%; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px; font: 13px/1.5 var(--mono); background: var(--paper); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* Klasoverzicht */
.matrix thead th { padding: 10px 10px 8px; background: var(--surface); }
.matrix .doel-head { border-top: 3px solid var(--wc); min-width: 130px; max-width: 190px; vertical-align: top; }
.matrix .doel-head .grp-label { font-size: 12px; }
.matrix .doel-text { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.matrix td { padding: 6px; vertical-align: middle; }
.matrix .name-col > div { margin-top: 3px; }
.score-cell { position: relative; }
.score-cell button.score {
  width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 0; cursor: pointer; text-align: left;
  border: 0; border-left: 4px solid var(--rc); border-radius: 6px; background: var(--rbg); padding: 6px 10px; transition: filter 0.1s;
}
.score-cell button.score:hover { filter: brightness(0.97); }
.score-cell button.score b { font-size: 15px; font-variant-numeric: tabular-nums; }
.score-cell button.score span { font-size: 12px; font-weight: 700; color: var(--rc); }
.score-cell.overridden button.score { outline: 1.5px dashed var(--rc); outline-offset: -1.5px; }
.route-menu {
  position: absolute; top: calc(100% - 2px); left: 6px; z-index: 10; min-width: 230px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow);
}
.menu-title { font-size: 12px; color: var(--muted); padding: 4px 8px 6px; font-weight: 700; }
.route-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; font-size: 14px; }
.route-menu button:hover { background: var(--paper-2); }
.route-menu button.on { background: var(--rbg, var(--paper-2)); font-weight: 700; }
.route-menu .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rc); }
.free-col { min-width: 180px; font-size: 13px; }
.free-bar { display: flex; height: 8px; border-radius: 4px; background: var(--paper-2); overflow: hidden; margin-bottom: 4px; }
.free-bar .seg.enrich { background: var(--r-compact); }
.free-bar .seg.bundle { background: var(--tempo); }
.free-bar.mini { width: 54px; display: inline-flex; margin: 0; vertical-align: middle; }
.bundle-note { color: var(--tempo-ink); font-weight: 700; }
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 22px; margin-top: 16px; }
.legend-item { display: flex; align-items: flex-start; gap: 10px; }
.legend-item .chip { flex: none; }

/* Lesrooster */
.rooster-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.rooster th, .rooster td { padding: 4px 3px; }
.rooster .week-head { border-top: 3px solid var(--wc); font-size: 13px; padding: 8px 8px 6px; background: var(--surface); }
.rooster .week-head span { font-weight: 400; color: var(--muted); }
.rooster .les-head { text-align: center; padding: 4px 1px; background: var(--surface); }
.les-head button { width: 30px; height: 26px; border: 0; border-radius: 6px; background: none; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--muted); }
.les-head button:hover { background: var(--paper-2); color: var(--ink); }
.les-head.sel button { background: var(--ink); color: var(--paper); }
.rooster td { text-align: center; cursor: pointer; }
.rooster td.sel, .rooster th.sel { background: color-mix(in srgb, var(--tempo) 9%, transparent); }
.rooster tbody .name-col { font-weight: 700; font-size: 14px; }
.rooster .block { display: block; height: 22px; min-width: 22px; border-radius: 5px; background: var(--rc); }
.rooster .block.everyone { background: var(--r-class-fill, var(--line)); }
.instr-row th, .instr-row td { background: var(--paper-2); }
.instr-row .name-col { background: var(--paper-2); font-size: 12px; color: var(--muted); font-weight: 700; }
.instr { display: inline-flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 40px; width: 22px; gap: 2px; }
.instr i { display: block; width: 14px; height: var(--h); min-height: 2px; background: var(--ink-2); border-radius: 3px 3px 0 0; }
.instr b { font-size: 11px; }
.instr.all { height: auto; font-size: 11px; color: var(--muted); width: auto; }
.lesson-detail { padding: 18px; position: sticky; top: calc(var(--top-h) + 68px); }
.lesson-detail h3 { margin: 4px 0 4px; font-size: 18px; }
.group { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.names { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0; font-size: 14px; }
ol.acts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
ol.acts li, .lesson li { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 3px 8px; border-radius: 5px; background: var(--paper-2); }
.k-enrichment { box-shadow: inset 3px 0 0 var(--r-compact); }
.k-bundle { box-shadow: inset 3px 0 0 var(--tempo); background: var(--tempo-tint) !important; color: var(--tempo-ink); font-weight: 700; }
.min { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Weektaken */
.pupils-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.pupil-list { padding: 6px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--top-h) + 68px); }
.pupil-item { display: grid; justify-items: start; gap: 3px; align-items: center; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; }
.pupil-item:hover { background: var(--paper-2); }
.pupil-item.on { background: var(--paper-2); box-shadow: inset 3px 0 0 var(--tempo); }
.pupil-item .pname { font-weight: 700; }
.pupil-item .chip { font-size: 11.5px; }
.pupil-plan { padding: 22px 24px; }
.plan-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.plan-head h2 { display: flex; align-items: center; gap: 10px; margin: 4px 0; font-size: 26px; }
.plan-stats { display: flex; gap: 10px; align-items: stretch; }
.plan-stats > div { display: flex; flex-direction: column; padding: 8px 14px; border-radius: 10px; background: var(--r-compact-bg); color: var(--r-compact); }
.plan-stats > div.bundle { background: var(--tempo-tint); color: var(--tempo-ink); }
.plan-stats b { font-size: 20px; }
.plan-stats span { font-size: 12px; font-weight: 700; }
.plan-stats .btn { align-self: center; }
.doel-strip { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 18px; }
.doel-pill { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: var(--rbg); color: var(--rc); font-weight: 700; }
.doel-pill b { color: var(--ink); }
.week-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.week-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--paper); }
.week-card h4 { margin: 0 0 8px; font-size: 14px; }
.week-card h4 span { font-weight: 400; color: var(--muted); }
.lesson { border-left: 4px solid var(--rc); padding: 4px 0 4px 10px; margin: 8px 0; }
.lesson-top { font-size: 14px; }
.lesson-top span { color: var(--muted); }
.lesson-doel { font-size: 12px; color: var(--muted); margin: 2px 0 4px; }
.lesson ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.week-foot { font-size: 12.5px; color: var(--muted); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-2); }

/* Bundel */
.bundle-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.brief { padding: 22px 24px; border-top: 4px solid var(--tempo); }
.brief .eyebrow { color: var(--tempo-ink); }
.brief-title { font-size: 34px; margin: 6px 0 4px; color: var(--tempo-ink); }
.brief-title span { font-size: 16px; color: var(--ink); font-weight: 400; letter-spacing: 0; }
.brief-weeks { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.brief-week { border-left: 4px solid var(--wc); padding-left: 12px; }
.bw-head { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.bw-head .min { margin-left: auto; font-weight: 700; color: var(--ink); }
.bw-bar { height: 6px; background: var(--paper-2); border-radius: 3px; margin: 6px 0; }
.bw-bar span { display: block; height: 100%; background: var(--tempo); border-radius: 3px; }
.brief-week ul { margin: 4px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-2); }
.side { display: flex; flex-direction: column; gap: 16px; }
.side > .sheet { padding: 18px 20px; }
.side h3 { margin: 0 0 6px; font-size: 16px; }
.prompt-card pre { white-space: pre-wrap; font: 12.5px/1.5 var(--mono); background: var(--paper-2); border-radius: var(--radius-sm); padding: 12px; max-height: 260px; overflow: auto; }
.bundle-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.bundle-list li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bundle-list li:last-child { border-bottom: 0; }
.bundle-list a { font-weight: 700; text-decoration: none; }
.bundle-list a:hover { color: var(--tempo-ink); text-decoration: underline; }

/* ------------------------------------------------------------ pupils (three trial layouts) */

.p-succesvol { --pc: #1d6b87; --pbg: #e1eff4; }
.p-uitdagend { --pc: #9a5b13; --pbg: #f8ecd9; }
.p-onderduikend { --pc: #6b4aad; --pbg: #eeeaf7; }
.p-risico { --pc: #b5392b; --pbg: #f8e8e5; }
.p-dubbel-bijzonder { --pc: #a03a6e; --pbg: #f6e5ee; }
.p-autonoom { --pc: #2f7a52; --pbg: #e5f2ea; }
@media (prefers-color-scheme: dark) {
  .p-succesvol { --pc: #6cb8d4; --pbg: #17303a; }
  .p-uitdagend { --pc: #e5a65a; --pbg: #3a2a16; }
  .p-onderduikend { --pc: #b39ce8; --pbg: #2a2342; }
  .p-risico { --pc: #f09a8f; --pbg: #3d1f1b; }
  .p-dubbel-bijzonder { --pc: #e08bb6; --pbg: #3a1c2b; }
  .p-autonoom { --pc: #74c69d; --pbg: #183327; }
}
.avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; background: var(--pbg); color: var(--pc); font-weight: 700; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pc) 35%, transparent); }
.ptag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--pc); background: var(--pbg); white-space: nowrap; }
.ptag::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--pc); transform: rotate(45deg); }

.levels { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.level { display: flex; justify-content: space-between; align-items: center; gap: 10px; max-width: 220px; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 16px; height: 7px; border-radius: 4px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.pips i.on { background: var(--pc, var(--ink-2)); box-shadow: none; }

.rounds { display: inline-flex; align-items: center; gap: 4px; }
.rounds i { width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.rounds i.done { background: var(--acc, var(--tempo)); box-shadow: none; }
.rounds i.now { width: 15px; height: 15px; background: radial-gradient(circle, var(--acc, var(--tempo)) 0 27%, transparent 30% 55%, var(--acc, var(--tempo)) 58%); box-shadow: none; }
.works-on { display: flex; flex-direction: column; gap: 4px; }
.works-on > a { font-weight: 700; text-decoration: none; color: var(--acc); }
.works-on > a:hover { text-decoration: underline; }
.works-on.none > span:first-child { font-weight: 700; color: var(--ink-2); }
.works-meta { display: flex; align-items: center; gap: 8px; }

.lv-intro { margin-bottom: 20px; }
.lv-intro h1.title { margin: 0 0 4px; }

/* Overview: one calm card per pupil; the details live in the dossier. */
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 14px; }
.pcard {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 26px 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  text-decoration: none; color: inherit; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
a.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--pc) 40%, var(--line)); }
.pcard h2 { margin: 6px 0 0; font-size: 21px; }
.pc-work { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; min-height: 104px; margin-top: auto; padding: 12px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); }
.pcard h2 + .ptag { margin-bottom: 10px; }
.pc-work b { font-size: 14.5px; color: var(--acc, var(--ink)); line-height: 1.3; }
.pc-work b.none { color: var(--ink-2); }
.pc-work .works-meta { flex-direction: column; gap: 4px; }
.pc-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.d-next { padding: 12px 14px; margin-bottom: 18px; border-radius: 10px; background: var(--tempo-tint); }
.d-next b { color: var(--tempo-ink); }
.pcard.add { justify-content: center; background: transparent; border: 1.5px dashed var(--line-2); }
.add-plus { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; color: var(--faint); border: 1.5px dashed var(--line-2); }

/* Pupils as the tab bar inside a dossier */
.pupil-tabs > a { gap: 8px; }
.pupil-tabs > a .avatar { box-shadow: none; }
.pupil-tabs > a:not(.on) .avatar { opacity: 0.75; }
.pupil-tabs > a.on::after { background: var(--pc); }

/* B: dossier */
.dossier { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.25fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.d-profile { padding: 22px; border-top: 5px solid var(--pc); }
.d-id { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.d-id h1.title { margin: 0 0 4px; font-size: 28px; }
.d-gist { font-size: 15.5px; color: var(--ink-2); margin: 0 0 6px; }
.d-profile h4 { margin: 18px 0 6px; font-size: 14px; }
.d-profile p { margin: 0 0 6px; }
.d-profile .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.d-watch { padding: 9px 12px; border-radius: 8px; background: #fff3cc; color: #5c4400; border-left: 3px solid #d99a00; font-size: 14px; }
@media (prefers-color-scheme: dark) { .d-watch { background: #3a3016; color: #f0dc9c; } }
.d-line { padding: 20px 22px; }
.d-line h3, .d-side h3 { margin: 0 0 12px; font-size: 16px; }
.d-note { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 18px; }
.d-note textarea { flex: 1; resize: vertical; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--paper); font-size: 14px; }
ol.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
ol.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
ol.timeline li { display: flex; gap: 14px; padding: 0 0 18px; position: relative; }
ol.timeline .t-dot { flex: none; width: 16px; height: 16px; margin-top: 3px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--line-2); position: relative; z-index: 1; }
ol.timeline .t-log .t-dot { background: var(--paper-2); }
ol.timeline .t-now .t-dot { background: radial-gradient(circle, var(--tempo) 0 25%, var(--surface) 28% 52%, var(--tempo) 55%); box-shadow: none; }
ol.timeline time { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
ol.timeline p { margin: 1px 0 0; font-size: 14.5px; }
ol.timeline .t-now p { font-weight: 700; }
.d-side { display: flex; flex-direction: column; gap: 16px; }
.d-side > .sheet { padding: 18px 20px; }
.d-side .eyebrow { margin-bottom: 2px; }
ol.d-week { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
ol.d-week li { display: flex; gap: 10px; padding: 6px 8px; border-radius: 8px; background: var(--rbg); border-left: 4px solid var(--rc); font-size: 13.5px; }
ol.d-week .d-day { font-weight: 700; width: 22px; flex: none; color: var(--rc); }
ol.d-week .small { color: var(--ink-2); }
.d-week-foot { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--muted); }
.d-week-foot a { font-weight: 700; color: var(--tempo-ink); }
ol.d-rounds { margin: 12px 0 0; padding-left: 20px; font-size: 13.5px; display: flex; flex-direction: column; gap: 3px; color: var(--muted); }
ol.d-rounds li.done { color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--faint); }
ol.d-rounds li.now { color: var(--ink); font-weight: 700; }
ol.d-rounds li.now::marker { color: var(--tempo); }

/* C: week plan */
.wp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.wp-head h1.title { margin: 0 0 4px; }
.wp-head h1 span { color: var(--muted); font-weight: 400; }
table.weekplan { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; }
.weekplan th, .weekplan td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.weekplan tbody tr:last-child th, .weekplan tbody tr:last-child td { border-bottom: 0; }
.weekplan thead th { font-size: 13px; background: var(--surface); }
.wp-focus { font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.3; margin-top: 2px; }
.wp-pupil { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.wp-pupil > span:last-child { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.wp-pupil:hover b { text-decoration: underline; }
.weekplan tbody .name-col { min-width: 190px; vertical-align: middle; }
.wp-cell { display: flex; flex-direction: column; gap: 1px; min-width: 120px; min-height: 52px; padding: 7px 9px; border-radius: 8px; background: var(--rbg); border-left: 4px solid var(--rc); }
.wp-cell b { font-size: 13px; color: var(--ink); }
.wp-cell span { font-size: 12px; color: var(--ink-2); line-height: 1.3; }
.wp-cell.bundle { background: var(--tempo-tint); border-left-color: var(--tempo); }
.wp-cell.bundle b { color: var(--tempo-ink); }
.wp-next { min-width: 170px; color: var(--ink-2); vertical-align: middle !important; }

@media (max-width: 1100px) {
  .dossier { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ responsive, print */

@media (max-width: 1100px) {
  .ctxbar-in { flex-wrap: wrap; gap: 0 16px; }
  .crumb { min-height: 44px; }
  .ctx-tabs { order: 3; flex-basis: 100%; min-height: 42px; margin: 0 -12px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary .route-split { grid-column: span 2; }
  .rooster-layout, .bundle-layout, .overview { grid-template-columns: 1fr; }
  .lesson-detail { position: static; }
}
@media (max-width: 720px) {
  .topbar-in { gap: 14px; padding: 0 16px; }
  .brand .tagline, .school div { display: none; }
  .nav a { padding: 0 8px; }
  .nav a .ico { display: none; }
  .ctx-actions { flex-basis: 100%; padding: 2px 0 10px; margin-left: 0; }
  .ctxbar-in, main.page { padding-left: 16px; padding-right: 16px; }
  main.page { padding-top: 20px; }
  h1.title { font-size: 26px; }
  .hero { grid-template-columns: 1fr; padding: 22px; }
  .hero-art { display: none; }
  .pupils-layout { grid-template-columns: 1fr; }
  .pupil-list { position: static; flex-direction: row; overflow-x: auto; }
  .pupil-item { min-width: 170px; }
}
@media print {
  body { background: #fff; }
  .topbar, .ctxbar, .no-print { display: none !important; }
  main.page { padding: 0; max-width: none; }
}

/* ------------------------------------------------------------------ bundle editor */
@font-face { font-family: tempono-mono; src: url(/fonts/mono-400-normal.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: tempono-mono; src: url(/fonts/mono-700-normal.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: tempono-mono; src: url(/fonts/mono-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: tempono-mono; src: url(/fonts/mono-700-italic.woff2) format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h2.section { margin-bottom: 14px; }
.ctx-actions form { display: contents; }
.ctx-tabs > button { background: none; border: 0; cursor: pointer; }

/* Start form for a new bundle */
.start-form { max-width: 720px; margin: 0 auto; padding: 26px 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.start-form > h1, .start-form > .lead, .start-form > .diag, .start-form .wide { grid-column: 1 / -1; }
.start-form .f { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.start-form .f > span { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.start-form input:not([type="checkbox"]), .start-form select { border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--surface); }
.start-form .checks { display: flex; gap: 16px; padding-top: 6px; }
.start-form .checks input { accent-color: var(--tempo); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Layout: outline · form · booklet, each scrolling on its own */
main.editor { height: calc(100vh - var(--top-h) - 49px); padding: 0 16px; display: flex; flex-direction: column; }
.ed-grid { display: grid; grid-template-columns: 264px minmax(440px, 1fr) minmax(360px, 0.9fr); gap: 16px; flex: 1 1 auto; min-height: 0; }
.ed-grid > * { min-height: 0; overflow-y: auto; padding: 16px 2px 40px; }
@media (max-width: 1180px) { .ed-grid { grid-template-columns: 240px 1fr; } .ed-preview { display: none; } }
.banner { flex: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 0; padding: 9px 14px; border-radius: var(--radius-sm); background: var(--zee-tint); color: var(--ink); font-size: 14px; }
.banner > span:first-child { flex: 1 1 320px; }
.banner.bad { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }

/* Outline */
.outline { display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; }
.outline button { background: none; border: 0; text-align: left; cursor: pointer; }
.o-bundle { display: flex; flex-direction: column; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); }
.o-bundle b { font-size: 15px; line-height: 1.25; }
.o-kicker { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.o-sec { display: flex; flex-direction: column; gap: 2px; }
.o-sec-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); font-weight: 700; font-size: 14px; }
.o-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 700; flex: none; }
.o-blocks { list-style: none; margin: 0; padding: 0 0 0 10px; display: flex; flex-direction: column; gap: 1px; min-height: 6px; border-left: 2px solid var(--line); margin-left: 18px; }
.o-block { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; position: relative; }
.o-block:hover, .o-sec-head:hover, .o-bundle:hover { background: var(--paper-2); }
.o-block.on, .o-sec-head.on, .o-bundle.on { background: var(--tempo-tint); box-shadow: inset 3px 0 0 var(--tempo); }
.o-block.dragging { opacity: 0.4; }
.o-block.drop-before::before, .o-block.drop-after::after { content: ""; position: absolute; left: 4px; right: 4px; height: 3px; border-radius: 2px; background: var(--tempo); }
.o-block.drop-before::before { top: -2px; } .o-block.drop-after::after { bottom: -2px; }
.o-block.err .o-badge, .o-sec-head.err .o-num, .o-bundle.err b { box-shadow: 0 0 0 2px var(--bad); }
.o-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 6px; background: var(--paper-2); color: var(--ink-2); font-size: 12px; font-weight: 700; flex: none; }
.o-badge.task { background: var(--tempo); color: #fff; }
.o-badge.note { background: var(--zee-tint); color: var(--zee); }
.o-text { display: flex; flex-direction: column; min-width: 0; }
.o-type { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.o-snip { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-add { margin-left: 28px; padding: 4px 8px; font-size: 13px; color: var(--muted); border-radius: var(--radius-sm); align-self: flex-start; }
.o-add:hover { color: var(--tempo-ink); background: var(--paper-2); }
.o-add.sec { margin-left: 0; font-weight: 700; }
.picker-modal { width: min(760px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 64px)); padding: 0; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.45); }
.picker-modal::backdrop { background: rgba(20, 22, 29, 0.42); }
.picker-modal header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.picker-modal h2 { margin: 0; font-size: 18px; }
.picker-body { padding: 4px 18px 18px; }
.picker-group { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); padding: 14px 0 8px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.picker-grid .pick { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.picker-grid .pick:hover { border-color: var(--line-2); background: var(--paper); }
.picker-grid .pick.on { border-color: var(--tempo); background: var(--tempo-tint); }
.picker-grid .pick b { display: block; font-size: 14.5px; }
.picker-grid .pick .small { display: block; line-height: 1.35; }

/* Record cards */
.ed-form { display: flex; flex-direction: column; gap: 14px; }
.ecard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 18px 18px; }
.ecard-head { display: flex; align-items: center; gap: 10px; margin: -2px 0 12px; flex-wrap: wrap; position: relative; z-index: 20; }
.ecard-head h2 { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 8px; flex: 1 1 auto; }
.ecard-actions { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
.ecard.answer { border-top: 3px solid var(--tempo); }
.ecard.note { border-top: 3px solid var(--zee); }
details.ecard > summary { cursor: pointer; display: flex; align-items: baseline; gap: 10px; font-weight: 700; font-size: 16px; list-style: none; }
details.ecard > summary::before { content: "▸"; color: var(--muted); transition: transform 0.15s; display: inline-block; }
details.ecard[open] > summary { margin-bottom: 12px; }
details.ecard[open] > summary::before { transform: rotate(90deg); }
details.ecard.teacher { background: color-mix(in srgb, var(--zee-tint) 45%, var(--surface)); border-color: color-mix(in srgb, var(--zee) 25%, var(--line)); }
.ed-form > .ecard .ecard.teacher, .ecard > details.ecard { margin-top: 14px; }

/* Fields */
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.fgrid:empty { display: none; }
.fgrid > .fgrid { grid-column: 1 / -1; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld.wide { grid-column: 1 / -1; }
.flabel { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.req { color: var(--tempo-ink); margin-left: 3px; }
.fhelp { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.ferr { font-size: 13px; color: var(--bad); font-weight: 700; }
.ferr::before { content: "! "; }
.rec-errors { margin: -4px 0 10px; }
.input { width: 100%; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 7px 10px; background: var(--surface); min-width: 0; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.input.num { max-width: 160px; }
.input.small { width: auto; padding: 3px 6px; font-size: 13px; }
.input.mono, .mono { font-family: var(--mono); font-size: 13px; }
.has-error > .input, .has-error .mdtext .overtype-container, td.has-error .input { border-color: var(--bad); }
.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; background: var(--paper-2); border-radius: 10px; align-self: flex-start; }
.seg button { border: 0; background: none; padding: 4px 11px; border-radius: 7px; font-size: 13.5px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.seg button.on.dflt { font-weight: 400; }
.seg.small button { font-size: 12.5px; padding: 3px 9px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.switch input { accent-color: var(--tempo); width: 18px; height: 18px; }
details.more { margin-top: 12px; }
details.more > summary { cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.anyof { display: flex; flex-direction: column; gap: 8px; }

/* Pyramid of cells (number walls) */
.pyramid { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0; overflow-x: auto; }
.pyr-row { display: flex; gap: 6px; justify-content: center; }
.brick { display: flex; flex-direction: column; align-items: stretch; gap: 3px; width: 84px; padding: 5px; border-radius: 10px; background: var(--paper-2); border: 1px solid var(--line-2); }
.brick.open { background: var(--surface); border-style: dashed; }
.brick.has-error { border-color: var(--bad); }
.brick .input { text-align: center; font-weight: 700; min-width: 0; padding-left: 4px; padding-right: 4px; }
.brick .tog { border: 0; background: none; border-radius: 6px; padding: 1px 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.brick .tog.on { background: var(--zee-tint); color: var(--zee); font-weight: 700; }
.pyr-tools { display: flex; gap: 6px; margin-top: 4px; }

/* Markdown-lite (OverType) */
.mdtext .overtype-container { border: 1px solid var(--line-2) !important; border-radius: var(--radius-sm); overflow: hidden; }
.mdtext .overtype-container:focus-within { border-color: var(--focus) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.mdtext .overtype-toolbar { padding: 3px 4px !important; }
.mdtext.compact { flex: 1 1 auto; min-width: 0; }

/* Lists, tables, cards in a field */
.list { display: flex; flex-direction: column; gap: 6px; }
.list .row { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.list .row > .input, .list .row > .mdtext, .list .row > .seg, .list .row > select { flex: 1 1 200px; }
.list .row > .ferr { flex-basis: 100%; padding-left: 28px; }
.row-num { width: 22px; flex: none; padding-top: 8px; font-size: 12px; color: var(--faint); text-align: right; }
.rowtools { display: inline-flex; gap: 1px; flex: none; padding-top: 3px; }
button.icon { width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; font-size: 13px; }
button.icon:hover:not([disabled]) { background: var(--paper-2); color: var(--ink); }
button.icon.danger:hover:not([disabled]) { color: var(--bad); }
button.icon[disabled] { opacity: 0.3; cursor: default; }
.btn.add { align-self: flex-start; color: var(--tempo-ink); }
.grid-edit { display: flex; flex-direction: column; gap: 6px; overflow-x: auto; }
.grid-edit table { border-collapse: collapse; width: 100%; }
.grid-edit th { font-size: 12px; text-align: left; color: var(--muted); padding: 0 4px 4px; font-weight: 700; }
.grid-edit td { padding: 2px; vertical-align: top; }
.grid-edit td.tools { width: 1%; white-space: nowrap; }
.grid-edit .seg { flex-wrap: nowrap; }
.subcard { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--paper); }
.subcard-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 13px; }
.optkey { display: flex; flex-direction: column; gap: 4px; }
.optkey label { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.optkey label.on { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.optkey input { accent-color: var(--ok); }
.asset-current { display: flex; gap: 14px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
.asset-current img { width: 180px; height: 120px; object-fit: contain; background: #fff; border-radius: 4px; flex: none; }
.asset-current.empty { padding: 14px; justify-content: space-between; border-style: dashed; }
.asset-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.asset-meta b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding-top: 14px; }
.asset-grid > button, .asset-upload { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-size: 12px; min-width: 0; }
.asset-grid > button.on { border-color: var(--tempo); box-shadow: 0 0 0 2px var(--tempo-tint); }
.asset-grid img { width: 100%; height: 96px; object-fit: contain; background: #fff; border-radius: 4px; }
.asset-grid span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-upload { justify-content: center; border-style: dashed; color: var(--tempo-ink); font-weight: 700; min-height: 104px; }
.asset-upload input { display: none; }
.answer-kind { font-weight: 400; color: var(--tempo-ink); }
.ecard.answer.empty { border-top-color: var(--line-2); }
.answer-summary { margin: -8px 0 12px; }
.problems { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; font-size: 13.5px; }
.problems summary { cursor: pointer; font-weight: 700; }
.problems ul, .yaml-diags { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.problems button, .yaml-diags button { border: 0; background: var(--paper-2); border-radius: 5px; padding: 1px 6px; font-family: var(--mono); font-size: 12px; cursor: pointer; color: var(--ink-2); }

/* Live booklet */
.ed-preview { display: flex; flex-direction: column; gap: 10px; overflow: hidden !important; padding-bottom: 16px !important; }
.ed-preview .seg-toggle { align-self: flex-start; flex: none; }
.ed-paper { flex: 1 1 auto; overflow: auto; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; }
.ed-paper.stale .ed-zoom { opacity: 0.45; filter: grayscale(0.6); }
.ed-zoom { position: relative; width: max-content; margin: 0 auto; }
.ed-zoom .t-doc { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.16); border-radius: 2px; }
.ed-mark { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--tempo) 9%, transparent); box-shadow: inset 4px 0 0 var(--tempo); pointer-events: none; border-radius: 2px; transition: top 0.2s, height 0.2s; }
.t-mark { display: block; height: 0; }
.ed-stale { font-size: 13px; color: var(--warn); font-weight: 700; }

/* YAML view */
.yaml-view { display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-height: 0; padding: 12px 0 16px; }
.yaml-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; flex: 1 1 auto; min-height: 0; }
textarea.yaml { height: 100%; resize: none; line-height: 20px; tab-size: 2; white-space: pre; }
.yaml-diags { overflow-y: auto; margin: 0; font-size: 13.5px; }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; font-weight: 700; letter-spacing: 0.05em; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 220px; padding: 5px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.menu-pop button { border: 0; background: none; text-align: left; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.menu-pop button:hover { background: var(--paper-2); }
.menu-pop button.danger { color: var(--bad); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.menu-label { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 2px; }

/* ---------------------------------------------------------------- watch (meekijken) */
main.watch { padding: 16px 24px 48px; }
.w-note { max-width: 900px; margin: 0 auto 10px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; }
.w-errors { color: var(--warn); font-weight: 700; }
.w-follow { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.w-paper { max-width: 900px; margin: 0 auto; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; cursor: pointer; }
.w-paper.stale .ed-zoom { opacity: 0.55; filter: grayscale(0.5); }
.w-paper .ed-zoom .t-doc { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.16); border-radius: 2px; }
.w-hover, .w-flash { position: absolute; left: 0; right: 0; pointer-events: none; border-radius: 2px; }
.w-hover { background: color-mix(in srgb, var(--tempo) 6%, transparent); box-shadow: inset 3px 0 0 color-mix(in srgb, var(--tempo) 55%, transparent); }
.w-flash { background: color-mix(in srgb, var(--tempo) 20%, transparent); box-shadow: inset 4px 0 0 var(--tempo); animation: w-flash 3s ease-out forwards; }
@keyframes w-flash { 0%, 35% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .w-flash { animation-duration: 0.01s; animation-delay: 2.5s; } }

/* Embedded (e.g. a panel next to the chat): no app bars, and every pixel for the page. */
body.embed .ctxbar { top: 0; }
body.embed .ctxbar-in { padding: 0 12px; gap: 12px; min-height: 44px; }
/* Title and actions share the first row (the title gives way), tabs below. */
body.embed .crumb { flex: 1 1 0; min-width: 0; min-height: 44px; }
body.embed .crumb b { max-width: none; }
body.embed .ctx-actions { flex-basis: auto; padding: 0; margin-left: auto; }
body.embed main.watch { padding: 10px 10px 24px; }
body.embed .w-paper { padding: 8px; border: 0; background: transparent; }
@media (max-width: 640px) { main.watch { padding: 12px 12px 32px; } .w-paper { padding: 8px; } }
