/* Val geleider CLAUDE versie – LineBuilder-huisstijl
   Werkbank: invoerkolom links, zijaanzicht en resultaten rechts; op smalle schermen gestapeld. */
:root {
  --ink: #13222a;
  --ink-2: #253a45;
  --paper: #f5f7f8;
  --panel: #ffffff;
  --zinc: #e9edef;
  --line: #d3dbdf;
  --line-soft: #e3e9ec;
  --muted: #5b6d76;
  --steel: #2a6a80;
  --steel-soft: #dcebf0;
  --crane: #f1b300;
  --crane-deep: #c98f00;
  --crane-soft: #fff4cf;
  --glass: #2f8a74;
  --glass-soft: #e1f2ec;
  --signal: #c2362b;
  --signal-soft: #fbe9e6;
  --cond: #13222a;
  --rope: #d7781f;
  --ghost: #93a3ab;
  --ground: #b9a88c;
  --gate-bg: #11212a;
  --gate-card: #192d38;
  --gate-line: #466473;
  --gate-fg: #e1ebef;
  --gate-input: #11212a;
  --gate-btn: #233d4a;
  --radius-s: 4px;
  --radius-m: 8px;
  --shadow: 0 1px 2px #13222a12, 0 6px 18px #13222a0a;
  --font: "Barlow", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Barlow Semi Condensed", "Barlow", "Arial Narrow", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-family: var(--font); font-size: 14px; font-weight: 500; line-height: 1.45; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; text-wrap: balance; }
img { max-width: 100%; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--steel); outline-offset: 2px; }
.badge { display: inline-block; vertical-align: middle; background: var(--crane); color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 0.42em; letter-spacing: 0.04em; padding: 0.15em 0.5em; border-radius: 3px; transform: translateY(-0.15em); }

/* ---------- toegang ---------- */
.gate { min-height: 100vh; background: var(--gate-bg); color: var(--gate-fg); display: flex; flex-direction: column; align-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
.gate-brand { align-self: flex-start; display: flex; align-items: center; gap: 10px; color: var(--gate-fg); text-decoration: none; font-weight: 700; font-size: 16px; }
.gate-brand img { border-radius: 6px; background: #fff; }
.gate-card { width: min(460px, 100%); margin-top: clamp(32px, 10vh, 110px); background: var(--gate-card); border: 1px solid var(--gate-line); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.gate-kicker { margin: 0; font-size: 12px; font-weight: 600; }
.gate-title { font-size: 36px; font-weight: 800; line-height: 1.05; }
.gate-lead { margin: 0; color: #a9bcc5; font-size: 13.5px; }
.gate-status { margin: 0; font-size: 13px; color: #a9bcc5; }
.gate-form { display: flex; flex-direction: column; gap: 12px; }
.gate .field span { color: #a9bcc5; }
.gate input { background: var(--gate-input); border: 1px solid var(--gate-line); color: var(--gate-fg); border-radius: 4px; padding: 9px 10px; font: inherit; width: 100%; }
.gate-button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; background: var(--gate-btn); border: 1px solid var(--gate-line); color: var(--gate-fg); border-radius: 4px; padding: 9px 14px; font-weight: 600; font-size: 13px; text-decoration: none; }
.gate-button:hover { border-color: var(--crane); }
.gate-button.ghost { background: transparent; }
.gate-button[disabled] { opacity: 0.6; cursor: progress; }
.gate-link { color: #8fb6c5; font-size: 12.5px; }
.gate-error, .gate-note { margin: 0; font-size: 13px; padding: 8px 10px; border-radius: 4px; }
.gate-error { background: #4a2420; color: #ffd7d2; }
.gate-note { background: #3d3412; color: #ffe8a3; }
.gate-msg { display: flex; flex-direction: column; gap: 12px; }
.gate-msg p { margin: 0; }
.gate-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.gate-foot { margin: 6px 0 0; font-size: 11.5px; color: #7f97a2; }
.gate-version { font-family: var(--font-mono); }

/* ---------- topbalk ---------- */
.app { min-height: 100vh; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand img { border-radius: 5px; }
.topbar-title { flex: 1 1 260px; min-width: 0; padding-left: 16px; border-left: 1px solid var(--line); }
.topbar-title h1 { font-size: 22px; font-weight: 800; line-height: 1.1; }
.topbar-title p { margin: 0; color: var(--muted); font-size: 12.5px; }
.topbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.user { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.status { font-family: var(--font-mono); font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.progress { width: 110px; height: 4px; background: var(--zinc); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--steel); transition: width .1s; }
.btn { background: var(--ink); color: #fff; border: 1px solid var(--ink); border-radius: var(--radius-s); padding: 7px 14px; font-weight: 600; font-size: 13px; }
.btn:hover { background: var(--ink-2); }
.btn.ghost { background: var(--panel); color: var(--ink); border-color: var(--line); font-weight: 600; }
.btn.ghost:hover { border-color: var(--steel); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--steel); font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; align-self: flex-start; }

/* ---------- indeling ---------- */
.layout { display: grid; grid-template-columns: minmax(290px, 350px) minmax(0, 1fr); gap: 18px; align-items: start; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }
@media (max-width: 920px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.panel { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 70px; max-height: calc(100vh - 82px); overflow: auto; padding-bottom: 8px; scrollbar-width: thin; }
@media (max-width: 920px) { .panel { position: static; max-height: none; overflow: visible; } }
.group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.group h2, .grouphead h2 { font-family: var(--font); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 700; }
.grouphead { display: flex; justify-content: space-between; align-items: baseline; }
.count { font-size: 12px; color: var(--muted); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--zinc); border-radius: var(--radius-s); padding: 3px; gap: 3px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { text-align: center; padding: 7px 4px; border-radius: 3px; font-size: 12.5px; line-height: 1.2; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg input:checked + label { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px #13222a1f; }
.seg input:focus-visible + label { outline: 2px solid var(--steel); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
input[type=number], input[type=text], select { width: 100%; font: inherit; font-size: 13.5px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 6px 8px; min-width: 0; }
input[type=number] { font-variant-numeric: tabular-nums; }
input[type=number]:focus, input[type=text]:focus, select:focus { border-color: var(--steel); background: var(--panel); }
.unitwrap { position: relative; }
.unitwrap input { padding-right: 44px; }
.unitwrap em { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 11px; color: var(--muted); pointer-events: none; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.check input { margin-top: 3px; accent-color: var(--steel); }
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.hint.mono { font-family: var(--font-mono); font-size: 11.5px; }
.props { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; font-size: 12px; background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius-s); padding: 8px 10px; margin: 0; }
.props:empty { display: none; }
.props div { display: flex; justify-content: space-between; gap: 6px; }
.props dt { color: var(--muted); }
.props dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.props .est { color: var(--crane-deep); }
.props .wide { grid-column: 1 / -1; }
details.adv > summary { cursor: pointer; font-size: 12.5px; color: var(--steel); list-style: none; font-weight: 600; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::before { content: "▸ "; }
details.adv[open] > summary::before { content: "▾ "; }
details.adv > div { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.protlist { display: flex; flex-direction: column; gap: 4px; }
.prot { display: flex; align-items: baseline; gap: 8px; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 6px 8px; color: var(--ink); }
.prot b { font-family: var(--font-display); font-size: 14px; }
.prot span { font-size: 12px; color: var(--muted); }
.prot.on { border-color: var(--steel); background: var(--steel-soft); }
.pfields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pfields .check, .pfields .full { grid-column: 1 / -1; }
.warnlist { display: flex; flex-direction: column; gap: 6px; }
.warnlist p { margin: 0; font-size: 12.5px; padding: 8px 10px; border-radius: var(--radius-s); background: var(--crane-soft); border-left: 3px solid var(--crane); }
.warnlist p.err { background: var(--signal-soft); border-left-color: var(--signal); }

/* ---------- hoofdkolom ---------- */
main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stage, .card, .chart, .tile, .assump { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); }
.stage { overflow: hidden; }
.stagehead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.stagehead h2 { font-size: 17px; font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 18px; height: 0; border-top: 3px solid; }
.legend i.lg-cond { border-top-color: var(--cond); }
.legend i.lg-rope { border-top-color: var(--rope); }
.legend i.lg-ghost { border-top-color: var(--ghost); border-top-style: dashed; }
.legend i.lg-trail { border-top-color: var(--steel); border-top-style: dotted; }
.canvaswrap { position: relative; height: clamp(300px, 46vh, 520px); }
@media (max-width: 600px) { .canvaswrap { height: 300px; } }
.canvaswrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--paper); }
.controls .tbtn { background: var(--panel); border: 1px solid var(--line); color: var(--ink); border-radius: var(--radius-s); padding: 5px 10px; font-size: 12.5px; font-weight: 600; }
.controls .tbtn.primary { background: var(--ink); color: #fff; border-color: var(--ink); min-width: 76px; }
.controls input[type=range] { flex: 1 1 200px; accent-color: var(--steel); min-width: 0; }
.controls select { width: auto; font-size: 12.5px; padding: 4px 6px; background: var(--panel); }
.tlabel { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; min-width: 74px; }

.verdict { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--panel); }
.verdict strong { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.verdict p { margin: 0; color: var(--ink-2); font-size: 13px; }
.verdict .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--muted); }
.verdict.ok { background: var(--glass-soft); border-color: transparent; } .verdict.ok .dot { background: var(--glass); }
.verdict.warn { background: var(--crane-soft); border-color: transparent; } .verdict.warn .dot { background: var(--crane); }
.verdict.bad { background: var(--signal-soft); border-color: transparent; } .verdict.bad .dot { background: var(--signal); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.tile { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile h3 { font-family: var(--font); font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.tile .v { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .v small { font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.tile .s { font-size: 12px; color: var(--muted); }
.meter { height: 6px; background: var(--zinc); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.meter i { display: block; height: 100%; width: 0; background: var(--glass); }
.chip { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.03em; padding: 2px 8px; border-radius: 999px; background: var(--zinc); color: var(--muted); align-self: flex-start; white-space: nowrap; }
.chip.ok { background: var(--glass-soft); color: var(--glass); } .chip.warn { background: var(--crane-soft); color: var(--crane-deep); } .chip.bad { background: var(--signal-soft); color: var(--signal); }

.card { padding: 12px 14px; min-width: 0; }
.card h2 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-weight: 700; color: var(--muted); font-size: 12px; white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .f { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
td .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.chart { padding: 10px 12px 6px; min-width: 0; }
.chart h3 { font-family: var(--font); font-size: 13px; font-weight: 700; }
.chart p { margin: 0 0 4px; font-size: 11.5px; color: var(--muted); }
.chart canvas { width: 100%; height: 170px; display: block; cursor: crosshair; touch-action: none; }
.cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; }
@media (max-width: 760px) { .cols { grid-template-columns: minmax(0, 1fr); } }
ol.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
ol.timeline li { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
ol.timeline li:last-child { border-bottom: 0; }
ol.timeline time { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); }
ol.timeline button { background: none; border: 0; padding: 0; text-align: left; color: var(--ink); }
ol.timeline button:hover { color: var(--steel); }
.assump { padding: 12px 14px; }
.assump summary { cursor: pointer; font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.assump ul { margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; max-width: 82ch; font-size: 13px; }
.foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.footnote { font-size: 11.5px; }
@media (prefers-reduced-motion: reduce) { .progress i { transition: none; } }
@media (max-width: 520px) { .topbar-title { border-left: 0; padding-left: 0; } .row3 { grid-template-columns: 1fr 1fr; } .pfields { grid-template-columns: 1fr 1fr; } }
