/* ============================================================
   factr.css — het designsysteem van de Django-app.
   Bron: het Factr-designsysteem (tokens.json + componenten). Twee
   thema's via data-theme op <html>: light (standaard) en dark.
   Alleen scherm-UI; de PDF-templates hebben hun eigen CSS.
   ============================================================ */

/* Fonts staan lokaal in static/fonts/ (zie scripts/download_fonts.py).
   Een @import naar Google Fonts kost bij de eerste lading twee extra
   DNS+TLS-verbindingen die het renderen blokkeren. */

@font-face { font-family:'Hanken Grotesk'; font-style:normal; font-weight:400; font-display:swap;
  src:url("../fonts/HankenGrotesk-400.78c2be80e151.woff2") format('woff2'); }

@font-face { font-family:'Hanken Grotesk'; font-style:normal; font-weight:500; font-display:swap;
  src:url("../fonts/HankenGrotesk-500.8d6eb9d4c9c2.woff2") format('woff2'); }

@font-face { font-family:'Hanken Grotesk'; font-style:normal; font-weight:600; font-display:swap;
  src:url("../fonts/HankenGrotesk-600.0c156079a0be.woff2") format('woff2'); }

@font-face { font-family:'Hanken Grotesk'; font-style:normal; font-weight:700; font-display:swap;
  src:url("../fonts/HankenGrotesk-700.f3223a1e6b4c.woff2") format('woff2'); }

@font-face { font-family:'JetBrains Mono'; font-style:normal; font-weight:400; font-display:swap;
  src:url("../fonts/JetBrainsMono-400.caf0dfde4e44.woff2") format('woff2'); }

@font-face { font-family:'JetBrains Mono'; font-style:normal; font-weight:500; font-display:swap;
  src:url("../fonts/JetBrainsMono-500.a21e038a03f7.woff2") format('woff2'); }

/* ---- tokens: licht (standaard) ---- */
:root, [data-theme="light"] {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-sunken: #f0f0ec;
  --surface-hover: #ebebe6;
  --border: #e0dfd8;
  --border-strong: #8c8b84;
  --hairline: #ecebe6;
  --text: #1b1c20;
  --text-muted: #5b5e67;
  --text-subtle: #8a8d95;
  --primary: #7b2d6e;
  --primary-hover: #632358;
  --on-primary: #ffffff;
  --primary-soft: #f6e8f2;
  --focus: #7b2d6e;
  --status-concept: #8a5300;
  --status-concept-bg: #fbf0dc;
  --status-verstuurd: #0a6585;
  --status-verstuurd-bg: #e2f1f6;
  --status-betaald: #18703d;
  --status-betaald-bg: #e3f2e8;
  --status-vervallen: #b42318;
  --status-vervallen-bg: #fce9e7;
  --shadow-sm: 0 1px 2px rgba(20,22,28,0.06);
  --shadow-md: 0 4px 16px rgba(20,22,28,0.08), 0 1px 2px rgba(20,22,28,0.06);
  --shadow-lg: 0 24px 48px rgba(20,22,28,0.12);
}

/* ---- tokens: donker ---- */
[data-theme="dark"] {
  --bg: #121317;
  --surface: #1a1b20;
  --surface-sunken: #15161a;
  --surface-hover: #24252c;
  --border: #2c2e36;
  --border-strong: #666a77;
  --hairline: #22242a;
  --text: #e8e9ed;
  --text-muted: #a0a4af;
  --text-subtle: #6c707b;
  --primary: #e59bd3;
  --primary-hover: #efb6e1;
  --on-primary: #2a0d24;
  --primary-soft: #3a1c34;
  --focus: #e59bd3;
  --status-concept: #e8c274;
  --status-concept-bg: #2d2616;
  --status-verstuurd: #6cc4e0;
  --status-verstuurd-bg: #12282f;
  --status-betaald: #72d293;
  --status-betaald-bg: #14281b;
  --status-vervallen: #f28b84;
  --status-vervallen-bg: #331a1a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 24px 48px rgba(0,0,0,0.6);
  color-scheme: dark;
}

/* ---- maten en families ---- */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;
  --control-h: 38px;
  --control-h-sm: 30px;
  --topbar-h: 56px;
  --content-max: 1200px;
  --font-sans: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---- basis ---- */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans);
  font-size: 14px; line-height: 22px; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num, .r { font-variant-numeric: tabular-nums; }
.r { text-align: right; }
.muted, .m, .dim { color: var(--text-muted); }
.strong { font-weight: 600; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.inline { display: inline; margin: 0; }
.row { display: flex; justify-content: space-between; gap: var(--space-3); }
.actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }

/* ---- AppFrame ---- */
.shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.shell__bar { height: var(--topbar-h); display: flex; align-items: center; gap: var(--space-6);
  padding: 0 var(--space-6); background: var(--surface); border-bottom: 1px solid var(--border); }
.shell__brand { font-weight: 700; font-size: 20px; letter-spacing: -0.02em; color: var(--primary); }
.shell__brand:hover { text-decoration: none; }
.shell__nav { display: flex; gap: var(--space-1); height: 100%; }
.shell__tab { display: flex; align-items: center; padding: 0 var(--space-3); color: var(--text-muted);
  font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.shell__tab:hover { color: var(--text); text-decoration: none; }
.shell__tab.is-active { color: var(--text); border-bottom-color: var(--primary); }
.shell__spacer { flex: 1; }
.shell__user { display: flex; align-items: center; gap: var(--space-2); }
.shell__body { flex: 1; width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--space-6); }

/* ---- Paginakop ---- */
.page-header, .topbar { display: flex; justify-content: space-between; align-items: flex-end;
  gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6); }
.page-header__title { margin: 0; font-size: 28px; line-height: 36px; font-weight: 600; letter-spacing: -0.01em; }
.page-header__sub { margin: var(--space-1) 0 0; color: var(--text-muted); font-size: 14px; }
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: var(--space-1); }
.breadcrumb a { color: var(--text-muted); }

/* ---- Knop ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: var(--control-h); padding: 0 var(--space-4); font: inherit; font-size: 14px; font-weight: 500;
  border-radius: var(--radius-md); border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  text-decoration: none; transition: background-color .12s, border-color .12s; }
.btn:hover { text-decoration: none; }
.btn--sm { height: var(--control-h-sm); padding: 0 var(--space-3); font-size: 13px; border-radius: var(--radius-sm); }
.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--primary:hover { background: var(--primary-hover); }
.btn--secondary, .btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--secondary:hover, .btn--ghost:hover { background: var(--surface-hover); }
.btn--quiet { background: transparent; color: var(--text-muted); }
.btn--quiet:hover { background: var(--surface-hover); color: var(--text); }
.btn--danger { background: var(--status-vervallen-bg); color: var(--status-vervallen); }
.btn--danger:hover { border-color: var(--status-vervallen); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; }
.btn--block { width: 100%; }

/* ---- StatusLabel ---- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 var(--space-2);
  font-size: 12px; font-weight: 500; border-radius: var(--radius-sm); white-space: nowrap; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; }
.chip--concept   { color: var(--status-concept);   background: var(--status-concept-bg); }
.chip--verstuurd { color: var(--status-verstuurd); background: var(--status-verstuurd-bg); }
.chip--betaald   { color: var(--status-betaald);   background: var(--status-betaald-bg); }
.chip--vervallen { color: var(--status-vervallen); background: var(--status-vervallen-bg); }

/* ---- StatusKeuze ---- */
.status-dropdown { width: auto; height: var(--control-h-sm); padding: 0 28px 0 var(--space-2); font: inherit;
  font-size: 12px; font-weight: 500; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
  appearance: none; background-repeat: no-repeat; background-position: right 8px center; background-size: 10px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(-45deg, transparent 50%, currentColor 50%);
  background-size: 5px 5px, 5px 5px; background-position: right 12px center, right 7px center; }
.status-dropdown.concept   { color: var(--status-concept);   background-color: var(--status-concept-bg); }
.status-dropdown.verstuurd { color: var(--status-verstuurd); background-color: var(--status-verstuurd-bg); }
.status-dropdown.betaald   { color: var(--status-betaald);   background-color: var(--status-betaald-bg); }
.status-dropdown.vervallen { color: var(--status-vervallen); background-color: var(--status-vervallen-bg); }
.success-message, .error-message { font-size: 12px; margin-left: var(--space-2); display: none; }
.success-message { color: var(--status-betaald); } .error-message { color: var(--status-vervallen); }

/* ---- KpiKaart ---- */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.scard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-5); box-shadow: var(--shadow-sm); }
.scard__label { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.scard__value { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; margin-top: var(--space-2); font-variant-numeric: tabular-nums; }
.scard__meta { font-size: 13px; color: var(--text-muted); margin-top: var(--space-1); }
.scard__value--open { color: var(--status-concept); }
.scard__value--paid { color: var(--status-betaald); }
.scard__value--late { color: var(--status-vervallen); }

/* ---- Tabel ---- */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); overflow: hidden; }
.tbl, .data-table, .regels-table { width: 100%; border-collapse: collapse; }
.tbl th, .data-table th, .regels-table th { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted); text-align: left; padding: var(--space-3) var(--space-4);
  background: var(--surface-sunken); border-bottom: 1px solid var(--border); }
.tbl td, .data-table td, .regels-table td { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--hairline); vertical-align: middle; }
.tbl tbody tr:first-child td { border-top: 0; }
.tbl tbody tr:hover { background: var(--surface-hover); }
.tbl tbody tr.is-selected { background: var(--primary-soft); }
.tbl th.r, .tbl td.r, .data-table .r, .regels-table .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.muted { color: var(--text-muted); } .tbl td.strong { font-weight: 600; }
.tbl__nr { font-family: var(--font-mono); font-size: 13px; }

/* ---- Factuurregels (regels-editor) ---- */
.regels-table td { padding: var(--space-2); }
.regels-table input, .regels-table select { height: 34px; }
.col-aantal, .col-prijs, .col-totaal { width: 120px; } .col-eenheid { width: 100px; } .col-actie { width: 48px; }
.regel-totaal { font-variant-numeric: tabular-nums; text-align: right; }
.regel-delete { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer; font: inherit; }
.regel-delete:hover { background: var(--status-vervallen-bg); color: var(--status-vervallen); }
.regel-add { margin-top: var(--space-2); }

/* ---- Veld ---- */
.field, .form-group { margin-bottom: var(--space-4); }
.field__label, .form-group > label { display: block; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.field__label .opt { color: var(--text-muted); font-weight: 400; }
.field__help, .helptext { display: block; font-size: 13px; line-height: 20px; color: var(--text-muted); margin-top: 6px; }
.input, .select, .form-input, .form-select,
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date],
input[type=password], input[type=url], input[type=search], textarea, select {
  width: 100%; height: var(--control-h); padding: 0 var(--space-3); font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  transition: border-color .12s, box-shadow .12s; }
textarea { height: auto; min-height: 88px; padding: 10px var(--space-3); line-height: 22px; resize: vertical; }
::placeholder { color: var(--text-subtle); }
input:focus, textarea:focus, select:focus, .input:focus, .select:focus {
  outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.field.has-error input, .field.has-error select, .field.has-error textarea, input.is-invalid { border-color: var(--status-vervallen); }
.field__error { display: block; font-size: 13px; color: var(--status-vervallen); margin-top: 6px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
input[type=file] { font: inherit; font-size: 13px; color: var(--text-muted); }
.checkbox-group label { display: flex; align-items: center; gap: var(--space-2); font-size: 14px; font-weight: 400; }
.input-group { display: flex; } .input-group__affix { display: flex; align-items: center; padding: 0 var(--space-3);
  background: var(--surface-sunken); border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius-md) 0 0 var(--radius-md); color: var(--text-muted); }
.input-group input { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* ---- Formuliersectie ---- */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); box-shadow: var(--shadow-sm); }
.form-section { margin-bottom: var(--space-8); }
.form-section h3, .form-section__title { margin: 0 0 var(--space-1); font-size: 16px; line-height: 24px; font-weight: 600; }
.form-section__desc { margin: 0 0 var(--space-4); color: var(--text-muted); font-size: 13px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); }
.form-row .form-group, .form-row .field { margin-bottom: var(--space-4); }
.form-footer { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-6);
  padding-top: var(--space-5); border-top: 1px solid var(--border); }

/* ---- InfoKaart ---- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.info-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm); }
.info-box h3 { margin: 0 0 var(--space-3); font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.info-box p { margin: 2px 0; }
.info-box dl { display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-4); margin: 0; }
.info-box dt { color: var(--text-muted); } .info-box dd { margin: 0; }

/* ---- Totalen ---- */
.totals { margin: var(--space-5) 0 0 auto; max-width: 320px; }
.totals .row { padding: var(--space-2) 0; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.totals .row span:last-child { color: var(--text); }
.totals .row.total-final { margin-top: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border);
  color: var(--text); font-size: 20px; line-height: 28px; font-weight: 600; }

/* ---- LegeStaat ---- */
.empty-state { text-align: center; padding: var(--space-12) var(--space-6); color: var(--text-muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.empty-state h3 { margin: 0 0 var(--space-1); color: var(--text); font-size: 16px; line-height: 24px; font-weight: 600; }
.empty-state p { margin: 0 0 var(--space-5); }

/* ---- Melding ---- */
.alert { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); font-size: 14px; margin-bottom: var(--space-3); border: 1px solid transparent; }
.alert__title { font-weight: 600; }
.alert--info    { background: var(--status-verstuurd-bg); color: var(--text); border-color: var(--status-verstuurd); }
.alert--success { background: var(--status-betaald-bg);   color: var(--text); border-color: var(--status-betaald); }
.alert--warning { background: var(--status-concept-bg);   color: var(--text); border-color: var(--status-concept); }
.alert--error   { background: var(--status-vervallen-bg); color: var(--text); border-color: var(--status-vervallen); }
.alert__mark { font-weight: 700; }
.alert--info .alert__mark { color: var(--status-verstuurd); } .alert--success .alert__mark { color: var(--status-betaald); }
.alert--warning .alert__mark { color: var(--status-concept); } .alert--error .alert__mark { color: var(--status-vervallen); }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; color: var(--status-vervallen); }
.errorlist.nonfield { padding: var(--space-3) var(--space-4); background: var(--status-vervallen-bg); border-radius: var(--radius-md); margin-bottom: var(--space-4); }

/* ---- Keuzekaart (stijlkeuze in factuurontwerp) ---- */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-2); }
.choice { position: relative; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); cursor: pointer; }
.choice:hover { background: var(--surface-hover); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice.is-on, .choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.choice:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.choice__swatch { width: 16px; height: 16px; border-radius: 4px; flex: 0 0 16px; }
.choice__name { font-weight: 500; } .choice__name small { display: block; font-size: 12px; font-weight: 400; color: var(--text-muted); }

/* ---- Kleurstalen ---- */
.swatches { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.swatch { position: relative; width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(127,127,127,.3); }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch.is-on, .swatch:has(input:checked) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 4px; }
.swatch--auto { display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-muted); background: var(--surface-sunken); }

/* ---- Schakellijst ---- */
.toggle-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0 var(--space-4); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; cursor: pointer; }
.toggle + .toggle { border-top: 1px solid var(--hairline); }
.toggle__text small { display: block; font-size: 13px; color: var(--text-muted); }
.switch { appearance: none; -webkit-appearance: none; position: relative; flex: 0 0 auto; width: 36px !important; height: 20px !important;
  border-radius: var(--radius-full); background: var(--border-strong); cursor: pointer; transition: background-color .15s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: var(--radius-full);
  background: var(--surface); transition: transform .15s; }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(16px); background: var(--on-primary); }

/* ---- Inlogkaart ---- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-6); background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: var(--space-8); }
.auth-brand { font-weight: 700; font-size: 22px; letter-spacing: -0.02em; color: var(--primary); margin-bottom: var(--space-6); }
.auth-title { margin: 0 0 var(--space-1); font-size: 20px; line-height: 28px; font-weight: 600; }
.auth-sub { margin: 0 0 var(--space-6); color: var(--text-muted); }
.divider { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-5) 0; color: var(--text-muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---- ThemaKiezer ---- */
.theme-switch { display: inline-flex; padding: 2px; gap: 2px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-full); }
.theme-switch a, .theme-switch button { display: inline-flex; align-items: center; height: 26px; padding: 0 var(--space-3);
  border: 0; border-radius: var(--radius-full); background: transparent; color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer; }
.theme-switch a:hover, .theme-switch button:hover { color: var(--text); text-decoration: none; }
.theme-switch .is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---- kbd (sneltoetshint) ---- */
.kbd { display: inline-flex; align-items: center; min-width: 20px; height: 20px; padding: 0 6px; font-family: var(--font-mono);
  font-size: 11px; color: var(--text-muted); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* ============================================================
   Responsive — telefoons (≤640px)
   ============================================================ */
@media (max-width: 640px) {
  .shell__bar { padding: 0 var(--space-4); gap: var(--space-3); }
  .shell__nav { position: fixed; left: 0; right: 0; bottom: 0; height: 56px; z-index: 10; justify-content: space-around;
    background: var(--surface); border-top: 1px solid var(--border); }
  .shell__tab { border-bottom: 0; border-top: 2px solid transparent; margin: 0; }
  .shell__tab.is-active { border-top-color: var(--primary); }
  .shell__body { padding: var(--space-4) var(--space-4) 88px; }
  .page-header__title { font-size: 22px; line-height: 30px; }
  .form-card { padding: var(--space-4); }
  .form-footer { flex-direction: column-reverse; } .form-footer .btn { width: 100%; }
  .totals { max-width: none; }
  .data-table, .regels-table { display: block; overflow-x: auto; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody { display: block; }
  .table-card { background: transparent; border: 0; box-shadow: none; }
  .tbl tr { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-1) var(--space-4); margin-bottom: var(--space-2); }
  .tbl td { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); padding: var(--space-2) 0; text-align: right; border-top: 0; }
  .tbl td + td { border-top: 1px solid var(--hairline); }
  .tbl td::before { content: attr(data-label); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); text-align: left; }
}

/* ============================================================
   App-specifiek — kleine onderdelen die alleen in de Django-schermen
   voorkomen. Alles op de tokens hierboven.
   ============================================================ */
.form-section .quick-add-link { margin-left: var(--space-2); font-weight: 400; font-size: 13px; }
.form-section h3 + .form-row { margin-top: var(--space-4); }
.logo-preview { margin-top: var(--space-2); }
.logo-preview img { max-height: 48px; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 8px; }
.regel-row.deleted td { opacity: .45; }
.regel-row.deleted input { text-decoration: line-through; }
.regels-table .regel-delete { margin: 0; }
.vrijstelling { margin-top: var(--space-2); text-align: right; color: var(--text-muted); font-size: 13px; }
.notities { margin-top: var(--space-6); }
.sort-bar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.sort-bar label { font-size: 13px; color: var(--text-muted); }
.sort-bar select { width: auto; min-width: 160px; height: var(--control-h-sm); font-size: 13px; }
.messages { margin-bottom: var(--space-4); }
.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; }

/* Factuurontwerp: instellingen links, live PDF-voorbeeld rechts */
.ontwerp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.ontwerp__preview { position: sticky; top: var(--space-4); }
.ontwerp__preview iframe { width: 100%; height: 80vh; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #ffffff; }
.ontwerp .form-section { margin-bottom: var(--space-6); }
.swatch--auto { background: repeating-linear-gradient(45deg, var(--surface-sunken), var(--surface-sunken) 3px, var(--surface-hover) 3px, var(--surface-hover) 6px); }

/* Inlogpagina's (templates/account/) */
.auth-footer { margin-top: var(--space-5); text-align: center; font-size: 14px; color: var(--text-muted); }
.forgot-link { display: block; text-align: right; font-size: 13px; margin: calc(-1 * var(--space-2)) 0 var(--space-4); }
.forgot-link a { color: var(--text-muted); }
.btn-google svg { width: 18px; height: 18px; }
.auth-card .auth-title { margin-bottom: var(--space-5); }
.auth-card .auth-title + .auth-sub { margin-top: calc(-1 * var(--space-4)); }
.form-errors .errorlist { margin: 0; }

@media (max-width: 640px) {
  .ontwerp { grid-template-columns: 1fr; }
  .ontwerp__preview { position: static; }
  .ontwerp__preview iframe { height: 60vh; }
}
