/* ════════════════════════════════════════════════════════════════
   AgroDash.nl — portalschil in de huisstijl van de interne AgroDash
   ("Noordzee", zie C:/claudeprojects/agrodash/app/static/style.css):
   staalgrijze vlakken, kobalt interactie-accent, Schibsted Grotesk +
   Fragment Mono, vierkante hoeken, donkergroene sidebar + kopband en
   de weeklineaal. Onderaan een compatibiliteitslaag die de oude
   --color-*-variabelen en componentklassen van het portaal op de
   nieuwe tokens afbeeldt, zodat bestaande pagina's (tegels, kaarten,
   formulieren) zonder aanpassing in de nieuwe schil renderen.
   ════════════════════════════════════════════════════════════════ */

/* ── Design tokens ── */
:root {
  --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;   /* schil: sidebar + kopband */
  --font-c: 'Schibsted Grotesk', 'Segoe UI', system-ui, sans-serif; /* inhoud */
  --mono: 'Fragment Mono', 'Consolas', monospace;

  --bg:       #eceff3;
  --panel:    #ffffff;
  --panel-2:  #f6f8fa;

  --primary:      #2447f0;
  --primary-dark: #1d3ad1;
  --primary-soft: #edf2fd;
  --primary-50:   #f0f4fb;

  --text:       #111927;
  --text-2:     #2c3a4b;
  --muted:      #5d6b78;
  --muted-2:    #94a1ae;

  --border:     #cfd8e3;
  --border-2:   #94a1ae;
  --divider:    #e2e8ef;

  --hover-bg:   #edf2fd;
  --selected:   #e7eefc;
  --selected-2: #d8e4fd;

  --ok:      #0a5c46;
  --ok-bg:   #ddefe9;
  --warn:    #d97706;
  --warn-bg: #fbe8c7;
  --err:     #be123c;
  --err-bg:  #fbe2e8;
  --info:    #2563eb;
  --info-bg: #dde9fd;

  --radius: 0px;
  --radius-lg: 0px;
  --tbl-font-size: 11px;
  --shadow-lg: 0 10px 30px rgba(17,25,39,.18);

  /* Sidebar — de bos-identiteit van de interne AgroDash */
  --sb-bg:      #0a2416;
  --sb-fg:      #e6efe9;
  --sb-muted:   #8fab99;
  --sb-hover:   #123524;
  --sb-active:  #1a5236;
  --sb-accent:  #4fd08a;
  --sb-border:  #173b27;

  --forest:      #0f6b36;
  --forest-dark: #0a4a24;
  --forest-50:   #e7f4ec;

  /* Weeklineaal-selectie (amberband, zoals intern) */
  --wk-sel-bg:   #f5a623;
  --wk-sel-tick: #6b3f00;
  --wk-sel-fg:   #2a1c00;
}

/* ── Basis ── */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
code, .mono { font-family: var(--mono); }

/* ── App-raster ── */
.app {
  display: grid;
  grid-template-columns: 216px 1fr;
  height: 100vh; overflow: hidden;
}

/* ── Sidebar ── */
.sb {
  background: var(--sb-bg); color: var(--sb-fg);
  border-right: 1px solid var(--sb-border);
  display: flex; flex-direction: column; min-height: 0;
  user-select: none;
}
.sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.sb-logo {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, var(--sb-accent), var(--forest));
  display: grid; place-items: center;
  color: #031910; font-weight: 800; font-size: 13px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset;
  flex-shrink: 0; text-decoration: none;
}
.sb-wordmark { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.sb-wordmark:hover { text-decoration: none; }
.sb-wordmark .n { font-weight: 700; font-size: 14px; letter-spacing: .2px; color: #fff; }
.sb-wordmark .v { font-size: 10px; color: var(--sb-muted); letter-spacing: .5px; }

.sb-nav { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.sb-nav::-webkit-scrollbar { width: 6px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 3px; }

.sb-section-block { margin-top: 6px; }
.sb-section {
  display: flex; align-items: center; gap: 8px;
  font-size: 9px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sb-muted);
  padding: 7px 8px 5px 10px;
}
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 5px;
  color: var(--sb-fg);
  font-size: 12px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: background .1s, color .1s;
  width: 100%; text-align: left; background: none;
  text-decoration: none;
}
.sb-item:hover { background: var(--sb-hover); color: #fff; text-decoration: none; }
.sb-item.active {
  background: var(--sb-active);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--sb-accent);
  font-weight: 600;
}
.sb-item .ic {
  width: 16px; height: 16px; flex-shrink: 0;
  stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: .85;
}
.sb-item.active .ic { opacity: 1; color: var(--sb-accent); }
.sb-item .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sb-foot {
  border-top: 1px solid var(--sb-border);
  padding: 10px 12px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.sb-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sb-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--sb-active);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 11px;
  flex-shrink: 0;
}
.sb-user-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sb-user-meta .u {
  font-size: 12px; font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sb-user-meta .s {
  font-size: 10px; color: var(--sb-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sb-foot-ctrl { display: flex; align-items: center; gap: 6px; }
.sb-foot-ctrl form { margin: 0; display: inline-flex; }
.sb-foot-btn {
  background: none; border: 1px solid transparent;
  color: var(--sb-muted); cursor: pointer;
  padding: 3px 8px; border-radius: 4px; font-size: 11px;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background .1s, color .1s;
  margin: 0; width: auto;
}
.sb-foot-btn:hover { background: var(--sb-hover); color: #fff; }
.sb-foot-btn .ic { width: 13px; height: 13px; }

/* Taalwissel in de sidebar-voet */
.lang-switch { display: inline-flex; gap: 2px; margin-right: auto; }
.lang-switch button {
  margin: 0; width: auto; padding: 2px 7px; font-size: 10px;
  font-weight: 600; background: transparent; color: var(--sb-muted);
  border: 1px solid transparent; border-radius: 4px; cursor: pointer;
}
.lang-switch button:hover { background: var(--sb-hover); color: #fff; }
.lang-switch button.active { color: var(--sb-accent); border-color: var(--sb-border); }

/* ── Hoofdgebied ── */
.main {
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
  font-family: var(--font-c);
}

/* Kopband: de sidebar-identiteit loopt door over de paginakop */
.module-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  background: var(--sb-bg);
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
  min-height: 48px;
  font-family: var(--font);
  color: var(--sb-fg);
}
.module-header h1 {
  margin: 0; font-size: 15px; font-weight: 700;
  color: var(--sb-fg); letter-spacing: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.module-header h1:empty { display: none; }
.module-header .btn, .module-header a.btn {
  background: var(--sb-active); color: #fff;
  border: 1px solid var(--sb-border); border-radius: 5px;
  box-shadow: inset 2px 0 0 var(--sb-accent);
  font-size: 11px; padding: 4px 10px; margin: 0;
}
.module-header .btn:hover, .module-header a.btn:hover { background: var(--sb-hover); border-color: var(--sb-border); text-decoration: none; }
.module-header h1 .muted { color: var(--sb-muted); font-weight: 400; }
.module-header .module-actions {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
/* Terugnavigatie als kruimel in de kopband (het back-blok van base.html) */
.module-header .backlink {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 0; font-size: 11px; color: var(--sb-muted);
  white-space: nowrap; text-decoration: none;
  padding: 3px 8px; border: 1px solid var(--sb-border); border-radius: 5px;
}
.module-header .backlink:hover { color: #fff; background: var(--sb-hover); text-decoration: none; }

/* Weergavewissel (ADR-0021) in de kopband */
.view-switch { display: inline-flex; gap: 2px; margin: 0; }
.view-switch button {
  margin: 0; width: auto; padding: 3px 9px; font-size: 10.5px;
  font-weight: 600; background: transparent; color: var(--sb-muted);
  border: 1px solid var(--sb-border); border-radius: 5px; cursor: pointer;
}
.view-switch button:hover { background: var(--sb-hover); color: #fff; }
.view-switch button.active {
  color: #fff; background: var(--sb-active);
  box-shadow: inset 2px 0 0 var(--sb-accent);
}

/* Organisatiekeuze naast de rolknoppen (meekijken met één partij) */
.view-org { display: inline-flex; margin: 0 0 0 6px; }
.view-org select {
  margin: 0; width: auto; max-width: 190px; padding: 3px 6px;
  font-family: var(--font); font-size: 10.5px; font-weight: 600;
  background: transparent; color: var(--sb-muted);
  border: 1px solid var(--sb-border); border-radius: 5px; cursor: pointer;
}
.view-org select:hover { background: var(--sb-hover); color: #fff; }
.view-org option { color: #1c2b22; background: #fff; }

/* Voorbeeldweergave-banner */
.preview-banner {
  background: var(--warn-bg); color: var(--warn);
  text-align: center; font-size: 12px; padding: 5px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 30%, var(--warn-bg));
  flex-shrink: 0;
}

/* ── Weeklineaal — navigatievariant (links, actieve week gemarkeerd) ── */
.week-liniaal {
  display: flex; align-items: flex-start; gap: 0;
  padding: 4px 14px 6px;
  background: var(--sb-bg);
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
  font-family: var(--font);
  overflow-x: auto;
}
.week-liniaal a {
  flex: 1 1 0; min-width: 22px; max-width: 40px;
  text-decoration: none; border-radius: 5px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 2px 0 3px; transition: background .1s;
}
.week-liniaal a i { display: block; width: 1px; height: 7px; background: #3f6650; transition: height .12s, width .12s, background .12s; }
.week-liniaal a span { font-size: 10px; font-weight: 500; color: var(--sb-muted); transition: color .12s; line-height: 1.2; }
.week-liniaal a:hover { background: var(--sb-hover); text-decoration: none; }
.week-liniaal a:hover i { height: 12px; background: var(--sb-fg); }
.week-liniaal a:hover span { color: #fff; }
.week-liniaal a.cur { background: var(--sb-active); }
.week-liniaal a.cur i { width: 3px; height: 14px; background: var(--sb-accent); }
.week-liniaal a.cur span { color: #fff; font-size: 10.5px; font-weight: 600; }
.week-liniaal a.lin-alle { flex: 0 0 auto; min-width: 48px; max-width: 62px; }
.week-liniaal a.lin-alle span { letter-spacing: .08em; }

/* ── Weeklineaal — sleep-selectievariant (filtert de tabel eronder) ── */
.wk-ruler {
  display: flex; align-items: stretch; gap: 0;
  padding: 5px 14px 7px;
  background: var(--sb-bg);
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0; font-family: var(--font);
  overflow-x: auto;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
  contain: layout paint;
}
.wk-ruler .wk, .wk-ruler .wk-alle {
  flex: 1 1 0; min-width: 24px; max-width: 42px; height: 34px;
  border: 0; background: transparent; cursor: pointer;
  border-radius: 5px; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
  padding: 3px 0 4px; transition: background .08s;
  margin: 0; width: auto;
}
.wk-ruler .wk-alle { flex: 0 0 auto; min-width: 50px; max-width: 62px; }
.wk-ruler .wk i {
  display: block; width: 2px; height: 15px; background: #3f6650;
  transform: scaleY(.47); transform-origin: bottom center;
  transition: transform .1s, background .1s; pointer-events: none;
}
.wk-ruler .wk span, .wk-ruler .wk-alle span {
  font-size: 10px; font-weight: 500; color: var(--sb-muted);
  transition: color .1s; line-height: 1.2; pointer-events: none;
}
.wk-ruler .wk-alle span { letter-spacing: .08em; }
.wk-ruler .wk:hover, .wk-ruler .wk-alle:hover { background: var(--sb-hover); }
.wk-ruler .wk:hover i { transform: scaleY(.8); background: var(--sb-fg); }
.wk-ruler .wk:hover span, .wk-ruler .wk-alle:hover span { color: #fff; }
.wk-ruler .wk.sel { background: var(--wk-sel-bg); border-radius: 0; }
.wk-ruler .wk.sel i { transform: scaleY(1); background: var(--wk-sel-tick); }
.wk-ruler .wk.sel span { color: var(--wk-sel-fg); font-weight: 700; }
.wk-ruler .wk.sel-start { border-top-left-radius: 7px; border-bottom-left-radius: 7px; }
.wk-ruler .wk.sel-end   { border-top-right-radius: 7px; border-bottom-right-radius: 7px; }
.wk-ruler .wk.sel:hover { background: color-mix(in srgb, var(--wk-sel-bg) 85%, #fff); }
.wk-ruler .wk.sel:hover span { color: var(--wk-sel-fg); }
.wk-ruler.is-dragging, .wk-ruler.is-dragging .wk { cursor: grabbing; }

/* Hintregel onder de lineaal: uitleg + selectie- en rijteller */
.wk-hint {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 6px 18px; font-size: 11px; color: var(--muted);
  background: var(--panel); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wk-hint .wkpill {
  font-weight: 700; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border);
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.wk-hint .wkpill.amber {
  color: var(--wk-sel-fg); background: var(--wk-sel-bg);
  border-color: color-mix(in srgb, var(--wk-sel-bg) 70%, #000);
}
.wk-hint .reset {
  margin: 0 0 0 auto; width: auto; cursor: pointer; font: inherit; color: var(--muted);
  background: transparent; border: 1px solid var(--border);
  border-radius: 0; padding: 3px 12px; transition: color .1s, background .1s;
}
.wk-hint .reset:hover { color: var(--text); background: var(--hover-bg); }

/* ── Inhoudsgebied ── */
.module-view {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.page { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; }
.page h1 { font-size: 1.25rem; margin: 0.25rem 0 0.75rem; }
.page h2 { font-size: 1rem; }
/* Tabelpaginas: randloos, de tabelwrap scrolt zelf */
.page.flush { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.page.wide { max-width: none; }

.module-layout { display: flex; flex-direction: column; flex: 1; height: 100%; min-height: 0; }
.module-content { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.module-table-area { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

/* Werkbalk boven een tabel (filters, knoppen, meta) */
.tb {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 12px;
}
.tb .grow { flex: 1; }
.tb-label { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tb form { margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.tb select, .tb .inp {
  padding: 4px 8px; border-radius: 0;
  font-size: 11px; font-family: inherit;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); outline: none;
}
.tb select:focus, .tb .inp:focus { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent); }

/* Segmentschakelaar in de werkbalk (bv. per lot / per merk) */
.tb-seg { display: inline-flex; }
.tb-seg a {
  padding: 3px 10px; font-size: 11px; font-weight: 600;
  color: var(--muted); text-decoration: none;
  border: 1px solid var(--border); border-left-width: 0;
  background: var(--panel);
}
.tb-seg a:first-child { border-left-width: 1px; }
.tb-seg a:hover { color: var(--text); background: var(--hover, color-mix(in srgb, var(--primary) 6%, var(--panel))); }
.tb-seg a.cur {
  color: #fff; background: var(--primary);
  border-color: var(--primary);
}

/* Statusbalk onder een tabel */
.status-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 18px; font-size: 10.5px; color: var(--muted);
  background: var(--panel); border-top: 1px solid var(--border); flex-shrink: 0;
}
.status-bar .grow { flex: 1; }

/* ── Moduletabel (de grote overzichtstabel) ── */
.module-tbl-wrap {
  flex: 1; min-height: 0;
  overflow: auto;
  background: var(--panel);
}
.module-tbl-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.module-tbl-wrap::-webkit-scrollbar-track { background: var(--panel); }
.module-tbl-wrap::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 5px; border: 2px solid var(--panel); }
.module-tbl-wrap::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.module-tbl {
  border-collapse: separate; border-spacing: 0;
  width: max-content; min-width: 100%; font-size: var(--tbl-font-size);
}
.module-tbl thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--panel-2); color: var(--muted);
  font-size: 10px; font-weight: 700;
  letter-spacing: .02em;
  text-align: left; padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--divider);
  white-space: nowrap; overflow: hidden;
}
.module-tbl thead th:first-child { border-left: none; }
.module-tbl .th-inner { display: flex; align-items: center; gap: 4px; }
.module-tbl .th-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.module-tbl tbody tr { border-bottom: 1px solid var(--divider); }
.module-tbl tbody tr:hover td { background: var(--hover-bg); }
.module-tbl tbody td {
  padding: 3.5px 8px; font-family: var(--mono); color: var(--text);
  white-space: nowrap; vertical-align: middle;
  border-bottom: 1px solid var(--divider); border-right: 1px solid var(--divider);
  font-size: var(--tbl-font-size);
}
.module-tbl tbody td.num { font-variant-numeric: tabular-nums; }
.module-tbl tbody td a { color: var(--primary); font-weight: 600; }
.module-tbl tbody td.chips { white-space: normal; min-width: 16rem; font-family: var(--font-c); }

/* Groepsmarkering (data-groep): deelregels van één lot zijn visueel één
   partij — aanwijzen licht ze samen op, klikken geeft de hele groep de
   amberband van de weeklineaal (zoals intern op /shipments). */
.module-tbl tbody tr.ghl td { background: var(--hover-bg); }
.module-tbl tbody tr.row-active td { background: var(--wk-sel-bg) !important; }
.module-tbl tbody tr.row-active.ghl td,
.module-tbl tbody tr.row-active:hover td { background: color-mix(in srgb, var(--wk-sel-bg) 88%, #fff) !important; }

/* Sorteer-/filterknoppen in de koppen (funnel rechts in de cel) */
.nz-funnel thead th:has(.filter-btn) { position: sticky; top: 0; padding-right: 20px; }
.nz-funnel thead .filter-btn {
  position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  padding: 0 2px; font-size: 10px; line-height: 1; color: var(--muted-2);
  background: transparent; border: 0; cursor: pointer; margin: 0; width: auto;
}
.nz-funnel thead .filter-btn:hover { color: var(--text); background: transparent; }
.nz-funnel thead .filter-btn.is-active { color: var(--primary); }
.nz-funnel thead .sort-btn { display: none; }
.nz-funnel thead .sort-btn.is-active {
  display: inline; background: none; border: 0; cursor: pointer;
  color: var(--primary); font-size: 10px; padding: 0 2px; line-height: 1; margin: 0; width: auto;
}
.nz-funnel thead .th-label { cursor: pointer; }

/* Gefilterde kolom: getinte kop + accentstreep */
.module-tbl thead th:has(.filter-btn.is-active) {
  background: var(--primary-soft);
  box-shadow: inset 0 -2px 0 0 var(--primary);
}
.module-tbl thead th:has(.filter-btn.is-active) .th-label { color: var(--primary); font-weight: 700; }

/* "Filters wissen (N)"-chip in de statusbalk */
.tc-clear-filters {
  cursor: pointer; font: inherit; font-size: 11px; line-height: 1.4;
  padding: 2px 10px; margin: 0; width: auto; border-radius: 999px;
  color: var(--primary); background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
  transition: background .1s, color .1s, border-color .1s;
}
.tc-clear-filters:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.tc-clear-filters[hidden] { display: none; }

/* ── Kolomfilterpaneel (Google-Sheets-achtig; deferred apply) ── */
.excel-filter-drop {
  position: fixed; z-index: 600;
  display: none; flex-direction: column; width: 236px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 0; box-shadow: var(--shadow-lg);
  font-family: var(--font-c); font-size: 12px; color: var(--text);
}
.excel-filter-drop.open { display: flex; }
.efd-sort { display: flex; gap: 6px; padding: 8px 10px 0; }
.efd-sort-btn {
  flex: 1; cursor: pointer; font: inherit; font-size: 11px; padding: 4px 6px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 0; transition: border-color .1s, color .1s; margin: 0; width: auto;
}
.efd-sort-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--panel-2); }
.efd-search { padding: 8px 10px 6px; }
.efd-search input {
  width: 100%; padding: 4px 8px; font: inherit; font-size: 12px;
  background: #fff; border: 1px solid var(--border); border-radius: 0; outline: none;
}
.efd-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 12%, transparent); }
.efd-acties { display: flex; align-items: baseline; gap: 10px; padding: 0 10px 5px; }
.efd-link { cursor: pointer; color: var(--primary); font-size: 11px; text-decoration: none; }
.efd-link:hover { text-decoration: underline; }
.efd-tel { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.efd-list {
  max-height: 240px; overflow-y: auto; padding: 4px 0;
  border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider);
}
.efd-list::-webkit-scrollbar { width: 5px; }
.efd-list::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
.efd-item {
  display: flex; align-items: center; gap: 7px; padding: 3px 10px; font-size: 12px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 400; margin: 0;
}
.efd-item:hover { background: var(--primary-50); }
.efd-item input[type=checkbox] { accent-color: var(--primary); flex-shrink: 0; cursor: pointer; margin: 0; width: auto; }
.efd-item .efd-leeg { color: var(--muted); font-style: italic; }
.efd-geen { padding: 10px; color: var(--muted); font-size: 11px; }
.efd-footer { display: flex; justify-content: flex-end; gap: 6px; padding: 8px 10px; }
.efd-btn {
  cursor: pointer; font: inherit; font-size: 11.5px; padding: 4px 14px;
  border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 0;
  transition: border-color .1s; margin: 0; width: auto; font-weight: 400;
}
.efd-btn:hover { border-color: var(--border-2); background: #fff; }
.efd-ok { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.efd-ok:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.efd-wis-filter { margin-right: auto; color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, var(--border)); }
.efd-wis-filter:hover { border-color: var(--err); background: #fff; }

/* ── Dashboardkaarten (startpagina) ── */
.dash { padding: 18px 20px; overflow-y: auto; flex: 1; background: var(--bg); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.dash-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px;
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer;
  transition: border-color .12s, transform .12s, box-shadow .12s;
  position: relative; min-height: 110px;
  color: var(--text); text-decoration: none;
}
.dash-card:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-lg); text-decoration: none; }
.dash-card .dc-top { display: flex; align-items: center; gap: 8px; }
.dash-card .dc-ic {
  width: 28px; height: 28px; border-radius: 0;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; flex-shrink: 0;
}
.dash-card .dc-ic .ic { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.dash-card h3 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.dash-card p { margin: 0; font-size: 11px; color: var(--muted); line-height: 1.4; }
.dash-card .dc-foot { margin-top: auto; display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--muted); padding-top: 4px; }
.dash-card .dc-foot .arr { margin-left: auto; color: var(--primary); font-weight: 700; }
.dash h2 { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
.dash .intro { margin: 0 0 14px; }
.dash .intro h1 { margin: 0 0 2px; font-size: 18px; font-weight: 700; }
.dash .intro p { margin: 0; font-size: 12px; color: var(--muted); }

/* ── Componenten ── */
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; white-space: nowrap;
}
.pill-done { background: var(--ok-bg); color: var(--ok); }
.pill-open { background: var(--err-bg); color: var(--err); }
.pill-wait { background: var(--warn-bg); color: var(--warn); }

.note {
  border-left: 3px solid var(--primary); padding: 10px 14px;
  background: var(--primary-50); border-radius: 0; margin: 12px 0;
}
.note-title { font-weight: 700; margin-bottom: 6px; }
.note-text { color: var(--muted); font-size: 13px; line-height: 1.45; }

.errors {
  background: var(--err-bg); color: var(--err);
  border-radius: 0; border-left: 3px solid var(--err);
  padding: 0.6rem 0.9rem; font-size: 0.85rem; margin-bottom: 0.5rem;
}
.notice {
  background: var(--ok-bg); color: var(--ok);
  border-radius: 0; border-left: 3px solid var(--ok);
  padding: 0.6rem 0.9rem; font-size: 0.85rem; margin-bottom: 0.5rem;
}
.helptext, .muted { color: var(--muted); font-size: 0.8rem; }

#toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--panel);
  padding: 9px 16px; border-radius: 0;
  font-size: 12px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s; z-index: 900;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ════════════════════════════════════════════════════════════════
   Compatibiliteitslaag — bestaande portalpagina's (tegels, kaarten,
   formulieren, table.data, chips) blijven werken op de oude
   --color-*-variabelen en klassen.
   ════════════════════════════════════════════════════════════════ */
:root {
  --color-bg: var(--bg);
  --color-surface: var(--panel);
  --color-text: var(--text);
  --color-muted: var(--muted);
  --color-primary: var(--primary);
  --color-primary-dark: var(--primary-dark);
  --color-border: var(--border);
  --color-error-bg: var(--err-bg);
  --color-error: var(--err);
  --color-ok-bg: var(--ok-bg);
  --color-ok: var(--ok);
  --color-warn-bg: var(--warn-bg);
  --color-warn: var(--warn);
}

/* Oude kaartpagina's (login, MFA, e-mailwijziging, bevestigingen) */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 2rem;
  max-width: 24rem;
  margin: 8vh auto 0;
  box-shadow: var(--shadow-lg);
}
.card h1 { font-size: 1.25rem; margin: 0 0 0.25rem; }
.card p.sub { color: var(--muted); margin: 0 0 1.25rem; font-size: 0.9rem; }

form label { display: block; font-size: 0.85rem; font-weight: 500; margin: 0.75rem 0 0.25rem; }
form input[type=text], form input[type=email], form input[type=password], form input[type=file] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--panel);
  color: var(--text);
}
form input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
button, .btn {
  margin-top: 0;
  width: auto;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--primary);
  border-radius: 0;
  background: var(--primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
button:hover, .btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
a.btn { display: inline-block; text-decoration: none; }
/* In de oude kaartformulieren blijft de knop volle breedte met marge erboven */
.card form button { width: 100%; margin-top: 1.25rem; padding: 0.6rem; font-size: 0.95rem; }

.backlink { display: inline-block; margin: 0 1rem 1rem 0; font-size: 0.9rem; }

table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  font-size: 0.85rem;
}
table.data th, table.data td { padding: 0.5rem 0.6rem; text-align: left; }
table.data thead th {
  border-bottom: 1px solid var(--border);
  background: var(--panel-2); color: var(--muted);
  font-size: 0.72rem; font-weight: 700; letter-spacing: .02em;
}
table.data tbody td { border-bottom: 1px solid var(--divider); }
table.data tbody tr:hover td { background: var(--hover-bg); }
.scroll-x { overflow-x: auto; }

/* Documentchips (aanvoerlijst/downloader-weergave, ADR-0019/0022) */
.chip {
  display: inline-block; padding: 0 0.45rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; line-height: 1.5;
  margin: 0 0.15rem 0.1rem 0; white-space: nowrap;
}
a.chip-ok { background: var(--ok-bg); color: var(--ok); text-decoration: none; border: 1px solid transparent; font-weight: 600; }
a.chip-ok:hover { border-color: var(--ok); text-decoration: none; }
.chip-busy { background: var(--warn-bg); color: var(--warn); }
.chip-todo { background: var(--bg); color: var(--muted); border: 1px dashed var(--border); }

/* Oude filterbalk (selects boven een tabel) */
form.filterbar { display: flex; align-items: center; gap: 0.5rem; margin: 0; flex-wrap: wrap; }
form.filterbar label { margin: 0; font-size: 11px; color: var(--muted); font-weight: 600; }
form.filterbar select {
  padding: 4px 8px; border: 1px solid var(--border);
  border-radius: 0; font-size: 11px; background: var(--panel); font-family: inherit;
}
form.filterbar button { margin: 0; width: auto; padding: 4px 10px; font-weight: 500; font-size: 11px; }

/* ── Kale schil (login, wachtwoordreset: geen sidebar) ── */
body.bare { display: flex; flex-direction: column; min-height: 100vh; height: auto; background: var(--bg); }
body.bare .bare-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--sb-bg); border-bottom: 1px solid var(--sb-border);
}
body.bare .bare-head .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
body.bare .bare-head .brand .n { font-weight: 700; font-size: 14px; color: #fff; font-family: var(--font); }
body.bare main { flex: 1; width: 100%; max-width: 60rem; margin: 0 auto; padding: 0 1.5rem 2rem; }
body.bare footer.site { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 1rem; }

/* ── Klein scherm: sidebar wordt een bovenbalk ── */
@media (max-width: 860px) {
  .app { display: flex; flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }
  .sb { flex-direction: column; border-right: 0; border-bottom: 1px solid var(--sb-border); }
  .sb-nav { display: flex; overflow-x: auto; padding: 4px 8px; gap: 2px; }
  .sb-section-block { margin: 0; display: flex; align-items: center; }
  .sb-section { display: none; }
  .sb-section-items { display: flex; gap: 2px; }
  .sb-item { white-space: nowrap; width: auto; }
  .sb-foot { flex-direction: row; align-items: center; }
  .sb-foot-ctrl { margin-left: auto; }
  .main { overflow: visible; }
  .module-view, .page { overflow: visible; }
  .page.flush { overflow: visible; display: block; }
  .module-tbl-wrap { overflow-x: auto; max-height: none; }
  .module-header h1 { white-space: normal; }
}
