/* Modelleur (teaser 2) — aanvulling op style.css, zelfde huisstijl */

body.page-mod { overflow: hidden; }

.mod {
  position: fixed; inset: var(--topbar-h) 0 0 0;
  display: grid; grid-template-columns: 340px minmax(0, 1fr) 380px;
}
.mod-col { overflow-y: auto; background: #fff; overscroll-behavior: contain; min-height: 0; }
.mod-links { border-right: 1px solid var(--line); }
.mod-rechts { border-left: 1px solid var(--line); }

.mod-stage { position: relative; background: #eef1f2; min-width: 0; min-height: 0; }
.mod-viewer { position: absolute; inset: 0; }

/* ---------- Secties ---------- */
.mod-sec { padding: 14px 16px 16px; border-bottom: 1px solid var(--line); }
.mod-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.mod-sec-head .eyebrow { margin: 0; }
.mod-sec h3 { margin: 0 0 6px; font-size: 14px; }
.mod-note { margin: 4px 0 8px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.mod-note code, .mod-hint code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; background: var(--soft); padding: 0 4px; border-radius: 2px; }

/* ---------- Modelbalk ---------- */
.mod-modelbar { display: grid; gap: 8px; }
.mod-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mod-row > .grow { flex: 1; min-width: 0; }
.mod-in, .mod-sel {
  width: 100%; font: inherit; font-size: 13px; padding: 6px 8px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-btn); background: #fff; color: var(--ink);
}
.mod-in:focus, .mod-sel:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--brand); }
.mod-in.is-err { border-color: var(--brand); background: var(--soft-red); }
.mod-in.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.mod-btn { padding: 5px 9px; font-size: 12.5px; }

/* ---------- Parameters ---------- */
.mod-param { padding: 8px 0 9px; border-bottom: 1px solid var(--line); }
.mod-param:last-of-type { border-bottom: 0; }
.mod-param-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.mod-param-head label { font-size: 12.5px; font-weight: 600; }
.mod-param-head code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: var(--muted); }
.mod-param-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.mod-val { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; min-width: 54px; text-align: right; }
.mod-val.is-err, .mod-err { color: var(--brand-dark); font-weight: 600; }
.mod-err { font-size: 11.5px; margin: 3px 0 0; }
.mod input[type="range"] { width: 100%; accent-color: var(--brand); margin: 6px 0 0; }
.mod-more { margin-top: 4px; font-size: 12px; }
.mod-more summary { cursor: pointer; color: var(--muted); }
.mod-more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.mod-more-grid .wide { grid-column: 1 / -1; }
.mod-more-grid label { display: grid; gap: 2px; font-size: 11px; color: var(--muted); }

.mod-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; margin-top: 8px; }

/* ---------- Beperkingen ---------- */
.mod-cons { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.mod-cons .tick { width: 18px; text-align: center; font-weight: 700; color: #2f8f4e; }
.mod-cons .tick.bad { color: var(--brand); }
.mod-cons-msg { grid-column: 2 / -1; margin-top: -2px; }

/* ---------- Onderdelen ---------- */
.mod-tree { display: grid; gap: 2px; }
.mod-tree h4 { margin: 10px 0 2px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--eyebrow); }
.mod-tree h4:first-child { margin-top: 0; }
.mod-node {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 1px solid transparent; background: none; padding: 6px 8px; border-radius: var(--radius-btn); font-size: 13px;
}
.mod-node:hover { background: var(--soft); }
.mod-node.is-sel { background: var(--soft-red); border-color: var(--focus); }
.mod-node .ic { width: 16px; flex: none; text-align: center; color: var(--muted); }
.mod-node .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod-node small { color: var(--muted); font-size: 11.5px; }
.mod-node .warn { color: #c77700; font-weight: 700; }
.mod-node .warn.fout { color: var(--brand); }
.mod-tree-add { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Eigenschappen ---------- */
.mod-field { display: grid; gap: 3px; margin-bottom: 9px; }
.mod-field > span.lbl { font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.mod-field .inl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.mod-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mod-hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 0; }
.mod-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* ---------- Aanzicht (SVG) ---------- */
.mod-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.mod-tabs button {
  border: 1px solid var(--line); background: #fff; padding: 4px 10px; font-size: 12.5px; border-radius: var(--radius-btn);
}
.mod-tabs button.is-on { border-color: var(--brand); background: var(--soft-red); font-weight: 600; }
.mod-svg { width: 100%; display: block; background: var(--panel-soft); border: 1px solid var(--line); border-radius: var(--radius); touch-action: none; user-select: none; }
.mod-svg .wand { fill: #fff; stroke: #9a9a9e; stroke-width: .02; }
.mod-svg .band-tr { fill: #d9d9dc; }
.mod-svg .band-rl { fill: #ececee; }
.mod-svg .grid { stroke: #e3e3e6; stroke-width: .01; }
.mod-svg .open { fill: #cfe0e8; stroke: #55595a; stroke-width: .03; cursor: grab; }
.mod-svg .open.deur { fill: #d9c3a3; }
.mod-svg .open.is-sel { fill: #f7b6c8; stroke: var(--brand); stroke-width: .05; }
.mod-svg .open.uit { opacity: .35; stroke-dasharray: .08; }
.mod-svg .bw { stroke: #55595a; stroke-width: .1; stroke-linecap: round; cursor: pointer; }
.mod-svg .bw.is-sel { stroke: var(--brand); }
.mod-svg .eind { fill: #fff; stroke: var(--brand); stroke-width: .04; cursor: grab; }
.mod-svg text { font-size: .32px; fill: var(--muted); font-family: var(--font); pointer-events: none; }
.mod-svg-cap { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); }

/* ---------- Overlay op de 3D ---------- */
.mod-maten { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.mod-dim {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  background: #fff; color: var(--brand-dark); border: 1px solid var(--brand);
  border-radius: 2px; padding: 1px 6px; font-size: 11.5px; font-weight: 700;
}
.mod-views {
  position: absolute; top: 12px; left: 12px; display: flex; gap: 4px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-btn); padding: 3px;
  box-shadow: 0 4px 16px rgba(41, 41, 44, .10);
}
.mod-views button { border: 0; background: none; padding: 5px 10px; font-size: 12.5px; border-radius: 2px; }
.mod-views button:hover { background: var(--soft); }
.mod-views button.is-on { background: var(--ink); color: #fff; }
.mod-check { display: flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 0 8px 0 10px; border-left: 1px solid var(--line); margin-left: 4px; }
.mod-check input { accent-color: var(--brand); }

.mod-meldingen {
  position: absolute; left: 12px; right: 12px; bottom: 12px; max-width: 560px;
  background: #fff; border: 1px solid var(--line); border-left: 4px solid #2f8f4e;
  border-radius: var(--radius); box-shadow: 0 4px 16px rgba(41, 41, 44, .12); font-size: 12.5px;
}
.mod-meldingen.heeft-waarschuwing { border-left-color: #e08a00; }
.mod-meldingen.heeft-fout { border-left-color: var(--brand); }
.mod-meldingen summary { padding: 8px 12px; cursor: pointer; font-weight: 600; }
.mod-meldingen ul { list-style: none; margin: 0; padding: 0 12px 8px; max-height: 190px; overflow-y: auto; display: grid; gap: 4px; }
.mod-meldingen li { display: flex; gap: 8px; align-items: baseline; }
.mod-meldingen li button { border: 0; background: none; padding: 0; text-align: left; font-size: 12.5px; color: var(--ink); cursor: pointer; text-decoration: underline dotted; }
.mod-meldingen .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.mod-meldingen .dot.fout { background: var(--brand); }
.mod-meldingen .dot.waarschuwing { background: #e08a00; }

/* ---------- Mobiel: 3D bovenaan en blijft staan, rest eronder ---------- */
@media (max-width: 1100px) {
  body.page-mod { overflow: auto; }
  .mod { position: static; display: flex; flex-direction: column; padding-top: var(--topbar-h); }
  .mod-stage { order: -1; height: 46vh; position: sticky; top: var(--topbar-h); z-index: 3; border-bottom: 1px solid var(--line); }
  .mod-col { overflow: visible; border: 0; border-top: 1px solid var(--line); }
  #open-config, .topbar .badge, .topbar .divider { display: none; }
  #publiceer { white-space: nowrap; padding: 8px 12px; font-size: 13px; }
  .mod-meldingen { max-width: none; }
  .mod-views { right: 12px; flex-wrap: wrap; }
}

/* ---------- Gevelrichtlijn ---------- */
.mod-opties { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 8px; font-size: 12.5px; }
.mod-opties .mod-btn { margin-left: auto; }
.mod-svg .zone { pointer-events: none; }
.mod-svg .zone.toegestaan { stroke: #9a9a9e; stroke-width: .02; fill-opacity: 1; }
.mod-svg .zone.optie { stroke: #e30613; stroke-width: .02; }
.mod-svg .zone.vast { stroke: var(--brand); stroke-width: .03; stroke-dasharray: .12 .08; }
.mod-svg .zone-t { font-size: .26px; fill: #55595a; }

/* ---------- Vaste waarden (beukmaten) ---------- */
.mod-keuzes { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.mod-keuze { font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 9px; border: 1px solid var(--line); border-radius: 2px; background: #fff; color: var(--ink, #1a1a1a); cursor: pointer; }
.mod-keuze:hover { border-color: var(--brand); }
.mod-keuze.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.mod-keuze:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Pop-up: kozijn in rood vlak ---------- */
.mod-pop { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(20, 20, 22, .45); padding: 16px; }
.mod-pop-box { background: #fff; border-top: 3px solid var(--brand); border-radius: 2px; max-width: 440px; width: 100%; padding: 18px 20px 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); font-size: 13.5px; line-height: 1.45; }
.mod-pop-box h3 { margin: 2px 0 8px; font-size: 16px; }
.mod-pop-box p { margin: 6px 0; }
.mod-pop-box ul { margin: 6px 0 8px; padding-left: 18px; }
.mod-pop-acties { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* Kozijnbibliotheek */
.mod-bibknop { margin-top: 6px; }
.mod-bibkaart { border: 1px solid var(--line, #d9d9d9); border-left: 3px solid var(--brand); padding: 8px 10px; margin: 6px 0; background: #fafafa; }
.mod-bibkaart-kop { display: flex; gap: 10px; align-items: center; }
.mod-bibkaart-kop small { display: block; color: #666; }
.mod-bibmerk { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; background: var(--brand); color: #fff; font-weight: 700; }
.mod-check { display: flex; gap: 6px; align-items: center; font-size: 13px; margin: 6px 0; }
.mod-bibbox { max-width: 760px; max-height: 88vh; display: flex; flex-direction: column; }
.mod-bibfilter { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.mod-bibfilter .mod-in { flex: 1 1 200px; }
.mod-bibchips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.mod-chip { border: 1px solid #c8c8c8; background: #fff; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; cursor: pointer; }
.mod-chip.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.mod-biblijst { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; overflow: auto; min-height: 120px; padding: 2px; }
.mod-bibtegel { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; border: 1px solid #d0d0d0; background: #fff; padding: 8px 6px; cursor: pointer; font: inherit; }
.mod-bibtegel:hover { border-color: var(--brand); }
.mod-bibtegel.is-sel { outline: 2px solid var(--brand); }
.mod-bibtegel.is-uit { opacity: .45; cursor: not-allowed; }
.mod-bibtegel small { color: #666; }
