:root {
  --bg: #0a1424;
  --bg-mid: #112340;
  --bg-light: #1a3458;
  --line: #2a4a78;
  --line-soft: rgba(42,74,120,0.4);
  --text: #e7eef8;
  --muted: #9bb0cf;
  --gold: #f0c419;
  --gold-soft: rgba(240,196,25,0.12);
  --green: #2ecc71;
  --red: #e74c3c;
  --blue: #1d9bf0;
  --purple: #7c5fa8;
  --orange: #e67e22;
  /* layer colors (matches archimate-ish but dark) */
  --c-external: #5b6f8c;
  --c-application: #2978c2;
  --c-data: #2e8e57;
  --c-technology: #7c4dc4;
  --c-business: #c4a534;
  --c-capability: #d68b3a;
  --c-value: #999;
}
* { margin:0; padding:0; box-sizing:border-box; }
html, body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; height: 100%; overflow: hidden; -webkit-font-smoothing: antialiased; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== TOP-BAR ===== */
.top {
  display: flex; align-items: center; gap: 1rem; padding: 0.5rem 1rem;
  background: linear-gradient(180deg, #060e1a, #0a1424);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.top .brand { font-weight: 700; color: var(--gold); }
.top .brand .ver { color: var(--muted); font-weight: 400; font-size: 0.78rem; margin-left: 0.4rem; }
.spacer { flex: 1; }
.fase-tabs, .view-tabs { display: flex; gap: 4px; }
.fase-tabs button, .view-tabs button {
  background: var(--bg-mid); border: 1px solid var(--line); color: var(--muted);
  padding: 0.4rem 0.8rem; border-radius: 6px; cursor: pointer; font-size: 0.82rem; font-weight: 600;
  transition: 0.15s;
}
.fase-tabs button.active, .view-tabs button.active { background: var(--gold); color: #0a1424; border-color: var(--gold); }
.fase-tabs button:hover:not(.active), .view-tabs button:hover:not(.active) { color: var(--text); border-color: var(--gold); }

/* ===== 3-PANEL GRID ===== */
.grid3 {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  height: calc(100vh - 50px);
  overflow: hidden;
}
.ctrl { background: var(--bg-mid); border-right: 1px solid var(--line); overflow-y: auto; padding: 0.75rem; }
.canvas-wrap { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.canvas-header { padding: 0.6rem 1rem; border-bottom: 1px solid var(--line-soft); }
.canvas-header h2 { font-size: 1.05rem; color: var(--gold); }
.canvas-header .pitch { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; line-height: 1.4; max-width: 900px; }
.canvas { flex: 1; overflow: auto; padding: 1rem; }
.detail { background: var(--bg-mid); border-left: 1px solid var(--line); overflow-y: auto; padding: 0.75rem; }

/* ===== CONTROLS ===== */
.ctrl-block { margin-bottom: 1.1rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--line-soft); }
.ctrl-block:last-child { border-bottom: none; }
.ctrl-block h3 { font-size: 0.78rem; color: var(--gold); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; }
.ctrl-block label.t {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.85rem; padding: 0.3rem 0; cursor: pointer; color: var(--text);
}
.ctrl-block label.t input { accent-color: var(--gold); }
.ctrl-block .row { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.ctrl-block .row button, .step-walk {
  background: var(--bg-light); border: 1px solid var(--line); color: var(--text);
  padding: 0.4rem 0.7rem; border-radius: 5px; cursor: pointer; font-size: 0.82rem;
}
.ctrl-block .row button:hover, .step-walk:hover { border-color: var(--gold); color: var(--gold); }
.step-walk { width: 100%; margin-top: 0.6rem; }
#journey-select {
  width: 100%; background: var(--bg-light); border: 1px solid var(--line); color: var(--text);
  padding: 0.4rem; border-radius: 5px; font-size: 0.82rem;
}
.links { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.82rem; }
#legend .leg { display: flex; align-items: center; gap: 0.5rem; padding: 0.2rem 0; font-size: 0.78rem; }
#legend .sw { width: 14px; height: 14px; border-radius: 3px; border: 2px solid; }

/* ===== SVG / CANVAS ===== */
svg.diagram { display: block; max-width: 100%; height: auto; min-width: 100%; }
svg.diagram .laag-band { fill: rgba(26,52,88,0.4); stroke: var(--line-soft); stroke-dasharray: 4 4; }
svg.diagram .laag-band-label { font-size: 12px; fill: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

svg.diagram .comp {
  fill: var(--bg-light); stroke: var(--line); stroke-width: 1.5;
  cursor: pointer; transition: 0.15s;
}
svg.diagram .comp.laag-external { fill: #1a2a3e; stroke: var(--c-external); }
svg.diagram .comp.laag-application { fill: #142b48; stroke: var(--c-application); }
svg.diagram .comp.laag-data { fill: #143828; stroke: var(--c-data); }
svg.diagram .comp.laag-technology { fill: #2a1d40; stroke: var(--c-technology); }
svg.diagram .comp.laag-business { fill: #3a2f10; stroke: var(--c-business); }
svg.diagram .comp.laag-capability { fill: #3a2510; stroke: var(--c-capability); }
svg.diagram .comp.laag-value_stream { fill: #1a1a1a; stroke: var(--c-value); }
svg.diagram .comp:hover { stroke-width: 3; filter: brightness(1.3); }
svg.diagram .comp.nieuw { stroke: var(--green); stroke-width: 2.5; }
svg.diagram .comp.agent { stroke-dasharray: 5 3; }
svg.diagram .comp.dimmed { opacity: 0.15; }
svg.diagram .comp.path-on-journey { stroke: var(--gold); stroke-width: 3; filter: drop-shadow(0 0 6px rgba(240,196,25,0.6)); }

svg.diagram .comp-label { font-size: 12px; fill: var(--text); font-weight: 600; pointer-events: none; text-anchor: middle; }
svg.diagram .comp-sub { font-size: 10px; fill: var(--muted); pointer-events: none; text-anchor: middle; }
svg.diagram .sub-bg { fill: rgba(255,255,255,0.04); stroke: var(--muted); stroke-dasharray: 2 2; stroke-width: 0.7; }

svg.diagram .pijl { stroke: #7090b8; stroke-width: 1.4; fill: none; cursor: pointer; transition: 0.15s; }
svg.diagram .pijl.dashed { stroke-dasharray: 6 4; }
svg.diagram .pijl:hover { stroke: var(--gold); stroke-width: 2.5; }
svg.diagram .pijl.dimmed { opacity: 0.1; }
svg.diagram .pijl-label { font-size: 10px; fill: var(--muted); pointer-events: none; }

/* Maturity overlay - balkjes
   Let op: .mat-asis krijgt GEEN vaste fill meer — JS bepaalt kleur o.b.v.
   instelbare drempels (zie getMaturityColor in renderer.js).
   .mat-bg en .mat-tobe blijven CSS-gestuurd (achtergrond + to-be-marker). */
svg.diagram .mat-bg { fill: rgba(0,0,0,0.5); }
svg.diagram .mat-asis { /* fill via inline-attribuut */ }
svg.diagram .mat-tobe { fill: rgba(46,204,113,0.85); }
svg.diagram .mat-label { font-size: 9px; fill: var(--text); pointer-events: none; }
svg.diagram .overlay-maturity { pointer-events: none; }
svg.diagram .mat-label-pct { paint-order: stroke; stroke: rgba(10,20,36,0.85); stroke-width: 2.5; }

/* Capacity overlay — eigen kleur-palette (Blauw/Paars/Teal) */
svg.diagram .cap-bg { fill: rgba(0,0,0,0.5); }
svg.diagram .cap-asis { /* fill via inline-attribuut */ }
svg.diagram .cap-tobe { fill: rgba(26,188,156,0.85); }
svg.diagram .overlay-capacity { pointer-events: none; }
svg.diagram .cap-label-pct { paint-order: stroke; stroke: rgba(10,20,36,0.85); stroke-width: 2.5; }
.detail .det-card .mat-fill { /* maturity fill — was: blue */ background: var(--blue); }
.detail .det-card .cap-fill { height: 100%; background: #9b59b6; }
.detail .det-card .cap-fill.tobe { background: #1abc9c; }

/* Threshold-sectie in ctrl-panel */
.thr-grid { display: flex; flex-direction: column; gap: 0.35rem; }
.thr-row {
  display: grid; grid-template-columns: 1fr 56px 32px; gap: 0.35rem;
  align-items: center; font-size: 0.82rem; color: var(--text);
}
.thr-row span:first-child { color: var(--muted); }
.thr-row input[type="number"] {
  background: var(--bg-light); color: var(--text);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 0.2rem 0.3rem; font-size: 0.82rem; width: 100%;
}
.thr-row input[type="color"] {
  width: 32px; height: 24px; padding: 0; border: 1px solid var(--line);
  border-radius: 4px; background: transparent; cursor: pointer;
}
.thr-mid-spacer { display: block; }
.thr-legend { display: flex; gap: 4px; margin-top: 0.45rem; }
.thr-legend .thr-band {
  flex: 1; text-align: center; font-size: 0.7rem; font-weight: 700;
  padding: 3px 0; border-radius: 4px; color: #0a1424;
  text-shadow: 0 0 2px rgba(255,255,255,0.4);
}
.thr-hint { font-size: 0.72rem; color: var(--muted); margin-top: 0.4rem; line-height: 1.4; font-style: italic; }

/* Capability frame */
svg.diagram .cap-frame {
  fill: none; stroke-width: 2; stroke-dasharray: 8 5;
  opacity: 0.55; pointer-events: none;
}
svg.diagram .cap-label {
  font-size: 11px; font-weight: 700; pointer-events: none;
}

/* Journey path & dot */
svg.diagram .journey-path { fill: none; stroke-width: 4; opacity: 0.45; stroke-linejoin: round; }
svg.diagram .journey-dot { filter: drop-shadow(0 0 8px currentColor); }

/* ===== DETAIL-PANE ===== */
.detail .empty { color: var(--muted); }
.detail .empty h3 { color: var(--gold); font-size: 0.95rem; margin-bottom: 0.5rem; }
.detail .empty p { font-size: 0.85rem; line-height: 1.5; margin-bottom: 0.5rem; }
.detail .det-card h3 { color: var(--gold); font-size: 1rem; margin-bottom: 0.3rem; }
.detail .det-card .ttype { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.detail .det-card .badge {
  display: inline-block; font-size: 0.7rem; padding: 1px 8px; border-radius: 99px;
  background: var(--gold); color: #0a1424; font-weight: 700; margin-left: 0.4rem;
}
.detail .det-card section { margin-top: 0.8rem; padding-top: 0.5rem; border-top: 1px solid var(--line-soft); }
.detail .det-card section h4 { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; margin-bottom: 0.3rem; }
.detail .det-card section p, .detail .det-card section ul { font-size: 0.85rem; line-height: 1.5; }
.detail .det-card section ul { list-style: none; padding: 0; }
.detail .det-card section ul li { padding: 0.15rem 0; }
.detail .det-card section ul li:before { content: "→ "; color: var(--gold); }
.detail .det-card .mat-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.3rem 0; font-size: 0.85rem; }
.detail .det-card .mat-bar { flex: 1; height: 8px; background: var(--bg-light); border-radius: 4px; overflow: hidden; }
.detail .det-card .mat-fill { height: 100%; background: var(--blue); }
.detail .det-card .mat-fill.tobe { background: var(--green); }
.detail .det-card .ttoelichting { font-style: italic; color: var(--muted); font-size: 0.82rem; }

/* ===== CUSTOMER + TRANSACTION JOURNEY VIEWS ===== */
.empty-msg { padding: 2rem; color: var(--muted); font-style: italic; }
.cust-wrap, .tx-wrap { display: flex; flex-direction: column; gap: 0.8rem; }
.cust-meta {
  background: var(--bg-mid); padding: 0.6rem 0.8rem; border-radius: 6px;
  border: 1px solid var(--line-soft); font-size: 0.85rem; color: var(--text);
}
.cust-meta em { color: var(--gold); }
.cust-newbox {
  margin-top: 0.4rem; padding: 0.4rem 0.6rem; border-radius: 4px;
  background: rgba(46,204,113,0.1); border-left: 3px solid var(--green);
  font-size: 0.8rem; color: var(--text);
}
.cust-newbox strong { color: var(--green); }

/* Stappenrail (horizontaal scroll) */
.cust-rail { display: flex; gap: 0.6rem; overflow-x: auto; padding-bottom: 0.4rem; }
.cust-step {
  flex: 0 0 200px; background: var(--bg-mid); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.6rem; cursor: pointer; transition: 0.15s;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.cust-step:hover { border-color: var(--gold); transform: translateY(-2px); }
.cust-step.flag-pijn { border-left: 4px solid var(--red); }
.cust-step.flag-waarde { border-left: 4px solid var(--green); }
.cust-step-head {
  display: flex; align-items: center; justify-content: space-between;
}
.cust-step-num {
  background: var(--gold); color: #0a1424; font-weight: 700;
  width: 22px; height: 22px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 0.8rem;
}
.cust-step-touch { font-size: 0.85rem; color: var(--text); font-weight: 600; line-height: 1.3; }
.cust-step-klant { font-size: 0.78rem; color: var(--muted); line-height: 1.3; }
.cust-step-pijn { font-size: 0.78rem; color: var(--red); line-height: 1.3; }
.cust-step .lbl { color: var(--gold); font-weight: 600; }

/* Emotie-pill (legend + step-head) */
.emo-pill {
  display: inline-block; font-size: 1.1rem; line-height: 1;
  padding: 2px 6px; background: rgba(0,0,0,0.25); border-radius: 12px;
  margin-right: 0.3rem;
}
.emo-pill.emo-zeer-pos { box-shadow: 0 0 0 1.5px var(--green); }
.emo-pill.emo-pos { box-shadow: 0 0 0 1.5px #6ed28b; }
.emo-pill.emo-neu { box-shadow: 0 0 0 1.5px var(--muted); }
.emo-pill.emo-licht-neg { box-shadow: 0 0 0 1.5px var(--orange); }
.emo-pill.emo-neg { box-shadow: 0 0 0 1.5px var(--red); }

/* Emotie-curve onder rail */
.cust-curve { background: var(--bg-mid); border: 1px solid var(--line-soft); border-radius: 6px; padding: 0.4rem; }

/* Transaction-tabel */
.tx-table {
  width: 100%; border-collapse: collapse; font-size: 0.84rem;
  background: var(--bg-mid); border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
}
.tx-table thead {
  background: linear-gradient(180deg, #0a1424, #112340);
}
.tx-table th {
  text-align: left; padding: 0.6rem 0.5rem; font-size: 0.74rem;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--gold);
  border-bottom: 1px solid var(--gold-soft);
}
.tx-table td {
  padding: 0.55rem 0.5rem; vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
}
.tx-table tbody tr { cursor: pointer; transition: 0.1s; }
.tx-table tbody tr:hover { background: rgba(240,196,25,0.08); }
.tx-col-id { width: 70px; }
.tx-id {
  display: inline-block; padding: 2px 8px; background: var(--bg-light);
  border-radius: 4px; font-weight: 700; color: var(--gold);
  font-family: monospace; font-size: 0.82rem;
}
.tx-col-actor { width: 90px; }
.tx-col-actie { min-width: 180px; }
.tx-col-io { min-width: 240px; font-size: 0.8rem; }
.tx-in, .tx-out { color: var(--text); }
.tx-arrow { color: var(--gold); margin: 0 0.4rem; font-weight: 700; }
.tx-col-sop code {
  background: var(--bg-light); padding: 2px 6px; border-radius: 4px;
  font-size: 0.78rem; color: var(--muted);
}

/* Actor-pills (transaction-tabel + legend) */
.actor-pill {
  display: inline-block; padding: 2px 10px; border-radius: 99px;
  font-size: 0.76rem; font-weight: 700; color: #0a1424;
  text-transform: capitalize;
}
.actor-pill.actor-klant   { background: #5b6f8c; color: #fff; }
.actor-pill.actor-junior  { background: #1d9bf0; color: #fff; }
.actor-pill.actor-senior  { background: #2978c2; color: #fff; }
.actor-pill.actor-gerben  { background: var(--gold); color: #0a1424; }
.actor-pill.actor-owner   { background: #2ecc71; color: #0a1424; }
.actor-pill.actor-agent   { background: var(--purple); color: #fff; }
.actor-pill.actor-default { background: var(--bg-light); color: var(--muted); border: 1px solid var(--line); }

/* ===== GOVERNANCE VIEW (3 kolommen) ===== */
.gov-wrap { display: flex; flex-direction: column; gap: 0.8rem; }
.gov-intro {
  margin-top: 0.4rem; font-size: 0.78rem; color: var(--muted);
  line-height: 1.45; font-style: italic;
}
.gov-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem;
  align-items: start;
}
.gov-col {
  background: var(--bg-mid); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.6rem; display: flex; flex-direction: column; gap: 0.4rem;
  border-top: 4px solid var(--line);
}
.gov-col.gov-data  { border-top-color: #1d9bf0; }
.gov-col.gov-ai    { border-top-color: var(--purple); }
.gov-col.gov-human { border-top-color: var(--c-business); }

.gov-col-head {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 0.5rem;
  align-items: center; padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line-soft);
}
.gov-ico { font-size: 1.4rem; line-height: 1; }
.gov-col-title { font-size: 0.92rem; font-weight: 700; color: var(--gold); }
.gov-col-sub { font-size: 0.72rem; color: var(--muted); line-height: 1.3; }
.gov-count {
  background: var(--bg-light); color: var(--gold); font-weight: 700;
  padding: 2px 8px; border-radius: 99px; font-size: 0.78rem;
}
.gov-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.gov-item {
  background: var(--bg-light); padding: 0.45rem 0.55rem; border-radius: 5px;
  font-size: 0.82rem; line-height: 1.4; cursor: pointer; transition: 0.12s;
  border-left: 3px solid transparent; color: var(--text);
}
.gov-item:hover { border-left-color: var(--gold); background: rgba(240,196,25,0.08); }
.gov-item-sub { margin-left: 1.1rem; font-style: italic; font-size: 0.78rem; color: var(--muted); }
.gov-item-empty { font-style: italic; color: var(--muted); cursor: default; }
.gov-item-empty:hover { border-left-color: transparent; background: var(--bg-light); }

.gov-col.gov-data  .gov-item:hover { border-left-color: #1d9bf0; }
.gov-col.gov-ai    .gov-item:hover { border-left-color: var(--purple); }
.gov-col.gov-human .gov-item:hover { border-left-color: var(--c-business); }

/* ===== BEPERKINGEN + RISICO'S VIEW ===== */
.lim-wrap { display: flex; flex-direction: column; gap: 0.8rem; }
.lim-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 0.8rem; align-items: start; }
.lim-col {
  background: var(--bg-mid); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.6rem; display: flex; flex-direction: column; gap: 0.4rem;
  border-top: 4px solid var(--line);
}
.lim-col.lim-bep { border-top-color: var(--red); }
.lim-col.lim-ris { border-top-color: var(--orange); }
.lim-item-bep { border-left: 3px solid var(--red); }
.lim-item-bep:hover { background: rgba(231,76,60,0.12); border-left-color: var(--red); }

.lim-ris-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.lim-risk-card {
  background: var(--bg-light); border-radius: 6px; padding: 0.5rem;
  border-left: 3px solid var(--orange); cursor: pointer; transition: 0.12s;
  display: flex; flex-direction: column; gap: 0.35rem;
}
.lim-risk-card:hover { background: rgba(230,126,34,0.12); }
.lim-risk-head { display: flex; gap: 0.5rem; align-items: flex-start; }
.lim-risk-num {
  background: var(--orange); color: #0a1424; font-weight: 700;
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 0.78rem;
}
.lim-risk-text { font-size: 0.85rem; color: var(--text); font-weight: 600; line-height: 1.35; }
.lim-mit {
  display: flex; gap: 0.5rem; padding: 0.35rem 0.4rem 0.35rem 1.7rem;
  background: rgba(46,204,113,0.08); border-radius: 4px;
  border-left: 2px solid var(--green);
}
.lim-mit-arrow { color: var(--green); font-weight: 700; }
.lim-mit-text { font-size: 0.82rem; color: var(--text); line-height: 1.35; }

/* ===== DATA GOVERNANCE VIEW ===== */
.dg-wrap { display: flex; flex-direction: column; gap: 0.8rem; }

/* Form */
.dg-form { background: var(--bg-mid); border: 1px solid var(--line); border-radius: 8px; padding: 0.7rem; display: flex; flex-direction: column; gap: 0.6rem; }
.dg-form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.dg-field { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: var(--text); }
.dg-field span { color: var(--gold); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.dg-field select, .dg-field input {
  background: var(--bg-light); color: var(--text); border: 1px solid var(--line);
  border-radius: 5px; padding: 0.4rem 0.5rem; font-size: 0.85rem;
}
.dg-field select:focus, .dg-field input:focus { outline: none; border-color: var(--gold); }
.dg-form-actions { display: flex; gap: 0.5rem; align-items: center; }
.dg-btn-ask {
  flex: 1; background: var(--gold); color: #0a1424; font-weight: 700;
  border: none; padding: 0.6rem 0.8rem; border-radius: 6px; cursor: pointer;
  font-size: 0.92rem; transition: 0.15s;
}
.dg-btn-ask:hover { background: #ffd838; box-shadow: 0 0 12px rgba(240,196,25,0.5); }

/* Scene */
.dg-scene { background: var(--bg-mid); border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem; }
.dg-svg { display: block; width: 100%; height: auto; max-height: 280px; }

/* Policy grid */
.dg-policy { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.dg-pol-col {
  background: var(--bg-mid); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.6rem; border-top: 4px solid var(--line);
  display: flex; flex-direction: column; gap: 0.4rem;
}
.dg-pol-intern { border-top-color: var(--blue); }
.dg-pol-extern { border-top-color: var(--purple); }
.dg-chips { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.dg-chip {
  display: grid; grid-template-columns: 28px 1fr; gap: 0.5rem;
  background: var(--bg-light); padding: 0.45rem 0.55rem; border-radius: 6px;
  border-left: 3px solid var(--line); font-size: 0.82rem; line-height: 1.4;
}
.dg-chip-pending { color: var(--muted); }
.dg-chip-pending .dg-chip-mark { color: var(--muted); }
.dg-chip-ok { border-left-color: var(--green); }
.dg-chip-ok .dg-chip-mark { color: var(--green); font-weight: 700; font-size: 1.1rem; }
.dg-chip-fail { border-left-color: var(--red); background: rgba(231,76,60,0.08); }
.dg-chip-fail .dg-chip-mark { color: var(--red); font-weight: 700; font-size: 1.1rem; }
.dg-chip-mark { text-align: center; line-height: 1.4; }
.dg-chip-reason { font-size: 0.74rem; color: var(--muted); margin-top: 0.15rem; line-height: 1.35; font-style: italic; }

/* Verdict */
.dg-verdict { display: flex; flex-direction: column; gap: 0.5rem; }
.dg-verdict-empty {
  background: var(--bg-mid); border: 1px dashed var(--line);
  padding: 0.8rem; border-radius: 8px; color: var(--muted); text-align: center; font-size: 0.85rem;
}
.dg-verdict-card {
  background: var(--bg-mid); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.8rem;
  border-left: 6px solid var(--line);
}
.dg-verdict-card.verdict-ok   { border-left-color: var(--green); background: rgba(46,204,113,0.06); }
.dg-verdict-card.verdict-cond { border-left-color: var(--orange); background: rgba(230,126,34,0.06); }
.dg-verdict-card.verdict-deny { border-left-color: var(--red); background: rgba(231,76,60,0.08); }
.dg-verdict-head { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 0.5rem; }
.dg-verdict-ico {
  font-size: 2rem; font-weight: 700; width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--bg-light);
}
.verdict-ok   .dg-verdict-ico { background: rgba(46,204,113,0.18); color: var(--green); }
.verdict-cond .dg-verdict-ico { background: rgba(230,126,34,0.18); color: var(--orange); }
.verdict-deny .dg-verdict-ico { background: rgba(231,76,60,0.18); color: var(--red); }
.dg-verdict-title { font-size: 1.4rem; font-weight: 700; color: var(--gold); letter-spacing: 0.04em; }
.dg-verdict-score { font-size: 0.82rem; color: var(--muted); margin-top: 0.1rem; }
.dg-verdict-txt { font-size: 0.88rem; color: var(--text); line-height: 1.5; margin-bottom: 0.5rem; }
.dg-verdict-fails { background: rgba(0,0,0,0.2); padding: 0.5rem 0.7rem; border-radius: 5px; font-size: 0.82rem; }
.dg-verdict-fails strong { color: var(--red); }
.dg-verdict-fails ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.dg-verdict-fails li { margin: 0.2rem 0; color: var(--text); line-height: 1.4; }
.dg-verdict-fails-empty { background: rgba(46,204,113,0.1); color: var(--green); }

/* ===== EMPTY-BANNER (overlay-toggle aan + geen data in view) ===== */
.overlay-empty-banner {
  display: flex; gap: 0.6rem; align-items: flex-start;
  background: rgba(240,196,25,0.1); border: 1px solid var(--gold-soft);
  border-left: 4px solid var(--gold); border-radius: 6px;
  padding: 0.6rem 0.8rem; margin-bottom: 0.8rem;
  font-size: 0.82rem; line-height: 1.45; color: var(--text);
}
.overlay-empty-banner .banner-ico { color: var(--gold); font-weight: 700; font-size: 1.1rem; line-height: 1.4; }
.overlay-empty-banner code {
  background: var(--bg-light); padding: 1px 6px; border-radius: 3px;
  font-family: monospace; font-size: 0.78rem; color: var(--gold);
}

/* ===== DOC-MODAL (markdown popup) ===== */
.doc-modal[hidden] { display: none; }
.doc-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.doc-modal-backdrop {
  position: absolute; inset: 0; background: rgba(6,14,26,0.78);
  backdrop-filter: blur(4px);
}
.doc-modal-card {
  position: relative; z-index: 1;
  width: min(900px, 92vw); max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--bg-mid); border: 1px solid var(--gold-soft);
  border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
}
.doc-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 1rem; border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #060e1a, #112340);
  flex-shrink: 0;
}
.doc-modal-head h2 { font-size: 1rem; color: var(--gold); margin: 0; line-height: 1.3; }
.doc-modal-close {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  font-size: 1.2rem; line-height: 1; transition: 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.doc-modal-close:hover { background: var(--red); border-color: var(--red); color: #fff; }
.doc-modal-body {
  flex: 1; overflow-y: auto; padding: 1rem 1.4rem;
  font-size: 0.9rem; line-height: 1.55; color: var(--text);
}
.doc-modal-foot {
  padding: 0.55rem 1rem; border-top: 1px solid var(--line-soft);
  background: rgba(0,0,0,0.18); flex-shrink: 0; font-size: 0.78rem;
}
.doc-modal-foot a { color: var(--gold); }

/* Markdown-body styling (zelfde palet als rest van page) */
.markdown-body h1 { font-size: 1.5rem; color: var(--gold); margin: 0.4rem 0 0.8rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--line-soft); }
.markdown-body h2 { font-size: 1.2rem; color: var(--gold); margin: 1.3rem 0 0.5rem; padding-bottom: 0.2rem; border-bottom: 1px solid var(--line-soft); }
.markdown-body h3 { font-size: 1.02rem; color: var(--gold); margin: 1.1rem 0 0.35rem; }
.markdown-body h4 { font-size: 0.92rem; color: var(--blue); margin: 0.9rem 0 0.3rem; text-transform: uppercase; letter-spacing: 0.04em; }
.markdown-body p { margin: 0.55rem 0; }
.markdown-body a { color: var(--gold); text-decoration: underline; }
.markdown-body strong { color: var(--text); font-weight: 700; }
.markdown-body em { color: var(--muted); }
.markdown-body code {
  background: var(--bg-light); color: var(--gold);
  padding: 1px 6px; border-radius: 3px;
  font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 0.85em;
}
.markdown-body pre {
  background: #0a1424; color: var(--text);
  padding: 0.8rem 1rem; border-radius: 6px;
  border: 1px solid var(--line); overflow-x: auto;
  margin: 0.7rem 0; font-size: 0.82rem; line-height: 1.45;
}
.markdown-body pre code { background: transparent; color: inherit; padding: 0; font-size: 1em; }
.markdown-body blockquote {
  border-left: 4px solid var(--gold);
  background: rgba(240,196,25,0.08);
  margin: 0.7rem 0; padding: 0.6rem 0.9rem;
  color: var(--text); font-style: italic;
}
.markdown-body blockquote p { margin: 0.3rem 0; }
.markdown-body ul, .markdown-body ol { margin: 0.55rem 0 0.55rem 1.5rem; padding: 0; }
.markdown-body ul li, .markdown-body ol li { margin: 0.25rem 0; line-height: 1.5; }
.markdown-body ul li::marker { color: var(--gold); }
.markdown-body table {
  width: 100%; border-collapse: collapse; margin: 0.7rem 0;
  font-size: 0.85rem; background: var(--bg-light);
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
}
.markdown-body thead { background: linear-gradient(180deg, #060e1a, #112340); }
.markdown-body th {
  text-align: left; padding: 0.5rem 0.7rem;
  color: var(--gold); font-size: 0.76rem;
  text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--gold-soft);
}
.markdown-body td {
  padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.markdown-body tbody tr:last-child td { border-bottom: none; }
.markdown-body hr { border: 0; border-top: 1px solid var(--line-soft); margin: 1.2rem 0; }
.markdown-body img { max-width: 100%; border-radius: 4px; }

@media (max-width: 1100px) {
  .grid3 { grid-template-columns: 220px 1fr 280px; }
}
@media (max-width: 900px) {
  .grid3 { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; height: auto; overflow: visible; }
  .ctrl, .detail { max-height: 350px; }
  html, body { height: auto; overflow: visible; }
  .gov-grid { grid-template-columns: 1fr; }
  .lim-grid { grid-template-columns: 1fr; }
  .dg-form-grid { grid-template-columns: 1fr; }
  .dg-policy { grid-template-columns: 1fr; }
}

/* ============================================================
   v0.8.0-Sowa — Fase-vergelijking tab
   ============================================================ */

.vergelijk-controls .t-block { display: block; margin-bottom: 0.5rem; font-size: 0.8rem; color: var(--muted); }
.vergelijk-controls .t-block select { width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text); padding: 4px 6px; border-radius: 4px; margin-top: 3px; font-size: 0.82rem; }
.vergelijk-controls .thr-hint { font-size: 0.72rem; color: var(--muted); margin-top: 0.4rem; line-height: 1.35; }

.vergelijk-kpi-header {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.6rem;
  padding: 0.7rem 0; margin-bottom: 0.8rem; border-bottom: 1px solid var(--line);
}
.kpi-card { background: var(--bg-mid); border: 1px solid var(--line); border-radius: 6px; padding: 0.5rem 0.7rem; }
.kpi-label { color: var(--gold); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; margin-bottom: 4px; }
.kpi-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 0.82rem; }
.kpi-fa { background: var(--bg); padding: 2px 6px; border-radius: 4px; color: var(--text); }
.kpi-delta { margin-left: auto; padding: 2px 8px; border-radius: 999px; font-weight: 700; background: var(--bg); color: var(--muted); }
.kpi-delta.pos { background: rgba(46,204,113,0.2); color: var(--green); }
.kpi-delta.neg { background: rgba(231,76,60,0.2); color: var(--red); }

.vergelijk-body { padding: 0.4rem 0; }

/* Sub-modus 1: side-by-side */
.vergelijk-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; align-items: start; }
@media (max-width: 1400px) { .vergelijk-grid-3 { grid-template-columns: 1fr; } }
.vergelijk-card { background: var(--bg-mid); border: 1px solid var(--line); border-radius: 8px; padding: 0.7rem; }
.vergelijk-card-head { padding-bottom: 0.4rem; margin-bottom: 0.5rem; border-bottom: 1px solid var(--line-soft); }
.vergelijk-card-head .fase-num { background: var(--gold); color: #0a1424; padding: 1px 8px; border-radius: 999px; font-weight: 800; font-size: 0.78rem; }
.vergelijk-card-head strong { margin-left: 6px; font-size: 0.95rem; }
.vergelijk-card-sub { color: var(--muted); font-size: 0.72rem; margin-top: 4px; }
.vergelijk-mini-canvas { overflow: hidden; border-radius: 4px; }
.vergelijk-mini-canvas svg { width: 100%; height: auto; max-height: 480px; }
.vergelijk-err { padding: 1rem; color: var(--red); font-size: 0.85rem; }

/* Sub-modus 2: werkstroom */
.vergelijk-werkstroom { display: flex; flex-direction: column; gap: 0.8rem; }
.vergelijk-w-card { background: var(--bg-mid); border: 1px solid var(--line); border-radius: 8px; padding: 0.9rem; }
.vergelijk-w-card h3 { color: var(--gold); font-size: 0.95rem; margin-bottom: 4px; }
.vergelijk-w-card .w-desc { color: var(--muted); font-size: 0.78rem; margin-bottom: 0.6rem; }
.vergelijk-w-card .w-fasen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
@media (max-width: 1200px) { .vergelijk-w-card .w-fasen { grid-template-columns: 1fr; } }
.w-fase-col { background: var(--bg); border: 1px solid var(--line-soft); border-radius: 6px; padding: 0.6rem; font-size: 0.8rem; }
.w-fase-col.fase-1 { border-left: 4px solid #4a7bd1; }
.w-fase-col.fase-2 { border-left: 4px solid #f0c419; }
.w-fase-col.fase-3 { border-left: 4px solid #2ecc71; }
.w-fase-head { font-weight: 700; margin-bottom: 0.4rem; }
.w-fase-head .fase-num { background: var(--gold); color: #0a1424; padding: 1px 7px; border-radius: 999px; font-size: 0.7rem; }
.w-new-badge { background: rgba(46,204,113,0.25); color: var(--green); padding: 1px 6px; border-radius: 6px; font-size: 0.7rem; margin-left: 4px; }
.w-caps { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.w-cap-item { background: var(--bg-light); padding: 4px 6px; border-radius: 4px; font-size: 0.75rem; }
.w-cap-item.is-new { background: rgba(46,204,113,0.15); border-left: 2px solid var(--green); }
.w-cap-item .w-mat { color: var(--muted); display: block; font-size: 0.7rem; }
.w-actoren { color: var(--muted); font-size: 0.72rem; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line-soft); }
.w-actoren strong { color: var(--text); }
.w-mat-avg { color: var(--gold); font-weight: 700; font-size: 0.78rem; margin-top: 4px; text-align: right; }
.w-empty { color: var(--muted); font-size: 0.72rem; }

/* Sub-modus 3: tabel-matrix */
.vergelijk-tabel-wrap { overflow-x: auto; }
.vergelijk-tabel { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin-bottom: 1rem; }
.vergelijk-tabel th, .vergelijk-tabel td { padding: 5px 8px; border: 1px solid var(--line); text-align: right; }
.vergelijk-tabel th { background: var(--bg-light); color: var(--gold); font-weight: 700; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.4px; }
.vergelijk-tabel .th-fase { text-align: center; background: var(--bg-mid); }
.vergelijk-tabel .sub-h th { font-size: 0.66rem; background: var(--bg); color: var(--muted); }
.vergelijk-tabel .ws-cell, .vergelijk-tabel .cap-cell { text-align: left; }
.vergelijk-tabel .ws-cell { color: var(--gold); font-weight: 700; }
.vergelijk-tabel td.bold { font-weight: 700; color: var(--text); }
.vergelijk-tabel td.empty-cell { color: var(--muted); text-align: center; font-style: italic; }
.vergelijk-tabel .cell-new { background: var(--green); color: white; padding: 0 5px; border-radius: 999px; font-size: 0.7rem; font-weight: 800; }
.vergelijk-tabel tbody tr:hover td { background: rgba(240,196,25,0.06); }
.vergelijk-tabel.small { font-size: 0.78rem; max-width: 600px; }
.vergelijk-tabel.small td.pos { color: var(--green); font-weight: 700; }
.vergelijk-tabel.small td.neg { color: var(--red); font-weight: 700; }
.vergelijk-tabel.small .agent-row { background: rgba(124,95,168,0.08); }
.vergelijk-tabel-sub { color: var(--gold); font-size: 0.88rem; margin: 1rem 0 0.4rem; }

/* Sub-modus 4: overlay-diff */
.vergelijk-diff .diff-summary { background: var(--bg-mid); border: 1px solid var(--line); border-radius: 8px; padding: 0.8rem; margin-bottom: 0.7rem; }
.vergelijk-diff .diff-summary h3 { color: var(--gold); margin-bottom: 0.4rem; }
.vergelijk-diff .diff-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 0.6rem; }
.vergelijk-diff .diff-stat { padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; background: var(--bg); border: 1px solid var(--line); }
.vergelijk-diff .diff-stat.new { background: rgba(46,204,113,0.15); border-color: var(--green); color: var(--green); }
.vergelijk-diff .diff-stat.agent { background: rgba(124,95,168,0.15); border-color: #7c5fa8; color: #b794d3; }
.vergelijk-diff .diff-stat.jump { background: rgba(240,196,25,0.15); border-color: var(--gold); color: var(--gold); }
.vergelijk-diff .diff-detail { font-size: 0.82rem; color: var(--text); }
.vergelijk-diff .diff-detail > div { margin-bottom: 0.3rem; }
.vergelijk-diff .diff-detail ul { margin: 0.2rem 0 0 1.2rem; }
.vergelijk-diff .diff-detail li { color: var(--muted); }
.diff-render g.comp.diff-new rect { stroke: var(--green); stroke-width: 3; filter: drop-shadow(0 0 6px rgba(46,204,113,0.5)); }
.diff-render g.comp.diff-new .comp-label { fill: var(--green); font-weight: 700; }
