/* ── Reset & variabelen ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f0f4f9;
  --surface:     #ffffff;
  --border:      #d4dff0;
  --text:        #0f2d5e;
  --text-muted:  #6b7fa3;
  --primary:     #1a4a8a;
  --primary-dk:  #0f2d5e;
  --primary-lt:  #dbeafe;
  --danger:      #e05252;
  --danger-dk:   #c43e3e;
  --success:     #0d6e3f;
  --warning:     #c47d0e;
  --radius:      8px;
  --shadow:      0 1px 3px rgba(15,45,94,.08), 0 1px 2px rgba(15,45,94,.06);
  --nav-h:       56px;
}

html { font-size: 15px; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
       background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── App-navigatie ─────────────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--primary-dk);
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center;
  padding: 0 1.5rem; gap: 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.nav-brand {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 700; font-size: .95rem; color: #ffffff;
  white-space: nowrap; text-decoration: none;
}
.nav-brand svg { color: #7eb3f8; }
.org-name-chip {
  background: var(--primary-lt); color: var(--primary);
  border: 1px solid #bfdbfe;
  border-radius: 20px; padding: .15rem .7rem;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.org-switcher { position: relative; }
.org-switcher-btn {
  background: var(--primary-lt); color: var(--primary);
  border: 1px solid #bfdbfe; border-radius: 20px;
  padding: .15rem .55rem .15rem .7rem;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
  cursor: pointer; display: flex; align-items: center; gap: .35rem;
}
.org-switcher-btn:hover { background: #dbeafe; }
.org-switcher-btn svg { flex-shrink: 0; }
.org-switcher-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.1);
  min-width: 200px; z-index: 200; padding: .3rem 0;
}
.org-switcher-menu.open { display: block; }
.org-switcher-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .9rem; font-size: .85rem; color: var(--text);
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
}
.org-switcher-item:hover { background: var(--bg); }
.org-switcher-current { font-weight: 600; color: var(--primary); }
.org-switcher-link { color: var(--text); }
.org-switcher-check { width: 1em; display: inline-block; flex-shrink: 0; }
.org-switcher-role {
  margin-left: auto; font-size: .72rem; color: var(--text-muted);
  background: var(--bg); border-radius: 10px; padding: .05rem .4rem;
}
.org-choose-card {
  width: 100%; display: flex; align-items: center; gap: .75rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .85rem 1rem; cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.org-choose-card:hover { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-lt); }
.org-choose-name { font-weight: 600; flex: 1; font-size: .95rem; color: var(--text); }
.org-choose-role {
  font-size: .75rem; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: .1rem .5rem;
}
.nav-links { display: flex; gap: .15rem; }
.nav-spacer { flex: 1; }
.nav-links a {
  padding: .35rem .75rem; border-radius: var(--radius);
  color: rgba(255,255,255,.65); font-size: .875rem;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,.12); color: #ffffff; text-decoration: none;
}
/* ── Zoekbalk in navbar ────────────────────────────────────────────────────── */
.nav-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 .75rem;
}
.nav-search-icon {
  position: absolute;
  left: .6rem;
  color: var(--text-muted);
  pointer-events: none;
}
.nav-search-input {
  width: 220px;
  padding: .35rem .75rem .35rem 2rem;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  background: rgba(255,255,255,.12);
  color: #ffffff;
  font-size: .85rem;
  transition: width .2s, border-color .15s;
}
.nav-search-input::placeholder { color: rgba(255,255,255,.5); }
.nav-search-input:focus {
  outline: none;
  border-color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.18);
  width: 300px;
}
.nav-search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 340px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 999;
  overflow: hidden;
}
.nav-search-dropdown.open { display: block; }
.nav-search-item {
  display: flex;
  flex-direction: column;
  padding: .55rem .9rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background .1s;
}
.nav-search-item:last-child { border-bottom: none; }
.nav-search-item:hover, .nav-search-item.active {
  background: var(--bg);
}
.nav-search-item-label {
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-search-item-sub {
  font-size: .775rem;
  color: var(--text-muted);
  margin-top: 1px;
}
.nav-search-empty {
  padding: .75rem .9rem;
  font-size: .85rem;
  color: var(--text-muted);
}

.nav-user { display: flex; align-items: center; gap: 1rem; font-size: .875rem; }
.nav-username { color: rgba(255,255,255,.85); font-weight: 500; }
.superadmin-label { color: var(--warning); font-weight: 600; }
.btn-link { color: var(--text-muted); }
.btn-link:hover { color: var(--danger); }

/* ── Container ─────────────────────────────────────────────────────────────── */
/* fit-content laat de container meegroeien met brede tabellen;              */
/* min-width zorgt dat hij nooit smaller is dan het scherm (of 1280px);      */
/* margin:auto houdt hem altijd gecentreerd.                                  */
.container {
  width: fit-content;
  min-width: min(100%, 1280px);
  margin: 0 auto;
  padding: 1.5rem;
}

/* ── Pagina-header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.back-link { font-size: .875rem; color: var(--text-muted); display: block; margin-bottom: .25rem; }
.back-link:hover { color: var(--primary); text-decoration: none; }

/* ── Compacte filterbar ─────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1rem;
}
.filter-group { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.filter-sep   { width: 1px; height: 20px; background: var(--border); margin: 0 .25rem; }

/* Status pills */
.filter-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .65rem;
  border-radius: 20px;
  font-size: .8rem; font-weight: 500;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  text-decoration: none;
  transition: all .12s;
  white-space: nowrap;
}
.filter-pill:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.filter-pill.active { color: #fff; border-color: transparent; }
.fp-count { font-size: .72rem; font-weight: 700; opacity: .85; }

.fp-all.active      { background: var(--primary); }
.fp-new.active      { background: var(--primary); }
.fp-pending.active  { background: #f59e0b; }
.fp-rejected.active { background: #ef4444; }
.fp-topay.active    { background: #8b5cf6; }
.fp-dispute.active  { background: #f97316; }
.fp-waiting.active  { background: #0ea5e9; }
.fp-incasso.active  { background: #db2777; }
.fp-paid.active     { background: #10b981; }

/* Dropdown filters */
.filter-dropdown-wrap { position: relative; }
.filter-dropdown-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .65rem;
  border-radius: 20px;
  font-size: .8rem; font-weight: 500;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all .12s;
}
.filter-dropdown-btn:hover, .filter-dropdown-btn.active {
  border-color: var(--primary); color: var(--primary);
}
.filter-dd {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.1);
  z-index: 200;
  overflow: hidden;
}
.filter-dd.open { display: block; }
.filter-dd-item {
  display: block;
  padding: .45rem .85rem;
  font-size: .83rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.filter-dd-item:last-child { border-bottom: none; }
.filter-dd-item:hover { background: var(--bg); text-decoration: none; }
.filter-dd-item.active { color: var(--primary); font-weight: 600; }

/* ── Statistieken ──────────────────────────────────────────────────────────── */
.stats-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.stat-card {
  flex: 1; min-width: 110px;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  text-align: center; text-decoration: none; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow);
}
.stat-card:hover { text-decoration: none; border-color: var(--primary); }
.stat-card.active { border-color: var(--primary); background: var(--primary-lt); }
.stat-number { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-label  { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; text-transform: uppercase; letter-spacing: .05em; }
.stat-card.status-new      .stat-number { color: var(--primary); }
.stat-card.status-pending  .stat-number { color: #7c3aed; }
.stat-card.status-rejected .stat-number { color: var(--danger); }
.stat-card.status-to-pay   .stat-number { color: var(--warning); }
.stat-card.status-paid     .stat-number { color: var(--success); }
.stat-card.status-archived .stat-number { color: var(--text-muted); }
.stat-card.status-dispute  .stat-number { color: #9a3412; }

/* ── Tabel ─────────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  width: fit-content; min-width: 100%; overflow: visible;
}
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th {
  background: var(--bg); padding: .65rem 1rem; text-align: left;
  font-weight: 600; font-size: .78rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: .5rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }

/* ── Tabel-footer (paginering) ───────────────────────────────────────────── *
 * Gebruik onder elke .table-wrap:                                            *
 *   <div class="tbl-footer">                                                 *
 *     <button class="btn btn-sm btn-secondary tbl-pg-prev">‹</button>       *
 *     <div class="tbl-pg-btns"></div>                                        *
 *     <button class="btn btn-sm btn-secondary tbl-pg-next">›</button>       *
 *     <span class="tbl-pg-info"></span>                                      *
 *   </div>                                                                   *
 * ── ────────────────────────────────────────────────────────────────────── */
.tbl-footer {
  display: flex; align-items: center; gap: .5rem;
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: .85rem;
}
.tbl-footer .tbl-pg-prev,
.tbl-footer .tbl-pg-next { padding: .25rem .6rem; line-height: 1; }
.tbl-footer .tbl-pg-btns { display: flex; gap: .35rem; }
.tbl-footer .tbl-pg-info { margin-left: auto; color: var(--text-muted); font-size: .8rem; }
/* ── PDF drag-and-drop overlay ───────────────────────────────────────────── */
.drop-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(59, 130, 246, .1);
  display: none; align-items: center; justify-content: center;
  pointer-events: none;
}
.drop-overlay.show { display: flex; }
.drop-overlay-inner {
  background: #fff; border-radius: 16px;
  padding: 3rem 5rem; text-align: center;
  border: 2px dashed var(--primary);
  box-shadow: 0 8px 40px rgba(0,0,0,.12);
}
.drop-title { font-size: 1.05rem; font-weight: 600; color: var(--text); margin: .75rem 0 .25rem; }
.drop-sub { font-size: .875rem; color: var(--text-muted); margin: 0; min-height: 1.25em; }

.td-ellipsis { max-width: 0; overflow: hidden; white-space: nowrap; }
.td-ellipsis-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-subject { max-width: 0; overflow: hidden; white-space: nowrap; }
.td-sender  { max-width: 0; overflow: hidden; white-space: nowrap; }
.mailbox-tag {
  display: inline-block; font-size: .7rem; padding: .05rem .4rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text-muted); font-family: monospace;
  text-decoration: none; white-space: nowrap;
}
.mailbox-tag:hover { background: var(--border); color: var(--text); text-decoration: none; }
.td-date { white-space: nowrap; color: var(--text-muted); }
.td-username, .td-displayname { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-email { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-size: .85rem; }
.td-amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.table th.th-amount { text-align: right; }

/*
 * ── Standaard tabelstructuur ─────────────────────────────────────────────────
 * Gebruik altijd de onderstaande HTML-opbouw voor data-tabellen in Factoo.
 * Gebruik NOOIT inline stijlen op <th> of <td> — gebruik de utility-klassen.
 *
 *   <div class="table-wrap">
 *     <table class="table" id="uniek-tabel-id">
 *       <thead><tr>
 *         <th data-col="veld">Kolomnaam</th>   ← sorteerbaar
 *         <th class="th-amount">Bedrag</th>    ← bedragen rechts
 *         <th class="th-center">Status</th>    ← gecentreerd
 *         <th></th>                             ← actie-kolom (geen data-col)
 *       </tr></thead>
 *       <tbody><tr>
 *         <td data-sort="sorteerwaarde">Inhoud</td>
 *         <td class="td-amount">€ 1.234,56</td>
 *         <td class="td-center"><span class="badge">…</span></td>
 *         <td class="td-mono">NL00BANK0000000000</td>
 *         <td class="td-bold">Naam</td>
 *         <td class="td-date">01-01-2024</td>
 *         <td class="td-actions" onclick="event.stopPropagation()">…knoppen…</td>
 *       </tr></tbody>
 *     </table>
 *   </div>
 *   ← Voeg toe in {% block scripts %}: initResizable('uniek-tabel-id');
 * ────────────────────────────────────────────────────────────────────────────
 */
.th-right,  .table th.th-right  { text-align: right; }
.th-center, .table th.th-center { text-align: center; }
.td-right   { text-align: right; white-space: nowrap; }
.td-center  { text-align: center; }
.td-mono    { font-family: monospace; font-size: .85rem; color: var(--text-muted); }
.td-id      { font-family: monospace; font-size: .78rem; color: var(--text-muted); white-space: nowrap; }
.td-bold    { font-weight: 600; }
.td-actions { white-space: nowrap; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .2rem .55rem; border-radius: 20px;
  font-size: .73rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.badge-new              { background: #dbeafe; color: #1d4ed8; }
.badge-open             { background: #d1fae5; color: #065f46; }
.badge-pending_approval { background: #ede9fe; color: #5b21b6; }
.badge-rejected         { background: #fee2e2; color: #991b1b; }
.badge-to_pay           { background: #fef3c7; color: #92400e; }
.badge-paid             { background: #dcfce7; color: #166534; }
.badge-archived         { background: #f1f5f9; color: #64748b; }
.badge-dispute          { background: #ffedd5; color: #9a3412; }
.badge-waiting          { background: #e0f2fe; color: #075985; }
.badge-incasso          { background: #fce7f3; color: #9d174d; }
.badge-admin         { background: #ede9fe; color: #5b21b6; }
.badge-user          { background: #f1f5f9; color: #475569; }
.badge-plan-free     { background: #f1f5f9; color: #475569; }
.badge-plan-pro      { background: #ede9fe; color: #5b21b6; }
.badge-plan-business { background: #fef3c7; color: #92400e; }
.badge-status-active     { background: #dcfce7; color: #166534; }
.badge-status-suspended  { background: #fee2e2; color: #991b1b; }

/* ── Knoppen ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500; border: none; cursor: pointer;
  text-decoration: none; transition: background .15s, opacity .15s; white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn-primary   { background: var(--primary);  color: #fff; }
.btn-primary:hover { background: var(--primary-dk); opacity:1; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); opacity:1; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dk); opacity:1; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm   { padding: .3rem .7rem; font-size: .8rem; }
.btn-lg   { padding: .7rem 1.6rem; font-size: 1rem; }
.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }

/* ── Formulieren ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: .35rem; font-size: .875rem; font-weight: 500; }
.form-group-check label { display: flex; align-items: center; gap: .5rem; font-weight: 400; margin-top: .75rem; }
.form-section-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: .5rem; }
.required { color: var(--danger); }
.form-control {
  width: 100%; padding: .5rem .75rem; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: .9rem; color: var(--text);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.form-control-sm { padding: .35rem .6rem; font-size: .85rem; }
.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; display: block; }
.form-section-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); padding-bottom: .5rem; border-bottom: 1px solid var(--border); margin-bottom: .85rem; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.inline-form { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .5rem 0; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Kaarten ───────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.card-header { padding: .75rem 1.25rem; border-bottom: 1px solid var(--border); font-weight: 600; font-size: .9rem; background: var(--bg); border-radius: var(--radius) var(--radius) 0 0; }
.card > form, .card > p, .card > dl { padding: 1.25rem; }
.card > .table-wrap, .card > .table { padding: 0; }
.card > .table-wrap { border: none; box-shadow: none; border-radius: 0; }

/* ── Factuurlayout ─────────────────────────────────────────────────────────── */
.invoice-layout { display: grid; grid-template-columns: 1fr 400px; gap: 1.25rem; align-items: start; }
@media (max-width: 960px) { .invoice-layout { grid-template-columns: 1fr; } }

/* PDF toolbar + zoom */
.pdf-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem .75rem; border-bottom: 1px solid var(--border);
  background: var(--bg); border-radius: var(--radius) var(--radius) 0 0;
  gap: .75rem;
}
.pdf-zoom-controls { display: flex; align-items: center; gap: .35rem; }
.pdf-zoom-btn {
  width: 28px; height: 28px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--surface); color: var(--text);
  font-size: 1rem; font-weight: 600; cursor: pointer; display: flex;
  align-items: center; justify-content: center; line-height: 1;
  transition: background .1s;
}
.pdf-zoom-btn:hover { background: var(--border); }
.pdf-zoom-label {
  min-width: 42px; text-align: center; font-size: .8rem;
  font-weight: 600; color: var(--text-muted);
}
.pdf-newtab-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .8rem; color: var(--text-muted); text-decoration: none;
  padding: .3rem .6rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); white-space: nowrap;
}
.pdf-newtab-btn:hover { background: var(--border); text-decoration: none; color: var(--text); }
.pdf-scroll-outer { overflow: auto; height: 600px; min-height: 300px; resize: vertical; }
.pdf-viewer { width: 100%; height: 100%; border: none; display: block; }

/* ── Datumbalk ─────────────────────────────────────────────────────────────── */
.invoice-dates {
  display: flex; align-items: stretch; gap: 0;
  padding: .85rem 1.25rem; background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--border);
}
.inv-date-item { display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.inv-date-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted);
}
.inv-date-value { font-size: .9rem; font-weight: 600; color: var(--text); }
.inv-date-divider { width: 1px; background: var(--border); margin: 0 1rem; }
.days-ok     { color: var(--success); }
.days-warn   { color: var(--warning); }
.days-danger { color: var(--danger); }
.days-paid   { color: var(--success); }
.inv-date-input {
  border: none; background: transparent; font-size: .9rem; font-weight: 600;
  color: var(--text); padding: 0; width: 100%; cursor: text;
  font-family: inherit;
}
.inv-date-input:focus {
  outline: 1px solid var(--primary); border-radius: 4px;
  padding: 2px 4px; background: var(--surface);
}

/* ── Factuur gecombineerde kaart ───────────────────────────────────────────── */
.card > form { padding: 1.25rem; }
.invoice-meta-section {
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem;
}
.invoice-meta-label {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin-bottom: .6rem;
}
.meta-list-inline dt {
  font-size: .78rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .04em; margin-top: .6rem;
}
.meta-list-inline dt:first-child { margin-top: 0; }
.meta-list-inline dd { font-size: .875rem; word-break: break-all; }
/* ── Betaal-QR sectie ────────────────────────────────────────────────────── */
.payment-qr-section {
  border-top: 1px solid var(--border);
}
.payment-qr-body {
  display: flex; flex-direction: column; gap: .75rem; align-items: flex-start;
  padding: .75rem 1.25rem 1.25rem;
}
.payment-qr-img {
  width: 160px; height: 160px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 8px;
  image-rendering: pixelated;
}
.payment-qr-details { width: 100%; min-width: 0; }
.payment-qr-hint {
  font-size: .8rem; color: var(--text-muted); margin-bottom: .25rem;
}
.payment-qr-missing {
  padding: .75rem 1.25rem 1.25rem;
  font-size: .875rem; color: var(--text-muted);
}

/* ── Kopieer-knoppen in betaal-QR sectie ────────────────────────────────────── */
.pay-copy-table { width: 100%; border-collapse: collapse; font-size: .82rem; margin-top: .5rem; }
.pay-copy-table td { padding: .25rem .3rem; vertical-align: middle; }
.pay-copy-label { color: var(--text-muted); text-transform: uppercase; font-size: .7rem; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.pay-copy-value { font-size: .875rem; word-break: break-all; }
.pay-copy-value.mono { font-family: monospace; }
.copy-btn {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem; border-radius: 5px; font-size: .75rem; font-weight: 500;
  border: 1px solid var(--border); background: var(--bg); color: var(--text-muted);
  cursor: pointer; white-space: nowrap; transition: all .15s; font-family: inherit;
}
.copy-btn:hover { background: var(--border); color: var(--text); }
.copy-btn.copied { background: #dcfce7; border-color: #86efac; color: #166534; }
.copy-btn-all { background: var(--surface); color: var(--text); font-weight: 500; }
.copy-btn-link { text-decoration: none; color: var(--primary); border-color: #bfdbfe; background: var(--primary-lt); }
.copy-btn-link:hover { background: #dbeafe; text-decoration: none; color: var(--primary-dk); }

/* ── IBAN-validatie feedback ─────────────────────────────────────────────────── */
.iban-hint { font-size: .78rem; margin-top: .25rem; display: none; }
.iban-hint.valid   { display: block; color: #16a34a; }
.iban-hint.invalid { display: block; color: #dc2626; }

/* ── Betaalpagina (betaallink) ───────────────────────────────────────────────── */
.betaallink-wrap { max-width: 480px; margin: 0 auto; }
.betaallink-header { text-align: center; padding: 2rem 1.5rem 1.5rem; background: var(--bg); border-radius: var(--radius) var(--radius) 0 0; border-bottom: 1px solid var(--border); }
.betaallink-amount { font-size: 2.25rem; font-weight: 800; color: var(--text); line-height: 1; }
.betaallink-payee { font-size: 1rem; color: var(--text-muted); margin-top: .4rem; }
.betaallink-ref { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }
.betaallink-qr-section { display: flex; flex-direction: column; align-items: center; padding: 1.5rem 1.5rem 1rem; border-bottom: 1px solid var(--border); }
.betaallink-qr-img { width: 220px; height: 220px; image-rendering: pixelated; border: 1px solid var(--border); border-radius: 8px; }
.betaallink-qr-hint { font-size: .8rem; color: var(--text-muted); margin-top: .75rem; text-align: center; }
.betaallink-details { padding: 1rem 1.5rem; }
.betaallink-sep { text-align: center; font-size: .75rem; color: var(--text-muted); margin-bottom: 1rem; }
.pay-detail-row { display: flex; align-items: center; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.pay-detail-row:last-of-type { border-bottom: none; }
.pay-detail-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); min-width: 64px; }
.pay-detail-value { flex: 1; font-size: .9rem; word-break: break-all; }
.pay-detail-value.mono { font-family: monospace; letter-spacing: .04em; }
.betaallink-footer { padding: 1rem 1.5rem 1.5rem; border-top: 1px solid var(--border); }

.invoice-approval-note {
  margin: 0 1.25rem 1.25rem;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  border-left: 4px solid transparent;
}
.invoice-approval-note .approval-note-label {
  display: block; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .3rem;
}
.note-approved { background: #f0fdf4; border-color: var(--success); color: #166534; }
.note-approved .approval-note-label { color: var(--success); }
.note-rejected { background: #fef2f2; border-color: var(--danger);  color: #991b1b; }
.note-rejected .approval-note-label { color: var(--danger); }

/* ── Meta-lijst ────────────────────────────────────────────────────────────── */
.meta-list { padding: 1rem 1.25rem; }
.meta-list dt { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-top: .75rem; }
.meta-list dt:first-child { margin-top: 0; }
.meta-list dd { font-size: .9rem; word-break: break-all; }

/* ── Activiteitenlog ───────────────────────────────────────────────────────── */
.activity-log { list-style: none; padding: 1rem 1.25rem; }
.activity-log li { display: flex; gap: .5rem; flex-wrap: wrap; font-size: .8rem; padding: .4rem 0; border-bottom: 1px solid var(--border); }
.activity-log li:last-child { border-bottom: none; }
.log-time   { color: var(--text-muted); white-space: nowrap; }
.log-user   { font-weight: 600; }
.log-action { color: var(--text-muted); }

/* ── Lege staat ────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-muted); }
.empty-state svg { margin-bottom: 1rem; opacity: .4; }
.empty-state p { margin-bottom: .5rem; }

/* ── Navbar toast-meldingen ─────────────────────────────────────────────────── */
.nav-toast-wrap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  pointer-events: none;
}
.nav-toast-wrap .nav-toast {
  pointer-events: auto;
}
.nav-toast {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .65rem;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
  max-width: 420px;
  animation: toast-in .2s ease;
  transition: opacity .4s ease, transform .4s ease;
}
.nav-toast.hiding {
  opacity: 0;
  transform: translateY(-6px);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
.nav-toast-success { background: #dcfce7; color: #166534; }
.nav-toast-danger  { background: #fee2e2; color: #991b1b; }
.nav-toast-warning { background: #fef9c3; color: #854d0e; }
.nav-toast-info    { background: #dbeafe; color: #1e40af; }
.nav-toast-icon    { font-size: .85rem; flex-shrink: 0; }
.nav-toast-msg     { overflow: hidden; text-overflow: ellipsis; }
.nav-toast-close {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 0 0 0 .25rem;
  opacity: .5; flex-shrink: 0;
  color: inherit;
}
.nav-toast-close:hover { opacity: 1; }

/* ── Auth (login + register) ───────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-box { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem 2rem 2.5rem; box-shadow: 0 4px 24px rgba(0,0,0,.08); }
.auth-back { display: inline-block; margin-bottom: 1.25rem; font-size: .875rem; color: var(--text-muted); }
.auth-back:hover { color: var(--primary); text-decoration: none; }
.login-logo { display: flex; align-items: center; justify-content: center; gap: .6rem; font-size: 1.3rem; font-weight: 700; margin-bottom: 1.5rem; color: var(--text); }
.login-logo svg { color: var(--primary); }
.advanced-login { margin: .75rem 0; font-size: .875rem; color: var(--text-muted); }
.advanced-login summary { cursor: pointer; }

/* ── Code-blokken ──────────────────────────────────────────────────────────── */
.code-block { background: #1e293b; color: #e2e8f0; padding: 1rem 1.25rem; border-radius: var(--radius); font-family: monospace; font-size: .8rem; overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: .75rem 0; }

/* ── Horizontale tabs (admin / algemeen) ─────────────────────────────────── */
.settings-tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 2px solid var(--border);
}
.settings-tab {
  padding: .5rem 1rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  text-decoration: none;
  transition: color .15s, border-color .15s;
}
.settings-tab:hover { color: var(--text); }
.settings-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: modal-fade-in .15s ease;
}
@keyframes modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: var(--surface);
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: 0 20px 60px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.1);
  width: 100%; max-width: 480px;
  animation: modal-slide-in .18s ease;
  overflow: hidden;
}
.modal-box.scan-modal-box {
  max-width: none;
  width: 88vw;
  animation: none;
}
@keyframes modal-slide-in { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.25rem .9rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 600; margin: 0; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.4rem; line-height: 1;
  padding: .1rem .4rem; border-radius: var(--radius);
  transition: background .12s, color .12s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 1.25rem; overflow-y: auto; max-height: 70vh; }
.modal-stats {
  display: flex; gap: 0;
  background: var(--bg); border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem; overflow: hidden;
}
.modal-stat {
  flex: 1; padding: .65rem .9rem; text-align: center;
  border-right: 1px solid var(--border);
}
.modal-stat:last-child { border-right: none; }
.modal-stat-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: .2rem; }
.modal-stat-value { font-size: .95rem; font-weight: 600; color: var(--text); }
.modal-footer {
  display: flex; gap: .5rem; align-items: center;
  padding: .9rem 1.25rem 1.1rem;
  border-top: 1px solid var(--border);
}
.modal-footer .ml-auto { margin-left: auto; }

/* ── Hulpklassen ───────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }

/* ── Instellingen-tabs ─────────────────────────────────────────────────────── */
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem; align-items: start; max-width: 1100px; }
@media (max-width: 640px) { .settings-layout { grid-template-columns: 1fr; } }
.settings-tabs-nav {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  position: sticky; top: calc(var(--nav-h) + 1rem);
}
.settings-tab-btn {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .75rem 1rem; border: none; background: none; cursor: pointer;
  font-size: .875rem; color: var(--text-muted); text-align: left;
  border-bottom: 1px solid var(--border); transition: background .15s, color .15s;
  font-family: inherit;
}
.settings-tab-btn:last-child { border-bottom: none; }
.settings-tab-btn:hover { background: var(--bg); color: var(--text); }
.settings-tab-btn.active { background: var(--primary-lt); color: var(--primary); font-weight: 600; }
.settings-tab-btn svg { flex-shrink: 0; opacity: .6; }
.settings-tab-btn.active svg { opacity: 1; }
.settings-tab-pane { display: none; }
.settings-tab-pane.active { display: block; }

/* Mail-type toggle binnen Inkomende mail tab */
.mail-type-toggle {
  display: flex; gap: 0; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 1.25rem;
  width: fit-content;
}
.mail-type-toggle label {
  padding: .45rem 1rem; font-size: .875rem; cursor: pointer;
  background: none; color: var(--text-muted); border: none;
  transition: background .15s, color .15s; user-select: none;
  border-right: 1px solid var(--border);
}
.mail-type-toggle label:last-child { border-right: none; }
.mail-type-toggle input[type="radio"] { display: none; }
.mail-type-toggle label.active { background: var(--primary); color: #fff; font-weight: 600; }

/* ════════════════════════════════════════════════════════════════════════════
   LANDINGSPAGINA
   ════════════════════════════════════════════════════════════════════════════ */

.landing-body { background: #fff; }

/* Landing navigatie */
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(255,255,255,.95);
  backdrop-filter: blur(8px); z-index: 100;
}
.landing-nav-links { display: flex; gap: .75rem; align-items: center; }

/* Hero */
.hero {
  display: flex; align-items: center; gap: 4rem;
  max-width: 1100px; margin: 0 auto;
  padding: 5rem 2rem 4rem;
}
.hero-content { flex: 1; }
.hero-badge {
  display: inline-block;
  background: var(--primary-lt); color: var(--primary);
  border: 1px solid #bfdbfe;
  padding: .3rem .85rem; border-radius: 20px;
  font-size: .8rem; font-weight: 600;
  margin-bottom: 1.25rem;
}
.hero-title {
  font-size: 3rem; font-weight: 800; line-height: 1.15;
  color: var(--text); margin-bottom: 1.25rem;
}
.hero-sub { font-size: 1.1rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 2rem; max-width: 480px; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Mock app preview */
.hero-visual { flex: 0 0 420px; }
.mock-app {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.12);
  overflow: hidden;
}
.mock-bar { background: var(--bg); padding: .75rem 1rem; display: flex; gap: .4rem; }
.mock-dot { width: 12px; height: 12px; border-radius: 50%; }
.mock-dot.red    { background: #ef4444; }
.mock-dot.yellow { background: #f59e0b; }
.mock-dot.green  { background: #22c55e; }
.mock-stats { display: flex; gap: 0; border-bottom: 1px solid var(--border); }
.mock-stat {
  flex: 1; text-align: center; padding: .85rem .5rem;
  border-right: 1px solid var(--border); font-size: .75rem; color: var(--text-muted);
}
.mock-stat:last-child { border-right: none; }
.mock-num { display: block; font-size: 1.5rem; font-weight: 700; color: var(--text); }
.mock-stat.new .mock-num    { color: var(--primary); }
.mock-stat.topay .mock-num  { color: var(--warning); }
.mock-stat.paid .mock-num   { color: var(--success); }
.mock-rows { padding: .5rem 0; }
.mock-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem; border-bottom: 1px solid var(--border);
  font-size: .82rem;
}
.mock-row:last-child { border-bottom: none; }
.mock-name { flex: 1; color: var(--text); }
.mock-amt  { font-weight: 600; color: var(--text); }
.mock-badge { padding: .15rem .45rem; border-radius: 12px; font-size: .68rem; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.mock-badge.new    { background: #dbeafe; color: #1d4ed8; }
.mock-badge.topay  { background: #fef3c7; color: #92400e; }
.mock-badge.paid   { background: #dcfce7; color: #166534; }

/* Features */
.features { background: var(--bg); padding: 5rem 2rem; }
.features-inner { max-width: 1100px; margin: 0 auto; }
.section-title { font-size: 2rem; font-weight: 700; text-align: center; margin-bottom: 3rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.75rem;
  box-shadow: var(--shadow);
}
.feature-icon {
  width: 52px; height: 52px; border-radius: 12px;
  background: var(--primary-lt); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
}
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: .5rem; }
.feature-card p  { font-size: .875rem; color: var(--text-muted); line-height: 1.6; }

/* CTA */
.cta-section {
  text-align: center; padding: 5rem 2rem;
  background: linear-gradient(135deg, #0f2d5e 0%, #1a4a8a 100%);
  color: #fff;
}
.cta-section h2 { font-size: 2rem; font-weight: 700; margin-bottom: .75rem; }
.cta-section p  { font-size: 1.05rem; opacity: .85; margin-bottom: 2rem; }
.cta-section .btn-primary { background: #fff; color: var(--primary); }
.cta-section .btn-primary:hover { background: var(--primary-lt); }

/* Footer */
.landing-footer {
  text-align: center; padding: 2rem; border-top: 1px solid var(--border);
  background: var(--surface);
}
.landing-footer .nav-brand { justify-content: center; margin-bottom: .5rem; }

/* Responsive */
@media (max-width: 780px) {
  .hero { flex-direction: column; padding: 3rem 1.25rem 2rem; gap: 2.5rem; }
  .hero-visual { width: 100%; }
  .hero-title { font-size: 2rem; }
  .hero-visual { flex: none; }
}

/* ── Sorteerbare kolomkoppen ─────────────────────────────────────────────── */
th[data-col] { cursor: pointer; user-select: none; }
th[data-col]:hover { background: #eaeff5; color: var(--text); }

.sort-ind {
  display: inline-block; margin-left: .3rem;
  font-size: .72rem; opacity: .22; line-height: 1;
  transition: opacity .15s, color .15s;
  pointer-events: none; vertical-align: middle;
}
th[data-col]:hover .sort-ind { opacity: .5; }
.sort-ind.active { opacity: 1; color: var(--primary); }

/* ── Kolomresizer ─────────────────────────────────────────────────────────── */
.col-resizer {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 8px;
  cursor: col-resize;
  user-select: none;
  z-index: 2;
  display: flex; align-items: center; justify-content: center;
}
/* Subtiele streep die altijd zichtbaar is */
.col-resizer::after {
  content: '';
  display: block;
  width: 2px; height: 35%;
  background: var(--border);
  border-radius: 1px;
  transition: height .12s, background .12s, opacity .12s;
}
.col-resizer:hover::after, .col-resizer.dragging::after {
  height: 55%; background: var(--primary); opacity: .65;
}

/* ── Rij-selectie ─────────────────────────────────────────────────────────── */
.col-check {
  width: 40px !important;
  padding-left: .85rem !important;
  padding-right: 0 !important;
}
.row-checkbox {
  cursor: pointer; width: 15px; height: 15px;
  accent-color: var(--primary); vertical-align: middle;
}
tbody tr.row-selected { background: var(--primary-lt) !important; }

/* ── Bulk-actiebalk ──────────────────────────────────────────────────────── */
.bulk-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: #1e293b; color: #fff;
  padding: .75rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  transform: translateY(100%);
  transition: transform .2s ease;
  box-shadow: 0 -4px 20px rgba(0,0,0,.25);
}
.bulk-bar.visible,
.bulk-bar.active  { transform: translateY(0); }
.bulk-bar-count { font-size: .9rem; font-weight: 600; flex: 1; }
.bulk-bar-actions { display: flex; gap: .5rem; }
.bulk-bar .btn-secondary {
  background: rgba(255,255,255,.12); color: #fff;
  border-color: rgba(255,255,255,.2);
}
.bulk-bar .btn-secondary:hover { background: rgba(255,255,255,.2); opacity:1; }

/* ── Resterende-dagen badges ─────────────────────────────────────────────── */
.days-badge {
  display: inline-block; padding: .18rem .55rem; border-radius: 20px;
  font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.days-ok      { background: #dcfce7; color: #166534; }
.days-warn    { background: #fef3c7; color: #92400e; }
.days-danger  { background: #fee2e2; color: #991b1b; }
.days-neutral { background: #f1f5f9; color: #64748b; }
