/* 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;
    --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;
    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;
  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 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.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; }
}
.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; 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; }
.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; }
.joinlink { font-family: var(--f-mono); font-size: clamp(1.1rem, 3.2vw, 2rem); font-weight: 500; overflow-wrap: anywhere; }
.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; }
.chart .lab { fill: var(--ink); font-weight: 600; }
.legend { margin-bottom: 8px; display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.swatch { display: inline-block; width: 14px; height: 10px; border-radius: 2px; background: var(--accent); margin-right: 6px; vertical-align: 0; }
.swatch.b { opacity: .55; }
.joingrid { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 32px; align-items: center; padding: 24px; }
@media (max-width: 720px) { .joingrid { grid-template-columns: minmax(0, 1fr); } }
.qr { background: #fff; border-radius: var(--r); line-height: 0; }
.qr svg { width: 100%; height: auto; display: block; }
.joingrid .bigstat .num { font-size: 2.6rem; }
.joingrid .joinlink { font-size: clamp(1.1rem, 2.3vw, 1.7rem); }
.joincode { font-family: var(--f-mono); font-size: clamp(2.4rem, 7vw, 4.2rem); font-weight: 600; letter-spacing: .14em; line-height: 1.1; color: var(--accent); }
input[type=text].codeinput { font-family: var(--f-mono); font-size: 2rem; letter-spacing: .18em; text-transform: uppercase; text-align: center; }
