/* Woonbijdrage Beoordelingsbalie: offline demo.
   Layout: a back-office case-management tool. Slim app bar, case file on the left, rulebook pinned on the right; debrief reads as a report. */
:root {
  --bg: #eaeef0;
  --surface: #ffffff;
  --sunk: #f3f6f7;
  --ink: #16232a;
  --muted: #586972;
  --line: #d0d9dc;
  --accent: #1d5c69;
  --accent-ink: #ffffff;
  --accent-soft: #dcebee;
  --warn: #a86200;
  --warn-bg: #fbefd9;
  --bad: #b3261e;
  --bad-bg: #fbe8e6;
  --good: #2d6a39;
  --good-bg: #e2f0e4;
  --va: #c4561a;  /* version A in the facilitator's charts and slides */
  --vb: #007c9c;  /* version B */
    --f-display: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --r: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1518; --surface: #162026; --sunk: #111a1e; --ink: #e2e9ec; --muted: #93a4ac; --line: #29363d;
    --accent: #6db3c0; --accent-ink: #0e1518; --accent-soft: #1b3339;
    --warn: #e3a64c; --warn-bg: #33260f; --bad: #f08b80; --bad-bg: #3a1c19; --good: #7dc58b; --good-bg: #17301f;
    --va: #d9773a; --vb: #2a9db3;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1518; --surface: #162026; --sunk: #111a1e; --ink: #e2e9ec; --muted: #93a4ac; --line: #29363d;
  --accent: #6db3c0; --accent-ink: #0e1518; --accent-soft: #1b3339;
  --warn: #e3a64c; --warn-bg: #33260f; --bad: #f08b80; --bad-bg: #3a1c19; --good: #7dc58b; --good-bg: #17301f;
  --va: #d9773a; --vb: #2a9db3;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
.mono, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.label { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
button { font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.appbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.appbar .wrap { display: flex; align-items: center; gap: 16px; padding-block: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.brand b { font-family: var(--f-display); font-size: 1.05rem; letter-spacing: .01em; }
.brand span { color: var(--muted); font-size: .85rem; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 6px; align-items: baseline; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: .8rem; background: var(--sunk); }
.chip .num { font-weight: 500; }
.chip.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }

main { padding-block: 24px 48px; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: minmax(0, 1fr); } .rules { order: -1; } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.panel-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-b { padding: 16px; display: grid; gap: 14px; }

.rules { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 72px); }
@media (max-width: 860px) { .rules { position: static; } }
.rules summary { list-style: none; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; }
.rules summary::-webkit-details-marker { display: none; }
.rules summary { cursor: pointer; }
.rules .toggle { color: var(--accent); font-size: .9rem; font-weight: 600; white-space: nowrap; }
.rules .toggle u { text-underline-offset: 3px; }
.rules .toggle .arrow { display: inline-block; width: 0; height: 0; margin-left: 6px; border: 6px solid transparent; border-left: 9px solid currentColor; border-right: 0; vertical-align: -1px; }
.rules[open] .toggle .arrow { border: 6px solid transparent; border-top: 9px solid currentColor; border-bottom: 0; vertical-align: 1px; }
.rules[open] .when-closed, .rules:not([open]) .when-open { display: none; }
.rules ol { margin: 0; padding: 0 16px 16px 34px; display: grid; gap: 10px; font-size: .9rem; }
.rules .limits { display: grid; grid-template-columns: auto auto; gap: 2px 12px; margin-top: 4px; font-size: .85rem; }
.rules .note { padding: 0 16px 16px; color: var(--muted); font-size: .8rem; }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.field { padding: 10px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 2px; min-width: 0; }
.field:nth-child(odd) { border-right: 1px solid var(--line); }
.field:nth-last-child(-n+2) { border-bottom: 0; }
.field .v { font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 480px) { .fields { grid-template-columns: minmax(0,1fr); } .field:nth-child(odd) { border-right: 0; } .field:nth-last-child(2) { border-bottom: 1px solid var(--line); } }

.raw { background: var(--sunk); border: 1px dashed var(--line); border-radius: var(--r); padding: 14px; font-family: var(--f-mono); font-size: .85rem; white-space: pre-wrap; overflow-wrap: anywhere; }

.ai { border: 1px solid var(--line); border-radius: var(--r); background: var(--sunk); padding: 12px 14px; display: grid; gap: 8px; }
.ai-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { display: inline-block; border-radius: 4px; padding: 2px 8px; font-weight: 600; font-size: .85rem; font-family: var(--f-display); letter-spacing: .03em; text-transform: uppercase; }
.pill.approve { background: var(--good-bg); color: var(--good); }
.pill.reject { background: var(--bad-bg); color: var(--bad); }
.ai .why { font-size: .9rem; }
.ai .flags { font-size: .85rem; color: var(--muted); }
.ai .flags.has { color: var(--bad); }
.ai-mini { display: none; }
.ai-mini .flags { color: var(--muted); margin-left: auto; white-space: nowrap; }
.ai-mini .pill { font-size: .78rem; padding: 1px 6px; }
.ai-mini .flags.has { color: var(--bad); font-weight: 600; }
.ai.hiddenai { color: var(--muted); font-size: .9rem; }
.spinner { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }

.banner { border-radius: var(--r); padding: 10px 14px; font-size: .9rem; }
.banner.bad { background: var(--bad-bg); color: var(--bad); font-weight: 500; }
.banner.info { background: var(--accent-soft); color: var(--ink); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
/* Phone: the decision buttons stay at the bottom of the screen while the case scrolls. */
@media (max-width: 860px) {
  .actions.decide { position: sticky; bottom: 0; z-index: 4; margin: 0 -16px -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); box-shadow: 0 -6px 16px rgba(0,0,0,.08); }
  .actions.decide > .btn.big, .actions.decide > .btn.primary { flex: 1 1 0; min-width: 0; }
  .actions.decide > .ai-mini { display: flex; flex: 1 1 100%; align-items: center; gap: 4px 8px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
}
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--r); padding: 10px 18px; font-weight: 500; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; padding: 12px 22px; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { min-width: 140px; }
.btn.link { border: 0; background: none; color: var(--muted); text-decoration: underline; padding: 8px 6px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.kbd { font-family: var(--f-mono); font-size: .75rem; opacity: .8; margin-left: 6px; }
textarea, input[type=text] { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
textarea { min-height: 70px; resize: vertical; }

.timer { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.timer i { display: block; width: 100%; height: 100%; background: var(--warn); transition: width .25s linear; }
.timer.late i { background: var(--bad); }

@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .timer i { transition: none; } }

.narrow { max-width: 680px; margin: 0 auto; display: grid; gap: 20px; }
.narrow.narrow-sm { max-width: 420px; }
.narrow.narrow-lg { max-width: 820px; }
.full { width: 100%; }
.error { color: var(--bad); }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 62ch; }
.stack { display: grid; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.report { display: grid; gap: 28px; }
.report section { display: grid; gap: 12px; }
.trap { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line); }
.trap:first-child { border-top: 0; }
.verdict { font-family: var(--f-display); font-weight: 700; text-transform: uppercase; font-size: .8rem; letter-spacing: .06em; padding: 4px 0; border-radius: 4px; text-align: center; align-self: start; }
.verdict.caught { background: var(--good-bg); color: var(--good); }
.verdict.missed { background: var(--bad-bg); color: var(--bad); }
.trap h3 { margin-bottom: 2px; }
.effects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .effects { grid-template-columns: minmax(0, 1fr); } }
.effect { padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.effect .label { color: var(--accent); }
.qs { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.chart { overflow-x: auto; }
.chart svg { display: block; max-width: 100%; height: auto; }
.chart text { fill: var(--muted); font-family: var(--f-body); font-size: 12px; }
.chart .val { fill: var(--ink); font-family: var(--f-mono); }

.bigstat { display: flex; gap: 24px; flex-wrap: wrap; }
.bigstat div { display: grid; }
.bigstat .num { font-size: 1.6rem; font-weight: 500; }

/* Result sharing (debrief) and facilitator view */
.sharebox { padding: 14px 16px; display: grid; gap: 10px; }
.codebox { display: flex; gap: 8px; }
.codebox input { font-size: .85rem; min-width: 0; }
.sessioncode { font-family: var(--f-mono); letter-spacing: .12em; }
.sessionrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sessionrow input { max-width: 12em; font-family: var(--f-mono); letter-spacing: .12em; text-transform: uppercase; }
.qr { background: #fff; border-radius: var(--r); line-height: 0; }
.qr svg { width: 100%; height: auto; display: block; }
input[type=text].codeinput { font-family: var(--f-mono); font-size: 2rem; letter-spacing: .18em; text-transform: uppercase; text-align: center; }

/* Facilitator view. Once a session is open it is a deck of slides. On screens at least 900px wide (.deck-fit) the deck is laid out
   on a 1920×1200 canvas in px, and facilitator.js zooms the page to the screen; narrower screens get the slides stacked at their own size. */
.facilitator-wrap { max-width: 900px; }
.decktools { display: flex; gap: 10px; align-items: center; }
.btn.slim { padding: 4px 12px; font-size: .85rem; color: var(--muted); }
.btn.slim.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); font-weight: 600; }
.pager { font-size: .85rem; color: var(--muted); min-width: 3.5em; text-align: center; }
.iconbtn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--r); width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; }
.iconbtn:hover { border-color: var(--accent); }
.iconbtn[disabled] { opacity: .3; cursor: default; }
.iconbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn.flat { border-color: transparent; background: none; color: var(--muted); }
.fs-exit, :root:fullscreen .fs-enter { display: none; }
:root:fullscreen .fs-exit { display: block; }

main:has(> .deck:not([hidden])) { padding: 0; }
.slide { display: grid; gap: 8px; align-content: start; padding: 32px 48px 16px; }
.slide h1 { font-size: 42px; }
.slide > .label { font-size: 16px; }
.slide .sub { font-size: 21px; color: var(--muted); }
.decknav { display: flex; justify-content: center; align-items: center; gap: 16px; padding: 8px; }
.dots { display: flex; gap: 6px; }
.dots button { width: 22px; height: 22px; border: 0; padding: 0; background: none; display: grid; place-items: center; }
.dots button::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--line); }
.dots button.on::before { background: var(--ink); }

/* Canvas mode: the app bar, the slide and the dots fill exactly one screen. */
:root.deck-fit { overflow: hidden; }
.deck-fit body { height: var(--deck-h); overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.deck-fit main, .deck-fit .deck { min-height: 0; height: 100%; }
.deck-fit .appbar { position: static; }
.deck-fit .appbar .wrap { max-width: none; padding-inline: 32px; }

/* Join slide */
.slide[data-slide=join] { align-content: center; min-height: 100%; padding-bottom: 80px; }
.slide .joingrid { display: grid; grid-template-columns: 600px minmax(0, 1fr); gap: 60px; align-items: center; padding: 0 40px; }
.joinlink { font-family: var(--f-mono); font-size: 44px; font-weight: 500; overflow-wrap: anywhere; }
.joincode { font-family: var(--f-mono); font-size: 120px; font-weight: 600; letter-spacing: .14em; line-height: 1.1; color: var(--accent); }
.joingrid .label { font-size: 18px; }
.joingrid .bigstat { gap: 60px; }
.joingrid .bigstat .num { font-size: 72px; }
.joingrid .btn.primary { font-size: 20px; padding: 14px 28px; }

/* Chart slides */
.chartslide { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: center; }
.deck-fit .chartslide { height: calc(var(--deck-h) - 250px); }
.chartbox { height: 100%; min-height: 0; display: grid; align-items: center; }
.deckchart { display: block; width: 100%; height: 100%; max-height: 100%; }
.deckchart text { fill: var(--muted); font-family: var(--f-body); font-size: 15px; }
.deckchart .lab { fill: var(--ink); font-weight: 600; font-size: 19px; }
.deckchart .grp { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.deckchart .val { fill: var(--ink); font-family: var(--f-mono); font-size: 16px; }
.deckchart .ver { fill: var(--ink); font-weight: 700; }
.deckchart .bara { fill: var(--va); }
.deckchart .barb { fill: var(--vb); }
.chartside { display: grid; gap: 20px; align-content: center; }
.chartside .small { font-size: 16px; }
.legend { display: grid; gap: 12px; font-size: 20px; }
.legend > span { display: flex; gap: 12px; align-items: baseline; }
.swatch { display: inline-block; flex: none; width: 20px; height: 15px; border-radius: 2px; background: var(--va); }
.swatch.b { background: var(--vb); }

/* Side-by-side slides: the real case screens, scaled down, with numbered markers that match the notes. */
.versus { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; padding-top: 12px; }
.vcol { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.vhead { display: flex; gap: 14px; align-items: center; }
.vhead b { font-size: 24px; }
.vsub { color: var(--muted); font-size: 19px; }
.vtag { font-family: var(--f-display); font-weight: 700; font-size: 22px; color: #fff; border-radius: 4px; padding: 1px 11px; background: var(--va); }
.vcol.b .vtag { background: var(--vb); }
.shot { border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); box-shadow: 0 8px 24px rgba(0,0,0,.08); max-width: 100%; }
.shot .screen { width: 760px; padding: 14px; transform-origin: 0 0; } /* not clipped: the callout numbers stick out on the left */
.shot .appbar { position: static; margin: -14px -14px 12px; border-radius: var(--r) var(--r) 0 0; }
.shot .appbar .wrap { max-width: none; padding-block: 8px; }
.shot .fields { grid-template-columns: repeat(4, minmax(0, 1fr)); } /* two rows of four, so the part that differs gets the room */
.shot .field { border-right: 1px solid var(--line); }
.shot .field:nth-child(4n) { border-right: 0; }
.shot .field:nth-last-child(-n+4) { border-bottom: 0; }
.shot .actions.decide { position: static; margin: 0; padding: 0; border: 0; box-shadow: none; background: none; }
.shot .ai-mini { display: none !important; }
/* Callouts: an outline on the element a note is about, and the note's number beside it (left, or right with .callout-right). */
.shot .callout { position: relative; outline: 3px solid var(--va); outline-offset: 4px; }
.vcol.b .shot .callout { outline-color: var(--vb); }
.shot [data-callout]::before { content: attr(data-callout); position: absolute; top: 50%; right: calc(100% + 12px); transform: translateY(-50%); z-index: 3;
  width: 30px; height: 30px; border-radius: 50%; background: var(--va); color: #fff; font: 700 17px/30px var(--f-display); letter-spacing: 0; text-transform: none; text-align: center; box-shadow: 0 0 0 3px var(--surface); }
.vcol.b .shot [data-callout]::before { background: var(--vb); }
.shot .callout-right::before { right: auto; left: calc(100% + 12px); }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: note; }
.notes li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 2px 14px; }
.notes li > * { grid-column: 2; }
.notes li::before { grid-row: span 2; content: ""; width: 12px; height: 12px; margin: 7px 11px; border-radius: 50%; background: var(--line); }
.notes li[data-target]::before { counter-increment: note; content: counter(note); width: 34px; height: 34px; margin: 0; color: #fff; background: var(--va); font: 700 19px/34px var(--f-display); text-align: center; }
.vcol.b .notes li[data-target]::before { background: var(--vb); }
.nhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.nhead b { font-size: 21px; line-height: 1.3; }
.notes p { font-size: 17.5px; color: var(--muted); line-height: 1.4; }
.tag { font-size: 14px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: 3px; padding: 1px 8px; }
.tag.risk { background: var(--bad-bg); color: var(--bad); }
.tag.help { background: var(--good-bg); color: var(--good); }
.tag.still { background: var(--warn-bg); color: var(--warn); }

/* Narrow screens: no canvas, everything stacks. */
@media (max-width: 899px) {
  .slide { padding: 20px 16px; }
  .slide h1 { font-size: 1.6rem; }
  .slide .sub { font-size: 1rem; }
  .slide .joingrid, .chartslide, .versus { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 0; }
  .joincode { font-size: clamp(2.4rem, 12vw, 4.2rem); }
  .joinlink { font-size: 1.3rem; }
  .joingrid .bigstat .num { font-size: 2.6rem; }
  .decktools .pager { display: none; }
}

.pastedialog { width: min(640px, calc(100vw - 32px)); padding: 0; color: var(--ink); }
.pastedialog::backdrop { background: rgba(0,0,0,.35); }
