:root {
  --achtergrond: #EDF0F3;
  --kaart: #FFFFFF;
  --inkt: #1B2530;
  --subtiel: #5B6775;
  --lijn: #D3D9E0;
  --blauw: #0D4E9C;
  --blauw-licht: #E6EEF8;
  --amber: #F4B400;
  --amber-licht: #FFF4CC;
  --rood: #B3261E;
  --groen: #1E7B45;
  --vgl: #F4F1FA;
  --vgl-rand: #6B4FA3;
  --radius: 6px;
  --font: "IBM Plex Sans", "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--inkt);
  background: var(--achtergrond);
  font-variant-numeric: tabular-nums;
}
h1 { font-size: 1.6rem; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 0; }
a { color: var(--blauw); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---------- Topbalk ---------- */
.topbalk {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 24px; background: var(--blauw); color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.topbalk a { color: #fff; text-decoration: none; }
.topnav a { opacity: .85; }
.topnav a:hover { opacity: 1; text-decoration: underline; }
.wie { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.wie small { opacity: .75; margin-left: 4px; }
.merk { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.lamp { display: inline-flex; flex-direction: column; gap: 2px; padding: 3px; background: #10161D; border-radius: 4px; }
.lamp i { width: 6px; height: 6px; border-radius: 50%; background: #3A4450; }
.lamp i:nth-child(1) { background: #E5483B; }
.lamp i:nth-child(2) { background: var(--amber); }
.lamp i:nth-child(3) { background: #2DBE6C; }

.inhoud { max-width: 1280px; margin: 0 auto; padding: 24px; }
.paginakop { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }

/* ---------- Knoppen ---------- */
.knop {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 500; font-size: .95rem;
  padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid var(--lijn); background: var(--kaart); color: var(--inkt);
  cursor: pointer; text-decoration: none;
}
.knop:hover { border-color: var(--subtiel); }
.knop-primair { background: var(--blauw); border-color: var(--blauw); color: #fff; }
.knop-primair:hover { background: #0A3F7F; }
.knop-stil { background: transparent; }
.topbalk .knop-stil { color: #fff; border-color: rgba(255,255,255,.45); }
.knop-gevaar { color: var(--rood); border-color: #E7B8B4; margin-left: auto; }
.knop-gevaar:hover { background: #FBECEB; border-color: var(--rood); }
.knop-link { background: none; border: 0; padding: 6px 0; color: var(--blauw); text-decoration: underline; cursor: pointer; font: inherit; }
.knop-breed { width: 100%; margin-top: 16px; padding: 11px; }

/* ---------- Meldingen ---------- */
.melding { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 16px; border-left: 4px solid; }
.melding-ok { background: #E8F5EE; border-color: var(--groen); }
.melding-fout { background: #FBECEB; border-color: var(--rood); }
.melding-info { background: var(--vgl); border-color: var(--vgl-rand); }
.subtiel { color: var(--subtiel); }
.hint { color: var(--subtiel); font-size: .85rem; margin: 6px 0 0; }
.leeg { background: var(--kaart); border: 1px dashed var(--lijn); border-radius: var(--radius); padding: 40px; text-align: center; }

/* ---------- Formulieren ---------- */
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--subtiel); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  font: inherit; font-size: .95rem; color: var(--inkt);
  padding: 7px 9px; border: 1px solid var(--lijn); border-radius: 4px; background: #fff; width: 100%;
}
input:focus, select:focus { border-color: var(--blauw); outline: 2px solid var(--blauw-licht); }
.vinkje { flex-direction: row; align-items: center; gap: 8px; align-self: end; padding-bottom: 8px; color: var(--inkt); }
.vinkje input { width: 18px; height: 18px; }

/* ---------- Login ---------- */
.login-pagina { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(180deg, var(--blauw) 0 42%, var(--achtergrond) 42%); }
.login-pagina .inhoud { width: 100%; max-width: 420px; }
.login-kaart { background: var(--kaart); border-radius: 10px; padding: 32px; box-shadow: 0 12px 32px rgba(13, 78, 156, .18); }
.login-kaart h1 { font-size: 1.35rem; margin: 22px 0 6px; }
.login-kaart label { margin-top: 14px; }
.merk-groot { font-size: 1.2rem; color: var(--blauw); }
.merk-groot .lamp i { width: 8px; height: 8px; }

/* ---------- Overzicht ---------- */
.tabel-scroll { overflow-x: auto; }
.overzicht { width: 100%; border-collapse: collapse; background: var(--kaart); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--lijn); }
.overzicht th { text-align: left; font-weight: 600; font-size: .85rem; background: #F6F8FA; border-bottom: 2px solid var(--lijn); padding: 8px 10px; white-space: nowrap; }
.overzicht .kop { display: inline-flex; align-items: center; gap: 6px; }
.sorteer { display: inline-flex; flex-direction: column; }
.sorteer button { border: 0; background: none; padding: 0 3px; font-size: .6rem; line-height: 1.1; color: #9AA5B1; cursor: pointer; }
.sorteer button:hover, .sorteer button.actief { color: var(--blauw); }
.overzicht td { padding: 10px; border-bottom: 1px solid var(--lijn); }
.overzicht tbody tr { cursor: pointer; }
.overzicht tbody tr:hover, .overzicht tbody tr:focus { background: var(--blauw-licht); outline: none; }
.num { text-align: right; white-space: nowrap; }
.status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem; background: #EEF1F4; }
.status-akkoord { background: #E1F3E8; color: var(--groen); }
.status-niet-akkoord { background: #FBECEB; color: var(--rood); }
.status-verstuurd { background: var(--blauw-licht); color: var(--blauw); }
.status-concept-vergelijk { background: var(--vgl); color: var(--vgl-rand); }

/* ---------- Offerte ---------- */
.kaart { background: var(--kaart); border: 1px solid var(--lijn); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.velden-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 16px; margin-bottom: 8px; }
.velden-raster .breed { grid-column: span 2; }
@media (max-width: 560px) { .velden-raster .breed { grid-column: auto; } }

.vergelijk { border-left: 4px solid var(--vgl-rand); }
.vergelijk-kop { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vergelijk-keuze { display: grid; grid-template-columns: repeat(3, minmax(140px, 220px)); gap: 12px; margin-top: 10px; }
@media (max-width: 560px) { .vergelijk-keuze { grid-template-columns: 1fr; } }

.sectie { padding: 0; overflow: hidden; }
.sectie-kop { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-left: 4px solid var(--blauw); background: #F8FAFC; }
.sectie.open .sectie-kop { border-bottom: 1px solid var(--lijn); }
.sectie-body { padding: 16px 20px 20px; }
.klap { display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--inkt); cursor: pointer; padding: 0; text-align: left; }
.pijl { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 4px; background: var(--blauw-licht); color: var(--blauw); font-size: .7rem; }
.factor { font-size: .8rem; color: var(--subtiel); }
.sectie-totaal { margin-left: auto; font-weight: 600; white-space: nowrap; }

table.blok { width: 100%; border-collapse: collapse; margin-top: 14px; }
table.blok caption { text-align: left; font-weight: 700; padding: 4px 0 8px; font-size: 1rem; }
table.blok th, table.blok td { padding: 5px 8px; border-bottom: 1px solid #EBEEF2; vertical-align: middle; }
table.blok thead th { font-size: .78rem; font-weight: 600; color: var(--subtiel); text-align: left; border-bottom: 1px solid var(--lijn); line-height: 1.25; }
table.blok thead th.num { text-align: right; }
table.blok tbody th { text-align: left; font-weight: 500; white-space: nowrap; }
table.blok th.omschr { width: 26%; }
table.blok tr.tussen th { font-weight: 400; font-size: .85rem; }
table.blok tr.tussen td { background: #FAFBFC; }
table.blok tfoot th, table.blok tfoot td { border-bottom: 0; padding-top: 10px; font-weight: 600; }

.invoer { display: inline-flex; align-items: center; gap: 6px; }
.invoer input { width: 92px; text-align: right; padding: 5px 7px; }
.invoer.klein input { width: 72px; }
.invoer.norm input { background: #F6F8FA; }
.eenheid { font-size: .8rem; color: var(--subtiel); min-width: 34px; }

/* Vergelijk-kolommen D, E, F */
.vgl { background: var(--vgl); }
thead th.vgl { color: var(--vgl-rand); }
.vgl-naam { font-weight: 700; }
.vgl-sub { font-weight: 600; color: var(--vgl-rand); }

/* Subtotaal = amber 'lamp' */
output { font-variant-numeric: tabular-nums; }
.subtotaal { display: inline-block; min-width: 64px; text-align: right; padding: 2px 8px; border-radius: 4px; background: var(--amber-licht); box-shadow: inset 3px 0 0 var(--amber); font-weight: 700; }

.totaal-tabel { border-collapse: collapse; min-width: min(420px, 100%); margin-top: 8px; }
.totaal-tabel th { text-align: left; font-weight: 500; padding: 6px 24px 6px 0; }
.totaal-tabel td { padding: 6px 0; }
.totaal-tabel tfoot th, .totaal-tabel tfoot td { border-top: 2px solid var(--inkt); font-weight: 700; padding-top: 10px; }

.actiebalk {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px 20px; background: rgba(255,255,255,.96);
  border: 1px solid var(--lijn); border-radius: var(--radius);
  box-shadow: 0 -6px 18px rgba(27, 37, 48, .06);
}

@media (max-width: 700px) {
  .inhoud { padding: 14px; }
  .topbalk { padding: 10px 14px; gap: 12px; flex-wrap: wrap; }
  .sectie-kop, .sectie-body { padding-left: 14px; padding-right: 14px; }
  .knop-gevaar { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Bedragen uiterst rechts in de secties */
/* ---------- Admin: kolom Totaal als eigen witte strook rechts naast elke sectie ---------- */
:root { --totaal-breedte: 150px; --totaal-gat: 16px; }
table.blok { border-collapse: separate; border-spacing: 0; }
body.is-admin.tarieven-aan .sectie {
  border: 0;
  /* wit tot en met de één na laatste kolom, dan een grijze tussenruimte, dan een eigen witte strook */
  background: linear-gradient(to right,
    var(--kaart) 0, var(--kaart) calc(100% - var(--totaal-breedte) - var(--totaal-gat)),
    transparent calc(100% - var(--totaal-breedte) - var(--totaal-gat)), transparent calc(100% - var(--totaal-breedte)),
    var(--kaart) calc(100% - var(--totaal-breedte)));
  overflow: visible;
}
body.is-admin.tarieven-aan .sectie-kop { position: relative; background: transparent; padding-right: calc(var(--totaal-breedte) + var(--totaal-gat) + 20px); }
body.is-admin.tarieven-aan .sectie.open .sectie-kop { border-bottom: 0; box-shadow: inset 0 -1px 0 var(--lijn); box-shadow: none; }
body.is-admin.tarieven-aan .sectie.open .sectie-kop::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px;
  right: calc(var(--totaal-breedte) + var(--totaal-gat)); background: var(--lijn);
}
body.is-admin.tarieven-aan .kop-rechts {
  position: absolute; top: 0; bottom: 0; right: 0; width: var(--totaal-breedte);
  display: flex; align-items: center; justify-content: flex-end; padding-right: 12px; font-weight: 700;
}
body.is-admin.tarieven-aan .kop-rechts .kop-bedrag { margin: 0; padding: 0; border: 0; }
body.is-admin.tarieven-aan .sectie-body { padding-right: 0; }
body.is-admin.tarieven-aan .sectie-body .melding { margin-right: calc(var(--totaal-breedte) + var(--totaal-gat) + 20px); }
body.is-admin.tarieven-aan .sectie .tabel-scroll { overflow-x: visible; }
body.is-admin.tarieven-aan table.blok caption { padding-right: calc(var(--totaal-breedte) + var(--totaal-gat)); }
table.blok th.bedrag, table.blok td.bedrag {
  width: var(--totaal-breedte); min-width: var(--totaal-breedte); box-sizing: border-box;
  padding-left: 10px; padding-right: 12px;
}
table.blok thead th.bedrag { color: var(--blauw); }
/* grijze tussenruimte vóór de kolom Totaal */
body.is-admin.tarieven-aan table.blok tr > *:nth-last-child(2) { border-right: var(--totaal-gat) solid transparent; background-clip: padding-box; }
body.is-admin.tarieven-aan table.blok tr > *:nth-last-child(2) { border-bottom-color: transparent; box-shadow: inset 0 -1px 0 #EBEEF2; }
body.is-admin.tarieven-aan table.blok thead tr > *:nth-last-child(2) { box-shadow: inset 0 -1px 0 var(--lijn); }
body.is-admin.tarieven-aan table.blok tfoot tr > *:nth-last-child(2) { box-shadow: none; }
@media (max-width: 900px) {
  body.is-admin.tarieven-aan .sectie { background: var(--kaart); border: 1px solid var(--lijn); }
  body.is-admin.tarieven-aan .sectie .tabel-scroll { overflow-x: auto; }
}
.kop-bedrag { margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--lijn); }
.totaal-tabel thead th { font-size: .8rem; color: var(--subtiel); font-weight: 600; }
.totaal-tabel td { padding-left: 24px; }

/* Kolom "Definitief aantal" verbergen bij status Concept / vergelijk */
body.def-uit .def { display: none; }
.vergelijk-knoppen { display: flex; gap: 8px; flex-wrap: wrap; }
.knop.niet-actief { opacity: .55; }

/* Gebruiker wisselen in de header */
.wissel { display: flex; align-items: center; gap: 8px; margin: 0; }
.wissel label { flex-direction: row; align-items: center; gap: 6px; color: rgba(255,255,255,.8); font-size: .85rem; }
.wissel select { width: auto; padding: 4px 8px; font-size: .9rem; }

/* Prullenbak in het overzicht */
.actie-kol { width: 1%; text-align: center; }
.prullenbak-form { margin: 0; }
.prullenbak { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid transparent; border-radius: 4px; background: none; color: var(--subtiel); cursor: pointer; }
.prullenbak:hover, .prullenbak:focus-visible { color: var(--rood); border-color: #E7B8B4; background: #FBECEB; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Read-only: alleen bekijken */
input:disabled, select:disabled { background: #F1F3F5; color: #7A8591; border-color: #E1E5EA; cursor: not-allowed; opacity: 1; }

/* Offertenummer: alleen weergave */
input.alleen-weergave { background: #F6F8FA; font-weight: 600; letter-spacing: .02em; }
.overzicht td.nr { font-weight: 600; white-space: nowrap; }

/* Gebruikersbeheer */
.topnav { display: flex; align-items: center; gap: 16px; }
.topnav .knop-stil { color: #fff; border-color: rgba(255,255,255,.45); padding: 5px 12px; opacity: 1; }
.gebruikers-tabel { width: 100%; border-collapse: collapse; }
.gebruikers-tabel th, .gebruikers-tabel td { text-align: left; padding: 10px; border-bottom: 1px solid var(--lijn); vertical-align: middle; }
.gebruikers-tabel thead th { font-size: .85rem; color: var(--subtiel); }
.gebruikers-tabel tbody th { font-weight: 500; }
.gebruikers-tabel select { width: auto; min-width: 160px; }
.gebruikers-tabel .hint { display: block; }
.gebruikers-acties { margin-top: 16px; }

/* Alle offertes (Admin): verwijderde regels en herstelknop */
.overzicht tbody tr.verwijderd { cursor: default; color: var(--subtiel); background: #FAFAFB; }
.overzicht tbody tr.verwijderd:hover { background: #FAFAFB; }
.overzicht tr.verwijderd td.nr { text-decoration: line-through; }
.status-verwijderd { background: #FBECEB; color: var(--rood); }
.herstel { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid #BFD8C9; border-radius: 4px; background: #E8F5EE; color: var(--groen); cursor: pointer; }
.herstel:hover, .herstel:focus-visible { background: var(--groen); color: #fff; border-color: var(--groen); }
.subtiel svg { vertical-align: -4px; color: var(--groen); }
.topnav .knop-stil.actief { background: rgba(255,255,255,.18); }

/* Vergelijk alleen bij status Concept / vergelijk */
body.geen-vgl .vgl-paneel, body.geen-vgl .vgl { display: none !important; }

/* Afronding */
table.blok th.afr, table.blok td.afr { background: #FBFAF4; }
table.blok td.afr .invoer input { width: 64px; }
.subtotaal-licht { font-weight: 600; color: var(--subtiel); }

/* Afronding: het andere veld is geblokkeerd zolang er één is ingevuld */
.invoer.geblokkeerd input { background: #EEF0F3; color: #9AA3AD; cursor: not-allowed; }
.invoer.geblokkeerd .eenheid { opacity: .5; }

/* Detailscherm: titel en knoppen blijven bovenaan staan */
.detailkop {
  position: sticky; top: var(--topbalk-h, 54px); z-index: 8;
  background: var(--achtergrond);
  margin: -24px -24px 18px; padding: 14px 24px;
  border-bottom: 1px solid var(--lijn);
  box-shadow: 0 6px 12px -8px rgba(27, 37, 48, .18);
}
.kop-knoppen { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
@media (max-width: 700px) {
  .detailkop { margin: -14px -14px 14px; padding: 10px 14px; }
  .detailkop h1 { font-size: 1.25rem; }
}

/* Verborgen elementen (bijv. opslaan-knoppen zonder wijziging) echt verbergen */
[hidden] { display: none !important; }

/* Inloggen: wachtwoord vergeten en wachtwoord-eisen */
.login-link { margin: 14px 0 0; text-align: center; font-size: .9rem; }
.login-link .knop { color: #fff; }
.eisen { list-style: none; margin: 8px 0 4px; padding: 0; font-size: .85rem; color: var(--subtiel); }
.eisen li { padding-left: 22px; position: relative; margin: 2px 0; }
.eisen li::before { content: "\25CB"; position: absolute; left: 4px; }
.eisen li.ok { color: var(--groen); }
.eisen li.ok::before { content: "\2713"; font-weight: 700; }
.hint-ok { color: var(--groen); }
.hint-fout { color: var(--rood); }

/* Gebruikers: password reset */
.reset-kol .hint { display: block; margin-top: 4px; }
.reset-melding p { margin: 4px 0; }
.tijdelijk-ww { display: flex; align-items: center; gap: 10px; }
.tijdelijk-ww code { font-size: 1.2rem; font-weight: 700; letter-spacing: .06em; background: #fff; padding: 4px 10px; border-radius: 4px; border: 1px solid var(--lijn); }
.tijdelijk-ww { flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }

/* Tarieven in de sectiekoppen: standaard verborgen, zichtbaar via de knop "Tarieven" */
.tarief-info { display: none !important; }
body.tarieven-aan .tarief-info { display: inline-flex !important; }
/* ook het totaalbedrag in de kop van elke sectie (witte strook rechts) */
/* Standaard alle prijzen in de secties verborgen: kolom Totaal, bedragen in de koppen en in het totaaloverzicht */
body:not(.tarieven-aan) .bedrag,
body:not(.tarieven-aan) .kop-rechts { display: none !important; }
.topnav button.knop-stil { color: #fff; border-color: rgba(255,255,255,.45); padding: 5px 12px; background: transparent; }

/* Tarief op dezelfde regel (basislijn) als de sectietitel */
.klap { align-items: baseline; }
.klap .pijl { align-self: center; }
.klap .tarief-info { font-weight: 400; margin-left: 4px; }

/* Tabel - Tarief */
.tarieven-tabel tr.nieuw td, .tarieven-tabel tr.nieuw th { background: #E8F5EE; }
.nieuw-tarief { margin-top: 12px; align-items: end; }
.nieuw-tarief-knop { align-self: end; }
.tarieven-tabel input[type=text] { min-width: 200px; }
.tarieven-tabel input.kort { width: 110px; text-align: right; }
.tarieven-tabel input[type=checkbox] { width: 18px; height: 18px; }
.tarieven-tabel tr.fout td { background: #FBECEB; }
.tarieven-tabel .hint-fout { display: block; margin-top: 4px; }

/* Header: knoppen "Tabel - …" in het midden */
.topbalk { display: grid; grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr); gap: 16px; }
.topbalk .knop, .topbalk .merk, .topnav a { white-space: nowrap; }
.top-links { display: flex; align-items: center; gap: 24px; min-width: 0; }
.top-midden { justify-self: center; }
.topbalk .wie { justify-self: end; margin-left: 0; }
@media (max-width: 1180px) {
  .topbalk { display: flex; flex-wrap: wrap; }
  .top-midden { order: 3; width: 100%; justify-content: center; }
  .topbalk .wie { margin-left: auto; }
}

/* Offerte: aanmaakdatum, gewijzigd en versie onder het offertenummer */
.meta-rij { margin-top: 4px; }
.meta-rij input.alleen-weergave { font-weight: 500; color: var(--subtiel); letter-spacing: 0; }
.overzicht td.datum { white-space: nowrap; }

/* Overzicht: versienummer gecentreerd onder de kop */
.overzicht th.midden, .overzicht td.midden { text-align: center; }
.overzicht th.midden .kop { justify-content: center; position: relative; }
/* sorteerknoppen buiten de tekst houden, zodat de kolom precies onder het woord gecentreerd is */
.overzicht th.midden .sorteer { position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 4px; }
.overzicht th.midden { padding-right: 26px; padding-left: 26px; }

/* Legenda statussen en cirkel in het overzicht */
.legenda { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 12px; padding: 10px 14px;
  background: var(--kaart); border: 1px solid var(--lijn); border-radius: var(--radius); font-size: .88rem; }
.legenda li { display: inline-flex; align-items: center; gap: 8px; }
.stip { display: inline-block; width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 0 0 3px rgba(27,37,48,.15); vertical-align: middle; }
.overzicht td.midden .stip { width: 16px; height: 16px; }

/* Minimale breedte voor de kolommen Versie en de prullenbakken */
.overzicht th.actie-kol, .overzicht td.actie-kol { width: 1%; white-space: nowrap; padding-left: 4px; padding-right: 4px; }
.overzicht th.kol-versie, .overzicht td.kol-versie { width: 1%; white-space: nowrap; }
/* Definitief verwijderen: rode knop */
.definitief { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid #E7B8B4; border-radius: 4px; background: #FBECEB; color: var(--rood); cursor: pointer; }
.definitief:hover, .definitief:focus-visible { background: var(--rood); color: #fff; border-color: var(--rood); }

/* Vergelijk: kolommen van andere gebruikers standaard verborgen */
body.vgl-anderen-uit .vgl-ander { display: none; }

/* Secties groeien mee met de tabel (bijv. als de vergelijkingskolommen D, E en F zichtbaar zijn):
   de witte achtergrond is dan altijd minstens zo breed als de tabel */
form.offerte .sectie { width: max-content; min-width: 100%; }
form.offerte .sectie .tabel-scroll,
body.is-admin.tarieven-aan form.offerte .sectie .tabel-scroll { overflow-x: visible; }
/* keuzegroep (drie standen) */
.keuzegroep { display: inline-flex; flex-wrap: wrap; }
.keuzegroep .knop { border-radius: 0; margin-left: -1px; }
.keuzegroep .knop:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.keuzegroep .knop:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.keuzegroep .knop.actief { background: var(--vgl); border-color: var(--vgl-rand); color: var(--vgl-rand); font-weight: 600; position: relative; z-index: 1; }

/* Sectie Overige */
/* Aantal zo smal mogelijk, Omschrijving begint er direct achter en krijgt alle overige breedte */
table.overige th.ov-aantal, table.overige td.ov-aantal { width: 1%; white-space: nowrap; padding-right: 4px; }
table.overige th.omschr { width: auto; padding-left: 4px; }
table.overige td:nth-child(2) { padding-left: 4px; }
table.overige th.prijs-kol, table.overige td.prijs-kol { width: 1%; white-space: nowrap; }
table.overige input.ov-omschr { width: 100%; min-width: 200px; }
table.overige .invoer .eenheid:first-child { min-width: 0; }
body:not(.tarieven-aan) .prijs-kol { display: none !important; }

/* Winst / Risico */
table.winst-risico tr.wr-basis th, table.winst-risico tr.wr-basis td { color: var(--subtiel); }

/* "Toon alleen de kolom van …" verbergt bij Concept / vergelijk ook de kolom Definitief aantal (weergave Admin) */
body.is-admin.vgl-anderen-uit:not(.geen-vgl) .def { display: none; }

/* Schakelaar (aan/uit) */
.schakelaar { gap: 10px; }
.schakel { position: relative; width: 34px; height: 18px; border-radius: 999px; background: #C7CED6; transition: background .15s; flex: none; }
.schakel::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.schakelaar.aan .schakel { background: var(--vgl-rand); }
.schakelaar.aan .schakel::after { transform: translateX(16px); }
.schakelaar.aan { border-color: var(--vgl-rand); color: var(--vgl-rand); }
@media (prefers-reduced-motion: reduce) { .schakel, .schakel::after { transition: none; } }

/* Gele totalen netjes onder de waarden erboven */
/* 1) onder tekstwaarden (bijv. kolom Totaal): tekst van het totaal lijnt rechts uit met de tekst erboven */
td.num > output.subtotaal:only-child { margin-right: -8px; }
/* 2) onder invoervelden (Afronding, Afgerond): totaal even breed als het invoerveld, cijfers rechts op dezelfde plek */
.totaal-onder-invoer .subtotaal { box-sizing: border-box; min-width: 0; padding: 2px 8px; text-align: right; }
table.blok td.afr .totaal-onder-invoer .subtotaal { width: 64px; }
.totaal-onder-invoer.breed .subtotaal { width: 92px; }

/* Diverse: sectie volgt de paginabreedte (niet de inhoud), zodat Omschrijving de beschikbare ruimte vult */
form.offerte .sectie.sectie-vast { width: auto; }

/* Uurtarief in de kop van de sectie (Admin) */
.kop-tarief { flex-direction: row; align-items: center; gap: 8px; margin-left: auto; font-size: .85rem; color: var(--subtiel); font-weight: 500; }
.kop-tarief .invoer input { width: 96px; }
.kop-tarief .eenheid { min-width: 0; }
body.tarieven-aan .kop-tarief + .sectie-totaal { margin-left: 16px; }

/* Balk met titel en opslaan-knoppen even breed als de header */
.detailkop {
  /* --sbw = breedte van de verticale schuifbalk, zodat er geen horizontale schuifbalk ontstaat */
  margin-left: calc(50% - 50vw + var(--sbw, 0px) / 2); margin-right: calc(50% - 50vw + var(--sbw, 0px) / 2);
  padding-left: 24px; padding-right: 24px;
}
@media (max-width: 700px) { .detailkop { padding-left: 14px; padding-right: 14px; } }

/* Vergelijkingskolommen direct naast de eerste kolom (Omschrijving) in de secties met werkzaamheden */
body:not(.geen-vgl) table.blok:not(.overige):not(.winst-risico) th.omschr { width: 1px; white-space: nowrap; }
body:not(.geen-vgl) table.blok:not(.overige):not(.winst-risico) tbody th[scope="row"] { padding-right: 12px; }
table.blok th.vgl, table.blok td.vgl { padding-left: 8px; padding-right: 8px; }
table.blok th.vgl, table.blok td.vgl { width: 1px; white-space: nowrap; }

/* Algemeen: knop linksonder */
.algemeen-acties { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }

/* Status met slot-knop */
.status-veld { display: flex; align-items: flex-end; gap: 8px; }
.status-veld label { flex: 1; }
.slot-knop { display: inline-grid; place-items: center; width: 38px; height: 36px; border: 1px solid var(--lijn); border-radius: 4px; background: #fff; color: var(--groen); cursor: pointer; }
.slot-knop.dicht { color: var(--rood); border-color: #E7B8B4; background: #FBECEB; }
.slot-knop.dicht:hover { background: var(--rood); color: #fff; }
.slot-knop:disabled { cursor: default; opacity: .6; }

/* Regel met aanmaakdatum, gewijzigd en versie; knop "Tarieven opnieuw ophalen" uiterst rechts */
.meta-rij { display: flex; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-top: 8px; }
.meta-rij label { width: 200px; }
/* Versie: veld precies even breed als het woord "Versie" */
.meta-rij label.versie-veld { width: min-content; }
.meta-rij label.versie-veld input { width: 0; min-width: 100%; text-align: center; padding-left: 2px; padding-right: 2px; }
.meta-rij #tarieven-ophalen { margin-left: auto; }

/* Titelbalk detailscherm: regel 1 nummer + omschrijving gecentreerd, regel 2 alle knoppen links */
.detailkop { flex-direction: column; align-items: stretch; gap: 10px; }
.detailkop .detail-titel { text-align: center; width: 100%; }
.detailkop .kop-knoppen { justify-content: flex-end; }

/* Dialoogvenster */
.dialoog { border: 1px solid var(--lijn); border-radius: 10px; padding: 22px 24px; max-width: 520px; width: calc(100% - 32px); box-shadow: 0 20px 50px rgba(27,37,48,.25); color: var(--inkt); }
.dialoog::backdrop { background: rgba(27,37,48,.35); }
.dialoog h2 { margin-bottom: 10px; }
.dialoog p { margin: 6px 0; }
.dialoog-tabel { border-collapse: collapse; width: 100%; margin: 10px 0; }
.dialoog-tabel th, .dialoog-tabel td { padding: 6px 4px; border-bottom: 1px solid #EBEEF2; text-align: left; font-weight: 400; }
.dialoog-tabel td.num { text-align: right; font-weight: 600; white-space: nowrap; }
.dialoog-knoppen { display: flex; justify-content: flex-end; margin-top: 14px; }

/* Vergelijk: keuzelijsten direct achter de titel */
.vergelijk .vergelijk-kop { justify-content: flex-start; flex-wrap: wrap; gap: 12px 20px; }
.vergelijk .vergelijk-keuze { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 0; }
.vergelijk .vergelijk-keuze select { width: 190px; }

/* Vergelijkingskolommen zonder persoon ("— niemand —") worden nooit getoond, ook niet bij "Toon alle kolommen" */
.vgl-leeg { display: none !important; }
/* 8 keuzelijsten in het blok Vergelijk */
.vergelijk .vergelijk-keuze select { width: 132px; }

/* Onderdeelkop Uitzetten / Inmeten (eigen pijltje) */
table.blok tr.deel-kop td { background: #F6F8FA; font-weight: 600; color: var(--inkt); font-size: .95rem; border-bottom: 1px solid var(--lijn); padding-top: 7px; padding-bottom: 7px; }
table.blok tr.deel-kop td.vgl { background: var(--vgl); }
table.blok tr.deel-kop td.deel-label { font-size: .8rem; color: var(--subtiel); font-weight: 500; }
.deel-klap { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--inkt); cursor: pointer; white-space: nowrap; }
.deel-klap .pijl { width: 20px; height: 20px; background: #fff; border: 1px solid var(--lijn); font-size: .6rem; }
table.blok.deel-dicht thead tr:not(.deel-kop), table.blok.deel-dicht tbody, table.blok.deel-dicht tfoot { display: none; }
table.blok + table.blok, .tabel-scroll + .tabel-scroll { margin-top: 10px; }

/* Hoofdsectie "GPS werkzaamheden - Overwerk" met de drie overwerksecties erin */
.sectie-groep > .groep-body { padding: 12px 12px 2px 20px; }
body.is-admin.tarieven-aan .sectie-groep > .groep-body { padding-right: 0; }
.sectie-groep .sub-sectie { margin-bottom: 10px; }
.sectie-groep .sub-sectie .sectie-kop { background: #FBFCFD; }
.sectie-groep .sub-sectie .sectie-kop h2 { font-size: 1rem; }

/* Sectie Totaal: overzicht links, opmerkingen rechts */
.totaal-indeling { display: grid; grid-template-columns: minmax(0, auto) minmax(260px, 1fr); gap: 32px; align-items: stretch; }
.totaal-rechts { display: flex; flex-direction: column; gap: 6px; }
.totaal-rechts textarea { font: inherit; font-size: .95rem; color: var(--inkt); width: 100%; min-height: 80px; flex: 1; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--lijn); border-radius: 4px; resize: vertical; }
.totaal-rechts textarea:focus { border-color: var(--blauw); outline: 2px solid var(--blauw-licht); }
.offerte-afronding { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--lijn); }
.offerte-afronding label { flex-direction: row; font-weight: 600; color: var(--inkt); font-size: .95rem; }
.offerte-afronding .invoer input { width: 120px; text-align: right; }
.offerte-afronding .eenheid { min-width: 0; }
@media (max-width: 800px) { .totaal-indeling { grid-template-columns: 1fr; } }

/* Opmerkingen even hoog als de opsomming van prijzen */
.totaal-rechts { height: 100%; }
/* Afronding offerte: zelfde plek en breedte als het gele totaal erboven */
.totaal-tabel tfoot .subtotaal { display: inline-block; box-sizing: border-box; width: 140px; }
.totaal-tabel tr.afronding-rij th, .totaal-tabel tr.afronding-rij td { border-top: 0; padding-top: 8px; font-weight: 600; }
.totaal-tabel tr.afronding-rij label { display: inline; font-size: inherit; color: var(--inkt); font-weight: 600; }
.totaal-tabel input.afronding-invoer {
  width: 140px; box-sizing: border-box; margin-right: -8px; text-align: right; font-weight: 700;
  /* zelfde opmaak als het gele totaal erboven */
  padding: 2px 8px; font: inherit; font-weight: 700; color: var(--inkt);
  background: var(--amber-licht); border: 0; border-radius: 4px; box-shadow: inset 3px 0 0 var(--amber);
}
.totaal-tabel input.afronding-invoer:focus { outline: 2px solid var(--blauw); outline-offset: 1px; }
.totaal-tabel input.afronding-invoer:disabled { background: var(--amber-licht); color: var(--inkt); opacity: .8; }
.totaal-tabel thead th.num { text-align: right; }

/* =====================================================================
   Compacte weergave van het offertescherm (body.compact)
   ===================================================================== */
body.compact { font-size: 14px; --totaal-breedte: 132px; --totaal-gat: 12px; }
body.compact .topbalk { padding: 6px 20px; }
body.compact .topbalk .knop, body.compact .topnav .knop-stil { padding: 3px 10px; font-size: .85rem; }
body.compact .merk { font-size: .95rem; }
body.compact .inhoud { padding: 12px 20px; }
body.compact .knop { padding: 5px 11px; font-size: .88rem; }

/* titelbalk */
body.compact .detailkop { padding: 6px 20px; gap: 6px; margin-top: -12px; margin-bottom: 10px; }
body.compact .detailkop .detail-titel { font-size: 1.15rem; }

/* kaarten en velden */
body.compact .kaart { padding: 10px 14px; margin-bottom: 8px; }
body.compact .melding { padding: 6px 10px; margin-bottom: 8px; }
body.compact label { font-size: .78rem; gap: 2px; }
body.compact input[type=text], body.compact input[type=email], body.compact input[type=number], body.compact select { padding: 4px 7px; font-size: .9rem; }
body.compact .velden-raster { gap: 6px 12px; margin-bottom: 4px; }
body.compact .meta-rij { margin-top: 2px; }
body.compact .algemeen-acties { margin-top: 8px; }
body.compact .vergelijk h2 { font-size: 1rem; }

/* secties */
body.compact .sectie { padding: 0; }
body.compact .sectie-kop { padding: 6px 14px; gap: 10px; }
body.compact .sectie-kop h2 { font-size: .98rem; }
body.compact .pijl { width: 20px; height: 20px; font-size: .6rem; }
body.compact .sectie-body { padding: 6px 14px 10px; }
body.compact .kop-tarief .invoer input { width: 84px; }
body.compact .sectie-groep > .groep-body { padding: 8px 10px 0 14px; }
body.compact.is-admin.tarieven-aan .sectie-groep > .groep-body { padding-right: 0; }
body.compact .sectie-groep .sub-sectie { margin-bottom: 6px; }

/* tabellen */
body.compact table.blok { margin-top: 6px; }
body.compact table.blok th, body.compact table.blok td { padding: 2px 6px; }
body.compact table.blok thead th { font-size: .72rem; padding-top: 4px; padding-bottom: 4px; }
body.compact table.blok tr.deel-kop td { padding-top: 4px; padding-bottom: 4px; font-size: .9rem; }
body.compact .deel-klap .pijl { width: 18px; height: 18px; }
body.compact table.blok tfoot th, body.compact table.blok tfoot td { padding-top: 5px; }
body.compact .invoer { gap: 4px; }
body.compact .invoer input { width: 70px; padding: 2px 6px; }
body.compact .invoer.klein input { width: 54px; }
body.compact table.blok td.afr .invoer input { width: 54px; }
body.compact table.blok td.afr .totaal-onder-invoer .subtotaal { width: 54px; }
body.compact .eenheid { font-size: .75rem; min-width: 26px; }
body.compact .subtotaal { min-width: 54px; padding: 1px 6px; }
body.compact td.num > output.subtotaal:only-child { margin-right: -6px; }
body.compact table.overige input.ov-omschr { padding: 3px 7px; }

/* totaal */
body.compact .totaal-tabel th, body.compact .totaal-tabel td { padding-top: 3px; padding-bottom: 3px; }
body.compact .totaal-tabel tfoot th, body.compact .totaal-tabel tfoot td { padding-top: 6px; }
body.compact .totaal-rechts textarea { font-size: .9rem; }
