/* style.css - basis + componenten voor Wouters Inspectierapporten.
 * Gebruikt uitsluitend de tokens uit tokens.css (link tokens.css EERST).
 * Modern 2026, mobile-first (toetsbaar op 375px, tap targets >= 44px). Zie ai-docs/design-system.md.
 */

/* ---------- Reset / basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Het hidden-attribuut wint altijd, ook van componentklassen met een eigen display (bv. .btn, .badge). */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-tint);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Inter: open cijfers/letters (cv05/cv11/ss01) voor een rustig, professioneel beeld */
  font-feature-settings: "cv05" 1, "cv11" 1, "ss01" 1, "tnum" 0;
  font-variant-numeric: proportional-nums;
}
::selection { background: var(--accent-soft); color: var(--accent-press); }
h1, h2, h3 { line-height: var(--lh-tight); margin: 0 0 var(--sp-3); color: var(--text); text-wrap: balance; }
h1 { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.015em; }
h3 { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.01em; }
/* Getallen die je vergelijkt (kengetallen, nummers, datums) staan tabellair */
.tnum, .stat-getal, .table td, .insp-card-meta, .lijst-teller { font-variant-numeric: tabular-nums; }
p { margin: 0 0 var(--sp-3); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-1); }
.muted { color: var(--text-muted); }
/* Onzichtbaar maar bereikbaar (screenreader-tekst, file-input achter een label, aria-live) */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Layout ---------- */
/* App-shell: vaste sidebar + hoofdgebied (zoals de portal/GetATable-chrome). */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.app-main { min-width: 0; display: flex; flex-direction: column; background: var(--bg); }

/* Sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 50;
  display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden;
  background: var(--surface); border-right: 1px solid var(--border);
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
/* Logo-balk exact even hoog als de topbar -> de scheidingslijnen lopen door in een lijn.
   Linkerinspring = die van de nav-iconen (sidebar-nav sp-2 + nav-item sp-3) zodat het logo
   met de navigatie uitlijnt. */
.sidebar-top { display: flex; align-items: center; height: var(--topbar-h); padding: 0 calc(var(--sp-2) + var(--sp-3)); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sidebar-brand { display: flex; align-items: center; }
.sidebar-brand .logo { display: block; width: auto; height: 38px; max-width: 100%; background: var(--logo-plate); border-radius: var(--r-1); }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: var(--sp-3) var(--sp-3); }
.nav-section { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-subtle); padding: var(--sp-4) var(--sp-3) var(--sp-1); }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--control-min); padding: 0 var(--sp-3);
  border-radius: var(--r-1); border: none; background: none; width: 100%;
  color: var(--text-muted); font: inherit; font-size: var(--fs-sm); font-weight: 550;
  text-align: left; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.nav-item svg { flex-shrink: 0; width: 19px; height: 19px; color: var(--text-subtle); transition: color var(--dur-1) var(--ease); }
.nav-item:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav-item:hover svg { color: var(--text); }
/* Actief: gouden markering links + zachte plaat; het icoon kleurt mee */
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav-item.active svg { color: var(--accent); }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: var(--r-pill); background: var(--accent);
}
.nav-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nav-item--subtle { color: var(--text-subtle); }
.sidebar-footer { flex-shrink: 0; padding: var(--sp-3) var(--sp-3); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.user-card { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-1); }
.user-info { min-width: 0; display: flex; flex-direction: column; }
.user-name { font-size: var(--fs-sm); font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: var(--fs-xs); color: var(--text-muted); text-transform: capitalize; }

/* Slanke hoofd-topbar: hamburger (mobiel) + titel links, thema rechts */
.app-topbar {
  position: sticky; top: 0; z-index: 40; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  height: var(--topbar-h); padding: 0 var(--sp-6);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.5) blur(12px); -webkit-backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid var(--border);
}
.app-topbar-left { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.app-topbar-right { display: flex; align-items: center; gap: var(--sp-1); flex-shrink: 0; }
.app-title { font-size: var(--fs-base); font-weight: 650; letter-spacing: -0.01em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hamburger { display: none; align-items: center; justify-content: center; width: var(--control-min); min-height: var(--control-min); padding: 0; border: none; background: none; color: var(--text-muted); border-radius: var(--r-1); cursor: pointer; }
.hamburger svg { width: 22px; height: 22px; }
.hamburger:hover { background: var(--surface-hover); color: var(--text); }
.app-overlay { display: none; position: fixed; inset: 0; z-index: 45; background: rgba(9,18,32,.5); backdrop-filter: blur(2px); }
.app-overlay.visible { display: block; }

.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(145deg, var(--accent-soft), color-mix(in srgb, var(--accent) 22%, var(--surface)));
  color: var(--accent); font-weight: 700; font-size: var(--fs-sm); flex: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* Mobiel: sidebar wordt een off-canvas lade met overlay */
@media (max-width: 860px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; left: 0; width: 264px; height: 100vh;
    transform: translateX(-100%); transition: transform var(--dur-2) var(--ease);
    z-index: 200; box-shadow: var(--shadow-3);
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: flex; }
}
/* Content vult het hoofdgebied naast de sidebar (zoals portal/GetATable), links
   uitgelijnd met de topbar - niet gecentreerd. Zijpadding = topbar-padding. */
.content { max-width: none; margin: 0; padding: var(--sp-6) var(--sp-6) var(--sp-8); }
/* Werkruimte-content (detail/preview) leest prettiger met een bovengrens op de leesbreedte */
/* Rapport-preview blijft op leesbreedte; de inspectie-werkruimte vult de volle
   app-breedte (zoals de overzichten), zodat de wizard + zijpaneel de ruimte benutten. */
.content.rp-content { max-width: var(--content-max); }
.page-header { display: flex; align-items: flex-end; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-6); }
.page-header .titles { flex: 1; min-width: 220px; }
.page-header h1 { margin: 0; }
.page-header .lead { color: var(--text-muted); font-size: var(--fs-base); margin: var(--sp-2) 0 0; max-width: 62ch; }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
/* Rapport-preview: downloadknop + toelichting als een blok, knoppen bovenaan uitgelijnd */
.rp-no-print.page-actions { align-items: flex-start; }
.page-actions .rapport-download-container { display: flex; flex-direction: column; align-items: flex-end; }
.page-actions .rapport-download-container .form-note { font-size: var(--fs-xs); max-width: 36ch; text-align: right; }

/* ---- Broodkruimel ---- */
.breadcrumb {
  display: flex; align-items: center; flex-wrap: nowrap; overflow: hidden;
  font-size: var(--fs-sm); margin-bottom: var(--sp-2); padding: 0; list-style: none; gap: 0;
}
.breadcrumb a {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--accent); text-decoration: none; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; max-width: 40%;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .breadcrumb-item {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text-muted); flex-shrink: 1; min-width: 0; max-width: 35%;
}
.breadcrumb .breadcrumb-item[aria-current="page"] { color: var(--text); font-weight: 500; flex-shrink: 2; }
.breadcrumb-sep {
  flex-shrink: 0; color: var(--text-subtle); padding: 0 var(--sp-2);
  display: inline-flex; align-items: center;
}
.breadcrumb-sep::before { content: '\203A'; font-size: 1.1em; line-height: 1; }

.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-3); }
/* Toolbar boven een lijst (filter/zoek); scheidingslijn naar de tabel */
.list-toolbar { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface-alt) 55%, var(--surface)); border-radius: var(--r-2) var(--r-2) 0 0; }
.list-toolbar .field { margin-bottom: 0; }
/* Filter-controls staan op EEN lijn: het label leeft voor screenreaders (for=), niet als tekst erboven */
.list-toolbar .field > label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.list-toolbar select { min-width: min(260px, 70vw); }
.list-toolbar input[type="search"] {
  min-width: min(220px, 70vw); padding-left: calc(var(--sp-3) + 18px + var(--sp-2));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238091a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 12px center; background-size: 17px;
}
.list-toolbar input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.lijst-teller { margin: 0; padding: var(--sp-2) var(--sp-5) 0; font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- Knoppen ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; padding: 0 var(--sp-4); border: 1px solid transparent; border-radius: var(--r-1);
  font: inherit; font-weight: 600; font-size: var(--fs-sm); letter-spacing: -0.005em;
  cursor: pointer; white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), transform 60ms var(--ease), box-shadow var(--dur-1) var(--ease);
  user-select: none;
}
.btn svg { flex: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, white) 0%, var(--accent) 100%);
  color: var(--accent-contrast);
  box-shadow: 0 1px 2px rgba(15,35,56,.14), inset 0 1px 0 rgba(255,255,255,.16);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 60%, transparent), 0 2px 6px rgba(15,35,56,.08); transform: translateY(-1px); }
.btn-primary:active { background: var(--accent-press); transform: translateY(0); box-shadow: var(--shadow-1); }
.btn-primary:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-1); }
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn-subtle { background: var(--surface-alt); color: var(--text); }
.btn-subtle:hover { background: var(--surface-hover); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); }
.btn-sm { min-height: var(--control-min); padding: 0 var(--sp-3); font-size: var(--fs-xs); }
.btn-icon { min-height: var(--control-min); width: var(--control-min); padding: 0; }
.btn-block { width: 100%; }

/* ---------- Kaarten ---------- */
/* Hairline + zachte schaduw; de kaart is de rustige drager, nooit een kleurvlak */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-2);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: var(--sp-5); }

/* ---------- Formulieren ---------- */
.field { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-4); }
.field > label { font-size: var(--fs-sm); font-weight: 600; color: var(--text); letter-spacing: -0.005em; }
.field .hint { font-size: var(--fs-xs); color: var(--text-subtle); }
/* "(optioneel)" en dergelijke: rustig naast het label, nooit een tweede kleur/gewicht */
.opt { font-weight: 400; font-size: var(--fs-xs); color: var(--text-subtle); }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; font-size: 16px;
  color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-1); box-shadow: inset 0 1px 2px rgba(15, 35, 56, 0.03);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease);
}
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: var(--text-subtle); }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238091a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 38px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--sp-4); }
.form-grid .col-2 { grid-column: 1 / -1; }
.field-error { color: var(--danger); font-size: var(--fs-xs); margin-top: var(--sp-1); }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { text-align: left; padding: 14px var(--sp-5); border-bottom: 1px solid var(--border); vertical-align: middle; }
/* Lange tokens (bv. een naam zonder spaties) breken in de cel i.p.v. alle kolommen uit beeld te duwen;
   koppen blijven op EEN regel en de eerste kolom houdt een leesbare minimumbreedte. */
.table td { overflow-wrap: anywhere; }
.table th { white-space: nowrap; }
.table .primary-cell { min-width: 18ch; }
.table th { padding-top: var(--sp-3); padding-bottom: var(--sp-3); font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-subtle); background: transparent; }
.table thead th { border-bottom-color: var(--border-strong); }
.table tbody tr { transition: background-color var(--dur-1) var(--ease); }
.table tbody tr:hover { background: var(--surface-alt); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .cell-actions { text-align: right; white-space: nowrap; padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
.table .primary-cell { font-weight: 600; color: var(--text); font-size: var(--fs-base); }
/* Klikbare rij (lijst -> detail): hele rij is de affordance, geen losse link */
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--surface-hover); transition: background-color var(--dur-1) var(--ease); }
.clickable-row:active { background: var(--surface-hover); }
.clickable-row:focus-visible { outline: none; box-shadow: var(--focus-ring-inset); }
.clickable-row:hover .primary-cell { color: var(--accent); }
/* Sublabel onder een primaire cel (bv. opdrachtgever onder object) */
.cell-sub { display: block; margin-top: 1px; font-size: var(--fs-xs); color: var(--text-muted); }
/* Tekstcel meerdere-regels-clamp: volledige tekst in DOM (screenreader), visueel afgekapt op 2 regels (AC6.4) */
.cell-rt { vertical-align: 2px; margin-left: 2px; }
.cell-clamp { display: -webkit-box; min-width: 12ch; max-width: 44ch; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.45; }
.deelinstallatie-sectie .table th, .deelinstallatie-sectie .table td { padding: 10px var(--sp-3); }
.deelinstallatie-sectie .table .primary-cell { font-size: var(--fs-sm); }
.deelinstallatie-sectie .table .cell-actions { padding-left: var(--sp-1); padding-right: var(--sp-2); }
/* Rij-highlight bij landing op ?id= (tijdelijk ~4s); inset box-shadow = linkerborder zonder layout-shift (AC4 WCAG 1.4.1) */
.row-highlight { background: var(--accent-soft) !important; box-shadow: inset 3px 0 0 var(--accent); }
/* Eerste kolom-thumbnail netjes inspringen */
.cell-thumb { padding-left: var(--sp-5); padding-right: 0; width: 52px; }
.logo-thumb { width: 36px; height: 36px; border-radius: var(--r-1); object-fit: cover; border: 1px solid var(--border); background: var(--surface-alt); }
.logo-thumb--empty { display: inline-flex; align-items: center; justify-content: center; color: var(--text-subtle); }

/* ---------- Badges / labels ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px;
  border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.01em;
  background: var(--surface-alt); color: var(--text-muted); white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-sm { height: auto; min-height: 1.4em; padding: 0 7px; font-size: var(--fs-xs); }

/* ---------- Alerts ---------- */
.alert { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-1); font-size: var(--fs-sm); border: 1px solid transparent; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }

/* ---------- Dirty-guard keuzestrip (bevinding-modal) ---------- */
.keuzestrip { background: var(--warning-soft); color: var(--warning); border: 1px solid color-mix(in srgb, var(--warning) 25%, transparent); border-radius: var(--r-1); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); }
.keuzestrip-vraag { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); }
.keuzestrip-knoppen { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.keuzestrip-knoppen .btn { flex: 1 1 auto; min-width: 120px; min-height: 44px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: var(--sp-8) var(--sp-4); color: var(--text-muted); }
.empty .empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; margin: 0 auto var(--sp-4); border-radius: 50%; background: var(--surface-alt); color: var(--text-subtle); }
.empty .empty-icon svg { width: 28px; height: 28px; }
.empty h3 { color: var(--text); margin-bottom: var(--sp-1); }
.empty p { margin: 0 auto var(--sp-4); max-width: 44ch; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  padding: 0; background: rgba(9, 18, 32, .5); backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility .18s ease;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-3) var(--r-3) 0 0; box-shadow: var(--shadow-3);
  transform: translateY(24px); transition: transform var(--dur-2) var(--ease);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-5) var(--sp-5) var(--sp-3); }
.modal-header h2 { margin: 0; flex: 1; min-width: 0; font-size: var(--fs-xl); }
.modal-body { padding: 0 var(--sp-5) var(--sp-4); }
.modal-footer { display: flex; gap: var(--sp-2); justify-content: flex-end; padding: var(--sp-4) var(--sp-5) var(--sp-5); position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); }
/* Rustig sluit-kruisje in de modal-kop (vervangt tekst-x knop) */
.modal-close {
  display: inline-grid; place-items: center; width: var(--control-min); min-height: var(--control-min); flex: none; flex-shrink: 0; padding: 0;
  border: none; border-radius: var(--r-1); background: none; color: var(--text-subtle); cursor: pointer;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.modal-close:hover { background: var(--surface-hover); color: var(--text); }
.modal-close:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.modal-close svg { width: 18px; height: 18px; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; left: 0; right: 0; bottom: var(--sp-5); display: flex; justify-content: center; z-index: 60; pointer-events: none; padding: 0 var(--sp-4); }
.toast {
  pointer-events: auto; display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-pill); background: var(--brand-strong); color: #fff;
  box-shadow: var(--shadow-2); font-size: var(--fs-sm); font-weight: 550;
  transform: translateY(12px); opacity: 0; transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.toast.toast-undo { border-radius: var(--r-2); }
:root[data-theme="dark"] .toast { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.toast-error { background: var(--danger); color: #fff; }

/* Undo-toast (role=alertdialog, interactief contract naast passieve App.toast) */
.toast.toast-undo {
  max-width: min(480px, 92vw); flex-direction: row; flex-wrap: nowrap; gap: var(--sp-3);
  align-items: center;
}
.toast-undo-tekst { flex: 1; font-size: var(--fs-sm); }
.toast-undo-knop {
  flex: none; min-height: 44px; padding: 0 var(--sp-3);
  background: rgba(255,255,255,0.13); border: 1px solid rgba(255,255,255,0.38);
  border-radius: var(--r-1); color: inherit;
  font: inherit; font-size: var(--fs-sm); font-weight: 650;
  cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center;
  transition: background var(--dur-1) var(--ease);
}
.toast-undo-knop:hover { background: rgba(255,255,255,0.26); }
.toast-undo-knop:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255,255,255,0.52); }
/* Donker thema: toast heeft lichte achtergrond, knop als ghost */
:root[data-theme="dark"] .toast.toast-undo .toast-undo-knop {
  background: var(--surface-hover); border-color: var(--border-strong); color: var(--text);
}
:root[data-theme="dark"] .toast.toast-undo .toast-undo-knop:hover { background: var(--surface); }
:root[data-theme="dark"] .toast.toast-undo .toast-undo-knop:focus-visible {
  box-shadow: var(--focus-ring);
}

/* ---------- Auth (login) - intranet: navy achtergrond met waterlijnen, EEN kaart ----------
   Geen marketing, geen tekst behalve wat nodig is. De achtergrond is in beide thema's navy/goud
   (vaste kleuren, de kaart volgt het thema). Motion respecteert prefers-reduced-motion. */
body.auth {
  position: relative; isolation: isolate; margin: 0;
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-rows: 1fr auto; place-items: center; gap: var(--sp-4);
  padding: var(--sp-6) var(--sp-4) var(--sp-5);
  color: #eef3fa;
  background:
    radial-gradient(760px 460px at 85% 0%, rgba(215, 169, 74, 0.20) 0%, rgba(215, 169, 74, 0) 62%),
    radial-gradient(900px 620px at 0% 100%, rgba(41, 96, 146, 0.55) 0%, rgba(41, 96, 146, 0) 60%),
    linear-gradient(160deg, #0a2038 0%, #10355a 58%, #0d2c4a 100%);
}
.auth-waves { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.auth-waves path { fill: none; stroke: rgba(215, 169, 74, 0.32); stroke-width: 1.25; vector-effect: non-scaling-stroke; }
.auth-waves-drift--slow path { stroke: rgba(207, 224, 245, 0.16); }
@keyframes auth-drift { from { transform: translateX(0); } to { transform: translateX(-60px); } }
.auth-waves-drift { animation: auth-drift 16s ease-in-out infinite alternate; }
.auth-waves-drift--slow { animation-duration: 26s; animation-direction: alternate-reverse; }
@media (prefers-reduced-motion: reduce) { .auth-waves-drift { animation: none; } }

.auth-theme { position: fixed; top: var(--sp-4); right: var(--sp-4); background: rgba(255,255,255,0.10); color: #eef3fa; border: 1px solid rgba(255,255,255,0.14); }
.auth-theme:hover { background: rgba(255,255,255,0.18); }
.auth-theme:focus-visible { outline: none; box-shadow: 0 0 0 2px #0a2038, 0 0 0 4px #e2b75a; }

.auth-card {
  width: min(420px, 100%);
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--r-3); box-shadow: var(--shadow-3);
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
}
@media (min-width: 640px) { .auth-card { padding: var(--sp-7) var(--sp-7) var(--sp-6); } }
@keyframes auth-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.auth-card { animation: auth-rise 420ms var(--ease) both; }
@media (prefers-reduced-motion: reduce) { .auth-card { animation: none; } }
.auth-logo { display: flex; justify-content: center; margin-bottom: var(--sp-6); }
.auth-logo img {
  display: block; height: 60px; width: auto; max-width: 100%;
  background: var(--logo-plate); padding: var(--sp-1) var(--sp-2); border-radius: var(--r-1);
}
.auth-card h1 { font-size: var(--fs-xl); letter-spacing: var(--tracking-tight); margin: 0 0 var(--sp-5); text-align: center; }
/* Veld met leidend Lucide-icoon; wachtwoordveld met toon/verberg-knop (44px tap target) */
.auth-field { position: relative; }
.auth-field .auth-ico {
  position: absolute; left: var(--sp-3); top: 50%; transform: translateY(-50%);
  display: flex; color: var(--text-subtle); pointer-events: none; transition: color var(--dur-1) var(--ease);
}
.auth-field:focus-within .auth-ico { color: var(--accent); }
.auth-field .auth-ico svg { width: 18px; height: 18px; }
.auth-field input { padding-left: calc(var(--sp-3) + 18px + var(--sp-2)); min-height: 48px; }
.auth-field--pw input { padding-right: calc(var(--control-min) + var(--sp-1)); }
.auth-pw-toggle {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: var(--control-min); height: var(--control-min);
  border: 0; border-radius: var(--r-1); background: transparent; color: var(--text-subtle); cursor: pointer;
}
.auth-pw-toggle:hover { color: var(--text); background: var(--surface-alt); }
.auth-pw-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.auth-pw-toggle svg { width: 20px; height: 20px; }
.auth-pw-toggle .ico-eye-off { display: none; }
.auth-pw-toggle[aria-pressed="true"] .ico-eye { display: none; }
.auth-pw-toggle[aria-pressed="true"] .ico-eye-off { display: block; }
.auth-hint { margin: var(--sp-1) 0 0; font-size: var(--fs-xs); color: var(--warning); font-weight: 600; }
.auth-submit { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); margin-top: var(--sp-2); min-height: 50px; font-size: var(--fs-base); }
.auth-submit svg { width: 18px; height: 18px; transition: transform var(--dur-2) var(--ease); }
.auth-submit:hover svg { transform: translateX(3px); }
.auth-card .alert { margin: 0 0 var(--sp-3); }
.auth-foot { margin: 0; font-size: var(--fs-xs); letter-spacing: 0.02em; color: rgba(238, 243, 250, 0.6); text-align: center; }

/* ---------- Foto-upload grid (story: fotos-bulk-upload-verkleinen-nummeren) ---------- */
.foto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(148px, 100%), 1fr));
  gap: var(--sp-2);
  list-style: none;
  padding: 0;
  margin: 0;
}
.foto-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-1);
  overflow: hidden;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.foto-item[data-status="klaar"]:hover { box-shadow: var(--shadow-2); border-color: var(--border-strong); }
.foto-item img.foto-thumb {
  display: none;
  width: 100%; height: 100%;
  object-fit: cover;
}
.foto-item[data-status="klaar"] img.foto-thumb { display: block; }
.foto-item[data-status="klaar"] .foto-overlay  { display: none; }
.foto-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--sp-1); padding: var(--sp-2);
}
.foto-item[data-status="wachten"] .foto-overlay { background: var(--surface-alt); color: var(--text-muted); }
.foto-item[data-status="bezig"]   .foto-overlay { background: var(--accent-soft); color: var(--accent); }
.foto-item[data-status="mislukt"] .foto-overlay { background: var(--danger-soft); color: var(--danger); }
.foto-status-tekst  { font-size: var(--fs-xs); font-weight: 600; text-align: center; line-height: 1.3; }
.foto-status-error  { font-size: var(--fs-xs); text-align: center; word-break: break-word; line-height: 1.3; }
.foto-retry-btn {
  margin-top: auto; width: 100%; min-height: 44px; padding: 0 var(--sp-2);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-radius: var(--r-1); color: var(--danger);
  font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.foto-retry-btn:hover { background: color-mix(in srgb, var(--danger) 20%, transparent); }
.foto-nummer-badge {
  position: absolute; top: var(--sp-1); left: var(--sp-1);
  min-width: 22px; height: 22px; padding: 0 6px;
  background: var(--brand); color: var(--surface); /* --surface: wit op navy (licht), donker op lichtblauw (donker) */
  font-size: var(--fs-xs); font-weight: 700; border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
/* Subtiele opnamedatum (EXIF), onder de nummer-badge zodat cover (rechtsboven) en
   herorden-knoppen (onder) vrij blijven. Donker-transparant: leesbaar over elke foto,
   themaonafhankelijk want het ligt op de afbeelding zelf. */
.foto-datum {
  position: absolute; top: calc(var(--sp-1) + 26px); left: var(--sp-1);
  max-width: calc(100% - var(--sp-1) * 2);
  padding: 2px 6px; border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.55); color: #fff;
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.25; letter-spacing: 0.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none; z-index: 2;
}
/* "Geen datum" badge voor foto's zonder EXIF-opnamedatum, zichtbaar naast foto's
   die wel een datum hebben (bijwerkGeenDatumBadges() in fotos-sorteren.js). */
.foto-geen-datum-badge {
  position: absolute; top: calc(var(--sp-1) + 26px); left: var(--sp-1);
  padding: 2px 6px; border-radius: var(--r-pill);
  background: var(--warning-soft); color: var(--warning);
  font-size: var(--fs-xs); font-weight: 700; line-height: 1.25; letter-spacing: 0.2px;
  white-space: nowrap;
  pointer-events: none; z-index: 2;
  border: 1px solid currentColor;
}
/* Upload voortgangsbalk */
.upload-progress-bar {
  height: 6px; border-radius: var(--r-pill); background: var(--border); overflow: hidden;
}
.upload-progress-fill {
  height: 100%; background: var(--accent); transition: width 0.3s ease; width: 0%;
}

/* Foto-selectie label als knop */
.foto-upload-label {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 44px; padding: 0 var(--sp-4);
  background: var(--accent); color: var(--accent-contrast);
  border: 1px solid transparent; border-radius: var(--r-1);
  font: inherit; font-weight: 600; font-size: var(--fs-sm);
  cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-1);
  user-select: none;
}
.foto-upload-label:hover { background: var(--accent-hover); }
.foto-upload-label[data-disabled="true"] { opacity: .55; cursor: not-allowed; pointer-events: none; }

/* ---------- Foto verwijderen - compound top-left + verwijderknop ---------- */
/* Wrapper voor nummerbadge + verwijderknop als flex-rij linksbovenaan.       */
.foto-compound-tl {
  position: absolute; top: var(--sp-1); left: var(--sp-1);
  display: flex; align-items: center; gap: 2px; z-index: 2;
}
/* Override: badge is relative binnen de compound rij (niet meer zelf absolute); ::before geeft
   de interactieve badge een onzichtbare tapzone van 44x44 rond de 22px-pill. */
.foto-compound-tl .foto-nummer-badge { position: relative; }
button.foto-nummer-badge[data-badge-mode="interactief"]::before { content: ""; position: absolute; inset: -11px; }
/* ---------- Coverfoto aanwijzen (story: coverfoto-aanwijzen) ---------- */
.foto-cover-badge {
  position: absolute; top: var(--sp-1); right: var(--sp-1);
  display: flex; align-items: center; gap: 3px;
  padding: 3px 6px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-contrast);
  font-size: var(--fs-xs); font-weight: 700; line-height: 1;
  pointer-events: none; z-index: 2;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.foto-cover-badge svg { flex-shrink: 0; }
.foto-cover-hint {
  margin-top: var(--sp-3); font-size: var(--fs-sm);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-1);
  background: var(--surface-alt); color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ---------- Foto-herordenen (story: foto-volgorde-herordenen) ---------- */
/* Herorden-knoppen staan BOVEN de deelinstallatie-chip (die neemt de onderrand); op muisapparaten
   verschijnen ze bij hover/focus (visibility, dus onzichtbaar = niet klikbaar en de lightbox-klik
   blijft vrij), op touch-apparaten staan ze altijd. */
.foto-herorden-knoppen {
  position: absolute; bottom: 52px; left: 0; right: 0; z-index: 2;
  display: flex; flex-direction: row; gap: 0; padding: var(--sp-1);
  background: linear-gradient(to top, rgba(0,0,0,0.42) 0%, transparent 100%);
  visibility: hidden; opacity: 0; transition: opacity var(--dur-1) var(--ease), visibility var(--dur-1);
}
.foto-item:hover .foto-herorden-knoppen,
.foto-item:focus-within .foto-herorden-knoppen { visibility: visible; opacity: 1; }
@media (hover: none) { .foto-herorden-knoppen { visibility: visible; opacity: 1; } }
/* Kaart zonder chip (nog geen data-foto-id/geen wrap): knoppen gewoon onderaan */
.foto-item:not(:has(.foto-assign-wrap)) .foto-herorden-knoppen { bottom: 0; }
.foto-herorden-omhoog,
.foto-herorden-omlaag {
  flex: 1; min-height: 44px; padding: 0; margin: 0;
  background: var(--surface); opacity: 0.92;
  border: 1px solid var(--border); color: var(--text);
  font: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, opacity 0.12s;
}
.foto-herorden-omhoog { border-radius: var(--r-1) 0 0 var(--r-1); }
.foto-herorden-omlaag { border-radius: 0 var(--r-1) var(--r-1) 0; border-left: none; }
.foto-herorden-omhoog:hover:not(:disabled),
.foto-herorden-omlaag:hover:not(:disabled) { opacity: 1; background: var(--surface-hover); }
/* Disabled: gedempt, maar tap-target blijft >= 44px op mobiel */
.foto-herorden-omhoog:disabled,
.foto-herorden-omlaag:disabled { opacity: 0.38; cursor: not-allowed; min-width: 44px; min-height: 44px; }
.foto-herorden-omhoog:focus-visible,
.foto-herorden-omlaag:focus-visible { outline: none; box-shadow: var(--focus-ring); z-index: 1; position: relative; }

/* Drag-and-drop - handle (desktop only), dragging state, drop indicators */
.foto-drag-handle {
  display: none;
  position: absolute; top: var(--sp-1); right: var(--sp-1);
  width: 26px; height: 26px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-1);
  align-items: center; justify-content: center;
  color: var(--text-muted); cursor: grab; opacity: 0;
  transition: opacity 0.15s;
}
@media (min-width: 640px) {
  .foto-drag-handle { display: flex; }
  .foto-item[data-foto-id]:hover .foto-drag-handle { opacity: 1; }
  /* Rechtsboven deelt de sleepgreep de hoek met de Cover-badge (en de bulk-checkbox): schuif de
     greep onder de badge zodat ze elkaar niet overlappen (badge ~24px hoog + marge). */
  .foto-item:has(.foto-cover-badge) .foto-drag-handle { top: calc(var(--sp-1) * 2 + 24px); }
  .foto-item:has(.foto-cover-badge) .foto-bulk-check { top: calc(var(--sp-1) * 2 + 24px); }
  [data-selectiemodus] .foto-item:has(.foto-cover-badge) .foto-bulk-check { top: var(--sp-1); }
  .foto-item[data-foto-id][draggable="true"] { cursor: default; }
  .foto-item[data-dragging] { opacity: 0.52; box-shadow: var(--shadow-2); }
  .foto-item[data-drop-before] { box-shadow: inset 3px 0 0 var(--accent); }
  .foto-item[data-drop-after]  { box-shadow: inset -3px 0 0 var(--accent); }
}

/* ---------- Nummerbadge als knop (story: foto-positie-popover) ---------- */
/* Reset browser-button-stijlen; de .foto-nummer-badge-regels hierboven geven de look. */
button.foto-nummer-badge {
  border: none;
  font: inherit;
  cursor: default;
  /* Tapzone >= 44x44 px via ::before (zie .foto-compound-tl); de badge zelf houdt pill-afmeting. */
}
/* Interactieve staat: accent-outline als affordance (AC1.1). */
button.foto-nummer-badge[data-badge-mode="interactief"] {
  cursor: pointer;
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
button.foto-nummer-badge[data-badge-mode="interactief"]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
/* Niet-interactieve staat: gedempt, geen pointer (AC1.3). */
button.foto-nummer-badge[data-badge-mode="inactief"] {
  opacity: .7;
  cursor: default;
  pointer-events: none;
}

/* ---------- Positie-popover (story: foto-positie-popover) ---------- */
.foto-positie-popover {
  width: min(280px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  box-shadow: var(--shadow-2);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  /* position/top/left/z-index gezet via JS */
}
.popover-positie-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}
.popover-positie-veld {
  width: 100%;
  font-size: 16px; /* >= 16px voorkomt iOS-zoom (AC mobiel) */
  font-family: inherit;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
}
.popover-positie-veld:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.popover-positie-helper {
  font-size: var(--fs-xs);
  color: var(--text-subtle);
  margin: 0;
}
.popover-positie-fout {
  font-size: var(--fs-xs);
  color: var(--danger);
  margin: 0;
}
.popover-verplaats-knop {
  width: 100%;
  min-height: 44px; /* tap-target >= 44px (AC mobiel) */
  justify-content: center;
}
.popover-post-fout {
  margin: 0;
  font-size: var(--fs-xs);
}

/* ---------- Foto-lightbox (story: foto-lightbox-groot-formaat) ---------- */
/* Transparante trigger-knop over de thumbnail; achter de andere controls via DOM-volgorde. */
.foto-lightbox-btn {
  position: absolute;
  inset: 0;
  background: transparent;
  border: none;
  cursor: zoom-in;
  padding: 0;
}
.foto-lightbox-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-inset);
}

/* Fullscreen native <dialog>; backdrop via ::backdrop pseudo-element. */
dialog.foto-lightbox {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  border: none;
  background: transparent;
  overflow: hidden;
}
dialog.foto-lightbox::backdrop {
  background: rgba(9, 18, 32, 0.90);
  backdrop-filter: blur(2px);
}

/* Inner wrapper: centreert inhoud verticaal en horizontaal. */
.foto-lightbox-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  box-sizing: border-box;
}

/* Sluitknop: rechtsboven, aligned to flex-end. */
.foto-lightbox-sluit {
  align-self: flex-end;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  border-radius: var(--r-1);
  cursor: pointer;
  transition: background 0.12s;
  font: inherit;
}
.foto-lightbox-sluit:hover { background: rgba(255, 255, 255, 0.22); }
.foto-lightbox-sluit:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Foto-zone: houdt skeleton, img en fout-staat. */
.foto-lightbox-zone {
  width: min(92vw, 800px);
  max-height: min(60vh, 560px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Skeleton: zichtbaar tijdens laden van het derivaat. */
.foto-lightbox-skeleton {
  width: min(92vw, 800px);
  height: min(60vh, 400px);
  border-radius: var(--r-1);
}

/* Afbeelding: AC5.2 - object-fit: contain, max-breedte 92vw (375px -> 345px). */
.foto-lightbox-img {
  max-width: min(92vw, 800px);
  max-height: min(60vh, 560px);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: var(--r-1);
}

/* Inline fout-staat bij 404/timeout: nav-knoppen blijven functioneel (AC5.1). */
.foto-lightbox-fout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(92vw, 800px);
  height: min(60vh, 400px);
  color: rgba(255, 255, 255, 0.75);
  font-size: var(--fs-sm);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--r-1);
  background: rgba(255, 255, 255, 0.05);
}
.foto-lightbox-fout p { margin: 0; }

/* ---------- Lightbox actiebalk (story: fotokaart-opruimen-verwijder-cover-lightbox) ---------- */
.foto-lightbox-acties {
  width: min(92vw, 800px);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.foto-lightbox-acties-knoppen {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
}
.foto-lightbox-acties-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  border-radius: var(--r-1);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-sm);
  transition: background 0.12s, opacity 0.12s;
}
.foto-lightbox-acties-btn:hover:not([aria-disabled="true"]) { background: rgba(255, 255, 255, 0.22); }
.foto-lightbox-acties-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.foto-lightbox-acties-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
/* Cover-knop: is-cover staat - gevuld ster, vet label; kleur-onafhankelijke drager (contrast >= 4.5:1). */
.foto-lightbox-cover-btn.is-cover {
  border-color: rgba(215, 169, 74, 0.70);
  font-weight: 700;
}
/* Verwijder-knop: links (weg van 'Als cover'), altijd rood herkenbaar; rode hover voor destructieve actie. */
.foto-lightbox-verwijder-btn { margin-right: auto; order: -1; color: #ffb9b3; border-color: rgba(242, 131, 123, 0.45); }
.foto-lightbox-verwijder-btn:hover:not([aria-disabled="true"]) {
  background: rgba(204, 59, 49, 0.30);
  border-color: rgba(204, 59, 49, 0.60);
  color: #fff;
}
/* Inline alert-error in de actiebalk (donkere achtergrond). */
.foto-lightbox-acties-fout {
  font-size: var(--fs-sm);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-1);
  background: rgba(204, 59, 49, 0.22);
  color: #ffbdba;
  border: 1px solid rgba(204, 59, 49, 0.45);
}

/* Navigatiebalk: prev | infoband | next. Duimzone: knoppen >= 44px (AC3.2). */
.foto-lightbox-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: min(92vw, 800px);
}
.foto-lightbox-info {
  flex: 1;
  text-align: center;
  color: #fff;
  font-size: var(--fs-sm);
  line-height: var(--lh);
}
.foto-lightbox-nav-btn {
  flex-shrink: 0;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  border-radius: var(--r-1);
  cursor: pointer;
  transition: background 0.12s, opacity 0.12s;
  font: inherit;
}
.foto-lightbox-nav-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.22); }
.foto-lightbox-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.foto-lightbox-nav-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---------- Hulp / responsief ---------- */
@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: var(--sp-5); }
  .modal { border-radius: var(--r-3); transform: translateY(12px) scale(.985); }
  .modal-overlay.open .modal { transform: none; }
}
/* Smalle modal (bevestigingen, korte formulieren) */
.modal-sm { max-width: min(480px, 92vw); }
/* Gereedheidscheck-modal: fout onder de checklist, footer met meerdere knoppen die mogen omslaan */
.gh-modal-fout { margin: 0 var(--sp-5) var(--sp-3); }
.gh-modal-footer { flex-wrap: wrap; gap: var(--sp-2); }
@media (max-width: 620px) {
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: var(--sp-5) var(--sp-4) var(--sp-7); }
  .app-topbar { padding: 0 var(--sp-3) 0 var(--sp-2); }
  .list-toolbar { padding: var(--sp-3) var(--sp-4); }
  .table th, .table td { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .cell-thumb { padding-left: var(--sp-4); }
  /* Fotogrid op smal scherm: altijd twee kolommen; iets hogere kaart zodat chip + herorden-knoppen passen */
  .foto-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foto-item { aspect-ratio: 4 / 5; }
  h1 { font-size: 24px; }
  .hide-sm { display: none !important; }
}

/* ---------- Deelinstallatie-secties (story: bevinding-beheer) ---------- */
.deelinstallatie-sectie {
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
  margin-bottom: var(--sp-3);
  background: color-mix(in srgb, var(--surface-alt) 40%, var(--surface));
}
.deelinstallatie-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
  min-height: 44px;
}
.deelinstallatie-naam {
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--text);
}
.bevindingen-container { padding-left: 0; }

/* ---------- Rapport-preview (story: rapport-preview-html) ---------- */
.rp-section { margin-bottom: var(--sp-4); }
.rp-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--sp-2) var(--sp-5);
  margin: 0;
}
.rp-dl dt { font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.rp-dl dd { margin: 0; min-width: 0; word-break: break-word; }
.rp-text { margin: 0; line-height: var(--lh); }
.rp-leeg { color: var(--text-muted); font-size: var(--fs-sm); margin: 0; }
.rp-foto-blok {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
@media (min-width: 480px) {
  .rp-foto-blok { grid-template-columns: repeat(4, 1fr); }
}
.rp-foto-item {
  position: relative;
  margin: 0;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-1);
  overflow: hidden;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}
.rp-foto-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.rp-deel-naam { margin: var(--sp-5) 0 var(--sp-2); font-size: var(--fs-lg); }
.rp-deel-naam:first-of-type { margin-top: 0; }
.rp-bev-wrap { margin-bottom: var(--sp-3); }
@media (max-width: 620px) {
  .rp-dl { grid-template-columns: 1fr; gap: var(--sp-1); }
  .rp-dl dt { font-size: var(--fs-xs); margin-top: var(--sp-2); }
}
/* rapport-download: spinner op de knop (zelfde animatie als .spinner) */
.rapport-spinner { animation: spin 1s linear infinite; vertical-align: middle; }

@media print {
  .app-shell { display: block; }
  .sidebar, .app-topbar, .app-overlay, .hamburger { display: none !important; }
  .rp-no-print { display: none !important; }
  /* Word-rapport downloadknop verbergen bij afdrukken */
  #btn-rapport-download,
  .rapport-download-container { display: none !important; }
  .rp-content { max-width: 100%; padding: 0; }
  .rp-foto-blok { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================
   Redesign 2026 - white-first premium.
   Navy = structuur/typografie, merkgoud (--accent) = alleen
   primaire actie/actieve stap/focus/accent. Uitsluitend tokens.
   ============================================================ */

/* Gedeelde spinner: EEN keyframe voor .spinner, .foto-spinner, .rapport-spinner, .dash-spinner en .loading */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner, .foto-spinner, .dash-spinner { animation: spin .9s linear infinite; }

/* Knop bezig-status: JS zet aria-busy + injecteert een .spinner + label */
.btn[aria-busy="true"] { pointer-events: none; }

/* Sterke display-koppen op ruimere schermen (WOW = typografie + witruimte) */
@media (min-width: 640px) {
  .page-header h1 { font-size: var(--fs-3xl); }
}

.section-label {
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: var(--tracking-wide); text-transform: uppercase;
  color: var(--text-subtle); margin: var(--sp-6) 0 var(--sp-1);
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Formulier-helpers (vervangen inline styles) */
.req { color: var(--danger); font-weight: 600; }
.check { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--control-min); cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; }
.field-startpunt { border: none; padding: 0; margin: 0 0 var(--sp-3); }
.field-startpunt-legend { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); margin-bottom: var(--sp-2); padding: 0; }
.field-startpunt-uitleg { display: block; font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-1); }
/* Label-tekst voor een groep controls (radiogroup, foto-picker) - geen <label> zonder control */
.field-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.skeleton-startpunt { height: 52px; margin-bottom: var(--sp-2); }
.fs-sm { font-size: var(--fs-sm); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }

/* Uniforme lege/laad/fout-toestand (1 taal over alle schermen) */
.state { text-align: center; padding: var(--sp-7) var(--sp-4); color: var(--text-muted); }
.state--inline { padding: var(--sp-5) 0; }
.state-icon { display: inline-flex; color: var(--text-subtle); margin-bottom: var(--sp-3); }
.state-icon svg { display: block; }
.state h3, .state-title { color: var(--text); margin: 0 0 var(--sp-1); }
.state p { margin: 0 auto; max-width: 44ch; }
.state-actions { margin-top: var(--sp-4); display: flex; justify-content: center; gap: var(--sp-2); }
/* Skeleton als rustige laadstaat */
@keyframes skeleton-sweep { 100% { transform: translateX(100%); } }
.skeleton { position: relative; overflow: hidden; background: var(--surface-alt); border-radius: var(--r-1); }
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--surface-hover), transparent);
  animation: skeleton-sweep 1.3s ease-in-out infinite;
}
.skeleton-line { height: 12px; margin: var(--sp-2) 0; }
/* Hoogte-modifiers zodat skeleton de uiteindelijke rij-hoogte benadert (minder layout-shift) */
.skeleton-line--row { height: 40px; margin: var(--sp-2) 0; }
.skeleton-stat-label { width: 55%; height: 12px; margin: 0 0 var(--sp-2); }
.skeleton-stat-getal { width: 40%; height: 28px; margin: 0; }
.skeleton-insp-card { height: 130px; }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }

/* Werkplek vult de contentbreedte (gelijk aan de overzichten -> geen verspringen). */
.workspace { max-width: 100%; }

/* Foto sleep-zone (drop-target rond het fotoblok) */
.foto-dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-2); padding: var(--sp-4);
  transition: border-color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease);
}
.foto-dropzone[data-drag="over"] { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Inspectie: compacte samenvatting + begeleide wizard ---------- */
.insp-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }
.insp-meta-item { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 30px; padding: 0 var(--sp-3); border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); font-size: var(--fs-sm); }
.insp-meta-item#insp-meta-rapporttype { padding: 0; border: 0; background: none; }
/* Ontbrekende gegevens benoemen we (geen kaal streepje): zacht waarschuwend, niet alarmerend */
.insp-meta-item--leeg { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); background: var(--warning-soft); color: var(--warning); }
.insp-meta-item--leeg .icon { color: var(--warning); }
.insp-meta-titel .is-standaard { opacity: .8; }
.insp-meta-item .icon { width: 15px; height: 15px; color: var(--text-subtle); flex: none; }
.insp-meta-link { color: var(--text-muted); text-decoration: none; }
.insp-meta-link:hover { color: var(--accent); text-decoration: none; }
.insp-meta-bewerk-btn { background: none; border: none; border-radius: var(--r-1); color: var(--text-subtle); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; width: 44px; padding: 0; }
.insp-meta-bewerk-btn:hover { background: var(--surface-hover); color: var(--accent); }
.insp-meta-bewerk-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.insp-meta-bewerk-btn svg { width: 15px; height: 15px; }
.insp-omschrijving { font-size: var(--fs-sm); margin: 0 0 var(--sp-4); max-width: 72ch; }

/* Stepper (voortgang: actief=goud, afgerond=navy+vinkje, te doen=grijs) */
.stepper {
  display: flex; align-items: center; gap: var(--sp-1); margin-bottom: var(--sp-4); overflow-x: auto; scrollbar-width: none;
  padding: var(--sp-1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill); box-shadow: var(--shadow-1);
}
.stepper::-webkit-scrollbar { display: none; }
.stepper-item {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3) var(--sp-1) var(--sp-2); border: none; background: none; cursor: pointer;
  border-radius: var(--r-pill); color: var(--text-muted); font: inherit; font-size: var(--fs-sm);
  white-space: nowrap; min-height: var(--control-min); transition: color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease);
}
.stepper-item:hover { background: var(--surface-alt); }
.stepper-item:hover .stepper-label { color: var(--text); }
.stepper-item.is-active { background: var(--accent-soft); }
.stepper-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.stepper-num {
  position: relative; display: grid; place-items: center; width: 26px; height: 26px; flex: none;
  border-radius: 50%; font-size: var(--fs-xs); font-weight: 700;
  background: var(--surface-alt); color: var(--text-subtle); border: 1px solid var(--border);
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.stepper-label { font-weight: 550; transition: color var(--dur-1) var(--ease); }
.stepper-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-alt); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 650; font-variant-numeric: tabular-nums; }
.stepper-item.is-active .stepper-count { background: var(--surface); color: var(--accent); }
@media (max-width: 520px) { .stepper-item:not(.is-active) .stepper-count { display: none; } }
.stepper-item.is-active .stepper-num { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.stepper-item.is-active .stepper-label { color: var(--text); font-weight: 700; }
.stepper-item.is-done .stepper-num { background: var(--text); border-color: var(--text); color: transparent; }
.stepper-item.is-done .stepper-num::after {
  content: ""; position: absolute; inset: 0; background: var(--surface);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 14px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.stepper-line { flex: 1; min-width: 12px; max-width: 48px; height: 2px; background: var(--border-strong); border-radius: var(--r-pill); opacity: .7; }
@media (max-width: 520px) { .stepper-item:not(.is-active) .stepper-label { display: none; } }

/* Wizard-panelen: 1 stap tegelijk (geen stapel losse kaarten) */
.wizard-panel { padding: var(--sp-6); }
@media (max-width: 620px) { .wizard-panel { padding: var(--sp-4); } }
.wizard-panel:not(.is-active) { display: none; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.panel-titles { min-width: 0; }
.panel-title { margin: 0; font-size: var(--fs-lg); }
.panel-sub { display: block; color: var(--text-muted); font-size: var(--fs-sm); margin-top: 2px; }
.panel-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.wizard-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--border); }

/* Twee kolommen: wizard (links) + zijpaneel met eerdere inspecties (rechts).
   Mobiel-first: 1 kolom, zijpaneel onder de wizard. Vanaf 1024px naast elkaar. */
.workspace-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
@media (min-width: 1024px) {
  .workspace-cols { grid-template-columns: minmax(0, 1fr) 300px; }
  .insp-aside { position: sticky; top: var(--sp-5); }
}
.insp-aside-head { display: flex; align-items: center; gap: var(--sp-2); }
.insp-aside-title { margin: 0; font-size: var(--fs-lg); }
.insp-aside-sub { font-size: var(--fs-sm); margin: 2px 0 var(--sp-4); }
.insp-aside-empty { font-size: var(--fs-sm); margin: 0; }
.insp-aside-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.insp-aside-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-height: 44px;
  padding: var(--sp-3); border-radius: var(--r-1); border: 1px solid var(--border);
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.insp-aside-item:hover { background: var(--surface-alt); border-color: var(--border-strong); }
.insp-aside-item-link { flex: 1 1 100%; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); text-decoration: none; color: var(--text); }
.insp-aside-item .insp-aside-instap, .insp-aside-item .insp-aside-dl { flex: 1 1 0; }
.insp-aside-item-link:hover { text-decoration: none; }
.insp-aside-date { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.insp-aside-status { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--text-muted); }
.insp-aside .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: currentColor; }
.insp-aside .dot-open { color: var(--brand); }
.insp-aside .dot-done { color: var(--success); }
.insp-aside-dl {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: 44px; padding: 0 var(--sp-3);
  border: 1px solid var(--border); border-radius: var(--r-1);
  background: var(--surface); color: var(--text-muted);
  font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer;
  transition: color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.insp-aside-dl:hover { color: var(--accent); border-color: var(--accent); }
.insp-aside-dl:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.insp-aside-dl svg { width: 14px; height: 14px; flex: none; }
.insp-aside-dl:disabled { opacity: .6; cursor: default; }
.insp-aside-instap {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-height: 44px; padding: 0 var(--sp-3);
  border: 1px solid var(--border); border-radius: var(--r-1);
  background: var(--surface); color: var(--text-muted);
  font: inherit; font-size: var(--fs-xs); font-weight: 600;
  text-decoration: none;
  transition: color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.insp-aside-instap:hover { color: var(--brand); border-color: var(--brand); text-decoration: none; }
.insp-aside-instap:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Rustige icoon-actieknop: bewerken/verwijderen minder prominent (1 gouden actie per context) */
.btn-quiet {
  display: inline-grid; place-items: center; min-height: var(--control-min); width: var(--control-min); padding: 0;
  border: 1px solid transparent; border-radius: var(--r-1); background: none;
  color: var(--text-subtle); cursor: pointer;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.btn-quiet svg { width: 17px; height: 17px; }
.btn-quiet:hover { background: var(--surface-hover); color: var(--text); }
.btn-quiet.is-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-quiet:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Sleek sluit-kruisje (detail-werkplek): rechtsboven, ronde knop */
.btn-close {
  display: inline-grid; place-items: center; width: var(--control-min); height: var(--control-min); padding: 0; flex: none;
  border: 1px solid var(--border); border-radius: 50%; background: var(--surface);
  color: var(--text-muted); cursor: pointer; text-decoration: none;
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.btn-close:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-1); text-decoration: none; }
.btn-close:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-close svg { width: 20px; height: 20px; }

/* Foto-koppeling picker (multi-select bevinding-foto) */
.koppeling-picker {
  border: 1px solid var(--border); border-radius: var(--r-2);
  background: var(--surface); overflow: hidden;
  width: min(100%, 92vw);
}
.koppeling-picker-inhoud {
  max-height: 40vh; overflow-y: auto; padding: var(--sp-3);
}
@media (max-width: 480px) {
  .koppeling-picker-inhoud { max-height: 30vh; }
}
.koppeling-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: var(--sp-2);
}
.koppeling-item {
  position: relative; border: 2px solid var(--border); border-radius: var(--r-1);
  overflow: hidden; cursor: pointer; background: var(--surface-alt);
  aspect-ratio: 1; min-height: 44px; min-width: 44px;
  transition: border-color var(--dur-1) var(--ease);
  padding: 0;
}
.koppeling-item:hover:not([aria-disabled="true"]), .koppeling-item:focus-visible:not([aria-disabled="true"]) {
  border-color: var(--accent); outline: none;
}
.koppeling-item[aria-pressed="true"] {
  border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent);
}
.koppeling-item[aria-disabled="true"] { cursor: default; opacity: 0.75; }
.koppeling-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.koppeling-item-nr {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.55); color: #fff; font-size: var(--fs-xs);
  text-align: center; padding: 2px 4px; line-height: 1.4;
}
.koppeling-item-check {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px;
  background: var(--accent); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--dur-1) var(--ease);
  pointer-events: none;
}
.koppeling-item[aria-pressed="true"] .koppeling-item-check { opacity: 1; }
.koppeling-item-check svg { width: 11px; height: 11px; stroke: #fff; }
.koppeling-leeg { font-size: var(--fs-sm); color: var(--text-muted); padding: var(--sp-2) 0; }
.koppeling-groep-kop { margin: var(--sp-2) 0 var(--sp-1); font-size: var(--fs-xs); font-weight: 650; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-subtle); }
.koppeling-groep-kop + .koppeling-grid { margin-bottom: var(--sp-2); }
.koppeling-fout { margin: var(--sp-2) 0; font-size: var(--fs-sm); }
.koppeling-skel { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: var(--sp-2); }
.koppeling-skel-item { aspect-ratio: 1; min-height: 44px; }

/* Rapport-acties: gebundelde actiegroep (stap 3, rapport-panel). Op smal scherm onder elkaar,
   vanaf 640px EEN rij in leesvolgorde preview - download - opleveren (de afsluitende actie rechts);
   toelichting en foutmelding over de volle breedte eronder. */
.rapport-actiegroep {
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  background: color-mix(in srgb, var(--surface-alt) 45%, var(--surface));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-3);
}
.rapport-actiegroep .btn { width: 100%; min-height: var(--control-min); }
.rapport-actiegroep > a[href*="rapport-preview"] { order: 1; }
.rapport-actiegroep > .rapport-download-container { order: 2; }
.rapport-actiegroep > #btn-opleveren, .rapport-actiegroep > .rapport-opgeleverd-row { order: 3; }
.rapport-actiegroep > .rapport-actiegroep-note, .rapport-actiegroep > .rapport-actiegroep-fout { order: 4; grid-column: 1 / -1; margin: 0; }
@media (min-width: 640px) {
  .rapport-actiegroep { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
}
.rapport-opgeleverd-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.rapport-opgeleverd-row .btn { min-height: var(--sp-7); width: auto; flex: 1 1 auto; }
.tekst-sectie-groep { display: flex; flex-direction: column; gap: var(--sp-5); margin-top: var(--sp-5); padding-top: var(--sp-5); border-top: 1px solid var(--border); }
.tekst-sectie > label { font-size: var(--fs-base); }
.tekst-sectie { display: flex; flex-direction: column; gap: var(--sp-2); }
.tekst-sectie-area { font-size: 16px; min-height: 160px; resize: vertical; }
.tekst-sectie-acties { display: flex; align-items: center; gap: var(--sp-3); }
.tekst-sectie-status { font-size: var(--fs-sm); }
/* Inline gereedheid in stap 3: rustig blok, groen zodra alles klaar is */
.gh-inline { padding: var(--sp-4) var(--sp-5); border: 1px solid var(--border); border-radius: var(--r-2); background: var(--surface); margin-bottom: var(--sp-4); }
.gh-inline.is-klaar { border-color: color-mix(in srgb, var(--success) 35%, var(--border)); background: color-mix(in srgb, var(--success-soft) 55%, var(--surface)); }
.gh-inline-kop { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.gh-inline-titel { font-weight: 650; }
.gh-inline .gh-checklist { gap: var(--sp-1); }
.gh-checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.gh-check {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  line-height: 1.4;
}
.gh-check-icon {
  width: 20px;
  flex-shrink: 0;
  text-align: center;
  font-size: var(--fs-sm);
}
.gh-check--ok   { color: var(--success); }
.gh-check--warn { color: var(--warning); }

/* Klikbare gereedheidscheck-regel voor niet-voldane punten (AC4, AC5) */
.gh-check-knop {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font: inherit;
  font-size: var(--fs-sm);
  line-height: 1.4;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--sp-2) var(--sp-1);
  margin: calc(-1 * var(--sp-2)) calc(-1 * var(--sp-1));
  min-height: 44px;
  width: calc(100% + 2 * var(--sp-1));
  text-align: left;
  border-radius: var(--r-1);
}
.gh-check-knop:hover { text-decoration: underline; opacity: 0.85; }
.gh-check-knop:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ============================================================
   Utilities + premium refinements (vervangen inline styles).
   Uitsluitend tokens; DRY zodat componenten identiek ogen.
   ============================================================ */

/* Rustige laadstaat met spinner (vervangt kale "Laden..."-tekst overal) */
.loading { display: flex; align-items: center; gap: var(--sp-2); color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.2; padding: var(--sp-4) 0; }
.loading::before {
  content: ""; flex: none; box-sizing: border-box; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
/* In een kaart (lijstpagina's) lijnt de laadstaat uit met de tabelcellen, niet met de kaartrand */
.card > .loading, .card > div > .loading, .skeleton-wrap--lijst { padding-left: var(--sp-5); padding-right: var(--sp-5); }
.wizard-panel .loading { padding-left: 0; padding-right: 0; }
.skeleton-wrap--lijst { padding-top: var(--sp-3); padding-bottom: var(--sp-3); }

/* Muted toelichting onder een actie (bv. bij het genereren van het rapport) */
.form-note { color: var(--text-muted); font-size: var(--fs-sm); margin-top: var(--sp-2); max-width: 54ch; }

/* Kleine helpers (token-gebaseerd, voor losse alerts/knoppen in modals) */
.text-center { text-align: center; }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mb-2 { margin-bottom: var(--sp-2); }
.ml-2 { margin-left: var(--sp-2); }
.ml-auto { margin-left: auto; }
.mb-3 { margin-bottom: var(--sp-3); }

/* ---- Segmented control (statusfilter + status-toggle) ---- */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; max-width: min(100%, 92vw); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--r-pill); overflow-x: hidden; }
.segmented button {
  appearance: none; border: none; background: none; cursor: pointer; font: inherit;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted);
  padding: 0 var(--sp-3); min-height: var(--control-min); border-radius: var(--r-pill); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.segmented button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.segmented .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: currentColor; opacity: .55; }
.segmented button.is-active .dot { opacity: 1; }
.segmented .dot-open { color: var(--brand); }
.segmented .dot-done { color: var(--success); }

/* Segmented control volledig breed (in modals voor rapporttype-kiezer) */
.segmented.segmented-full { display: flex; width: 100%; }
.segmented.segmented-full button { flex: 1; justify-content: center; min-height: 44px; }
/* Actieve staat extra herkenbaar via outline (niet alleen kleur, AC6.1) */
.segmented button[role="radio"][aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); outline: 2px solid var(--brand); outline-offset: -2px; }
.segmented button[role="radio"][aria-checked="false"] { color: var(--text-muted); }

/* Rapporttitel in inspectie-meta */
.insp-meta-titel { font-style: italic; color: var(--text-muted); max-width: min(380px, 70vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Status-badge (openstaand / opgeleverd) ---- */
.status-badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.01em; white-space: nowrap; }
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; background: currentColor; }
.status-openstaand { background: color-mix(in srgb, var(--brand) 13%, transparent); color: var(--brand); }
.status-opgeleverd { background: var(--success-soft); color: var(--success); }
:root[data-theme="dark"] .status-openstaand { background: color-mix(in srgb, var(--brand) 18%, transparent); }

/* ---- Dashboard: kaarten met openstaande inspecties ---- */
.insp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: var(--sp-4); }
.insp-card {
  position: relative; display: flex; flex-direction: column; gap: var(--sp-1);
  padding: var(--sp-5); color: inherit; text-decoration: none;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), transform 80ms var(--ease);
}
.insp-card:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.insp-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.insp-card-title { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.012em; color: var(--text); text-wrap: balance; }
.insp-card-og { font-size: var(--fs-sm); color: var(--text-muted); }
.insp-card-meta { display: flex; align-items: center; gap: var(--sp-1) var(--sp-4); flex-wrap: wrap; margin-top: var(--sp-3); color: var(--text-muted); font-size: var(--fs-sm); }
.insp-card-meta .item { display: inline-flex; align-items: center; gap: 6px; }
.insp-card-meta svg { width: 14px; height: 14px; color: var(--text-subtle); flex: none; }

/* Rij-acties zijn app-breed altijd zichtbaar; opacity:0 hover-gate en @media-blok verwijderd (AC5). */

/* Smalle invoervelden */
.input-narrow { max-width: 140px; }
.textarea-lg { min-height: 120px; }

.dash-section-label { margin: var(--sp-6) 0 var(--sp-4); }
.dash-section-count { flex: none; margin-left: var(--sp-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-muted); }
.dash-section-count a { color: var(--accent); font-weight: 650; }

/* ---- Opdrachtgever-logo veld ---- */
.logo-field { display: flex; flex-direction: column; gap: var(--sp-2); }
.logo-row { display: flex; align-items: center; gap: var(--sp-3); }
.logo-preview { width: 56px; height: 56px; border-radius: var(--r-1); object-fit: cover; border: 1px solid var(--border); background: var(--surface-alt); flex: none; }
.file-input { border: 1px dashed var(--border-strong); background: var(--surface-alt); font-size: var(--fs-sm); padding: var(--sp-2) var(--sp-3); cursor: pointer; }
.file-input::file-selector-button { font: inherit; font-size: var(--fs-xs); font-weight: 600; margin-right: var(--sp-3); padding: 6px var(--sp-3); border: 1px solid var(--border-strong); border-radius: var(--r-1); background: var(--surface); color: var(--text); cursor: pointer; }

/* ---- Foto-upload teller ---- */
.upload-teller { margin-bottom: var(--sp-3); }
.upload-teller-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.upload-teller-tekst { font-size: var(--fs-sm); color: var(--text-muted); }

/* ---- Bevindingen (workspace) ---- */
.bev-toolbar { display: flex; justify-content: flex-end; margin-bottom: var(--sp-2); }
.bev-empty { font-size: var(--fs-sm); color: var(--text-muted); padding: var(--sp-2) 0 var(--sp-3); }
.bev-def-note { margin: var(--sp-2) 0 var(--sp-3); font-size: var(--fs-sm); }
.bev-nr-badge { margin-right: 6px; }
.bev-bevestiging { margin-bottom: var(--sp-3); transition: opacity .4s ease; }
.deel-opmerking { margin: var(--sp-1) 0 var(--sp-3); font-size: var(--fs-sm); color: var(--text-muted); white-space: pre-wrap; }

/* ---------- Dashboard: kengetallen-tegels ---------- */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
@media (min-width: 600px) { .stat-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat-tile { position: relative; display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-5); overflow: hidden; }
.stat-tile::before { content: ""; position: absolute; left: var(--sp-5); right: var(--sp-5); top: 0; height: 2px; border-radius: 0 0 var(--r-pill) var(--r-pill); background: linear-gradient(90deg, var(--accent), transparent); opacity: .9; }
.stat-tile:nth-child(n+2)::before { background: linear-gradient(90deg, var(--brand), transparent); opacity: .35; }
.stat-label { font-size: var(--fs-xs); font-weight: 650; color: var(--text-muted); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.stat-getal { font-size: var(--fs-3xl); font-weight: 700; color: var(--brand); line-height: 1; letter-spacing: var(--tracking-tight); }

/* ---------- Dashboard: inspectiekaart-voortgang en acties ---------- */
.insp-voortgang { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.insp-voortgang-item { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 0 var(--sp-2); border-radius: var(--r-pill); background: var(--surface-alt); font-size: var(--fs-xs); font-weight: 550; color: var(--text-muted); }
.insp-voortgang-item svg { flex: none; color: var(--text-subtle); }
/* Volgende stap: EEN duidelijke regel per kaart wat er nu van je gevraagd wordt (klik = naar die stap) */
.insp-card-next {
  display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-4);
  min-height: var(--control-min); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-1);
  background: var(--accent-soft); color: var(--accent); text-decoration: none; font-size: var(--fs-sm);
  transition: background-color var(--dur-1) var(--ease);
}
.insp-card-next:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.insp-card-next:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.insp-card-next.is-klaar { background: var(--success-soft); color: var(--success); }
.insp-card-next-body { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.insp-card-next-label { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-wide); opacity: .8; line-height: 1.2; }
.insp-card-next-tekst { font-weight: 650; line-height: 1.3; }
.insp-card-next svg { flex: none; }
.insp-card--mijn { box-shadow: var(--shadow-1), inset 3px 0 0 var(--accent); }
.insp-card--mijn:hover { box-shadow: var(--shadow-2), inset 3px 0 0 var(--accent); }
.insp-card-jij { margin-left: 4px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-size: var(--fs-xs); font-weight: 650; }
.insp-card-acties { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--border); flex-wrap: wrap; }
.insp-card-acties .btn { flex: 1 1 0; width: auto; }
@media (max-width: 400px) { .insp-card-acties { flex-direction: column; } }
.insp-card-fout { margin-top: var(--sp-2); font-size: var(--fs-sm); }
.dash-grens { font-size: var(--fs-sm); color: var(--text-muted); padding: var(--sp-3) 0 0; }

/* ---------- Zoek-overlay (Ctrl+K palette-lite) ---------- */

/* Topbar-zoekknop en thema-knop: 44px tap-target (mobiel-veilig) */
.btn-icon-sm { min-height: 44px; width: 44px; padding: 0; }
/* Icoon in de knop op vaste maat (wi_icon zet geen width/height); matcht de nav- en thema-iconen */
.btn-icon svg,
.btn-icon-sm svg { width: 20px; height: 20px; }

/* Native <dialog>: bottom-sheet op mobiel (< 640px) */
dialog.zoek-dialog {
  position: fixed;
  top: auto;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  max-height: 80dvh;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  overflow: visible;
  border-radius: var(--r-3) var(--r-3) 0 0;
}
dialog.zoek-dialog::backdrop { background: rgba(9, 18, 32, 0.55); backdrop-filter: blur(2px); }

/* Gecentreerde dialog op >= 640px */
@media (min-width: 640px) {
  dialog.zoek-dialog {
    top: 50%;
    left: 50%;
    bottom: auto;
    right: auto;
    width: min(600px, 92vw);
    max-width: min(600px, 92vw);
    max-height: 70dvh;
    margin: 0;
    border-radius: var(--r-3);
    transform: translate(-50%, -50%);
  }
}

/* Inner wrapper (scrollbaar lichaam) */
.zoek-inner {
  background: var(--surface);
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  max-height: 80dvh;
  overflow: hidden;
  box-shadow: var(--shadow-3);
}
@media (min-width: 640px) { .zoek-inner { max-height: 70dvh; } }

/* Invoerkop: lens + input + sluitknop */
.zoek-kop {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.zoek-lens { flex-shrink: 0; width: 20px; height: 20px; color: var(--text-muted); }
.zoek-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: var(--fs-sm);  /* >= 14px */
  color: var(--text);
  padding: var(--sp-2) 0;
  outline: none;
  line-height: var(--lh);
}
.zoek-input::placeholder { color: var(--text-subtle); }
/* Palette-input is bewust plat: de tekstcursor toont focus. De globale input-focus-ring
   (regel input:focus) zet anders een los zwevend kader in de balk - dat oogt niet strak. */
.zoek-input:focus,
.zoek-input:focus-visible { box-shadow: none; border-color: transparent; }
.zoek-sluit {
  flex-shrink: 0;
  min-height: 44px;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--r-1);
}
.zoek-sluit:hover { background: var(--surface-alt); color: var(--text); }
.zoek-sluit:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Scrollbaar resultatengebied */
.zoek-lichaam {
  overflow-y: auto;
  flex: 1;
  padding: var(--sp-2) 0 var(--sp-3);
  min-height: 72px;
}

/* Hint en leeg-staat */
.zoek-hint, .zoek-leeg {
  margin: 0;
  padding: var(--sp-5);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  text-align: center;
}

/* Groep-sectie */
.zoek-groep { margin-bottom: var(--sp-1); }
.zoek-groep-header {
  padding: var(--sp-2) var(--sp-4) var(--sp-1);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: var(--tracking-wide);
  color: var(--text-subtle);
  text-transform: uppercase;
}

/* Resultaatlijst */
.zoek-resultaten { list-style: none; margin: 0; padding: 0; }
.zoek-resultaat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--sp-4);
  min-height: 44px;
  cursor: pointer;
  outline: none;
  gap: 1px;
  transition: background var(--dur-1) var(--ease);
}
.zoek-resultaat:hover, .zoek-resultaat--actief { background: var(--surface-hover); }
.zoek-resultaat:focus-visible { outline: none; box-shadow: var(--focus-ring-inset); }
.zoek-naam { font-size: var(--fs-sm); font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zoek-sub { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Match-markering */
.zoek-mark { background: var(--accent-soft); color: var(--accent); border-radius: 2px; font-style: normal; }

/* "+ N meer" uitvouw-knop (tap-target >= 44px, volle breedte) */
.zoek-meer {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.zoek-meer:hover { background: var(--surface-alt); }
.zoek-meer:focus-visible { outline: none; box-shadow: var(--focus-ring-inset); }

/* Fout-staat */
.zoek-fout { padding: var(--sp-4); }

/* Skeleton binnen de overlay */
.zoek-skeleton { padding: var(--sp-2) var(--sp-4); }

/* Ingetogen beweging: respecteer prefers-reduced-motion overal */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
}

/* Cross-document view transitions (same-origin paginawissel) */
@view-transition { navigation: auto; }

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: none; }
  ::view-transition-new(root) {
    animation: vt-fade-in var(--dur-2) var(--ease) both;
  }
  @keyframes vt-fade-in { from { opacity: 0; } to { opacity: 1; } }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ---- Gegroepeerde fotostap: groep-koppen + assign-UI (story: fotos-koppelen-aan-deelinstallatie) */

/* Full-width groep-kop in het foto-grid (grid-column: 1/-1 zodat hij de hele rij vult) */
.foto-groep-kop {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) 0 var(--sp-1);
  margin-top: var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.foto-groep-kop:first-child { margin-top: 0; }
.foto-groep-naam {
  flex: 1;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}
.foto-groep-bulk-btn { flex-shrink: 0; }
.foto-groep-leeg {
  grid-column: 1 / -1;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  padding: var(--sp-2) 0;
}

/* Deelinstallatie-chip op elk foto-item (vervangt de inline select) */
.foto-assign-wrap {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: var(--sp-1);
  background: rgba(0,0,0,0.48);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.foto-assign-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  width: 100%;
  min-height: 44px;
  padding: 0 var(--sp-2);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--r-pill);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.foto-assign-chip:hover:not([aria-disabled="true"]) { background: rgba(255, 255, 255, 0.28); }
.foto-assign-chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.foto-assign-chip[aria-disabled="true"] { opacity: 0.6; cursor: default; }
.foto-assign-chip-tekst {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.foto-assign-chip-chevron { flex-shrink: 0; color: rgba(255, 255, 255, 0.75); }
/* Selectiemodus-guard: chip niet interactief als kaart in selectiemodus staat (Story A #97). */
[data-selectiemodus] .foto-assign-chip { pointer-events: none; opacity: 0; }
/* Bulk-selectie checkbox linksonder op foto-item */
.foto-bulk-check {
  position: absolute;
  top: var(--sp-1);
  right: var(--sp-1);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  background: var(--surface);
  border-radius: var(--r-1);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
[data-selectiemodus] .foto-bulk-check,
.foto-bulk-check:focus-within,
.foto-bulk-check:has(input:checked) { opacity: 1; }
.foto-bulk-checkbox {
  width: 16px; height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* Selectiemodus: tap-zone >= 44px, controls passief, geselecteerde kaart gemarkeerd */
[data-selectiemodus] .foto-bulk-check { width: 44px; height: 44px; }
[data-selectiemodus] .foto-herorden-knoppen,
[data-selectiemodus] .foto-nummer-badge { pointer-events: none; }
[data-selectiemodus] .foto-drag-handle { display: none; }
[data-selectiemodus] .foto-cover-badge { display: none; }
.foto-item[data-geselecteerd] {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  background: var(--accent-soft);
}

/* Bulk-assign balk - vast onderin de viewport bij selectie (links gelijk met de sidebar) */
.bulk-assign-balk {
  position: fixed;
  bottom: 0;
  left: 248px;
  right: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  background: var(--surface);
  border-top: 2px solid var(--border-strong);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  flex-wrap: wrap;
}
@media (max-width: 860px) {
  .bulk-assign-balk { left: 0; }
}
.bulk-balk-telling { font-size: var(--fs-sm); font-weight: 600; color: var(--accent); }
.bulk-balk-acties { display: flex; gap: var(--sp-2); flex-shrink: 0; }
.bulk-balk-acties .btn { min-height: 44px; }

/* Bottom sheet overlay (bulk-assign) */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 18, 32, .5); backdrop-filter: blur(3px); /* zelfde overlay-recept als .modal-overlay */
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.bottom-sheet-overlay[hidden] { display: none; }
.bottom-sheet {
  background: var(--surface);
  border-radius: var(--r-3) var(--r-3) 0 0;
  width: min(540px, 100%);
  max-height: 80vh;
  overflow-y: auto;
  padding: var(--sp-3) var(--sp-5) var(--sp-6);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
}
.bottom-sheet-handle {
  width: 36px; height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 0 auto var(--sp-4);
}
.bottom-sheet-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.bottom-sheet-titel { flex: 1; font-size: var(--fs-lg); font-weight: 600; }
.bottom-sheet-body .field { margin-bottom: var(--sp-3); }
.bottom-sheet-footer {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  margin-top: var(--sp-4);
  flex-wrap: wrap;
}
.bottom-sheet-footer .btn { min-height: 44px; }
body.sheet-open { overflow: hidden; }

/* Inline object aanmaken (sub-formulier in inspectie-aanmaakmodal) */
.inline-object-subform {
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  max-width: min(100%, 92vw);
}
.sub-object-trigger { margin-top: var(--sp-2); }
.inline-object-subform .field { margin-bottom: var(--sp-3); }
.inline-object-subform .field:last-of-type { margin-bottom: 0; }
.sub-object-footer {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  margin-top: var(--sp-3);
  flex-wrap: wrap;
}
.sub-object-footer .btn { min-height: 44px; }
@media (max-width: 400px) {
  .sub-object-footer { flex-direction: column; }
  .sub-object-footer .btn { width: 100%; }
}
