/* Snaap (AFAS OData-applicatie): rustige, toegankelijke Nederlandstalige interface. */
:root {
  --primary: #1f4e79;
  --bg: #f5f6f8;
  --fg: #1c1c1c;
  --border: #c9ced6;
  --danger: #a4261c;
  --ok: #107c10;
  /* Ontwerptokens (2.0.6): neutrale vlakken, één accent, vaste maten. */
  --surface: #fff;
  --line: #dde1e7;
  --muted: #4b5563;
  --radius: 8px;
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --fs-title: 1.6rem;
  --fs-section: 1.15rem;
  --fs-body: 1rem;
  --fs-small: .875rem;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}
header {
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.25rem;
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1.5rem; letter-spacing: .06em; }
/* Versienummer: klein en ondergeschikt aan de navigatie, leesbaar op de donkere balk. */
.brand .brand-version {
  font-weight: 400; font-size: .7rem; letter-spacing: normal;
  opacity: .75; margin-left: .45rem; white-space: nowrap;
  align-self: flex-end; padding-bottom: .25rem;
}
/* Paginanavigatie als knop: zelfde vorm als de knop Uitloggen. */
header nav { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
header nav a.nav-btn, header nav a.nav-btn:visited {
  color: #fff; text-decoration: none; font-weight: 600;
  padding: .4rem .75rem; border: 1px solid transparent;
  border-radius: 6px; background: transparent; line-height: 1.2;
  display: inline-block;
}
header nav a.nav-btn:hover, header nav a.nav-btn:focus-visible {
  background: rgba(255,255,255,.18); text-decoration: none;
}
header nav a.nav-btn:focus-visible { outline: 2px solid #ffbf47; outline-offset: 2px; }
header nav a.nav-btn[aria-current="page"] {
  background: #fff; color: var(--primary); border-color: #fff;
}
header .user { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
header .user form { margin: 0; }
header .user button.link {
  margin: 0; padding: .4rem .75rem; border: 1px solid rgba(255,255,255,.75);
  border-radius: 6px; background: transparent; color: #fff; font-weight: 600;
}
/* Context als rustige regel; de kopbalk en het kruimelpad tonen dezelfde scope. */
.scope-context { color: var(--muted); font-size: var(--fs-small); padding: 0; }
.scope-context strong { font-weight: 600; }
.breadcrumb { margin: .6rem 0 1rem; color: #4b5563; }
.breadcrumb a { color: #315f86; }
.account-label { white-space: nowrap; }
:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; }
/* 1500 px inhoud plus 2 × 20 px padding (globale border-box). */
main { max-width: 1540px; margin: 0 auto; padding: 1.5rem 20px; min-width: 0; overflow-wrap: anywhere; }
.table-scroll { max-width: 100%; overflow-x: auto; }
.table-scroll table { display: table; overflow: visible; }
h1, h2 { color: var(--primary); }
a { color: var(--primary); }
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  background: #fff;
}
th, td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: left;
}
th { background: #e8ecf1; }
form label { display: block; margin: 0.75rem 0 0.25rem; font-weight: 600; }
input, select, textarea {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  width: 100%;
  max-width: 24rem;
}
button {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
}
button.danger { background: var(--danger); }
.button-link { display: inline-block; padding: .45rem .75rem; border-radius: 4px;
  background: var(--primary); color: #fff; text-decoration: none; margin-top: .25rem; }
.button-link:visited { color: #fff; }
.button-link.secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.button-link.secondary:visited { color: var(--primary); }
button:hover, button:focus { filter: brightness(1.1); }
.error { color: var(--danger); }
.info {
  background: #e8f1fa;
  border-left: 4px solid var(--primary);
  padding: 0.5rem 0.75rem;
}
.breadcrumb { color: #555; }
/* Dashboardgegevens en -knoppen delen dezelfde afmetingen (1.4.10) */
.stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(4, minmax(9rem, 1fr)); } }
@media (max-width: 640px)  { .stats { grid-template-columns: repeat(2, minmax(9rem, 1fr)); } }
.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 4.75rem;
  min-width: 9rem;
}
.stat .num { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
footer { text-align: center; color: #666; padding: 1rem; }
@media (max-width: 700px) {
  header { align-items: flex-start; flex-direction: column; gap: .75rem; }
  header .user { margin-left: 0; align-self: stretch; flex-wrap: wrap; }
  header nav { flex-direction: row; width: 100%; }
  header nav a.nav-btn { flex: 1 1 auto; text-align: center; }
  .brand { font-size: 1.25rem; max-width: 100%; }
  table { display: block; overflow-x: auto; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { min-width: 0; }
  header .user { max-width: 100%; flex-wrap: wrap; }
  .account-label { white-space: normal; overflow-wrap: anywhere; }
}

/* Uitklapbare klant-/omgevingssecties op de relatiespagina */
details.cust-section, details.env-section {
    border: 1px solid #d7dce3; border-radius: 6px; margin: 0.6rem 0;
    padding: 0.4rem 0.8rem; background: #f8fafc;
}
details.cust-section > summary, details.env-section > summary {
    cursor: pointer; font-weight: 600; padding: 0.2rem 0;
}
details.env-section { margin-left: 1.2rem; background: #ffffff; }


/* Sync-voortgang op de feeds-pagina */
.sync-gesynchroniseerd { color: #1a7f37; font-weight: 600; }
.sync-mislukt { color: #b3261e; font-weight: 600; }
.sync-nooit { color: #6b7280; }
.feed-table { table-layout: fixed; }
.feed-table td { vertical-align: top; }
.feed-title { font-weight: 700; color: var(--primary); overflow-wrap: anywhere; }
.feed-meta, .feed-endpoint, .feed-status { display: block; color: #4b5563; font-size: .9rem; }
.feed-endpoint { overflow-wrap: anywhere; }
.feed-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: flex-start; min-width: 8rem; }
.feed-actions form { margin: 0; }
.icon-button, .icon-menu > summary {
  display: inline-flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem;
  margin: 0; padding: 0; border: 1px solid #b8c1cc; border-radius: 5px;
  background: #fff; color: var(--primary); text-decoration: none; font-size: 1.2rem; font-weight: 700;
  cursor: pointer; list-style: none;
}
.icon-button:hover, .icon-button:focus, .icon-menu > summary:hover, .icon-menu > summary:focus {
  background: #e8f1fa; filter: none;
}
.icon-button.warning { color: #8a4b00; border-color: #c78b45; }
.icon-button.danger { color: var(--danger); background: #fff; border-color: #d4a09c; }
.icon-menu { position: relative; }
.icon-menu > summary::-webkit-details-marker { display: none; }
.icon-menu[open] .schema-upload-compact {
  position: absolute; z-index: 10; right: 0; top: 2.4rem; width: 18rem; padding: .75rem;
  border: 1px solid var(--border); border-radius: 6px; background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.schema-upload-compact label { font-size: .85rem; font-weight: 600; margin-top: .6rem; }
.schema-upload-compact input { font-size: .82rem; padding: .25rem; }


/* Resultaatkaarten bij het opzoeken van een begrip in AFAS Help */
.helpresult {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  background: #fff;
}
.helpresult h3 { margin: 0 0 0.4rem 0; }
.helpresult form { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: end; }
td.beschrijving { max-width: 30rem; }

/* Voortgangsbalk bij bestandsuploads (data-upload-progress in app.js). */
.progress-wrap { margin: .6rem 0 0; max-width: 26rem; }
.progress-bar {
  height: 14px;
  background: var(--border);
  border-radius: 7px;
  overflow: hidden;
}
.progress-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: 7px;
  transition: width .15s ease;
}
.progress-wrap.busy .progress-bar > span { animation: progress-pulse 1s ease-in-out infinite alternate; }
.progress-wrap.error .progress-bar > span { background: var(--danger); }
.progress-text { margin: .3rem 0 0; font-size: .9rem; }
.progress-wrap.error .progress-text { color: var(--danger); font-weight: 600; }
@keyframes progress-pulse { from { opacity: 1; } to { opacity: .5; } }

/* Hulpblok bij lege klant-/omgevingslijsten (geen query_data-toekenning). */
.help-steps {
  background: #fff8e6;
  border: 1px solid #e0c56e;
  border-radius: 4px;
  padding: .75rem 1rem;
  margin-bottom: 1rem;
}
.help-steps h2 { margin-top: 0; font-size: 1.05rem; }
.help-steps ol { margin: .4rem 0 .2rem; padding-left: 1.4rem; }


/* Toevoegen-knop rechts boven de tabel (ingeklapte invoersectie). */
.add-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  border: 0;
  background: transparent;
  margin: 0 0 .8rem;
  padding: 0;
  width: 100%;
}
.add-block > summary {
  cursor: pointer;
  display: inline-block;
  margin: 0 0 .6rem;
  padding: .4rem 1rem;
  background: var(--primary, #1f5c8b);
  color: #fff;
  border-radius: 5px;
  font-weight: 600;
  list-style: none;
  user-select: none;
}
.add-block > summary::-webkit-details-marker { display: none; }
.add-block > summary::before { content: '+ '; font-weight: 700; }
.add-block[open] > summary { background: #345; }
/* uitgeklapt: formulier als paneel over de volle breedte, links uitgelijnd */
.add-block[open] { align-items: stretch; }
.add-block > *:not(summary) {
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  background: #f7f8fa;
  border: 1px solid #d6d9de;
  border-radius: 7px;
  padding: .6rem .9rem .9rem;
  text-align: left;
}
.add-block form { padding-bottom: 0; }

/* Toevoegen-knop zonder aanmaakrecht: grijs en uitgeschakeld, met uitleg. */
.add-block.is-disabled > summary {
  background: #a6adb6;
  cursor: not-allowed;
}
.add-block.is-disabled[open] > summary { background: #a6adb6; }

/* Actiakolom met icoonknoppen: netjes naast elkaar, verticale uitlijning. */
td.actions { white-space: nowrap; }
td.actions .icon-button { vertical-align: middle; margin: 0 .18rem .18rem 0; }
td.actions form { display: inline-block; margin: 0; }

/* Vraag stellen: de vraag staat boven de bronkeuze. */
.question-entry { padding: 1.15rem; margin: 1rem 0; border: 1px solid #bcd4ea;
  border-radius: 10px; background: #eef5fc; }
.question-entry label { display: block; font-size: 1.2rem; font-weight: 700; margin-bottom: .45rem; }
.question-entry textarea { display: block; box-sizing: border-box; width: 100%; min-height: 5.5rem;
  margin-bottom: .7rem; font: inherit; resize: vertical; }
.question-entry button { font-size: 1rem; padding: .65rem 1.3rem; }
.question-entry p { margin: .7rem 0 0; }
.question-sources { margin: 1rem 0; }
.question-sources h2 { margin-bottom: .3rem; }
/* Keuzelijsten van links naar rechts (klant, omgeving, gegevensbron). */
.ask-selectors {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}
.ask-selectors fieldset {
  flex: 1 1 15rem;
  min-width: 14rem;
  margin: 0;
}
.ask-selectors select[multiple] { width: 100%; }


/* Begrippen als klikbare tegels in plaats van een tabel. */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: .8rem;
  margin: 1rem 0;
}
.tile {
  display: flex;
  flex-direction: column;
  border: 1px solid #d6d9de;
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}
.tile-main {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .7rem .85rem;
  flex: 1;
  text-decoration: none;
  color: inherit;
}
.tile:hover { border-color: #4a6da4; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.tile-title { font-weight: 600; font-size: 1.02rem; }
.tile-sub { color: #5a6270; font-size: .85rem; }
.tile-desc { color: #333; font-size: .88rem; }
.tile-meta { color: #6b7280; font-size: .78rem; margin-top: .25rem; overflow-wrap: anywhere; }
.tile-actions {
  display: flex;
  gap: .2rem;
  align-items: center;
  border-top: 1px solid #e8eaee;
  padding: .3rem .5rem;
  background: #f7f8fa;
}
.tile-actions form { display: inline-block; margin: 0; }


/* Werkbalk rechts boven een tabel (bijv. Excel-export auditlog). */
.table-tools { display: flex; justify-content: flex-end; gap: .3rem; margin: .4rem 0; }
.history-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin: 1rem 0 .4rem; }
.history-table-wrap { overflow-x: auto; max-width: 100%; }
/* Eén gedeelde tabelopmaak voor alle overzichten. */
.managed-table-wrap { overflow-x: auto; max-width: 100%; }
.managed-table { width: 100%; table-layout: fixed; }
.managed-table.table-resize-ready { min-width: 0; }
.managed-table-wrap .managed-table { display: table; overflow: visible; }
.managed-table th, .managed-table td { vertical-align: top; overflow-wrap: anywhere; }
.managed-table thead th { position: relative; padding-right: 1rem; }
.table-filters input, .table-filters select,
.history-filters input, .history-filters select { width: 100%; min-width: 0; max-width: none; }
.table-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin: .7rem 0; }
.table-controls form { margin: 0; }
.table-controls button { margin: 0; }
.table-resize-hint { margin: .4rem 0; color: #586575; font-size: .9rem; }
.table-resize-handle { display: none; position: absolute; top: 0; right: 0; bottom: 0; width: 12px;
  cursor: col-resize; touch-action: none; z-index: 1; }
.table-resize-ready .table-resize-handle { display: block; }
.table-resize-handle::after { content: ''; position: absolute; top: 20%; bottom: 20%; right: 4px;
  width: 2px; border-radius: 2px; background: #8ca5be; }
.table-resize-handle:hover, .table-resize-handle:focus-visible { background: #cbd9e7; }
.table-resize-handle:hover::after, .table-resize-handle:focus-visible::after,
body.table-resizing .table-resize-handle::after { background: var(--primary); }
body.table-resizing { cursor: col-resize; user-select: none; }
.table-reset-widths { padding: .35rem .6rem; background: #fff;
  border: 1px solid var(--primary); color: var(--primary); }
.table-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin: 1rem 0; }
.history-action { display: inline-block; margin: 0 .25rem 0 0; }
.history-disabled { font-size: .8rem; color: #586575; }
.history-pagination { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }


/* Dashboardtegels als klikbare knoppen (1.3.19). */
a.stat-link { text-decoration: none; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
a.stat-link:hover, a.stat-link:focus-visible { border-color: #4a6da4; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
a.stat-link:focus-visible { outline: 2px solid #4a6da4; outline-offset: 2px; }


/* Navigatieknoppen op het dashboard: grijze knop met blauwe pijl en tekst. */
.nav-tiles { margin: 0; }
a.nav-tile {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: #eef0f4;
  border: 1px solid #dfe3ea;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 0.85rem 1rem;
  min-height: 4.75rem;
  text-decoration: none;
  color: #222;
  font-weight: 600;
  transition: background .15s, box-shadow .15s, border-color .15s;
}
a.nav-tile:hover, a.nav-tile:focus-visible {
  background: #e4e8ef;
  border-color: #b9c2d0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
}
a.nav-tile:focus-visible { outline: 2px solid #4a6da4; outline-offset: 2px; }
/* eigen icoon per knop: emoji in een lichtblauw badgeje (1.4.9) */
.nav-tile .icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  flex: none;
  background: #e3edf8;
  border: 1px solid #c9dcf0;
  border-radius: 8px;
  font-size: 1.05rem;
  line-height: 1;
}
.nav-tile .label { text-align: left; }
.question-header { font-size: 1.5rem; font-weight: 600; margin: .2rem 0 1rem; }
.query-path { color: #2c4a6e; margin: 0 0 .8rem; }

/* Uitklapbare stappentabel op de antwoordpagina */
details.steps-box { margin: 1rem 0; border: 1px solid var(--border, #d7dce3); border-radius: 6px; background: #f7f9fb; }
details.steps-box > summary { cursor: pointer; padding: 0.6rem 0.9rem; font-weight: 600; }
table.steps-table { width: 100%; border-collapse: collapse; margin: 0; }
table.steps-table th, table.steps-table td { border-top: 1px solid var(--border, #d7dce3); padding: 0.45rem 0.9rem; text-align: left; vertical-align: top; }

/* Doorvragen, grafieken en gerelateerde tabellen (antwoordpagina) */
form.followup-box { background: #f7f9fb; border: 1px solid var(--border, #d7dce3); border-radius: 6px; padding: 0.7rem 0.9rem; margin: 0.8rem 0; }
form.followup-box textarea { resize: vertical; }
.charts-box { margin: 1rem 0; }
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.charts-grid figure { margin: 0; border: 1px solid var(--border, #d7dce3); border-radius: 6px; padding: 0.5rem; }
.charts-grid figcaption { font-weight: 600; margin-bottom: 0.3rem; }
svg.chart { width: 100%; height: auto; }
.chart-t { font-size: 13px; font-weight: 600; fill: #333; }
.chart-l { font-size: 10px; fill: #555; }
.chart-a { font-size: 11px; fill: #666; }
/* Klikbare grafiekonderdelen: duidelijk doel, zichtbare focus (niet alleen kleur) en markering. */
.chart-hit { cursor: pointer; }
.chart-hitarea { fill: transparent; pointer-events: all; }
.chart-hit:hover .chart-mark, .chart-hit:focus-visible .chart-mark,
.chart-hit[aria-current] .chart-mark { stroke: #111; stroke-width: 3; }
.chart-hit:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; }
.chart-hit:focus-visible .chart-hitarea, .chart-hit[aria-current] .chart-hitarea {
  fill: rgba(31, 78, 121, .08); stroke: var(--primary); stroke-width: 2; stroke-dasharray: 4 3; }
.chart-hint { margin: .25rem 0 .5rem; }
/* Het paneel staat direct onder zijn grafiek en krijgt dan de volle breedte van het raster. */
.chart-block:has(.chart-detail:not([hidden])) { grid-column: 1 / -1; }
.chart-block svg.chart { max-width: 640px; display: block; }
.chart-detail { margin-top: .75rem; border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: 6px; padding: .75rem; background: #fff; }
.chart-detail-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; justify-content: space-between; }
.chart-detail-head h2 { font-size: 1.05rem; margin: 0; }
.chart-detail-head h2:focus { outline: none; }
.chart-detail-head h2:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; }
.chart-detail-table tfoot td, .chart-detail-table tfoot th { font-weight: 600; border-top: 2px solid var(--border); }
/* Kolommen niet per letter laten afbreken: bij weinig ruimte scrolt de tabel horizontaal binnen het paneel. */
.chart-detail .table-scroll { overflow-x: auto; }
.chart-detail-table { width: max-content; min-width: 100%; }
.chart-detail-table th, .chart-detail-table td { white-space: nowrap; }
.chart-detail-nav, .chart-detail-tools { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center;
  margin-top: .5rem; }
.chart-detail-tools form { margin: 0; }
.chart-detail button, .chart-detail-nav a { min-height: 24px; }
@media (prefers-reduced-motion: reduce) { .chart-detail { scroll-behavior: auto; } }
.related-box { margin: 1rem 0; }
.related-form { display: inline-block; margin: 0.2rem 0.4rem 0.2rem 0; }
p.hint { font-size: 0.85rem; color: #666; margin: 0.2rem 0 0.5rem; }

/* Accountrechten: gegroepeerd raster met één expliciete opslagactie. */
.permission-scope { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem;
  margin: 1rem 0; }
.permission-scope label { margin: 0; }
.permission-scope select { width: auto; min-width: min(20rem, 100%); }
.permission-table-wrap { max-width: 65rem; overflow-x: auto; }
table.permission-grid { width: 100%; min-width: 30rem; margin: 0; }
.permission-grid td, .permission-grid th { vertical-align: middle; }
.permission-grid th:last-child, .permission-grid .permission-check { width: 7rem; text-align: center; }
.permission-grid .permission-origin { width: 17rem; color: #475569; }
.permission-grid td label { margin: 0; font-weight: 500; cursor: pointer; }
.permission-grid .permission-check input[type="checkbox"] { width: 1.25rem; height: 1.25rem;
  margin: 0; cursor: pointer; }
.permission-grid .permission-check input:disabled { cursor: not-allowed; }
.permission-grid .permission-group th { background: #e8eef7; color: #243b5a;
  text-align: left; font-weight: 700; }
.permission-save { max-width: 65rem; display: flex; flex-wrap: wrap; align-items: center;
  gap: 1rem; margin: 1rem 0 1.5rem; }

/* Instellingen: keuzelijst per instelling in de tabel */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0,0,0,0); border: 0; }
form.setting-form { display: inline-flex; align-items: center; gap: .4rem; }


/* Live voortgang van een vraag (uitklapbaar venster tijdens het verwerken) */
details.voortgang-paneel { margin: 1rem 0; border: 1px solid #bcd4ea; border-radius: 10px;
  background: #eef5fc; padding: 0.4rem 0.9rem 0.6rem; }
details.voortgang-paneel > summary { cursor: pointer; font-weight: 600; padding: 0.3rem 0; }
details.voortgang-paneel[open] { border-color: #719bc4; }
.voortgang-status { margin: .45rem 0; font-weight: 600; }
details.voortgang-paneel ol { margin: 0.4rem 0 0; padding-left: 1.2rem; }
details.voortgang-paneel li { margin: 0.35rem 0; }
.voortgang-detail { color: #4a5568; font-size: 0.9rem; }
.voortgang-fout { color: #a00; margin: 0.4rem 0 0; }

.answer-export-tools { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: .55rem; margin: .6rem 0 1rem; padding: .65rem .8rem; background: #eef3f8; border: 1px solid #d7e3ef; border-radius: 8px; }
.answer-export-tools form { margin: 0; }
.answer-export-tools strong { margin-right: auto; font-size: .88rem; }
.answer-export-icon { display: inline-flex; align-items: center; gap: .35rem; min-width: 5rem; font-size: .9rem; font-weight: 600; }
.file-icon { display: inline-grid; place-items: center; width: 1.65rem; height: 1.85rem; border-radius: .17rem; font-size: .58rem; font-weight: 800; color: white; letter-spacing: -.02em; }
.file-icon-pdf { background: #aa3338; }
.file-icon-xlsx { background: #217346; font-size: 1.05rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Gesprek en bevestiging blijven gewone server-side formulieren. */
.chat-messages { display: flex; flex-direction: column; gap: 1rem; margin: 1.5rem 0; }
.chat-message { max-width: 90%; padding: 1rem 1.25rem; border-radius: 12px;
  background: #fff; border: 1px solid var(--border); min-width: 0; }
.chat-message p { white-space: pre-wrap; }
.chat-user { align-self: flex-end; background: #e8f1fa; }
.chat-assistant { align-self: flex-start; }
.chat-answer { width: 100%; max-width: 100%; }
.chat-proposal, .chat-attachment { padding: 1rem; border: 1px solid var(--border); border-radius: 8px; background: #fff; margin: 1rem 0; }
.chat-proposal dl { display: grid; grid-template-columns: minmax(7rem, 1fr) 3fr; gap: .4rem 1rem; }
.chat-proposal dd { margin: 0; }
.chat-proposal textarea { width: 100%; max-width: none; min-height: 6rem; }
.chat-composer { border-top: 2px solid var(--primary); margin-top: 1.5rem; padding-top: 1rem; }
.chat-upload summary { color: var(--primary); font-weight: 600; cursor: pointer; padding: .6rem 0; }
.chat-upload input[type=checkbox], .chat-attachment input[type=checkbox] { width: auto; }
@media (max-width: 640px) {
  .chat-message { max-width: 100%; }
  .chat-proposal dl { grid-template-columns: 1fr; }
  .chat-composer button { width: 100%; }
}

/* Compacte chatberichten en composer: indeling, geen uitvoeringslogica. */
.chat-messages { gap: .65rem; margin: 1rem 0; }
.chat-message { width: fit-content; padding: .55rem .8rem; max-width: min(90%, 65rem); }
.chat-message > p { margin: .25rem 0 0; }
.chat-answer { width: 100%; max-width: 100%; }
.chat-message .chat-proposal { margin: .65rem 0 0; padding: .75rem; }
.chat-proposal h2 { margin: 0 0 .4rem; font-size: 1.1rem; }
.chat-management { margin: .5rem 0; font-size: .9rem; }
.chat-management summary { cursor: pointer; }
.chat-composer .question-entry textarea.chat-question-input {
  min-height: 4.5rem; max-height: 13.5rem; padding: .65rem .85rem;
  line-height: 1.5; font-size: 1rem; border-radius: 14px; resize: vertical;
  width: 100%; max-width: none;
}
.chat-composer-files { margin: .5rem 0 1rem; }
.chat-composer-files .chat-attachment { padding: .65rem; margin: .5rem 0; }
.chat-send { margin: .6rem 0; }
.chat-send button { margin-top: 0; font-weight: 600; }
.chat-send p { margin: .35rem 0; color: #475569; font-size: .9rem; }

/* AFAS Help: rustige gespreksruimte, vraag rechts, antwoord links. */
.chat-shell { background: #f2f5fa; border: 1px solid var(--border); border-radius: 14px;
  padding: 1.1rem; min-width: 0; }
.chat-toolbar { background: transparent; color: var(--fg); padding: 0;
  display: flex; justify-content: space-between; gap: .75rem; align-items: center; }
.chat-toolbar h1 { margin: 0; font-size: 1.65rem; }
.chat-toolbar nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.chat-toolbar a { color: var(--primary); font-weight: 600; }
.chat-context, .chat-intro { margin: .55rem 0; color: #475569; }
.chat-shell .chat-user { background: #fff; border-left: 0; border-right: 3px solid #64748b; }
.chat-shell .chat-assistant { border-left: 3px solid var(--primary); }
.chat-shell .chat-composer { border-top: 1px solid var(--border); padding-top: .75rem; }
.chat-shell .question-entry { background: #fff; padding: .75rem; margin: .75rem 0; }
.chat-replies { display: flex; gap: .5rem; flex-wrap: wrap; margin: .4rem 0; }
.chat-replies button { background: #fff; color: var(--primary); border: 1px solid #94b3d0;
  padding: .4rem .65rem; border-radius: 18px; font-size: .95rem; margin: 0; white-space: normal; }
.chat-replies button:hover { background: #e8f1fa; }
.chat-replies button:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.chat-followups { border-top: 1px solid var(--border); margin-top: .8rem; padding-top: .5rem; }
.chat-followups > p, .chat-choice > p { margin: .3rem 0; font-weight: 600; }
.chat-hint { font-size: .9rem; color: #475569; }
.chat-operation { padding: .5rem .65rem; background: #eef5fc; border-radius: 6px; }
.chat-waiting { color: #475569; }
.chat-shell[aria-busy=true] .chat-waiting { border-style: dashed; }
@media (max-width: 640px) {
  .chat-shell { padding: .65rem; }
  .chat-toolbar { align-items: flex-start; }
  .chat-toolbar h1 { font-size: 1.35rem; }
  .chat-replies button { max-width: 100%; }
  .chat-message { max-width: 100%; }
  .chat-send button { width: 100%; }
}

/* Gegevenscontext boven het gesprek, met compacte afhankelijke keuzelijsten. */
.chat-shell { max-width: 1120px; margin: 0 auto; background: #f8fafc; padding: 1.5rem; }
.chat-shell .question-sources { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin: 1rem 0; }
.chat-shell .question-sources h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.context-summary { font-weight: 600; margin: .35rem 0; overflow-wrap: anywhere; }
.context-picker summary { color: var(--primary); cursor: pointer; padding: .5rem 0; }
.context-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.context-grid fieldset { min-width: 0; max-height: 22rem; overflow: auto; border-radius: 8px; padding: .75rem; }
.context-grid input[type=search] { width: 100%; }
.context-option { display: flex; align-items: flex-start; gap: .5rem; padding: .45rem 0; font-weight: 400; overflow-wrap: anywhere; }
.context-option input[type=checkbox] { width: auto; flex: 0 0 auto; margin-top: .2rem; }
.context-option:has(input:disabled) { opacity: .45; }
.context-option[hidden] { display: none; }
.chat-shell .chat-message { max-width: min(90%, 48rem); }
.chat-shell .chat-answer { max-width: 100%; }
.chat-shell .question-entry { padding: 0; background: transparent; }
.chat-send { display: flex; align-items: center; gap: 1rem; }
.chat-shell :focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.chat-answer .steps-box { margin-top: 1rem; }
@media (max-width: 700px) {
  .chat-shell { padding: .75rem; }
  .context-grid { grid-template-columns: 1fr; }
  .chat-toolbar { flex-direction: column; }
  .chat-shell .chat-message { max-width: 100%; }
  .chat-send { flex-wrap: wrap; }
}

.context-grid { align-items: start; }
.context-grid fieldset[hidden] { display: none; }

/* Vervolgvraag, voorstel, antwoord en eindreactie zijn in één oogopslag te onderscheiden. */
.chat-kind { display: inline-block; margin-left: .5rem; padding: .1rem .55rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600; background: #e8f1fa; color: var(--primary); vertical-align: middle; }
.chat-shell .chat-kind-question { border-left-color: #b45309; background: #fffbeb; }
.chat-kind-question > .chat-kind { background: #fde68a; color: #7c2d12; }
.chat-shell .chat-kind-result, .chat-shell .chat-answer { border-left-color: var(--ok); }
.chat-kind-result > .chat-kind { background: #dcfce7; color: #14532d; }
.chat-shell .chat-kind-final { border-left-color: var(--danger); background: #fef2f2; }
.chat-kind-final > .chat-kind { background: #fee2e2; color: #7f1d1d; }
.chat-improvements { border-top: 1px solid var(--border); margin-top: .8rem; padding-top: .5rem; }
.chat-clarifications h2 { margin: 0 0 .4rem; font-size: 1.1rem; }
.chat-clarifications ul { margin: .3rem 0; }
.chat-improvements > p:first-child { margin: .3rem 0; font-weight: 600; }
.chat-choice > p.chat-hint { font-weight: 400; }
.chat-improvements .chat-replies button { border-radius: 10px; text-align: left; }
.chat-replies button { min-height: 2.5rem; }
@media (max-width: 700px) {
  .chat-kind { display: block; width: fit-content; margin: .25rem 0 0; }
  .chat-replies { flex-direction: column; align-items: stretch; }
  .chat-replies button { width: 100%; text-align: left; }
}

/* Beheerpagina: tegels in een raster. */
.management-section { margin: 2rem 0; }
.management-section .stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
@media (max-width: 600px) {
 .management-section .stats { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------------
   Over omgevingen heen (2.0.1): één herkenbaar beeld op alle plekken.
   De accentkleur ondersteunt; label, letters en symbolen (⇄ koppeling,
   = gelijkstelling) dragen de betekenis zelfstandig.
   --------------------------------------------------------------------------- */
:root { --cross: #4a2f7a; --cross-tint: #f3eefb; --cross-border: #b9a5dd; }
.cross-label {
  display: inline-block; background: var(--cross); color: #fff; font-weight: 700; font-size: .8rem;
  letter-spacing: .02em; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; vertical-align: middle;
}
.cross-symbol { font-weight: 700; color: var(--cross); font-size: 1.15em; padding: 0 .2rem; }
.cross-env { display: inline-flex; align-items: baseline; gap: .45rem; max-width: 100%; overflow-wrap: anywhere; }
.cross-env-mark {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-width: 1.6rem;
  height: 1.6rem; padding: 0 .3rem; border: 2px solid var(--cross); border-radius: 6px; background: #fff;
  color: var(--cross); font-weight: 700; font-size: .85rem; line-height: 1;
}
.cross-warning {
  border: 1px solid #c78b45; border-left: 6px solid #8a4b00; background: #fff8ec; color: #3d2a00;
  padding: .7rem .9rem; border-radius: 6px; font-weight: 600;
}
.cross-block { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin: 1rem 0; }
.cross-block > h2 { margin-top: 0; }
.cross-card, .cross-member {
  border: 1px solid var(--cross-border); border-left: 6px solid var(--cross); border-radius: 8px;
  background: #fff; padding: .8rem 1rem; margin: .8rem 0;
}
.cross-card > header { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between;
  background: transparent; color: inherit; padding: 0; }
.cross-card h3, .cross-member h3 { margin: .1rem 0 .4rem; font-size: 1.05rem; }
.cross-card dl { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .8rem; margin: .4rem 0; }
.cross-card dt { font-weight: 600; }
.cross-card dd { margin: 0; overflow-wrap: anywhere; }
.cross-notes { margin: .3rem 0 .6rem 1.1rem; padding: 0; font-size: .9rem; }
.cross-link-list { list-style: none; margin: .6rem 0; padding: 0; }
.cross-link-row, .cross-two {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(9rem, auto) minmax(0, 1fr); gap: .8rem;
  align-items: stretch; margin: .7rem 0;
}
.cross-side, .cross-two > fieldset {
  border: 1px solid var(--cross-border); border-radius: 8px; background: var(--cross-tint); padding: .7rem .8rem;
  min-width: 0; overflow-wrap: anywhere;
}
.cross-side p { margin: .4rem 0 0; }
.cross-bridge {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; text-align: center;
  border-top: 3px solid var(--cross); border-bottom: 3px solid var(--cross); padding: .5rem .4rem; font-size: .9rem;
}
.cross-bridge .cross-symbol { font-size: 1.6rem; line-height: 1; }
.cross-select { font-weight: 400; display: inline-flex; gap: .35rem; align-items: center; }
.cross-select input, .cross-values input, .cross-mode input { width: auto; }
.cross-values { max-height: 16rem; overflow: auto; border-radius: 8px; padding: .6rem .8rem; }
.cross-values label { display: flex; gap: .45rem; align-items: flex-start; font-weight: 400; overflow-wrap: anywhere; }
.cross-members { display: grid; gap: .2rem; }

/* Vraagsteller: moduskeuze en vaste balk boven het vraagveld. */
.cross-mode { border: 1px solid var(--border); border-radius: 8px; padding: .6rem .8rem; margin: .6rem 0; }
.cross-mode legend { font-weight: 600; }
.cross-mode label { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; padding: .25rem 0; }
.cross-mode label strong { font-weight: 600; }
.cross-scope-bar {
  border: 1px solid var(--cross-border); border-left: 6px solid var(--cross); background: var(--cross-tint);
  border-radius: 8px; padding: .6rem .8rem; margin: .6rem 0; overflow-wrap: anywhere;
}
.cross-scope-bar ul { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin: .4rem 0 0; padding: 0; }
.chat-composer.cross-active { border-color: var(--cross); box-shadow: inset 0 3px 0 var(--cross); }

/* Antwoord: band met relaties, dekking en status per omgeving. */
.cross-band {
  border: 1px solid var(--cross-border); border-left: 6px solid var(--cross); background: var(--cross-tint);
  border-radius: 8px; padding: .8rem 1rem; margin: .8rem 0;
}
.cross-band h2 { margin: .1rem 0 .5rem; font-size: 1.05rem; }
.cross-band ul { margin: .3rem 0 0 1.1rem; padding: 0; }
.cross-coverage { font-weight: 700; font-size: 1.05rem; margin: .6rem 0 .2rem; }
.cross-partial {
  display: inline-block; border: 2px solid #8a4b00; color: #5a3100; background: #fff8ec; border-radius: 6px;
  padding: .05rem .5rem; font-weight: 700; font-size: .85rem; margin-left: .4rem;
}
.cross-status-table td, .cross-status-table th { vertical-align: top; }
.cross-state { font-weight: 600; white-space: nowrap; }
.cross-total th, .cross-total td { border-top: 3px double var(--cross); font-weight: 700; background: var(--cross-tint); }
.cross-origin { display: block; font-weight: 400; font-size: .8rem; color: #444; }

@media (max-width: 760px) {
  .cross-link-row, .cross-two { grid-template-columns: 1fr; }
  .cross-bridge { flex-direction: row; flex-wrap: wrap; }
  .cross-card dl { grid-template-columns: 1fr; }
}

/* Verzendknop en balk volgen de moduskeuze, ook zonder JavaScript (:has). De serverklassen
   (.cross-on, .cross-server-on) zijn de terugval voor browsers zonder :has. */
.send-cross { display: none; }
.cross-scope-bar { display: none; }
.cross-scope-bar.cross-on { display: block; }
.chat-composer.cross-server-on .send-cross { display: inline; }
.chat-composer.cross-server-on .send-default { display: none; }
.chat-composer.cross-server-on { border-color: var(--cross); box-shadow: inset 0 3px 0 var(--cross); }
.chat-shell:has(input[name="question_mode"][value="gecombineerd"]:checked) .cross-scope-bar { display: block; }
.chat-shell:has(input[name="question_mode"][value="gecombineerd"]:checked) .send-cross { display: inline; }
.chat-shell:has(input[name="question_mode"][value="gecombineerd"]:checked) .send-default { display: none; }
.chat-shell:has(input[name="question_mode"][value="gecombineerd"]:checked) .chat-composer {
  border-color: var(--cross); box-shadow: inset 0 3px 0 var(--cross);
}
.chat-shell:has(input[name="question_mode"][value="per_omgeving"]:checked) .cross-scope-bar { display: none; }
.chat-shell:has(input[name="question_mode"][value="per_omgeving"]:checked) .send-cross { display: none; }
.chat-shell:has(input[name="question_mode"][value="per_omgeving"]:checked) .send-default { display: inline; }
.chat-shell:has(input[name="question_mode"][value="per_omgeving"]:checked) .chat-composer { box-shadow: none; }
.chat-shell:has(input[name="question_mode"][value="per_omgeving"]:checked) .cross-relation-choice { display: none; }
.cross-relation-choice { display: block; margin-top: .4rem; }
.cross-relation-choice select { display: block; max-width: 100%; }
.cross-mode-info { margin: .5rem 0; }
.history-cross { display: block; margin-top: .2rem; font-size: .85rem; }


/* Favorieten en schermbreedte gebruiken dezelfde kleuren en tabelcontainers. */
.dashboard-favorites { min-width: 0; grid-column: 1 / -1; }
.favorite-card { border: 1px solid var(--line); background: var(--surface); padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0; border-radius: var(--radius); min-width: 0; }
.favorite-card form { display: inline-block; margin-right: .5rem; }
.favorite-status { display: inline-block; color: var(--primary); padding: .2rem .5rem; border: 1px solid var(--border); border-radius: 4px; margin: .2rem; }
.favorite-mark { margin: .5rem 0; }
.favorite-mark summary { cursor: pointer; }
.qa-block { min-width: 0; max-width: 100%; }
.qa-block [data-screenwide] { margin-bottom: .75rem; }
main.is-screenwide { max-width: none; }
main.is-screenwide .chat-shell.is-screenwide { max-width: none; width: 100%; }
.chat-shell.is-screenwide .chat-message { max-width: 100%; }
.chat-shell .qa-block [data-screenwide] { display: none; }
.chat-toolbar nav { align-items: center; justify-content: flex-end; }
.chat-toolbar [data-screenwide] { margin: 0; }
.qa-block.is-screenwide { width: 100%; }
.qa-block .table-scroll { max-width: 100%; overflow-x: auto; }
.favorite-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.favorite-grid > .favorite-card { margin: 0; }
.favorite-grid h3, .favorite-question, .favorite-tooltip { overflow-wrap: anywhere; white-space: normal; }
.personal-favorite { position: relative; }
.favorite-actions { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.favorite-actions form { margin: 0; }
.favorite-run { display: inline-flex; }
.favorite-star, .favorite-info > summary { width: 2.5rem; height: 2.5rem; }
.favorite-star { font-size: 1.25rem; font-weight: 400; }
.favorite-tooltip { position: absolute; z-index: 20; left: 0; right: 0; top: 2.75rem;
  display: block; padding: .75rem; background: #172b45; color: #fff; border-radius: 6px;
  box-shadow: 0 4px 12px #0003; visibility: hidden; opacity: 0; max-height: min(16rem, 40vh); overflow: auto; }
.favorite-run:not(.tooltip-dismissed):hover .favorite-tooltip,
.favorite-run:not(.tooltip-dismissed):focus-within .favorite-tooltip { visibility: visible; opacity: 1; }
.favorite-info { position: static; }
.favorite-info[open] { flex-basis: 100%; order: 2; }
.favorite-info[open] .favorite-question { margin: .5rem 0 0; padding: .75rem; background: #f2f5fa; border-radius: 6px; }
.favorite-remove { margin: 0; }
.personal-favorite .hint { margin-bottom: 0; }
.favorite-actions :focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
@media (max-width: 700px) {
  .favorite-grid { grid-template-columns: 1fr; }
  .chat-toolbar nav { justify-content: flex-start; }
}

/* Rechtenpagina per gebruiker: matrix met negen rolkolommen, vaste koppen en eerste kolom. */
.rechten-samenvatting { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: .5rem 1rem; margin: 1rem 0; padding: .75rem 1rem; border: 1px solid #cbd5e1;
  border-radius: 8px; background: #f8fafc; }
.rechten-samenvatting div { margin: 0; }
.rechten-samenvatting dt { font-size: .8rem; color: #475569; }
.rechten-samenvatting dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.rechten-legenda p { margin: .25rem 0; }
.rechten-filters input[type="search"] { width: auto; min-width: min(14rem, 100%); }
.rechten-matrix-wrap { position: relative; max-height: 75vh; overflow: auto; border: 1px solid #cbd5e1; border-radius: 6px;
  margin: .5rem 0; }
.rechten-matrix-wrap:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; }
table.rights-matrix { border-collapse: separate; border-spacing: 0; width: max-content;
  margin: 0; font-size: .85rem; }
.rights-matrix th, .rights-matrix td { padding: .35rem .5rem; border-bottom: 1px solid #e2e8f0;
  vertical-align: top; background: #fff; }
.rights-matrix thead th { position: sticky; z-index: 2; background: #e8eef7; color: #1e293b;
  text-align: center; }
.rights-matrix thead tr:first-child th { top: 0; height: 2.2rem; }
.rights-matrix thead tr:nth-child(2) th { top: 2.2rem; }
/* De algemene mobiele regel (tabel als eigen scrollblok) zou de vaste kolom en koppen breken. */
.rechten-matrix-wrap table.rights-matrix { display: table; overflow: visible; }
.rights-matrix .fn-kolom { position: sticky; left: 0; z-index: 1; min-width: 13rem; max-width: 16rem;
  text-align: left; border-right: 2px solid #cbd5e1; }
.rights-matrix thead .fn-kolom { z-index: 3; }
.rights-matrix .fn-naam { display: block; font-weight: 600; }
.rights-matrix small { display: block; color: #475569; font-weight: 400; margin-top: .15rem; }
.rights-matrix .recht-code { font-family: ui-monospace, monospace; font-size: .72rem; color: #64748b; }
.rights-matrix .matrix-groep th { text-align: left; background: #243b5a; color: #fff; font-weight: 700; }
.rights-matrix .matrix-groep th span { position: sticky; left: .5rem; }
.rights-matrix .niveau { border-left: 2px solid #94a3b8; }
.rights-matrix .rol { min-width: 6.5rem; font-weight: 600; }
.rights-matrix .actieve-rol { background: #fff7d6; box-shadow: inset 0 0 0 2px #b45309; }
.rights-matrix thead .actieve-rol { background: #fde68a; }
.rights-matrix .actief-label { display: block; font-size: .7rem; text-transform: uppercase; color: #92400e; }
.rights-matrix .cel { min-width: 6.5rem; max-width: 9rem; }
.rights-matrix .cel-icoon { font-weight: 700; }
.rights-matrix .cel-toegestaan .cel-icoon { color: #166534; }
.rights-matrix .cel-niet-toegestaan .cel-icoon { color: #b91c1c; }
.rights-matrix .cel-nvt { color: #64748b; }
.rights-matrix .uitzondering { min-width: 9rem; max-width: 15rem; border-left: 2px solid #94a3b8; }
.rights-matrix .uitzondering fieldset { border: 0; margin: 0; padding: 0; }
.rights-matrix .uitzondering label { display: flex; align-items: center; gap: .35rem; margin: 0 0 .15rem;
  font-weight: 400; min-height: 24px; cursor: pointer; }
.rights-matrix .uitzondering input[type="radio"] { width: 1.1rem; height: 1.1rem; margin: 0; }
.rights-matrix .uitzondering input:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; }
.rights-matrix .reden { color: #7c2d12; }
.rights-matrix .geerfd { color: #1e40af; }
.rights-matrix .effectief { font-weight: 600; }
.rol-keuze select { min-width: min(28rem, 100%); }
h2.stap { font-size: 1.05rem; margin: 1rem 0 .25rem; }
@media (max-width: 640px) {
  .rights-matrix .fn-kolom { min-width: 10rem; max-width: 12rem; }
  .rights-matrix .recht-code { display: none; }
  .rechten-matrix-wrap { max-height: 70vh; }
}

/* Rolstandaarden en inklapbare kolommen (2.0.5) */
.rights-matrix .kolom-knop { min-width: 24px; min-height: 24px; padding: 0 .3rem; margin: 0 .2rem .2rem 0;
  font-size: .9rem; line-height: 1; background: #fff; color: #243b5a; border: 1px solid #94a3b8;
  border-radius: 4px; cursor: pointer; vertical-align: middle; }
.rights-matrix .kolom-knop:focus-visible { outline: 3px solid #ffbf47; outline-offset: 1px; }
.rights-matrix th.rol .kolom-knop { float: right; }
.rights-matrix .ingeklapt { min-width: 2.2rem; max-width: 2.2rem; width: 2.2rem; padding-left: .2rem;
  padding-right: .2rem; overflow: hidden; }
.rights-matrix .ingeklapt .cel-inhoud { display: none; }
.rights-matrix th.ingeklapt .kolom-knop { float: none; }
.rights-matrix .herkomst { color: #6b21a8; font-weight: 600; }
.rights-matrix .std-keuze { display: block; width: 100%; margin-top: .3rem; font-size: .8rem; padding: .15rem; }
.rights-matrix .herstel-rol { display: block; margin-top: .2rem; padding: 0; min-height: 24px; font-size: .75rem;
  background: none; border: 0; color: #1d4ed8; text-decoration: underline; cursor: pointer; }
.rights-changes small { display: block; color: #475569; }
label.bevestig-gegevens { display: flex; align-items: flex-start; gap: .5rem; margin: .5rem 0; font-weight: 600; }
label.bevestig-gegevens input { width: auto; margin-top: .2rem; }
.kolomkeuze { flex-basis: 100%; }
.kolomkeuze summary { cursor: pointer; font-weight: 600; }
.kolomkeuze fieldset { display: inline-flex; flex-wrap: wrap; gap: .25rem .75rem; border: 1px solid #cbd5e1;
  border-radius: 6px; margin: .3rem .5rem .3rem 0; padding: .3rem .6rem; }
.kolomkeuze fieldset label { display: inline-flex; align-items: center; gap: .3rem; margin: 0; font-weight: 400;
  white-space: nowrap; }
.kolomkeuze input[type="checkbox"] { width: auto; margin: 0; }

/* ---------------------------------------------------------------------------
   Dashboard (2.0.6): rust en structuur. Eén kolom tekstbreedte, links uitgelijnd
   met het kruimelpad; witte vlakken met een dunne lijn; de accentkleur alleen
   voor de primaire actie. Drie tekstgroottes plus hulptekst, twee gewichten.
   --------------------------------------------------------------------------- */
.daily-dashboard { max-width: 64rem; }
.daily-dashboard h1, .daily-dashboard h2, .daily-dashboard h3 { color: var(--fg); font-weight: 600; }
.daily-dashboard h1 { font-size: var(--fs-title); margin: 0; }
.daily-dashboard h2 { font-size: var(--fs-section); margin: 0 0 var(--space-3); }
.daily-dashboard h3 { font-size: var(--fs-body); margin: 0; }
.daily-dashboard p { margin: 0; }
.daily-dashboard button { margin: 0; }
.dashboard-head { margin: var(--space-4) 0 var(--space-6); }
.welcome { color: var(--muted); font-size: var(--fs-body); margin: 0 0 var(--space-1); }
.dashboard-section { margin: 0 0 var(--space-8); }
/* Primaire actie: één wit vlak, geen kleurvlak of schaduw. */
.dashboard-question { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--space-6); }
.dashboard-question form label { margin: 0 0 var(--space-2); font-size: var(--fs-body); }
.dashboard-question textarea { display: block; width: 100%; max-width: none; min-height: 5.5rem;
  resize: vertical; background: var(--surface); }
.daily-dashboard .dashboard-question-example { margin: var(--space-2) 0 var(--space-4); color: var(--muted);
  font-size: var(--fs-small); }
.dashboard-question-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-4); }
.dashboard-question-actions button { padding: .55rem 1.1rem; font-weight: 600; }
/* Omgeving en uitleg op één regel boven de favorieten. */
.environment-choice { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-1); }
form.environment-choice label { margin: 0; }
p.environment-choice { display: block; }
.environment-choice select { width: auto; max-width: 100%; min-width: min(18rem, 100%); }
.dashboard-favorites > .hint { margin: 0 0 var(--space-6); }
.daily-dashboard .hint { color: var(--muted); font-size: var(--fs-small); }
/* Secundaire en tekstknoppen: geen concurrentie met de primaire actie. */
.daily-dashboard button.secondary { background: var(--surface); color: var(--primary); border: 1px solid var(--primary);
  padding: .35rem .8rem; font-size: var(--fs-small); }
.daily-dashboard button.link-button { background: none; border: 0; padding: .35rem .25rem; color: var(--primary);
  text-decoration: underline; font-size: var(--fs-small); }
.daily-dashboard button.secondary:hover, .daily-dashboard button.link-button:hover { background: #eef3f8; filter: none; }
.daily-dashboard button.favorite-remove { color: var(--danger); }
/* Favorietkaarten: vraag, één metaregel, acties. */
.daily-dashboard .favorite-grid { gap: var(--space-3); }
.daily-dashboard .favorite-card { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; }
.favorite-title { font-weight: 600; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; }
.favorite-text { overflow-wrap: anywhere; }
.favorite-meta { color: var(--muted); font-size: var(--fs-small); }
.daily-dashboard .favorite-actions { margin-top: auto; gap: var(--space-2); }
.daily-dashboard .personal-favorite .hint { margin: 0; }
.favorite-empty { color: var(--muted); }
.favorite-restore { margin-top: var(--space-3); }
.dashboard-history p { color: var(--muted); }
.dashboard-history a { margin-left: var(--space-1); }
@media (max-width: 640px) {
  .dashboard-question { padding: var(--space-4); }
  .dashboard-question-actions { align-items: stretch; flex-direction: column; gap: var(--space-3); }
  .dashboard-question-actions button { width: 100%; }
  .environment-choice select { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .daily-dashboard * { transition: none !important; }
}
