/* Invent+ — basisstijl */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #1c2230;
  --muted: #6b7384;
  --primary: #4f46e5;
  --primary-ink: #ffffff;
  --primary-soft: #eef0ff;
  --success: #15803d;
  --success-soft: #e7f6ec;
  --danger: #c2262e;
  --danger-soft: #fdecec;
  --warning: #a15c00;
  --warning-soft: #fff4e0;
  --sidebar: #151a28;
  --sidebar-ink: #c9cfdc;
  --sidebar-active: #262d42;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .25);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 15px; margin: 0; }
p { margin: 0 0 10px; }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); border: 1px solid var(--border); padding: 0 4px; border-radius: 4px; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.mono { font-family: var(--mono); }
.mt { margin-top: 10px; }
.grow { flex: 1; min-width: 0; }
ul.plain { list-style: none; padding: 0; margin: 6px 0; }
[hidden] { display: none !important; }

/* ── Layout ──────────────────────────────────────────── */
.has-sidebar .main { margin-left: 232px; padding: 24px 28px 90px; max-width: 1600px; }
.is-guest .main { padding: 0; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 232px; background: var(--sidebar); color: var(--sidebar-ink); display: flex; flex-direction: column; z-index: 40; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-side { padding: 18px 18px 12px; }
.brand-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 800; }
.nav-section { margin: 16px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7d869b; font-weight: 600; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--sidebar-ink); }
.nav-link:hover { background: rgba(255,255,255,.05); text-decoration: none; color: #fff; }
.nav-link.is-active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-ico { width: 18px; text-align: center; opacity: .75; }
.sidebar-user { border-top: 1px solid rgba(255,255,255,.08); padding: 12px 18px 16px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.sidebar-user .who { width: 100%; display: flex; flex-direction: column; margin-bottom: 4px; }
.sidebar-user .who strong { color: #fff; }
.sidebar-user .who span { font-size: 12px; color: #7d869b; }
.sidebar-user a, .sidebar-user .linklike { color: var(--sidebar-ink); }
.sidebar-user form { margin: 0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.linklike:hover { text-decoration: underline; }
.topbar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
  .has-sidebar .main { margin-left: 0; padding: 72px 14px 90px; }
  .topbar { display: flex; align-items: center; gap: 10px; position: fixed; inset: 0 0 auto 0; height: 56px; padding: 0 12px; background: var(--sidebar); z-index: 30; }
  .menu-toggle { background: none; border: 0; color: #fff; font-size: 22px; padding: 6px 10px; cursor: pointer; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.menu-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.menu-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
}

/* ── Paginakop / secties ─────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; }
.crumbs { margin: 0 0 4px !important; font-size: 13px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 26px 0 10px; }
.section-head form { margin: 0; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 10px; }

/* ── Kaarten ─────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-title { margin-bottom: 10px; }
.card-danger { border-color: #f3c7c9; }
.grid-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.grid-top .card { margin-bottom: 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.grid-side { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: 150px 150px minmax(220px, 1fr) 120px 160px; gap: 12px; align-items: end; }
.row-gap { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-narrow { max-width: 440px; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-4 .field-grow { grid-column: 1 / -1; } }
@media (max-width: 900px) { .grid-top, .grid-side, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .grid-4 { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 3px; color: var(--text); }
.stat > span { font-size: 12px; color: var(--muted); }
.stat strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); }
.stat-accent { background: var(--primary-soft); border-color: #d9dcff; }
.stat-link:hover { text-decoration: none; border-color: var(--border-strong); }
.stat-pill { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 8px 16px; display: flex; gap: 10px; align-items: baseline; box-shadow: var(--shadow); }
.stat-pill span { color: var(--muted); font-size: 12px; }
.stat-pill strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.list-card { padding: 4px 0; }
.list-row { display: flex; gap: 10px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }

/* ── Knoppen ─────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 13px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #4338ca; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a51f26; }
.btn-danger-ghost { color: var(--danger); border-color: #f0c2c4; }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 13px; }
.btn-block { width: 100%; }
summary.btn { list-style: none; }
summary.btn::-webkit-details-marker { display: none; }
form.inline { display: inline; margin: 0; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 14px; padding: 0; color: inherit; }
.icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-del { color: var(--danger); font-size: 12px; }

/* ── Formulieren ─────────────────────────────────────── */
input, select, textarea { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 9px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent); border-color: var(--primary); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--primary); }
input:disabled { background: var(--surface-2); color: var(--muted); }
textarea { resize: vertical; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > span, .field .label { font-size: 12px; font-weight: 600; color: #3b4354; }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field-inline > span { font-weight: 400; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 7px; margin: 4px 0 12px; cursor: pointer; }
.w-90 { width: 90px; } .w-110 { width: 110px; } .w-140 { width: 140px; } .w-260 { min-width: 260px; }
input.num { text-align: right; }
.subtle-box { border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px 2px; margin: 0 0 12px; }
.subtle-box legend { font-size: 12px; font-weight: 600; padding: 0 4px; }
.radio-row { display: flex; gap: 18px; margin-bottom: 10px; }
.radio-row label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.jar-total { padding-bottom: 20px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer; background: var(--surface); }
.seg label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: #312e81; font-weight: 600; }
.seg-sm label { padding: 5px 10px; }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--border); font-weight: 600; font-size: 13px; cursor: pointer; }
.chip input:checked + span { background: var(--chip); border-color: var(--chip); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--primary); }
.money-input { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.money-input span { padding: 0 0 0 9px; color: var(--muted); }
.money-input input { border: 0; outline: 0; text-align: right; padding-left: 5px; }
.money-input:focus-within { border-color: var(--primary); outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.money-input:has(input:disabled) { background: var(--surface-2); }
.search { max-width: 260px; }
.search-in-select { margin-bottom: 4px; }
.filterbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filterbar .field { margin: 0; min-width: 150px; }

/* ── Toolbar ─────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar-spacer { flex: 1; }
.drawer { position: relative; }
.drawer[open] > summary { box-shadow: 0 0 0 3px var(--primary-soft); }
.drawer-panel { position: absolute; z-index: 20; top: calc(100% + 8px); left: 0; width: min(680px, 92vw); box-shadow: var(--shadow-lg); }
.bulk-bar { position: sticky; top: 8px; z-index: 15; display: flex; align-items: center; gap: 10px; background: var(--text); color: #fff; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 10px; }
.bulk-bar .btn { background: #fff; }

/* ── Tabellen ────────────────────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table thead th { position: sticky; top: 0; background: var(--surface-2); font-size: 12px; font-weight: 600; color: #4a5263; z-index: 1; white-space: nowrap; }
.table tbody tr:hover td { background: #fafbff; }
.table tfoot th { background: var(--surface-2); font-variant-numeric: tabular-nums; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-compact th, .table-compact td { padding: 6px 10px; }
.group-head th { background: var(--surface-2); font-size: 14px; font-weight: 700; letter-spacing: .02em; padding-top: 12px; }
.group-head:hover th { background: var(--surface-2) !important; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.col-cb { width: 34px; }
.col-name { min-width: 160px; }
.col-notes { max-width: 220px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.col-actions { white-space: nowrap; text-align: right; }
.col-actions > * { margin-left: 4px; }
tr.is-inactive td { color: var(--muted); }
.table-oos td strong:first-child { color: inherit; }
.row-edit { display: inline-block; text-align: left; }
.row-edit[open] > summary { background: var(--primary-soft); border-color: var(--primary); }
.row-edit-panel { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 18px; width: min(640px, 94vw); max-height: 90vh; overflow: auto; white-space: normal; text-align: left; }
.row-edit[open] > summary::before { content: ''; position: fixed; inset: 0; background: rgba(15, 20, 35, .45); z-index: 59; cursor: default; }
.row-edit-extra { display: flex; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.row-edit-extra form { margin: 0; }
.mini-note textarea { font-size: 12px; margin-bottom: 4px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 6px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #eef0f4; color: #4a5263; vertical-align: 1px; }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-amber { background: var(--warning-soft); color: var(--warning); }

/* ── Meldingen ───────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid; }
.alert-success { background: var(--success-soft); border-color: #bfe5cb; color: #125c2e; }
.alert-error { background: var(--danger-soft); border-color: #f3c7c9; color: #8c1c22; }
.alert-warning { background: var(--warning-soft); border-color: #f5d9a8; color: #7a4600; }
.alert-info { background: var(--primary-soft); border-color: #d9dcff; color: #312e81; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 100; max-width: 90vw; }
.toast.is-error { background: var(--danger); }

/* ── Tabs ────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 6px 12px; border-radius: var(--radius-sm); color: var(--text); background: var(--surface); border: 1px solid var(--border); font-weight: 500; }
.tab:hover { text-decoration: none; border-color: var(--border-strong); }
.tab.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tabs-months { margin-bottom: 14px; container-type: inline-size; }
.tabs-months .tab { position: relative; flex: 1 1 auto; text-align: center; min-width: 58px; white-space: nowrap; padding: 6px 14px; }
.tabs-months .lock { position: absolute; top: 2px; right: 3px; font-size: 9px; line-height: 1; opacity: .75; }
.tabs-months .tab.is-active .lock { opacity: 1; }
.lock { font-size: 11px; }
/* Volledige maandnamen alleen als ze echt passen (gemeten op de breedte van de balk, niet van het scherm) */
@container (max-width: 1180px) { .tab-long { display: none; } }
@supports not (container-type: inline-size) { @media (max-width: 1250px) { .tab-long { display: none; } } }

/* ── Kasboek ─────────────────────────────────────────── */
.lock-status { color: var(--muted); }
.lock-status.is-locked { color: var(--warning); font-weight: 600; }
.save-status { font-size: 12px; color: var(--muted); min-width: 90px; text-align: right; }
.cash-table td { padding: 5px 10px; }
.cash-table .col-day { width: 78px; white-space: nowrap; }
.cash-table tr.is-weekend td { background: #fbfbfd; }
.cash-table tr.is-today td { background: #f3f4ff; }
.cash-wrap { display: flex; gap: 5px; align-items: center; }
.cash-wrap .money-input { width: 150px; }
.cash-wrap .money-input input { padding: 5px 8px 5px 4px; }
.cash-cell.is-saving .money-input { border-color: #a5b4fc; }
.cash-cell.is-saved .money-input { border-color: var(--success); }
.cash-cell.is-error .money-input { border-color: var(--danger); }
.muts-summary { display: flex; gap: 12px; align-items: center; width: 100%; min-height: 32px; padding: 4px 10px; background: transparent; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); font: inherit; cursor: pointer; font-variant-numeric: tabular-nums; text-align: left; }
.muts-summary:hover { background: var(--surface-2); border-style: solid; }
.muts-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.money-input input[data-start-input] { font-size: 16px; font-weight: 700; padding: 2px 6px; }
.stat .money-input { margin-top: 2px; }

/* ── Modal ───────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 20, 35, .5); }
.modal-card { position: relative; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: 18px; }
.modal-sm { width: min(420px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.muts-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.muts-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.muts-item .pill { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 800; }
.muts-item .pill.plus { background: var(--success-soft); color: var(--success); }
.muts-item .pill.minus { background: var(--danger-soft); color: var(--danger); }
.muts-item .amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.muts-item .meta { font-size: 12px; color: var(--muted); }
.muts-add { display: grid; grid-template-columns: auto 140px 1fr auto; gap: 8px; align-items: center; border-top: 1px solid var(--border); padding-top: 14px; }
@media (max-width: 560px) { .muts-add { grid-template-columns: 1fr 1fr; } .muts-add input[name=note] { grid-column: 1 / -1; } }
body.modal-open { overflow: hidden; }

/* ── Inlog ───────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, #e7e8ff, transparent), var(--bg); }
.auth-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-lg); }
.auth-card h1 { margin: 18px 0 16px; }
.auth-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; }

.empty-state { text-align: center; padding: 60px 20px; }
.empty-code { font-size: 54px; font-weight: 800; color: var(--border-strong); }
.role-help { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 10px; }
.role-help p { margin: 0 0 6px; }

@media print {
  .sidebar, .topbar, .toolbar, .btn, form button { display: none !important; }
  .has-sidebar .main { margin: 0; padding: 0; }
  .table-wrap { box-shadow: none; border: 0; }
}
.row-edit[open] > summary.btn-primary { background: var(--primary); color: #fff; }

/* ══ v4.2 ═════════════════════════════════════════════════ */

/* ── Menu: Instellingen-groep en badge ───────────────── */
.nav-group > summary { list-style: none; cursor: pointer; user-select: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-caret { margin-left: auto; font-size: 11px; opacity: .6; transition: transform .15s; }
.nav-group[open] .nav-caret { transform: rotate(180deg); }
.nav-sub { margin: 2px 0 4px 18px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.1); }
.nav-sub .nav-link { padding: 6px 10px; font-size: 13px; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
@media (max-width: 900px) { .nav-link { padding: 10px 10px; } .nav-sub .nav-link { padding: 9px 10px; } }

/* ── Algemeen: modals als "sheet" op mobiel, compacte velden ── */
.modal-wide { width: min(860px, 100%); }
.field-tight { margin-bottom: 10px; }
.seg-full { margin-bottom: 12px; }
.date-quick { display: flex; gap: 4px; flex-wrap: wrap; margin: -4px 0 10px; }
.date-quick .btn { color: var(--primary); padding: 3px 8px; }
.modal-actions-split { align-items: center; }
.page-head-tight { margin-bottom: 12px; align-items: center; }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-link { background: var(--primary-soft); color: #312e81; font-weight: 600; }
.badge-link:hover { text-decoration: none; filter: brightness(.97); }
@media (max-width: 640px) {
  .modal { padding: 0; place-items: end stretch; }
  .modal-card.modal-sheet { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); }
  .modal-sheet .modal-head { position: sticky; top: -16px; background: var(--surface); z-index: 2; padding: 6px 0 8px; margin: -6px 0 8px; }
  input, select, textarea { font-size: 16px; }   /* voorkomt inzoomen op iOS */
  .page-head-tight h1 { font-size: 20px; }
}

/* ── Locatiepagina: compacte balk ─────────────────────── */
.loc-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); cursor: pointer; font-weight: 500; list-style: none; white-space: nowrap; user-select: none; }
.chip-btn::-webkit-details-marker { display: none; }
.chip-btn:hover { background: var(--surface-2); }
.chip-btn.is-static { cursor: default; }
.chip-btn .caret { font-size: 10px; opacity: .55; }
.pop { position: relative; }
.pop[open] > .chip-btn { border-color: var(--primary); background: var(--primary-soft); color: #312e81; }
.pop-panel { position: absolute; z-index: 25; top: calc(100% + 6px); left: 0; width: min(360px, 92vw); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px; }
.pop-panel .field { margin-bottom: 8px; }
.pop-panel textarea { min-height: 70px; }
@media (max-width: 640px) {
  .pop-panel { position: fixed; left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); }
  .pop[open] > summary::before { content: ''; position: fixed; inset: 0; background: rgba(15, 20, 35, .35); z-index: 24; }
}
.note-strip { background: var(--warning-soft); border: 1px solid #f5d9a8; color: #6b3d00; border-radius: var(--radius-sm); padding: 7px 12px; margin-bottom: 12px; font-size: 13px; }
.tx-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; }
.tx-grid:has([data-to-bucket]:not([hidden])) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) { .tx-grid, .tx-grid:has([data-to-bucket]:not([hidden])) { grid-template-columns: 1fr 1fr; } .tx-grid > label:has([name=tx_date]) { grid-column: 1 / -1; } }
.tx-form .seg label { font-size: 13px; }

/* ── Regel-editor (bulk / producten bij crediteur) ────── */
.line-rows { display: flex; flex-direction: column; gap: 8px; }
.line-row { display: grid; grid-template-columns: minmax(140px, 2fr) minmax(100px, 1fr) 82px 78px 78px 92px 104px 32px; gap: 8px; align-items: end; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.line-row:not(:has(.lf-total)) { grid-template-columns: minmax(140px, 2fr) minmax(100px, 1fr) 82px 78px 78px 92px 32px; }
.line-row.line-row-amount { grid-template-columns: minmax(0, 1fr) 130px 32px; }
/* Gram per jar alleen bij eenheid Jars (kolom blijft op desktop staan zodat alles uitlijnt) */
.line-row[data-unit="gram"] .lf-gpj { visibility: hidden; }
.lf-gpj input { text-align: right; }
.lf-total small { font-size: 11px; text-align: right; white-space: nowrap; }
.lf-total small:empty { display: none; }
.lf { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lf > span { font-size: 11px; font-weight: 600; color: var(--muted); }
.lf input, .lf select { padding: 6px 8px; }
.lf-qty input, .lf-price input { text-align: right; }
.lf-total strong { padding: 6px 0; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.line-del { align-self: end; margin-bottom: 2px; }
.line-rows .line-row:first-child .lf > span { display: flex; }
.line-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; margin-top: 10px; }
@media (min-width: 761px) {
  /* Op desktop alleen labels boven de eerste regel: een nette tabel */
  .line-rows .line-row:not(:first-child) .lf > span { display: none; }
  .line-rows .line-row { border-width: 0 0 1px; border-radius: 0; padding: 4px 0 8px; background: transparent; }
}
@media (max-width: 760px) {
  .line-row { grid-template-columns: 1.25fr 1fr 1fr; gap: 6px 8px; padding: 8px 10px 6px; position: relative; background: var(--surface-2); }
  .line-row:not(:has(.lf-total)) { grid-template-columns: 1.25fr 1fr 1fr; }
  .lf-name { grid-column: 1 / -1; padding-right: 38px; }
  .lf-name .line-badge { right: 44px; }
  .line-row[data-unit="gram"] .lf-gpj { display: none; }
  .line-row.line-row-amount { grid-template-columns: minmax(0, 1fr) 110px 32px; align-items: end; }
  .line-row-amount .lf-name { grid-column: auto; padding-right: 0; }
  .line-row-amount .line-del { position: static; }
  .lf-total { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; gap: 8px; align-items: baseline; }
  .lf-total strong { padding: 0; font-size: 13px; }
  .lf-total > span { font-weight: 500; }
  .line-del { position: absolute; top: 8px; right: 8px; }
  .line-foot .btn { width: 100%; }
}

/* ── Debiteuren / Crediteuren ─────────────────────────── */
.stats-compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stats-compact .stat { padding: 10px 12px; }
.stats-compact .stat strong { font-size: 17px; }
.toolbar-filters { gap: 8px; }
.toolbar-filters .tab { padding: 5px 11px; }
.search-form { margin: 0; flex: 0 1 300px; }
.search-form .search { max-width: none; }
.dc-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.empty-card { text-align: center; padding: 30px; }
.dc-row { display: grid; grid-template-columns: 116px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); }
.dc-row.is-paid { background: var(--surface-2); }
.dc-row.is-paid .dc-title strong, .dc-row.is-paid .dc-amount { opacity: .7; }
.dc-check { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.dc-check input { position: absolute; opacity: 0; pointer-events: none; }
.dc-check-box { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--border-strong); display: grid; place-items: center; color: transparent; font-weight: 800; background: var(--surface); flex: none; transition: all .12s; }
.dc-check:hover .dc-check-box { border-color: var(--success); }
.dc-check input:checked + .dc-check-box { background: var(--success); border-color: var(--success); color: #fff; }
.dc-check input:focus-visible + .dc-check-box { outline: 2px solid var(--primary); outline-offset: 2px; }
.dc-check-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.dc-check input:checked ~ .dc-check-label { color: var(--success); }
.dc-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dc-title strong { font-size: 15px; }
.dc-desc { margin-top: 2px; }
.dc-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12px; color: var(--muted); margin-top: 3px; }
.dc-amount { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dc-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 0 12px; }
.dc-existing { margin: 0 0 8px; }
/* Status per productregel bij bewerken (in Main / al eerder in Main / na goedkeuring) */
.lf-name { position: relative; }
.line-badge { position: absolute; right: 6px; bottom: 6px; font-style: normal; font-size: 10px; font-weight: 700; line-height: 1; padding: 4px 7px; border-radius: 999px; background: #eef0f4; color: #4a5263; pointer-events: none; white-space: nowrap; }
.line-badge:empty { display: none; }
.line-badge.is-main { background: var(--success-soft); color: #125c2e; }
.line-badge.is-pending { background: var(--warning-soft); color: var(--warning); }
.lf-name:has(.line-badge:not(:empty)) input { padding-right: 104px; }
.dc-products legend, .dc-free legend { color: #3b4354; }
.dc-mode { margin-top: 2px; }
.dc-skip-main { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 4px; padding: 8px 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-size: 13px; }
.dc-skip-main input { margin-top: 2px; flex: none; width: 18px; height: 18px; }
.dc-skip-main:has(input:checked) { border-style: solid; border-color: var(--primary); background: var(--primary-soft); }
.dc-skip-note { margin: 0 0 6px; font-size: 12px; color: #312e81; }
.dc-free { margin-bottom: 12px; }
.dc-amount-lines { color: #3b4354; }
@media (max-width: 520px) { .dc-mode label { flex: 1 1 100%; justify-content: center; } }
.dc-paynow { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: center; }
.dc-paynow .check { margin: 0 0 10px; }
@media (max-width: 760px) {
  .dc-row { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "check main main" "check amount actions"; padding: 12px; gap: 8px 12px; }
  .dc-check { grid-area: check; flex-direction: column; gap: 4px; align-self: start; }
  .dc-check-box { width: 34px; height: 34px; }
  .dc-check-label { font-size: 11px; }
  .dc-main { grid-area: main; }
  .dc-amount { grid-area: amount; align-self: center; font-size: 16px; }
  .dc-actions { grid-area: actions; text-align: right; }
  .toolbar-filters .tabs { width: 100%; }
  .toolbar-filters .tab { flex: 1 0 auto; text-align: center; white-space: nowrap; }
  .search-form { flex: 1 1 100%; }
  .dc-grid { grid-template-columns: 1fr 1fr; }
  .dc-grid .dc-party { grid-column: 1 / -1; }
}

/* ── Kasboek: zoeken en mutaties bewerken ─────────────── */
.search-box { flex: 0 1 340px; min-width: 200px; }
.search-box .search { max-width: none; }
.search-results { padding: 10px 12px; margin-top: -4px; }
.search-results-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.search-results-head .btn { margin-left: auto; }
.search-results-list { display: flex; flex-direction: column; max-height: 340px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sr-item { display: grid; grid-template-columns: 130px 26px 110px minmax(0, 1fr); gap: 10px; align-items: center; padding: 7px 4px; border-top: 1px solid var(--border); color: var(--text); }
.sr-item:hover { background: var(--surface-2); text-decoration: none; }
.sr-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sr-amt { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.sr-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-item .pill, .muts-item .pill { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-weight: 800; font-size: 12px; }
.pill.plus { background: var(--success-soft); color: var(--success); }
.pill.minus { background: var(--danger-soft); color: var(--danger); }
.pill.fd { background: var(--primary-soft); color: var(--primary); font-size: 11px; }
@media (max-width: 640px) {
  .search-box { flex: 1 1 100%; }
  .sr-item { grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-areas: "pill date amt" "pill note note"; gap: 0 10px; }
  .sr-item .pill { grid-area: pill; }
  .sr-date { grid-area: date; }
  .sr-amt { grid-area: amt; }
  .sr-note { grid-area: note; font-size: 13px; color: var(--muted); }
}
.cash-table tr.is-match td { background: #fff8db !important; }
.cash-table tr.is-flash td { background: #e0e7ff !important; transition: background .4s; }
.muts-item-actions { display: flex; gap: 6px; }
.muts-edit { display: grid; grid-template-columns: auto 130px 1fr; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--primary); border-radius: var(--radius-sm); background: var(--primary-soft); }
.muts-edit-date { display: flex; align-items: center; gap: 8px; grid-column: 1 / 3; }
.muts-edit-actions { display: flex; gap: 6px; justify-content: flex-end; }
.muts-edit-hint { grid-column: 1 / -1; }
@media (max-width: 560px) {
  .muts-edit { grid-template-columns: 1fr 1fr; }
  .muts-edit .seg, .muts-edit .money-input, .muts-edit input[name=note], .muts-edit-date, .muts-edit-actions { grid-column: 1 / -1; }
  .muts-edit .seg { flex-wrap: nowrap; }
  .muts-edit .seg label { flex: 1; justify-content: center; }
  .muts-edit-actions .btn { flex: 1; }
  .muts-item { flex-wrap: wrap; }
  .muts-item-actions { width: 100%; justify-content: flex-end; }
}
@media (max-width: 640px) {
  .cash-wrap .money-input { width: 112px; }
  .cash-table td { padding: 4px 6px; }
}

/* ── v4.3: goedkeuring Debiteuren/Crediteuren ────────── */
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #116632; }
.approve-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; background: var(--warning-soft); border: 1px solid #f5d9a8; color: #6b3d00; border-radius: var(--radius); padding: 9px 12px; margin-bottom: 12px; }
.approve-bar form { margin: 0; }
.tab-pending:not(.is-active) { border-color: #f5d9a8; background: var(--warning-soft); color: #7a4600; }
.dc-row.is-pending { border-color: #f0c674; box-shadow: 0 0 0 1px #f5d9a8, var(--shadow); }
.dc-changes { margin-top: 8px; background: var(--warning-soft); border: 1px solid #f5d9a8; border-radius: var(--radius-sm); padding: 7px 10px; color: #5c3600; }
.dc-changes ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.dc-approve-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.dc-check.is-requested .dc-check-box { background: var(--warning-soft); border-color: #e0a84a; color: #7a4600; font-size: 14px; }
.dc-check.is-requested .dc-check-label { color: var(--warning); }
.dc-check input:disabled ~ .dc-check-box { cursor: default; }
.approve-note { background: var(--warning-soft); border: 1px solid #f5d9a8; color: #6b3d00; border-radius: var(--radius-sm); padding: 7px 10px; font-size: 13px; margin: 0 0 10px; }
.nav-badge-amber { background: #e0a84a; color: #3d2400; }
@media (max-width: 760px) {
  .dc-approve-actions .inline, .dc-approve-actions .btn { flex: 1; }
  .dc-approve-actions .inline { display: flex; }
  .approve-bar .btn { flex: 1; }
  .approve-bar form { flex: 1; display: flex; }
}
