/* SPDX-FileCopyrightText: 2026 Huismus contributors
   SPDX-License-Identifier: AGPL-3.0-or-later */
/* ==========================================================================
   Huismus design system: richting "Zomerochtend" (hemelsblauw + abrikoos)
   Plain CSS, geen build-stap. Licht/donker via light-dark() + color-scheme.
   Forceer een thema met <html data-theme="dark|light">.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light dark;

  /* Typografie: systeemfontstack (offline, geen hosting nodig) */
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs: 0.75rem;    /* 12 */
  --fs-sm: 0.8125rem;  /* 13 */
  --fs-md: 0.9375rem;  /* 15: basis */
  --fs-lg: 1.0625rem;  /* 17 */
  --fs-xl: 1.375rem;   /* 22 */
  --fs-2xl: 1.75rem;   /* 28 */
  --fs-3xl: 2.25rem;   /* 36 */
  --lh-tight: 1.2;
  --lh: 1.5;
  --fw-medium: 550;
  --fw-semibold: 620;
  --fw-bold: 700;

  /* Spacing (4px-raster) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

  /* Radius */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-pill: 999px;

  /* Neutralen: verenkleed van de mus */
  --bg:            light-dark(#FBF8F3, #191613);
  --surface:       light-dark(#FFFFFF, #231F1B);
  --surface-2:     light-dark(#F4EFE7, #2C2722);
  --surface-3:     light-dark(#EBE4D9, #362F29);
  --border:        light-dark(#E6DED2, #3A342D);
  --border-strong: light-dark(#CEC3B3, #564C42);
  --text:          light-dark(#2A2520, #F2ECE4);
  --text-muted:    light-dark(#6B6258, #B3A99C);
  --paper:         light-dark(#FFFFFF, #26221E);

  /* Primair: ochtendlucht */
  --primary:       light-dark(#1B6AC9, #74B4FF);
  --primary-hover: light-dark(#1559AB, #9CCBFF);
  --on-primary:    light-dark(#FFFFFF, #0F1B2B);
  --primary-soft:  light-dark(#E3EEFB, #1B2A3D);
  --primary-ink:   light-dark(#14539E, #9CCBFF);
  --ring:          light-dark(rgb(27 106 201 / .32), rgb(116 180 255 / .42));

  /* Accent: abrikoos (highlights, hints, vieren; nooit voor knoppen) */
  --accent:        light-dark(#F4A259, #F7B57A);
  --accent-soft:   light-dark(#FDEBD8, #3A2A1A);
  --accent-ink:    light-dark(#86470F, #F9C696);

  /* Status */
  --ok:       light-dark(#1E7A45, #7AD6A0);  --ok-bg:    light-dark(#E2F3E8, #1D3326);
  --warn:     light-dark(#8F5600, #F2BE6B);  --warn-bg:  light-dark(#FCEFD6, #3A2C14);
  --bad:      light-dark(#B8302A, #FF9A92);  --bad-bg:   light-dark(#FBE4E2, #3D1F1C);
  --draft:    light-dark(#5E574F, #C9BFB2);  --draft-bg: light-dark(#EFEAE3, #2F2A24);
  --danger:       light-dark(#B8302A, #FF9A92);
  --danger-hover: light-dark(#9A2621, #FFB5AF);
  --on-danger:    light-dark(#FFFFFF, #2B0E0C);
  --danger-ring:  light-dark(rgb(184 48 42 / .28), rgb(255 154 146 / .38));

  /* Schaduwen */
  --sh-1: 0 1px 2px rgb(42 37 32 / .05);
  --sh-2: 0 1px 2px rgb(42 37 32 / .05), 0 6px 18px rgb(42 37 32 / .07);
  --sh-paper: 0 1px 2px rgb(42 37 32 / .06), 0 14px 44px rgb(42 37 32 / .10);
  --sh-pop: 0 2px 6px rgb(25 22 19 / .08), 0 18px 48px rgb(25 22 19 / .20);
  --overlay: rgb(25 22 19 / .42);

  /* Maten */
  --sidebar-w: 248px;
  --content-max: 1120px;
  --control-h: 40px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
:root[data-theme="dark"]  { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

/* ---------- 2. Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: var(--fs-md)/var(--lh) var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: var(--lh-tight); font-weight: var(--fw-semibold); letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: var(--fs-2xl); letter-spacing: -0.022em; }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
p { margin: 0; text-wrap: pretty; }
a { color: var(--primary-ink); text-underline-offset: 3px; }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgb(27 106 201 / .2); }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-sm); }
.num, .amount { font-variant-numeric: tabular-nums; }
.num { white-space: nowrap; }
.amount { text-align: right; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.row { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.split-rev { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-6); align-items: start; }
.split-even { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--s-6); align-items: start; }
@media (max-width: 980px) { .split-rev > .aside-first { order: -1; } }
@media (max-width: 980px) { .grid-3 { grid-template-columns: 1fr 1fr; } .grid-3 > :first-child { grid-column: 1 / -1; } .split, .split-rev, .split-even { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 22px; height: 22px; }
.mark { flex: none; }

.kbd {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;
  font: 600 11px/1 var(--font-mono); color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px;
}
.btn-primary .kbd { background: transparent; color: inherit; border-color: color-mix(in oklab, currentColor 40%, transparent); }

/* View transitions (cross-document + htmx: htmx.config.globalViewTransitions = true) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; animation-timing-function: var(--ease); }
/* Alleen de zijbalk heeft een eigen naam: die is op elke pagina even groot.
   Een naam op de hoofdinhoud of het papier laat de browser tussen twee
   formaten "morphen", en dat zag eruit als in- en uitzoomen bij elke klik. */
.sidebar { view-transition-name: sidebar; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
  ::view-transition-group(*) { animation: none !important; }
}

/* ---------- 3. App-shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--s-4);
  padding: var(--s-5) var(--s-3); background: var(--surface); border-right: 1px solid var(--border);
}
.sidebar > * { flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px; color: var(--text); text-decoration: none; font-weight: var(--fw-bold); font-size: 1.1875rem; letter-spacing: -0.02em; }
.brand:hover { color: var(--text); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 0 10px; border-radius: var(--r-md);
  color: var(--text-muted); text-decoration: none; font-weight: var(--fw-medium); font-size: 0.90625rem;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"], .nav a.is-active { background: var(--primary-soft); color: var(--primary-ink); font-weight: var(--fw-semibold); }
.nav .sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px; }
.nav .sub a { min-height: 32px; padding-left: 39px; font-size: var(--fs-sm); }
.nav .sub a[aria-current="page"] { background: none; color: var(--primary-ink); }
.sidebar-search {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); font: inherit; font-size: var(--fs-sm); cursor: pointer; width: 100%;
}
.sidebar-search .kbd { margin-left: auto; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: var(--s-3); border-top: 1px solid var(--border); }
.sidebar-foot .nav a { min-height: 34px; font-size: var(--fs-sm); }
.lang { display: inline-flex; padding: 2px; gap: 2px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.lang button { height: 26px; min-width: 34px; padding: 0 8px; border: 0; border-radius: 6px; background: none; font: 600 12px/1 var(--font-sans); color: var(--text-muted); cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.btn-new { anchor-name: --nieuw; }
#nieuw-menu { position-anchor: --nieuw; inset: auto; top: anchor(bottom); left: anchor(left); width: anchor-size(width); margin-top: 6px; }
#meer-menu { inset: auto 12px calc(72px + env(safe-area-inset-bottom)) auto; max-height: calc(100dvh - 140px); overflow-y: auto; }

.main { min-width: 0; display: flex; flex-direction: column; }
.content { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--s-8) var(--s-10) var(--s-16); }
.content-narrow { max-width: 820px; }
.content-wide { max-width: 1280px; }
.app-footer { max-width: var(--content-max); width: 100%; margin: auto auto 0; padding: var(--s-5) var(--s-10); font-size: var(--fs-xs); color: var(--text-muted); display: flex; gap: var(--s-4); flex-wrap: wrap; }

/* Paginakop */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-6); }
.page-head .titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.page-head .actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); color: var(--text-muted); text-decoration: none; font-weight: var(--fw-medium); }
.back:hover { color: var(--text); }
.lede { color: var(--text-muted); max-width: 62ch; }

/* Mobiel: topbalk + onderbalk */
.mtop, .tabbar { display: none; }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: var(--s-5) var(--s-4) 112px; }
  .app-footer { padding: var(--s-4) var(--s-4) 96px; }
  h1 { font-size: var(--fs-xl); }
  .main { padding-top: 56px; }
  .mtop {
    display: flex; align-items: center; gap: 10px; position: fixed; top: 0; left: 0; right: 0; z-index: 20;
    height: 56px; padding: 0 var(--s-4); background: color-mix(in oklab, var(--surface) 90%, transparent);
    backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
  }
  .mtop .brand { padding: 0; font-size: var(--fs-lg); }
  .mtop .spacer { flex: 1; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border);
  }
  .tabbar a, .tabbar button {
    border: 0; background: none; font-family: inherit; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 50px;
    font-size: 11px; font-weight: var(--fw-medium); color: var(--text-muted); text-decoration: none; border-radius: var(--r-md);
  }
  .tabbar a[aria-current="page"], .tabbar button[aria-current="page"] { color: var(--primary-ink); }
  .tabbar .fab { justify-self: center; align-self: center; width: 48px; height: 48px; min-height: 0; border-radius: 50%; background: var(--primary); color: var(--on-primary); box-shadow: var(--sh-2); }
  .page-head { align-items: flex-start; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn-primary { flex: 1 1 100%; order: -1; }
  .page-head .actions .btn-ghost { height: 36px; padding: 0 10px; }
  .page-head .actions .btn-ghost .i { display: none; }
}

/* HTMX-indicator */
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ---------- 4. Knoppen ---------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 16px; border-radius: var(--r-md);
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bd);
  font: var(--fw-semibold) var(--fs-sm)/1 var(--font-sans); letter-spacing: .005em; white-space: nowrap;
  text-decoration: none; cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn-primary { --btn-bg: var(--primary); --btn-fg: var(--on-primary); --btn-bd: transparent; box-shadow: var(--sh-1); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { /* standaard */ }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: var(--on-danger); --btn-bd: transparent; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-danger:focus-visible { box-shadow: 0 0 0 3px var(--danger-ring); }
.btn-danger-quiet { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--danger); }
.btn-danger-quiet:hover { background: var(--bad-bg); }
.btn-sm { height: 32px; padding: 0 12px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: var(--fs-md); border-radius: 12px; }
.btn-icon { width: var(--control-h); padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
/* Laadtoestand: HTMX zet .htmx-request op het element */
.btn .spinner { display: none; }
.btn.htmx-request, .btn.is-loading { color: transparent; pointer-events: none; }
.btn.htmx-request .spinner, .btn.is-loading .spinner { display: block; position: absolute; inset: 0; margin: auto; color: var(--btn-fg); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: hm-spin .7s linear infinite; }
@keyframes hm-spin { to { transform: rotate(360deg); } }

/* ---------- 5. Formulieren ---------- */
.form { display: flex; flex-direction: column; gap: var(--s-6); }
.fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s-4); }
.fieldset > .field { grid-column: span 6; }
/* Fields grouped for showing and hiding together, still laid out by the fieldset's grid. */
.fieldset > .field-group { display: contents; }
.fieldset > .field-group[hidden] { display: none; }
.fieldset > .field-group > .field { grid-column: span 6; }
.fieldset > .field-group > .span-2 { grid-column: span 2; } .fieldset > .field-group > .span-3 { grid-column: span 3; }
.fieldset > .span-2 { grid-column: span 2; } .fieldset > .span-3 { grid-column: span 3; } .fieldset > .span-4 { grid-column: span 4; }
.card-pad { container-type: inline-size; }
@media (max-width: 640px) { .fieldset > .span-2, .fieldset > .span-3, .fieldset > .span-4, .fieldset > .field-group > .span-2, .fieldset > .field-group > .span-3 { grid-column: span 6; } }
@container (max-width: 520px) { .fieldset > .span-2, .fieldset > .span-3, .fieldset > .span-4, .fieldset > .field-group > .span-2, .fieldset > .field-group > .span-3 { grid-column: span 6; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text); }
.label .opt { font-weight: 400; color: var(--text-muted); }
.help { font-size: var(--fs-sm); color: var(--text-muted); }
.error { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-sm); color: var(--danger); font-weight: var(--fw-medium); }
.error .i { width: 15px; height: 15px; margin-top: 2px; }

.input, .select, .textarea {
  width: 100%; height: var(--control-h); padding: 0 12px;
  font: inherit; font-size: var(--fs-md); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
/* Pseudo-elementen lossen light-dark() niet overal op: vaste kleur die op licht én donker leesbaar is */
.input::placeholder, .textarea::placeholder, .palette-search input::placeholder { color: #938979; opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in oklab, var(--border-strong) 60%, var(--text)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); background: color-mix(in oklab, var(--bad-bg) 45%, var(--surface)); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-ring); }
.input[readonly] { background: var(--surface-2); }
.textarea { height: auto; min-height: 92px; padding: 10px 12px; line-height: var(--lh); resize: vertical; }
.select {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8075' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-sm { height: 34px; font-size: var(--fs-sm); padding: 0 10px; border-radius: 8px; }
.select.input-sm { padding-right: 30px; background-position: right 8px center; }
.money { position: relative; }
.money::before { content: "€"; position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--text-muted); pointer-events: none; font-size: var(--fs-sm); }
.money .input { padding-left: 28px; text-align: right; font-variant-numeric: tabular-nums; }
.input-affix { position: relative; }
.input-affix .i { position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--text-muted); pointer-events: none; }
.input-affix .input { padding-left: 38px; }
.input-affix .kbd { position: absolute; right: 10px; top: 50%; translate: 0 -50%; }
/* Rustig veld dat pas bij hover/focus een rand krijgt (factuureditor) */
.input-quiet { border-color: transparent; background-color: transparent; }
.input-quiet:hover { border-color: var(--border); background-color: var(--surface); }
.input-quiet:focus { background-color: var(--surface); }
.textarea.input-quiet { field-sizing: content; }

/* Toggle */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: var(--fw-medium); }
.switch input {
  appearance: none; flex: none; width: 42px; height: 24px; margin: 0; border-radius: var(--r-pill); cursor: pointer;
  background: var(--border-strong); position: relative; transition: background .2s var(--ease);
}
.switch input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: translate .2s var(--ease); }
.switch input:checked { background: var(--primary); }
.switch input:checked::before { translate: 18px 0; }
.switch input:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
/* Fields that show once the form's switch is on (Wachtwoord), without JS. */
.reveal-when-on:has(.switch input:not(:checked)) .when-on { display: none; }
/* Checkbox / radio */
.check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
/* Segmented (bijv. btw 0 / 9 / 21 %) */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 9px; border: 1px solid var(--border); }
.seg label { position: relative; display: grid; place-items: center; min-width: 40px; height: 28px; padding: 0 10px; border-radius: 7px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-muted); cursor: pointer; font-variant-numeric: tabular-nums; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--sh-1), 0 0 0 1px var(--border); }
.seg label:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--ring); }
.seg-sm label { min-width: 34px; height: 26px; padding: 0 8px; }

/* Dropzone */
.dropzone {
  position: relative; display: grid; place-items: center; gap: 10px; text-align: center;
  padding: var(--s-8) var(--s-6); border: 2px dashed var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface); color: var(--text-muted); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over, .dropzone:has(input:focus-visible) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .dz-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); }
.dropzone strong { color: var(--text); font-size: var(--fs-md); }
.dropzone-lg { padding: var(--s-12) var(--s-6); }

/* Combobox (contactkiezer) */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-pop); }
.combo-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.combo-list li[aria-selected="true"] { background: var(--primary-soft); color: var(--primary-ink); }
.combo-list .muted { font-size: var(--fs-sm); }

/* ---------- 6. Kaarten, tabellen, lijsten ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); min-width: 0; }
.card-pad { padding: var(--s-5) var(--s-6); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: var(--fs-md); }
.card-foot { padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.section-title { font-size: var(--fs-lg); margin-bottom: var(--s-3); }
.divider { height: 1px; background: var(--border); border: 0; margin: var(--s-6) 0; }

.table-wrap { container-type: inline-size; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.table th { text-align: left; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-muted); padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table .amount, .table .num { font-variant-numeric: tabular-nums; }
.table .w-min { width: 1%; white-space: nowrap; }
.table tbody tr { transition: background .12s; }
.table tbody tr.is-link { cursor: pointer; }
.table tbody tr.is-link:hover { background: var(--surface-2); }
.table .row-link { color: var(--text); text-decoration: none; font-weight: var(--fw-semibold); }
/* De hele rij is klikbaar via app.js. Geen ::after over de rij: Safari
   gebruikt een <tr> niet als anker voor position:absolute, dan lag die
   laag over het hele scherm, ook over het menu. */
.table .row-link:focus-visible { outline: none; }
.table tr:has(.row-link:focus-visible) { box-shadow: inset 0 0 0 2px var(--primary); }
.table .draft-no { color: var(--text-muted); font-style: italic; font-weight: var(--fw-medium); }
.table tfoot td { font-weight: var(--fw-bold); border-top: 1px solid var(--border-strong); border-bottom: 0; }
/* Mobiel: rijen stapelen tot kaarten */
@container (max-width: 560px) {
  .table.stackable thead { display: none; }
  .table.stackable tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
  .table.stackable tbody tr:last-child { border-bottom: 0; }
  .table.stackable td { padding: 0; border: 0; }
  .table.stackable td[data-cell="primary"] { grid-column: 1; grid-row: 1; font-size: var(--fs-md); }
  .table.stackable td[data-cell="secondary"] { grid-column: 1; grid-row: 2; font-size: var(--fs-sm); color: var(--text-muted); text-align: left; }
  .table.stackable tr.is-editing { background: var(--primary-soft); }
  .table.stackable tr.is-editing td { background: none; }
  .table.stackable td[data-cell="order"] { grid-column: 1; grid-row: 3; text-align: left; }
  /* Het veld heeft hier geen kolomkop meer: het label (sr-only) wordt zichtbaar. */
  .table.stackable td[data-cell="order"] > label { position: static; width: auto; height: auto; overflow: visible; clip: auto; font-size: var(--fs-sm); color: var(--text-muted); margin-right: 8px; }
  .table.stackable td[data-cell="amount"] { grid-column: 2; grid-row: 1; text-align: right; font-weight: var(--fw-semibold); }
  .table.stackable td[data-cell="status"] { grid-column: 2; grid-row: 2; justify-self: end; }
  .table.stackable td[data-cell="action"] { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  /* w-min (1%) is een kolombreedte; in een grid wordt de cel er 1px smal van en
     steken de knoppen eruit. Hier past de cel zich weer aan de inhoud aan. */
  .table.stackable td.w-min { width: auto; }
  .table.stackable td[data-cell="hide"] { display: none; }
  .table.stackable tfoot { display: none; }
}

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: var(--s-3); padding: 12px var(--s-5); border-top: 1px solid var(--border); position: relative; }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: var(--fw-semibold); color: var(--text); text-decoration: none; }
.list .title::after { content: ""; position: absolute; inset: 0; }
.list > li:hover { background: var(--surface-2); }

/* Filtertabs. Too many for the width: they break onto a next line, never
   scroll out of sight (Offertes at 1024px, 2026-10-31). So the active tab's
   line sits under the tab itself, on every row, not on the row's border. */
.tabs { display: flex; flex-wrap: wrap; gap: 0 2px; border-bottom: 1px solid var(--border); }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; color: var(--text-muted); text-decoration: none; font-weight: var(--fw-semibold); font-size: var(--fs-sm); white-space: nowrap; }
/* On a phone a little less room beside each tab, so Offertes takes three rows, not four. */
@media (max-width: 560px) { .tab { padding-inline: 8px; } }
.tab:hover { color: var(--text); }
.tab[aria-current="page"], .tab[aria-selected="true"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--primary); }
.tab .count { font-size: 11px; padding: 1px 7px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.toolbar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); }
.toolbar .input-affix { flex: 1; min-width: 200px; max-width: 360px; }
/* Op een telefoon krijgt het zoekveld een eigen regel, zodat de placeholder past; de keuzelijsten schuiven eronder. */
@media (max-width: 560px) { .toolbar .input-affix { flex-basis: 100%; max-width: none; } }

/* ---------- 7. Statuspills ---------- */
.pill {
  --pill-bg: var(--draft-bg); --pill-fg: var(--draft);
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: var(--r-pill); background: var(--pill-bg); color: var(--pill-fg);
  font-size: 12.5px; font-weight: var(--fw-semibold); white-space: nowrap; line-height: 1;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill.no-dot::before, .pill-final::before, .pill-import::before { display: none; }
.pill .i { width: 13px; height: 13px; stroke-width: 2.2; }
.pill-concept   { --pill-bg: var(--draft-bg); --pill-fg: var(--draft); }
.pill-final     { --pill-bg: var(--surface-3); --pill-fg: var(--text); }
.pill-sent      { --pill-bg: var(--primary-soft); --pill-fg: var(--primary-ink); }
.pill-accepted  { --pill-bg: var(--ok-bg); --pill-fg: var(--ok); }
.pill-rejected  { --pill-bg: var(--bad-bg); --pill-fg: var(--bad); }
.pill-expired   { --pill-bg: transparent; --pill-fg: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border-strong); }
.pill-expired::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.pill-unpaid    { --pill-bg: var(--warn-bg); --pill-fg: var(--warn); }
.pill-partial   { --pill-bg: var(--warn-bg); --pill-fg: var(--warn); }
.pill-partial::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); box-shadow: inset 0 0 0 1.5px currentColor; }
.pill-paid      { --pill-bg: var(--ok-bg); --pill-fg: var(--ok); }
.pill-overdue   { --pill-bg: var(--bad-bg); --pill-fg: var(--bad); }
.pill-import    { --pill-bg: var(--accent-soft); --pill-fg: var(--accent-ink); }
.pill-credit    { --pill-bg: var(--surface-2); --pill-fg: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.pill-credit::before { display: none; }
/* Quiet statuses: settled, nothing left to do. No fill, only the dot (or lock) in
   colour, so a pill with a fill (Vervallen, Openstaand) stands out (huismus-intern/besluiten.md, 2026-10-30). */
.pill-final, .pill-paid, .pill-accepted, .pill-rejected, .pill-expired { --pill-bg: transparent; box-shadow: none; --pill-fg: var(--text-muted); padding-inline: 0; font-weight: var(--fw-medium); }
.pill-paid::before, .pill-accepted::before { background: var(--ok); }
.pill-rejected::before { background: var(--bad); }
.proposal { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; font: 700 10px/1 var(--font-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-soft); border: 1px dashed color-mix(in oklab, var(--accent-ink) 45%, transparent); vertical-align: middle; }

/* ---------- 8. Meldingen ---------- */
.flash { --f-fg: var(--primary-ink); --f-bg: var(--primary-soft); display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: var(--r-md); background: var(--f-bg); color: var(--text); border: 1px solid color-mix(in oklab, var(--f-fg) 22%, transparent); }
.flash > .i { color: var(--f-fg); margin-top: 2px; }
.flash .flash-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.flash strong { font-weight: var(--fw-semibold); }
.flash-success { --f-fg: var(--ok); --f-bg: var(--ok-bg); }
.flash-info    { --f-fg: var(--primary-ink); --f-bg: var(--primary-soft); }
.flash-warning { --f-fg: var(--warn); --f-bg: var(--warn-bg); }
.flash-error   { --f-fg: var(--bad); --f-bg: var(--bad-bg); }
.toasts { position: fixed; z-index: 100; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100% - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-pop); animation: hm-toast-in .28s var(--ease); }
.toast .flash-body { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); }
.toast .flash-body strong { font-size: var(--fs-md); }
.toast.flash-success > .i { color: var(--ok); } .toast.flash-info > .i { color: var(--primary-ink); }
.toast.flash-warning > .i { color: var(--warn); } .toast.flash-error > .i { color: var(--bad); }
@keyframes hm-toast-in { from { opacity: 0; translate: 0 -8px; } }

/* ---------- 9. Dialogen, slide-over, popover ---------- */
.dialog { width: min(500px, calc(100% - 32px)); padding: 0; border: 0; border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--sh-pop); }
.dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.dialog[open] { animation: hm-pop .22s var(--ease); }
@keyframes hm-pop { from { opacity: 0; scale: .97; } }
.dialog-body { padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-3); }
.dialog-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); }
.dialog-icon.is-danger { background: var(--bad-bg); color: var(--bad); }
.dialog h2 { font-size: var(--fs-xl); }
.dialog-foot { display: flex; justify-content: flex-end; gap: var(--s-2); flex-wrap: wrap; padding: var(--s-4) var(--s-6); background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.dialog .checks { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dialog .checks li { display: flex; gap: 10px; align-items: flex-start; }
.dialog .checks .i { color: var(--primary-ink); margin-top: 2px; }
.dialog .checks li.is-warn, .dialog .checks li.is-warn .i { color: var(--warn); font-weight: var(--fw-medium); }
/* The editor's preview PDF in the installed app: nearly the whole screen. */
.dialog.is-pdf { width: min(960px, calc(100% - 16px)); max-height: calc(100dvh - 16px); }
.dialog.is-pdf .dialog-body { padding: var(--s-4); }
.dialog.is-pdf .pdf-frame { height: calc(100dvh - 180px); }
.dialog.is-static { position: static; display: block; margin: 0; animation: none; }

.sheet { margin: 0 0 0 auto; width: min(440px, 100%); max-width: none; height: 100dvh; max-height: none; padding: 0; border: 0; background: var(--surface); color: var(--text); box-shadow: var(--sh-pop); display: none; flex-direction: column; }
.sheet[open] { display: flex; animation: hm-slide .26s var(--ease); }
.sheet::backdrop { background: var(--overlay); }
@keyframes hm-slide { from { translate: 24px 0; opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); }
.sheet-body { flex: 1; overflow-y: auto; padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.sheet-foot { display: flex; gap: var(--s-2); justify-content: flex-end; padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); }

.menu { margin: 0; padding: 6px; min-width: 220px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text); box-shadow: var(--sh-pop); }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-medium); text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu .kbd { margin-left: auto; }
.menu hr { margin: 6px 4px; border: 0; border-top: 1px solid var(--border); }

/* Command palette (⌘K) */
.palette { width: min(620px, calc(100% - 32px)); margin-top: 12vh; padding: 0; border: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--sh-pop); }
.palette::backdrop { background: var(--overlay); }
.palette-search { display: flex; align-items: center; gap: 12px; padding: 0 var(--s-5); height: 56px; border-bottom: 1px solid var(--border); }
.palette-search input { flex: 1; border: 0; background: none; font: inherit; font-size: var(--fs-lg); color: var(--text); outline: none; }
.palette-group { padding: 8px; }
.palette-group h3 { font-size: var(--fs-xs); color: var(--text-muted); font-weight: var(--fw-semibold); padding: 6px 10px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 8px; }
.palette-item[aria-selected="true"] { background: var(--primary-soft); color: var(--primary-ink); }
.palette-item .muted { margin-left: auto; font-size: var(--fs-sm); }

/* ---------- 10. Lege toestand ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: var(--s-3); padding: var(--s-12) var(--s-6); }
.empty .empty-art { position: relative; width: 120px; height: 84px; display: grid; place-items: end center; margin-bottom: var(--s-2); }
.empty .empty-art::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: 2px; background: var(--border-strong); }  /* dakgoot */
.empty .empty-art svg { position: relative; bottom: 9px; }
.empty h2 { font-size: var(--fs-xl); }
.empty p { color: var(--text-muted); max-width: 44ch; }
.empty .row { justify-content: center; margin-top: var(--s-2); }

/* ---------- 11. Document ("vel papier") ---------- */
.doc-stage { padding: var(--s-6) 0 var(--s-10); }
.paper {
  container-type: inline-size; position: relative; max-width: 860px; margin: 0 auto;
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--r-sm);
  box-shadow: var(--sh-paper); padding: var(--s-12) var(--s-12) var(--s-10);
}
.split-rev > .paper, .split > .paper { margin: 0; max-width: none; width: 100%; min-width: 0; }
.paper-final { background-image: linear-gradient(var(--paper), var(--paper)), repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in oklab, var(--border) 45%, transparent) 10px 11px); background-origin: padding-box, border-box; }
.paper-stamp { position: absolute; top: var(--s-5); right: var(--s-5); display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); border: 1.5px solid var(--border-strong); }
.doc-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 280px); gap: var(--s-8); margin-bottom: var(--s-8); }
.doc-kind { font-size: var(--fs-3xl); font-weight: var(--fw-bold); letter-spacing: -0.03em; }
.doc-meta { display: grid; grid-template-columns: auto 1fr; gap: 10px var(--s-4); align-items: center; align-content: start; font-size: var(--fs-sm); }
.doc-meta dt { color: var(--text-muted); }
.doc-meta dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.doc-meta .input { text-align: right; }
.doc-address { font-size: var(--fs-md); line-height: 1.55; }
.doc-address .who { font-weight: var(--fw-semibold); }
.doc-lines { margin: var(--s-6) 0; }
.line-head, .line { display: grid; grid-template-columns: 24px minmax(0, 1fr) 68px 72px 112px 112px 104px 32px; gap: 8px; align-items: start; }
.line-head { padding: 0 0 8px; border-bottom: 1px solid var(--border-strong); font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.line-head .r, .line .r { text-align: right; }
.line { padding: 8px 0; border-bottom: 1px solid var(--border); }
.line .line-desc { height: auto; min-height: 34px; padding-block: 6px; line-height: 1.4; resize: none; overflow: hidden; field-sizing: content; font-family: inherit; }
.line .grip { color: var(--text-muted); cursor: grab; height: 34px; display: grid; place-items: center; opacity: .5; }
.line:hover .grip { opacity: 1; }
.line .line-total { height: 34px; display: flex; align-items: center; justify-content: flex-end; font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); }
.line.has-error { background: color-mix(in oklab, var(--bad-bg) 40%, transparent); border-radius: 8px; padding-inline: 4px; margin-inline: -4px; }
/* Twee rijen: de omschrijving krijgt de volle breedte, daaronder de cijfers. */
.line > .grip { grid-column: 1; grid-row: 1; }
.line > .line-desc { grid-column: 2 / 8; grid-row: 1; }
.line > .line-delete { grid-column: 8; grid-row: 1; }
.line > .line-qty { grid-column: 3; grid-row: 2; }
.line > .line-unit { grid-column: 4; grid-row: 2; }
.line > .line-price { grid-column: 5; grid-row: 2; }
.line > .line-vat { grid-column: 6; grid-row: 2; }
.line > .line-total { grid-column: 7; grid-row: 2; }
.line .line-error { grid-column: 2 / -1; grid-row: 3; }
.line.is-dragging { background: var(--surface); box-shadow: var(--sh-pop); border-radius: 8px; }
.add-line { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--primary-ink); font: inherit; font-weight: var(--fw-semibold); font-size: var(--fs-sm); cursor: pointer; }
.add-line:hover { background: var(--primary-soft); }
/* Alleen-lezen regels */
.doc-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.doc-table th { text-align: left; padding: 0 0 8px; border-bottom: 1px solid var(--border-strong); font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.doc-table td { padding: 11px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc-table th + th, .doc-table td + td { padding-left: 16px; }
.doc-table .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); gap: var(--s-8); align-items: start; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 8px 0; font-variant-numeric: tabular-nums; transition: opacity .2s; }
.totals dt { color: var(--text-muted); } .totals dd { margin: 0; padding-left: var(--s-6); text-align: right; }
.totals .grand { padding-top: 10px; border-top: 1.5px solid var(--text); font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text); }
.totals.htmx-request, .totals.is-refreshing { opacity: .55; }
.totals-status { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: var(--fs-xs); color: var(--text-muted); min-height: 16px; }
.totals-status .spinner { width: 11px; height: 11px; border-width: 1.5px; }
.f-meta .spinner { display: inline-block; width: 11px; height: 11px; border-width: 1.5px; vertical-align: -1px; margin-right: 6px; }
.kor-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-ink); font-size: var(--fs-sm); }
.kor-note .i { margin-top: 1px; }
.snapshot-hint { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-muted); }
@media (max-width: 760px) { .paper { padding: var(--s-6) var(--s-5); } .doc-stage { padding-top: var(--s-4); } }
@container (max-width: 660px) {
  .line-head { display: none; }
  .line { grid-template-columns: 1fr 1fr 1fr; grid-template-areas: "desc desc desc" "qty unit price" "vat total del"; row-gap: 8px; padding: 12px 0; }
  .line .grip { display: none; }
  .line > .line-desc { grid-area: desc; } .line > .line-qty { grid-area: qty; } .line > .line-unit { grid-area: unit; }
  .line > .line-price { grid-area: price; } .line > .line-vat { grid-area: vat; } .line > .line-total { grid-area: total; }
  .line > .line-delete { grid-area: del; justify-self: end; }
  .line .line-error { grid-column: 1 / -1; grid-row: 4; }
  .line .input-quiet { border-color: var(--border); background-color: var(--surface); }
}
@container (max-width: 520px) {
  .doc-head, .doc-foot { grid-template-columns: 1fr; gap: var(--s-5); }
  .doc-kind { font-size: var(--fs-2xl); }
  .doc-table thead { display: none; }
  .doc-table tr { display: grid; grid-template-columns: auto auto auto minmax(0, 1fr); gap: 4px 0; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
  .doc-table td { padding: 0 !important; border: 0; }
  .doc-table td:nth-child(1) { grid-column: 1 / -1; font-weight: var(--fw-medium); }
  .doc-table td:nth-child(2), .doc-table td:nth-child(3), .doc-table td:nth-child(4) { grid-row: 2; font-size: var(--fs-sm); color: var(--text-muted); text-align: left; }
  .doc-table td:nth-child(2)::after { content: "×"; margin: 0 6px; }
  .doc-table td:nth-child(3)::after { content: "·"; margin: 0 6px; }
  .doc-table td:nth-child(5) { grid-row: 2; grid-column: 4; text-align: right; font-weight: var(--fw-semibold); }
}

/* Sticky actiebalk */
.actionbar {
  position: sticky; bottom: 0; z-index: 15; display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap;
  padding: var(--s-3) var(--s-10); background: color-mix(in oklab, var(--surface) 90%, transparent);
  backdrop-filter: blur(10px); border-top: 1px solid var(--border);
}
.actionbar .status { display: flex; align-items: center; gap: 8px; margin-right: auto; font-size: var(--fs-sm); color: var(--text-muted); }
.actionbar .dot-unsaved { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
@media (max-width: 760px) {
  .actionbar { bottom: calc(62px + env(safe-area-inset-bottom)); padding: 10px var(--s-4); }
  .actionbar { flex-wrap: nowrap; }
  .actionbar .status { display: none; }
  .actionbar .btn { flex: 1; padding: 0 10px; }
}
/* Extra actions in the editor's bar. On a wide screen the popover's own box
   is dissolved (display: contents), so its buttons sit in the bar; on a
   phone it is a menu behind "Meer", just above the bar. One set of buttons,
   never a phone without them (test_every_page checks that). */
.actionbar-more-toggle { display: none; }
.actionbar-more:not(:popover-open) { display: contents; }
/* Opened on a phone, then the window widened: back into the bar. */
@media (min-width: 761px) { .actionbar-more:popover-open { display: contents; } }
@media (max-width: 760px) {
  .actionbar .actionbar-more-toggle { display: inline-flex; flex: none; }
  .actionbar-more:not(:popover-open) { display: none; }
  .actionbar-more:popover-open {
    inset: auto 12px calc(134px + env(safe-area-inset-bottom)) auto; display: flex; flex-direction: column; gap: 2px;
    margin: 0; padding: 6px; min-width: 220px; border: 1px solid var(--border); border-radius: var(--r-md);
    background: var(--surface); color: var(--text); box-shadow: var(--sh-pop);
  }
  .actionbar .actionbar-more .btn { flex: none; width: 100%; justify-content: flex-start; }
}

/* ---------- 12. Voortgang, stappen, tijdlijn ---------- */
.progress { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--ok); }
.progress.is-warn > span { background: var(--warn); }
.progress.is-bad > span { background: var(--bad); }

.steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 0; counter-reset: step; flex-wrap: wrap; row-gap: 10px; }
.step { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-muted); white-space: nowrap; }
.step + .step::before { content: ""; width: 32px; height: 2px; margin: 0 10px; border-radius: 2px; background: var(--border-strong); }
.step .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); font-size: 12px; background: var(--surface); }
.step .dot .i { width: 14px; height: 14px; stroke-width: 2.6; }
.step.is-done { color: var(--text); }
.step.is-done .dot { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.step.is-done + .step::before { background: var(--primary); }
.step.is-current { color: var(--text); }
.step.is-current .dot { border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 0 0 4px var(--ring); }
.step.is-ok, .step.is-bad { color: var(--text); }
.step.is-ok .dot { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.step.is-bad .dot { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.step.is-muted .dot { border-style: dashed; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: var(--s-3); padding-bottom: var(--s-5); }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 2px; width: 2px; background: var(--border); }
.timeline .t-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.timeline .t-dot .i { width: 14px; height: 14px; }
.timeline .t-dot.is-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.timeline .t-dot.is-primary { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
.timeline .t-dot.is-bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.timeline .t-body { padding-top: 4px; min-width: 0; overflow-wrap: break-word; }
.timeline .t-date { padding-top: 5px; font-size: var(--fs-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .steps { flex-direction: column; align-items: flex-start; gap: 10px; }
  .step { white-space: normal; }
  .step + .step::before { display: none; }
}

/* ---------- 13. Dashboard & jaaroverzicht ---------- */
.kpi { padding: var(--s-5) var(--s-6); display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: var(--fs-sm); color: var(--text-muted); font-weight: var(--fw-medium); display: flex; align-items: center; gap: 8px; }
.kpi-value { white-space: nowrap; font-size: var(--fs-2xl); font-weight: var(--fw-bold); letter-spacing: -0.025em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-sub { font-size: var(--fs-sm); color: var(--text-muted); }
.kpi-hero { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.kpi-hero .kpi-label, .kpi-hero .kpi-sub { color: color-mix(in oklab, var(--on-primary) 82%, var(--primary)); }
.kpi-hero a { color: var(--on-primary); }
/* A notice is a quiet card: colour only in the stripe, the icon and the link on the
   right, so a reminder doesn't shout like a problem (huismus-intern/besluiten.md, 2026-10-30). */
.hint-banner {
  --hb-line: var(--accent); --hb-ink: var(--accent-ink);
  display: flex; align-items: center; gap: var(--s-3); padding: 12px var(--s-4);
  border-radius: var(--r-md); background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: inset 3px 0 0 var(--hb-line), var(--sh-1);
  font-weight: var(--fw-medium); text-decoration: none;
}
.hint-banner:hover { color: var(--text); border-color: var(--border-strong); }
.hint-banner > .i { color: var(--hb-ink); flex: none; }
.hint-banner .spacer { flex: 1; }
.hint-banner .spacer + span, .hint-banner a { color: var(--hb-ink); font-weight: var(--fw-semibold); }
.hint-banner.is-warn { --hb-line: var(--warn); --hb-ink: var(--warn); }
.hint-banner.is-bad { --hb-line: var(--bad); --hb-ink: var(--bad); }
/* Information that isn't a task, like a new version (desktop app). */
.hint-banner.is-info { --hb-line: var(--primary); --hb-ink: var(--primary-ink); }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.checklist li { display: flex; align-items: center; gap: var(--s-3); padding: 12px 0; border-top: 1px solid var(--border); }
.checklist li:first-child { border-top: 0; }
.checklist .tick { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); color: transparent; }
.checklist .is-done .tick { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.checklist .is-done .c-title { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.checklist .tick .i { width: 13px; height: 13px; stroke-width: 3; }
.checklist .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.chart { display: grid; grid-template-columns: 56px repeat(4, minmax(0, 1fr)); gap: 0 var(--s-4); height: 240px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: right; padding-bottom: 28px; }
.chart-col { display: grid; grid-template-rows: 1fr 28px; background-image: linear-gradient(var(--border) 1px, transparent 1px); background-size: 100% calc((100% - 28px) / 4); }
.chart-bars { display: flex; align-items: flex-end; justify-content: center; gap: 6px; border-bottom: 1.5px solid var(--border-strong); }
.chart-bar { width: min(34%, 38px); height: calc(var(--v) * 1%); border-radius: 6px 6px 2px 2px; background: var(--primary); position: relative; transition: height .4s var(--ease); }
.chart-bar.is-cost { background: var(--accent); }
.chart-bar.is-empty { height: 2px; background: var(--border-strong); }
.chart-label { display: grid; place-items: center; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-muted); }
.legend { display: flex; gap: var(--s-4); font-size: var(--fs-sm); color: var(--text-muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--primary); }
.legend i.is-cost { background: var(--accent); }
.hbars { display: flex; flex-direction: column; gap: 14px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr) 96px; gap: var(--s-3); align-items: center; font-size: var(--fs-sm); }
.hbar-track { height: 10px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.hbar-fill { height: 100%; width: calc(var(--v) * 1%); border-radius: inherit; background: var(--accent); }
.hbar .amount { font-weight: var(--fw-semibold); }
@media (max-width: 560px) { .hbar { grid-template-columns: 1fr auto; } .hbar-track { grid-column: 1 / -1; grid-row: 2; } }
.year-nav { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.year-nav a { display: inline-grid; place-items: center; min-width: 36px; height: 32px; padding: 0 10px; border-radius: 7px; color: var(--text-muted); text-decoration: none; font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.year-nav a:hover { background: var(--surface-2); color: var(--text); }
.year-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-ink); }
.disclaimer { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--text-muted); }

/* ---------- 14. Import ---------- */
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; gap: var(--s-3); align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.file-item > * { min-width: 0; }
/* The PDF page (documents/pdf_page.html): the PDF in a frame, as tall as
   the screen leaves below the page head. 100dvh: on a phone the address
   bar comes and goes. A phone that only shows the first page still has
   the way back and Download above it. */
.pdf-frame { display: block; width: 100%; height: max(480px, calc(100dvh - 220px)); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
@media (max-width: 560px) {
  .file-item { grid-template-columns: 36px minmax(0, 1fr) auto; row-gap: 4px; }
  .file-item .f-icon { grid-row: 1 / span 2; }
  .file-item .f-arrow { grid-column: 2; grid-row: 2; }
  .file-item > .btn { grid-column: 3; grid-row: 1 / span 2; }
}
.file-item .f-icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-muted); }
.file-item .f-name { font-weight: var(--fw-semibold); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .f-meta { font-size: var(--fs-xs); color: var(--text-muted); }
.file-item .f-arrow { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ok); font-weight: var(--fw-semibold); }
.file-item.is-unknown .f-arrow { color: var(--warn); }
/* Name and what Huismus found share one cell: a long list of tabs drops
   below the name instead of squeezing it (BUGS-BY-HAND.md). */
.file-item .f-body { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s-3); }
.file-item .f-text { flex: 1 1 14rem; min-width: 0; }
.file-item .f-text .f-name { display: block; white-space: normal; overflow-wrap: anywhere; }
.file-item .f-text .f-meta { display: block; }
.thumb { width: 100%; aspect-ratio: 3 / 4; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-muted); overflow: hidden; }
.receipts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s-3); }
.receipt { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-xs); }
.receipt .r-row { display: flex; align-items: center; gap: 4px; }
.receipt .r-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--fw-semibold); font-size: var(--fs-sm); }

.report { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); overflow: hidden; }
.report + .report { margin-top: var(--s-3); }
.stack > .report + .report { margin-top: 0; }
.report > summary:only-child .chev { display: none; }
.report > summary:only-child { cursor: default; border-bottom: 0; }
.report > summary { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5); cursor: pointer; list-style: none; }
.report > summary::-webkit-details-marker { display: none; }
.report > summary .chev { margin-left: auto; color: var(--text-muted); transition: rotate .2s var(--ease); }
.report[open] > summary .chev { rotate: 180deg; }
.report[open] > summary { border-bottom: 1px solid var(--border); }
.report .r-icon { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); }
.report.is-warn .r-icon { background: var(--warn-bg); color: var(--warn); }
.report.is-bad .r-icon { background: var(--bad-bg); color: var(--bad); }
.report .r-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.report .r-title strong { font-size: var(--fs-md); }
.report .r-title span { font-size: var(--fs-sm); color: var(--text-muted); }
.report .r-stats { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.report .r-body { padding: var(--s-4) var(--s-5) var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.stat-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-sm); }
.stat-chip b { font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.issue-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-md); }
.issue-list li { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: var(--s-3); padding: 10px 14px; border-top: 1px solid var(--border); font-size: var(--fs-sm); align-items: baseline; }
.issue-list li:first-child { border-top: 0; }
.issue-list .ref { font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 600; }
@media (max-width: 560px) { .issue-list li { grid-template-columns: 1fr; gap: 2px; } }

.mode-banner { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-5) var(--s-6); border-radius: var(--r-lg); border: 1.5px dashed var(--border-strong); background: var(--surface); }
.mode-banner .mb-icon { width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); }
.mode-banner.is-done { border-style: solid; border-color: transparent; background: var(--ok-bg); }
.mode-banner.is-done .mb-icon { background: var(--ok); color: var(--surface); }
.mode-banner h2 { font-size: var(--fs-xl); }
@media (max-width: 560px) { .mode-banner { padding: var(--s-4); gap: var(--s-3); align-items: flex-start; } .mode-banner .mb-icon { width: 36px; height: 36px; } .mode-banner h2 { font-size: var(--fs-lg); } }
.how-to { counter-reset: how; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.how-to li { counter-increment: how; display: grid; grid-template-columns: 28px 1fr; gap: 12px; font-size: var(--fs-sm); }
.how-to li::before { content: counter(how); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); font-weight: var(--fw-bold); font-size: var(--fs-xs); }
.celebrate { position: relative; display: grid; justify-items: center; text-align: center; gap: var(--s-3); padding: var(--s-10) var(--s-6) var(--s-8); overflow: hidden; }
.celebrate .burst { position: absolute; inset: 0; pointer-events: none; }
.celebrate .burst i { position: absolute; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); opacity: .9; animation: hm-float 2.4s var(--ease) both; }
.celebrate .burst i:nth-child(3n) { background: var(--primary); border-radius: 50%; }
.celebrate .burst i:nth-child(4n) { background: var(--ok); width: 6px; height: 12px; }
@keyframes hm-float { from { translate: 0 30px; opacity: 0; } 30% { opacity: 1; } to { translate: 0 -10px; opacity: 0; } }
.celebrate .hop { animation: hm-hop 1.2s var(--ease) .2s both; }
@keyframes hm-hop { 0% { translate: 0 20px; opacity: 0; } 40% { translate: 0 -10px; opacity: 1; } 60% { translate: 0 0; } 75% { translate: 0 -4px; } 100% { translate: 0 0; } }

/* Kolomkoppeling (uitgaven-import) */
.mapping { display: grid; grid-template-columns: minmax(96px, 140px) 0 minmax(0, 1fr); gap: 10px var(--s-3); align-items: center; }
.mapping > span:empty { width: 0; }
.mapping .src { padding: 8px 12px; border-radius: var(--r-md); background: var(--surface-2); font-family: var(--font-mono); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapping .arrow { color: var(--text-muted); display: grid; place-items: center; }
.preview-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.preview-table th, .preview-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.preview-table th { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; background: var(--surface-2); }
.preview-table .is-mapped { background: color-mix(in oklab, var(--primary-soft) 55%, transparent); }
.preview-table th.is-mapped { background: var(--primary-soft); color: var(--primary-ink); box-shadow: inset 0 -2px 0 var(--primary); }
.preview-table td:not(.is-mapped), .preview-table th:not(.is-mapped) { color: var(--text-muted); }

/* ---------- 15. Instellingen ---------- */
.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr) 320px; gap: var(--s-8); align-items: start; }
.settings-nav { position: sticky; top: var(--s-6); display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { padding: 8px 12px; border-radius: 8px; color: var(--text-muted); text-decoration: none; font-weight: var(--fw-medium); font-size: var(--fs-sm); }
.settings-nav a:hover { background: var(--surface-2); color: var(--text); }
.settings-nav a[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: var(--sh-1), 0 0 0 1px var(--border); }
.settings-section { scroll-margin-top: var(--s-6); }
.settings-section .card-pad { display: flex; flex-direction: column; gap: var(--s-4); }
.settings-section + .settings-section { margin-top: var(--s-5); }
.settings-preview { position: sticky; top: var(--s-6); }
.logo-slot { position: relative; width: 120px; height: 64px; border-radius: 8px; border: 1.5px dashed var(--border-strong); display: grid; place-items: center; font-size: var(--fs-xs); color: var(--text-muted); background: var(--surface-2); }
@media (max-width: 1180px) { .settings { grid-template-columns: 180px minmax(0, 1fr); } .settings-preview { display: none; } }
@media (max-width: 760px) {
  .settings { grid-template-columns: 1fr; gap: var(--s-4); }
  .settings-nav { position: sticky; top: 56px; z-index: 5; flex-direction: row; overflow-x: auto; padding: 8px 0; background: var(--bg); scrollbar-width: none; }
  .settings-nav a { white-space: nowrap; }
  /* Below the top bar (56px) and the sticky section tabs, not under them. */
  .settings-section { scroll-margin-top: 124px; }
}

/* ---------- 16. Inloggen ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s-6) var(--s-4); background: radial-gradient(1200px 600px at 50% -10%, var(--primary-soft), transparent 70%), var(--bg); }
.login-card { width: min(400px, 100%); padding: var(--s-8); display: flex; flex-direction: column; gap: var(--s-5); }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); text-align: center; }
.login-brand h1 { font-size: var(--fs-2xl); }

/* ---------- 17. Aanvullingen (ronde 2) ---------- */
/* Hint bij offerte die bijna verloopt of verlopen is */
.due-hint { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--warn); white-space: nowrap; }
.due-hint .i { width: 13px; height: 13px; }
.due-hint.is-past { color: var(--bad); }
/* Verwijzing tussen documenten (creditnota ↔ factuur) */
.doc-ref { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text); text-decoration: none; }
.doc-ref:hover { background: var(--surface-3); color: var(--text); }
.doc-ref .i { width: 15px; height: 15px; color: var(--text-muted); }
.amount.neg, .neg { color: var(--text); }
/* Creditruimte: hoeveel mag er nog gecrediteerd worden */
.credit-room { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.credit-room dt { color: var(--text-muted); } .credit-room dd { margin: 0; text-align: right; }
.credit-room .is-strong { font-weight: var(--fw-bold); color: var(--text); }
.credit-room.is-over { background: var(--bad-bg); }
.credit-room.is-over .is-strong { color: var(--bad); }
/* Totaalregel onder een lijst */
.sum-row { display: flex; align-items: center; gap: var(--s-3); padding: 12px 16px; border-top: 1.5px solid var(--border-strong); font-variant-numeric: tabular-nums; }
.sum-row .amount { margin-left: auto; font-weight: var(--fw-bold); font-size: var(--fs-lg); }
/* Inline bewerkbare rij */
.table tr.is-editing td { background: var(--primary-soft); }
.table .input-sm { max-width: 320px; }
.table .order { width: 72px; text-align: right; }
/* Lege resultaten in de combobox */
.combo-list .combo-empty { display: block; padding: 14px 12px 10px; color: var(--text-muted); font-size: var(--fs-sm); cursor: default; }
.combo-list .combo-action { color: var(--primary-ink); font-weight: var(--fw-semibold); border-top: 1px solid var(--border); margin-top: 4px; padding-top: 10px; border-radius: 0 0 7px 7px; }
.combo-list .combo-action .i { width: 15px; height: 15px; }
/* Foutpagina */
.error-page { min-height: calc(100vh - 160px); display: grid; place-items: center; }
.error-code { font: 700 var(--fs-xs)/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); }
.login .error-page { min-height: 0; }

/* ---------- 18. Aanvullingen bij de implementatie (M8, Huismus-repo) ---------- */
/* Uitloggen is een POST-formulier (Django's LogoutView), geen link:
   de knop krijgt dezelfde vorm als de navigatielinks. */
.nav .nav-button {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 34px; padding: 0 10px;
  border: 0; border-radius: var(--r-md); background: none; cursor: pointer;
  color: var(--text-muted); font: inherit; font-weight: var(--fw-medium); font-size: var(--fs-sm); text-align: left;
  transition: background .15s, color .15s;
}
.nav .nav-button:hover { background: var(--surface-2); color: var(--text); }

/* Taalwissel onder de inlogkaart: .login is een grid met place-items:center,
   dus de kaart en de wissel staan onder elkaar gecentreerd. */
.login { grid-auto-rows: auto; align-content: center; gap: var(--s-4); }

/* Betaalstatus "Gecrediteerd": creditnota's dekken het hele factuurbedrag.
   Zelfde uiterlijk als de creditnota-pil, zonder stip. */
.pill-credited { --pill-bg: var(--surface-2); --pill-fg: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.pill-credited::before { display: none; }

/* {% field ... suffix="dagen" %}: eenheid rechts in het invoerveld
   (ontwerp: betalingstermijn in contact.html). */
.input-suffix .input { padding-left: 12px; padding-right: 56px; }
.input-suffix .suffix { position: absolute; right: 12px; top: 50%; translate: 0 -50%; pointer-events: none; }

/* Instellingen: een kaart per onderwerp (ontwerp ronde 3, Main.dc.html);
   op een telefoon een compacte lijst zonder de uitleg. */
.settings-topics { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.settings-topics > li { display: flex; }
.settings-topics .card { flex: 1; display: flex; flex-direction: column; gap: var(--s-2); color: inherit; text-decoration: none; }
.settings-topics .card:hover { border-color: var(--border-strong); }
.settings-topics .topic-head { justify-content: space-between; flex-wrap: nowrap; }
.settings-topics h2 { font-size: var(--fs-md); }
@media (max-width: 980px) { .settings-topics { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) {
  .settings-topics { grid-template-columns: 1fr; gap: var(--s-2); }
  .settings-topics .card { padding: var(--s-3) var(--s-4); gap: 2px; }
  .settings-topics .topic-intro { display: none; }
}

/* Nummerformaten ({year}-{seq:04d}) in een monospace letter, zoals het ontwerp. */
.input.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }

/* Editor: een regel waarvan het prullenbakje (het label van de DELETE-
   checkbox van de formset) is aangevinkt, wordt bij opslaan verwijderd. */
.line:has(.line-delete input:checked) { opacity: .45; }
.line:has(.line-delete input:checked) .input { text-decoration: line-through; }
/* Prullenbakje over het logo (Instellingen): aangevinkt = het logo gaat weg bij opslaan. */
.logo-remove { position: absolute; top: 4px; right: 4px; background: var(--surface); box-shadow: var(--sh-1); }
.logo-slot img { transition: opacity .15s; }
.logo-slot:has(.logo-remove input:checked) img { opacity: .3; filter: grayscale(1); }
.logo-remove:has(input:checked) { color: var(--danger); background: var(--bad-bg); }
.logo-remove:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--ring); }
.line-delete:has(input:checked) { color: var(--danger); background: var(--bad-bg); }
.line-delete:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--ring); }

/* Factuurpagina: de inline stijlen uit factuur-uitgegeven.html als klassen. */
.list-icon { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-muted); }
.list-icon.is-ok { background: var(--ok-bg); color: var(--ok); }
.file-link { text-decoration: none; color: inherit; grid-template-columns: 36px minmax(0, 1fr) auto; }
.file-link .f-name { display: block; }
.f-icon.is-accent { background: var(--accent-soft); color: var(--accent-ink); }

/* Importrapport: de inline stijlen uit moneybird-proefdraai.html als klassen. */
.stat-chip.is-warn { background: var(--warn-bg); color: var(--warn); }
.report .r-icon.is-info { background: var(--primary-soft); color: var(--primary-ink); }
.list-icon.is-warn { background: var(--warn-bg); color: var(--warn); border-radius: 8px; }
/* Een melding zonder nummer en label (bijv. een afwijking of betaling uit
   het importrapport) beslaat de hele breedte van de .issue-list-rij. */
.issue-list li > span:only-child { grid-column: 1 / -1; }
.report .r-icon.is-muted { background: var(--surface-2); color: var(--text-muted); }
.card.is-highlighted { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
/* Kleurblokje in een KPI-label, gelijk aan de legenda van de grafiek. */
.legend-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--primary); }
.legend-dot.is-cost { background: var(--accent); }
/* Sneltoetsen bestaan alleen met een toetsenbord: niet tonen op touch. */
@media (hover: none) { .shortcut-hint { display: none; } }
/* Phone: the icon stays beside the first line, the link wraps below the text. */
@media (max-width: 760px) {
  .hint-banner { flex-wrap: wrap; align-items: flex-start; }
  .hint-banner .spacer { display: none; }
  .hint-banner > .spacer ~ span:not(.spacer) { flex-basis: 100%; padding-left: calc(18px + var(--s-3)); }
  .hint-banner > .i + span { flex: 1 1 0; min-width: 0; }
}

/* Grote schermen: het ontwerp is gemaakt voor een laptop (± 1440 px). Daarboven
   wordt alles naar verhouding groter — tekst, knoppen, afstanden en de
   zijbalk samen — in plaats van alleen de inhoud te verbreden. zoom schaalt
   ook de px-waarden van de tokens mee; browsers zonder zoom tonen het
   gewoon op ware grootte. */
@supports (zoom: 1) {
  @media (min-width: 1600px) { :root { zoom: 1.1; --zoom: 1.1; } }
  @media (min-width: 1920px) { :root { zoom: 1.2; --zoom: 1.2; } }
  @media (min-width: 2400px) { :root { zoom: 1.4; --zoom: 1.4; } }
  /* Onder zoom telt ook 100vh mee in de vergroting: deel schermhoogtes
     door dezelfde factor, anders valt de onderkant van de zijbalk weg. */
  .app { min-height: calc(100vh / var(--zoom, 1)); }
  .sidebar { height: calc(100vh / var(--zoom, 1)); }
  .sheet { height: calc(100dvh / var(--zoom, 1)); }
  .login { min-height: calc(100vh / var(--zoom, 1)); }
  .error-page { min-height: calc(100vh / var(--zoom, 1) - 160px); }
}

/* A choice among files or folders (Instellingen → Back-ups, terugzetten). */
.folder-choices .file-item { cursor: pointer; }
.folder-choices .file-item:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.folder-choices .f-name, .folder-choices .f-meta { display: block; }
.folder-choices .f-meta { overflow-wrap: anywhere; }
.folder-choices .f-icon input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.btn[hidden] { display: none; }
/* A folder path in running text (backups) has no place to break. */
.hint-banner > span, .error { overflow-wrap: anywhere; }

/* Hulp: Markdown from docs/hulp/ (huismus/core/help.py). A wide code block scrolls
   by itself and a table is as wide as the text, breaking long words; the
   page never scrolls sideways. */
.help-text { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.help-text h2 { margin-top: var(--s-4); scroll-margin-top: var(--s-6); }
.help-text h2:first-child { margin-top: 0; }
.help-text ul, .help-text ol { margin: 0; padding-left: var(--s-6); display: flex; flex-direction: column; gap: var(--s-1); }
.help-text code { font-family: var(--font-mono); font-size: 0.92em; background: var(--surface-2); border-radius: 4px; padding: 1px 4px; overflow-wrap: anywhere; }
.help-text pre { margin: 0; padding: var(--s-3) var(--s-4); background: var(--surface-2); border-radius: var(--r-sm); overflow-x: auto; font-size: var(--fs-sm); line-height: 1.5; }
.help-text pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; }
.help-text table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.help-text th { text-align: left; color: var(--text-muted); font-weight: var(--fw-semibold); }
.help-text th, .help-text td { padding: var(--s-2) var(--s-3) var(--s-2) 0; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.help-text a { overflow-wrap: anywhere; }
