/* Facturio — plain and readable first, a little bit "kassabon" second.
   Layout follows nhs.uk: a header across the top, one calm column, big plain type, underlined links.
   Light only. Square corners, no soft shadows, no animation. Colours come from the logo. */
:root {
    color-scheme: light;

    /* Colour: 12 colours, 4 tints, 2 pressed/hover shades. Nothing else in this file picks a colour
       (the invoice document, .inv, has its own neutral palette: it is what the klant receives). */
    --bg: #f3eee2;            /* paper */
    --surface: #fffdf8;       /* receipt white: cards, inputs */
    --ink: #1b1f2a;           /* text, outlines — the logo's outline */
    --ink-soft: #4d4a42;      /* secondary text, hints */
    --rule: #ddd3bd;          /* lines between rows, card edges */
    --input: #5c5648;         /* form field borders, ≥3:1 against paper */
    --accent: #3b4870;        /* links, selected states — slate from the logo */
    --action: #f8ac68;        /* the one primary button — soft logo orange, always with ink text and an ink
                                 outline (too light to stand off the paper on its own) */
    --focus: #ffd84d;         /* keyboard focus highlight */
    --ok: #2f6b1f;
    --warn: #7a5200;
    --danger: #b3261e;

    --accent-soft: #e7e9f0;   /* tints: selected, tags, banners */
    --ok-soft: #e6efd9;
    --warn-soft: #fbefcf;
    --danger-soft: #f9e4df;

    --action-dark: #f39a4c;   /* primary button: hover */
    --danger-dark: #8f1d17;

    /* Type: five sizes. Body is 16px on a phone, 19px from 641px (html font-size), like nhs.uk. */
    --fs-h1: 2rem;
    --fs-h2: 1.4rem;
    --fs-h3: 1.15rem;
    --fs-body: 1rem;
    --fs-small: .875rem;

    --radius: 0;
    --radius-control: 3px;
    --page-width: 1280px;     /* every page: one width, so cards and tables line up from page to page */
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
    font-size: 16px; -webkit-text-size-adjust: 100%;
    /* Always reserve the scrollbar's room: short pages (no scrollbar) would otherwise sit a few
       pixels off from long ones, and the whole UI jumps sideways when switching pages. */
    scrollbar-gutter: stable;
}
@media (min-width: 641px) { html { font-size: 19px; } }

body {
    margin: 0;
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    font-size: var(--fs-body);
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 700; line-height: 1.2; color: var(--ink); }
h1 { font-size: var(--fs-h1); text-wrap: balance; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
p { margin: 0 0 1rem; }
img, svg { vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }

a { color: var(--accent); text-decoration: underline; text-underline-offset: .15em; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); text-decoration-thickness: 2px; }

/* Keyboard focus: yellow highlight, the nhs.uk way */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }
a:focus-visible {
    outline: none; background: var(--focus); color: var(--ink); text-decoration: none;
    box-shadow: 0 -2px var(--focus), 0 4px var(--ink);
}

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

.content {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* Back link (nhs.uk): a chevron and where it goes, above the page title */
.back-link {
    display: inline-flex; align-items: center; gap: .4rem; margin-bottom: .75rem;
    font-size: var(--fs-small); color: var(--accent); text-decoration: underline; text-underline-offset: .15em;
}
.back-link::before {
    content: ""; width: .45em; height: .45em; border: solid currentColor; border-width: 0 0 2px 2px;
    transform: rotate(45deg); flex-shrink: 0;
}
.back-link:hover { color: var(--ink); text-decoration-thickness: 2px; }

.sub { color: var(--ink-soft); margin: 0; font-size: var(--fs-body); max-width: 40em; }
.muted { color: var(--ink-soft); }
.small { font-size: var(--fs-small); }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.page-head h1 { margin-bottom: .35rem; }
.head-actions { display: flex; gap: .6rem; align-items: center; }

/* ---------- Header (replaces the old sidebar) ---------- */
.site-header { background: var(--surface); border-bottom: 4px solid var(--ink); }
.sh-inner { max-width: var(--page-width); margin: 0 auto; padding: 1rem 1.5rem 0; }
.sh-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.sh-brand { display: inline-flex; align-items: center; text-decoration: none; padding: .2rem 0; }
.sh-brand img { height: 2.75rem; width: auto; display: block; }
.sh-utility { display: flex; align-items: center; gap: 1.4rem; }
.sh-utility a, .sh-utility button {
    display: inline-flex; align-items: center; gap: .35rem;
    color: var(--accent); background: none; border: 0; padding: .2rem 0;
    font: inherit; font-size: var(--fs-small); cursor: pointer;
    text-decoration: underline; text-underline-offset: .15em;
}
.sh-utility a:hover, .sh-utility button:hover { color: var(--ink); text-decoration-thickness: 2px; }
.sh-utility svg { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.sh-utility form { margin: 0; display: inline-flex; }

.sh-nav ul { list-style: none; margin: .8rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 1.8rem; }
.sh-nav a {
    display: block; padding: .45rem 0 .6rem; margin-bottom: -4px;
    color: var(--ink); text-decoration: none; border-bottom: 4px solid transparent;
}
.sh-nav a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.sh-nav a.active { font-weight: 700; border-bottom-color: var(--action); }
.sh-nav a:focus-visible { box-shadow: none; border-bottom-color: var(--ink); }

/* ---------- Buttons ---------- */
.btn-primary, .btn-ghost, .btn-danger {
    font: inherit;
    font-weight: 700;
    font-size: var(--fs-body);
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .6rem 1rem;
    border: 2px solid transparent;
    border-radius: var(--radius-control);
    text-decoration: none;
    cursor: pointer;
    position: relative;
}
/* The one primary action on a page: soft orange, ink text and outline, an ink edge underneath (nhs.uk-style). */
.btn-primary { background: var(--action); border-color: var(--ink); color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
.btn-primary:hover { background: var(--action-dark); border-color: var(--ink); color: var(--ink); }
.btn-primary:active:not(:disabled) { top: 2px; box-shadow: 0 2px 0 var(--ink); }
.btn-danger:active:not(:disabled) { top: 2px; box-shadow: 0 2px 0 var(--danger-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: var(--surface); border-color: var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-ghost.small, .btn-primary.small, .btn-danger.small { padding: .35rem .7rem; font-size: var(--fs-small); }
.btn-primary.small { box-shadow: 0 3px 0 var(--ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--surface); box-shadow: 0 4px 0 var(--danger-dark); }
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); color: var(--surface); }
.btn-danger:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost.danger-ghost:hover { border-color: var(--danger); color: var(--danger); }
/* A destructive action at the bottom of a detail page: a plain red text link, away from the main actions. */
.foot-danger { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.link-danger {
    display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 0;
    background: none; border: 0; cursor: pointer; font: inherit; font-weight: 700;
    color: var(--danger); text-decoration: underline; text-underline-offset: .15em;
}
.link-danger:hover { color: var(--danger-dark); text-decoration-thickness: 2px; }
.link-danger:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn-primary:focus-visible, .btn-ghost:focus-visible, .btn-danger:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn-primary .icon, .btn-ghost .icon, .btn-danger .icon { width: 1.05rem; height: 1.05rem; flex-shrink: 0; }

/* ---------- Tables ---------- */
.grid { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--rule); }
.card .grid { border: 0; }
.grid th {
    text-align: left;
    font-size: var(--fs-small);
    font-weight: 700;
    color: var(--ink);
    padding: .7rem .8rem;
    border-bottom: 2px solid var(--ink);
}
.grid td { padding: .75rem .8rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
/* Same inner edge as cards, lists and the tasks: text starts 1rem in, wherever it is. */
.grid th:first-child, .grid td:first-child { padding-left: 1rem; }
.grid th:last-child, .grid td:last-child { padding-right: 1rem; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid td[data-label="Datum"] { white-space: nowrap; } /* "02-07-2026" never breaks at its hyphens */
.grid tbody tr.clickable { cursor: pointer; }
.grid tbody tr.clickable:hover { background: var(--bg); }
/* Bonnetjes: a phone's file name ("image_picker_93888C22-…jpg") is long and says little. One line, cut
   off with "…", the full name on hover — it must not make the table wider. */
.bon-list .file-name { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.link { color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: .15em; }
.link:hover { color: var(--ink); text-decoration-thickness: 2px; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.card-head {
    padding: .75rem 1rem;
    font-size: var(--fs-body);
    font-weight: 700;
    color: var(--ink);
    border-bottom: 1px solid var(--rule);
    background: var(--surface);
}
.card-body { padding: 1rem; display: flex; flex-direction: column; gap: .75rem; }
.card-foot { padding: .7rem 1rem; display: flex; align-items: center; gap: .75rem; border-top: 1px solid var(--rule); }
/* Safety net for wide tables inside a card (which clips): scroll instead of cutting off. */
.table-scroll { overflow-x: auto; }

/* Two-column review layout */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 1.25rem; align-items: start; }
@media (max-width: 880px) { .cols { grid-template-columns: 1fr; } }

/* ---------- Tags: status only (nhs.uk tag) — never a message, never a link ---------- */
.tag {
    display: inline-flex; align-items: center; margin-left: .4rem; padding: .05rem .5rem;
    font-size: var(--fs-small); font-weight: 700; line-height: 1.4; white-space: nowrap;
    border: 1px solid currentColor; border-radius: 2px;
    background: var(--accent-soft); color: var(--accent);
}
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- The five boxes (nhs.uk) ----------
   card · inset text · warning callout · notification banner · summary list. Nothing else on a page
   draws a box (dialogs, toasts and the invoice document aside). */

/* Inset text: an explanation or an empty list, set apart by a bar on the left. */
.inset { margin: 0 0 1.25rem; padding: .75rem 1rem; border-left: 8px solid var(--rule); color: var(--ink-soft); }
.inset > :last-child { margin-bottom: 0; }

/* Warning callout: something that can go wrong (or went wrong: .error). */
.warning { margin: 0 0 1.25rem; padding: .85rem 1rem; background: var(--warn-soft); border-left: 8px solid var(--warn); color: var(--ink); }
.warning.error { background: var(--danger-soft); border-left-color: var(--danger); }
.warning > :last-child { margin-bottom: 0; }
.warning ul { margin: .35rem 0 0; padding-left: 1.2rem; }
.warning li { margin: .15rem 0; }
.warning:has(> .icon) { display: flex; gap: .8rem; align-items: flex-start; }
.warning > .icon { width: 1.4rem; height: 1.4rem; flex-shrink: 0; margin-top: .1rem; color: var(--danger); }

/* Notification banner: the state of this page — archived, in the prullenbak, just sent, viewed as beheerder. */
.banner {
    display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: 0 0 1.25rem; padding: .75rem 1rem;
    background: var(--surface); border: 1px solid var(--rule); border-left: 8px solid var(--accent); color: var(--ink);
}
.banner > span:not(.tasks-check):not(.banner-actions) { flex: 1 1 14rem; }
.banner > .tasks-check { flex: 0 0 auto; margin: 0; }
.banner-ok { background: var(--ok-soft); border-color: var(--ok-soft); border-left-color: var(--ok); }
.banner-warn { background: var(--warn-soft); border-color: var(--warn-soft); border-left-color: var(--warn); }
.banner-danger { background: var(--danger-soft); border-color: var(--danger-soft); border-left-color: var(--danger); }
.banner-actions { display: inline-flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.banner-actions form { margin: 0; }
.banner-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--accent); text-decoration: underline; cursor: pointer; }
.banner-x { background: none; border: none; color: inherit; cursor: pointer; font-size: var(--fs-h3); line-height: 1; padding: 0 .2rem; flex-shrink: 0; }
/* The beheerder's "bekijk als" strip spans the page above the content. */
.banner.admin-view { margin: 0; border-width: 0 0 2px; border-bottom-color: var(--warn); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: .3rem; font-size: var(--fs-body); }
.field > span { font-weight: 700; color: var(--ink); font-size: var(--fs-small); }
.field input, .field select, .field textarea {
    font: inherit;
    font-size: var(--fs-body);
    padding: .5rem .6rem;
    border: 2px solid var(--input);
    border-radius: 0;
    background: var(--surface);
    color: var(--ink);
}
/* One height for every single-line box in a form: a native select is otherwise a few pixels taller
   than a text box next to it (and differs per browser). */
.field > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .field > select, .field > .stepper { height: 2.75rem; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 3px solid var(--focus);
    outline-offset: 0;
    border-color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--ink);
}
.field.checkbox { flex-direction: row; align-items: center; gap: .5rem; }
/* Number inputs: keep right-aligned digits clear of the +/- spinner */
input[type="number"] { padding-right: .35rem; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { margin-left: .5rem; }
/* NumberStepper: own −/+ buttons, native spinner hidden (consistent in every browser) */
.stepper {
    display: inline-flex; align-items: stretch;
    border: 2px solid var(--input); border-radius: 0;
    background: var(--surface); overflow: hidden;
}
.stepper:focus-within { outline: 3px solid var(--focus); border-color: var(--ink); }
.stepper > input[type="number"] {
    flex: 1 1 auto; width: 4.5rem; min-width: 0; border: none; border-radius: 0; box-shadow: none;
    background: transparent; color: var(--ink); font: inherit; font-size: var(--fs-body);
    text-align: right; padding: .45rem .75rem; font-variant-numeric: tabular-nums;
    -moz-appearance: textfield; appearance: textfield;
}
.stepper > input[type="number"]:focus { outline: none; border: none; box-shadow: none; }
.stepper > input[type="number"]::-webkit-inner-spin-button,
.stepper > input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-btn {
    display: flex; align-items: center; justify-content: center;
    width: 2rem; padding: 0; border: none; background: var(--bg);
    color: var(--ink); font: inherit; font-size: var(--fs-h3); font-weight: 700; line-height: 1; cursor: pointer;
}
.stepper-dec { order: -1; border-right: 1px solid var(--rule); }
.stepper-inc { border-left: 1px solid var(--rule); }
.stepper-btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.stepper-btn:disabled { opacity: .35; cursor: default; }
.stepper.disabled { opacity: .55; }
.stepper.disabled > input[type="number"] { cursor: default; }
.stepper.compact > input[type="number"] { width: 3.75rem; padding: .25rem .6rem; }
.stepper.compact .stepper-btn { width: 1.6rem; font-size: var(--fs-body); }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--ink); cursor: pointer; }

/* Validation (Blazor forms) */
.validation-message { color: var(--danger); font-weight: 700; font-size: var(--fs-small); }
.invalid { outline: 2px solid var(--danger); }

.actions { display: flex; flex-direction: column; gap: .6rem; margin-top: .2rem; }
.save-status {
    display: flex; align-items: center; justify-content: space-between; gap: .8rem;
    font-size: var(--fs-small); color: var(--ok); font-weight: 700; padding: .2rem 0;
}
.save-status .link { color: var(--accent); }




/* Invoice preview */
.invoice-preview { padding: 1.2rem 1.3rem; }

/* Clients & forms grid */
.client-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; padding: 1rem; }
.client-grid .wide, .client-grid .small-field { grid-column: 1 / -1; }
.client-grid .small-field > input, .client-grid .rate > input { width: 7rem; }
.client-grid .small-field > .stepper { width: 10rem; }
@media (max-width: 640px) { .client-grid { grid-template-columns: 1fr; } }

.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .75rem; align-items: end; padding: 1rem; }
.inline-form .grow { grid-column: span 2; }
.inline-form .btn-primary { height: fit-content; }

/* Vrije regels (concept factuur, klant page) */
.free-lines { margin-bottom: 1.25rem; }
.free-lines-intro { margin: 0; padding: .75rem 1rem 0; }

/* ---------- Invoice document (neutral on purpose — it's what the client receives) ---------- */
.inv {
    --paper: #ffffff;
    --paper-ink: #1a1c22;
    --paper-soft: #6b7180;
    --paper-rule: #e4e6ec;
    background: var(--paper);
    color: var(--paper-ink);
    font-family: Helvetica, Arial, sans-serif;
    font-size: 13.5px;
    line-height: 1.5;
    padding: 2.4rem 2.4rem 2rem;
    border: 1px solid var(--rule);
    max-width: 640px;
}
.inv .muted { color: var(--paper-soft); }
.inv-head { display: flex; justify-content: space-between; gap: 1.5rem; align-items: flex-start; }
.inv-logo { max-height: 56px; max-width: 200px; margin-bottom: .5rem; }
.inv-name { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.inv-name-sm { font-weight: 700; margin-bottom: .1rem; }
.inv-company-meta { font-size: .82rem; color: var(--paper-soft); }
.inv-title { text-align: right; }
.inv-title-word { font-size: 1.6rem; font-weight: 700; }
.inv-meta { margin-top: .5rem; font-size: .82rem; display: inline-flex; flex-direction: column; gap: .1rem; }
.inv-meta div { display: flex; justify-content: space-between; gap: 1.2rem; }
.inv-meta span { color: var(--paper-soft); }

.inv-billto { margin: 1.6rem 0 1.1rem; }
.inv-label {
    font-size: .64rem; text-transform: uppercase; font-weight: 700;
    letter-spacing: .08em; color: var(--paper-soft); display: block; margin-bottom: .2rem;
}
.inv-client { font-weight: 700; font-size: 1rem; }

.inv-table { width: 100%; border-collapse: collapse; margin-top: .4rem; }
.inv-table th {
    text-align: left; font-size: .66rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--paper-soft); font-weight: 600; padding: .4rem .5rem;
    border-bottom: 2px solid var(--inv-accent);
}
.inv-table td { padding: .45rem .5rem; border-bottom: 1px solid var(--paper-rule); }
.inv-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.inv-table .inv-section th { text-align: left; padding: 1rem .5rem .35rem; border-bottom: 2px solid var(--paper-rule); color: var(--inv-accent, #3559e8); font-size: .95rem; text-transform: none; letter-spacing: 0; }
.inv-table .inv-section-total td { border-bottom: 0; color: #6b7180; text-align: right; }
.inv-table .inv-section-total td.num { color: inherit; font-weight: 700; }

.inv-totals { margin: 1rem 0 0 auto; width: 240px; display: flex; flex-direction: column; gap: .25rem; }
.inv-totals .row { display: flex; justify-content: space-between; font-size: .88rem; font-variant-numeric: tabular-nums; }
.inv-totals .row span:first-child { color: var(--paper-soft); }
.inv-totals .row.total {
    font-weight: 700; font-size: 1.05rem; color: var(--inv-accent);
    border-top: 2px solid var(--inv-accent); padding-top: .4rem; margin-top: .25rem;
}
.inv-totals .row.total span:first-child { color: var(--inv-accent); }

.inv-foot {
    margin-top: 1.8rem; padding-top: .9rem; border-top: 1px solid var(--paper-rule);
    font-size: .78rem; color: var(--paper-soft);
    display: flex; align-items: center; gap: 1rem;
}
.inv-foot-text { flex: 1; min-width: 0; }
/* Same box as the PDF (150 × 30 pt), so the preview shows the size it prints at. */
.inv-foot-logo { max-height: 40px; max-width: 200px; flex-shrink: 0; }
.inv-foot-meta { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; margin-top: .4rem; }
.inv-foot-meta span { font-size: .72rem; }

/* Modern — accent top band, bold title in accent */
.inv-modern { border-top: 5px solid var(--inv-accent); }
.inv-modern .inv-title-word { color: var(--inv-accent); }

/* Klassiek — centred letterhead, ruled */
.inv-klassiek { text-align: center; }
.inv-klassiek .inv-head { flex-direction: column; align-items: center; gap: .3rem;
    border-bottom: 1px solid var(--paper-rule); padding-bottom: 1rem; }
.inv-klassiek .inv-name, .inv-klassiek .inv-title-word { letter-spacing: .04em; text-transform: uppercase; }
.inv-klassiek .inv-title { text-align: center; }
.inv-klassiek .inv-title-word { font-size: 1.1rem; font-weight: 600; margin-top: .3rem; }
.inv-klassiek .inv-meta div, .inv-klassiek .inv-billto, .inv-klassiek .inv-table th { text-align: left; }
.inv-klassiek .inv-billto { text-align: left; }
.inv-klassiek .inv-totals { text-align: left; }

/* Compact — small, tight, no band */
.inv-compact { padding: 1.6rem 1.6rem 1.4rem; font-size: 12.5px; }
.inv-compact .inv-title-word { font-size: 1.2rem; }
.inv-compact .inv-billto { margin: 1rem 0 .7rem; }

/* ---------- Sjabloon ---------- */
.tmpl-cols { display: grid; grid-template-columns: 21rem minmax(0, 1fr); gap: 1.4rem; align-items: start; }
@media (max-width: 880px) { .tmpl-cols { grid-template-columns: 1fr; } }
.style-picker { display: flex; flex-direction: column; gap: .5rem; }
.style-opt {
    display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .8rem;
    border: 2px solid var(--rule); border-radius: 0; cursor: pointer; background: var(--surface);
}
.style-opt:hover { border-color: var(--ink-soft); }
.style-opt.active { border-color: var(--ink); background: var(--accent-soft); }
.style-opt .st-name { font-weight: 700; }
.style-opt .st-desc { font-size: var(--fs-small); color: var(--ink-soft); }
.color-row { display: flex; align-items: center; gap: .6rem; }
.color-row input[type="color"] { width: 3rem; height: 2.2rem; padding: 2px; border: 2px solid var(--input); border-radius: 0; background: var(--surface); }
.preview-wrap { position: sticky; top: 1rem; }

/* ---------- Quick-add chips (Uren) ---------- */
.quick-row { display: flex; align-items: center; gap: .7rem; padding: .75rem 1rem 0; }
.quick-label { font-size: var(--fs-small); font-weight: 700; color: var(--ink-soft); min-width: 3rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip-btn {
    font: inherit; font-size: var(--fs-small); font-weight: 700; cursor: pointer;
    padding: .35rem .8rem; border-radius: var(--radius-control); border: 2px solid var(--rule);
    background: var(--surface); color: var(--ink);
}
.chip-btn:hover { border-color: var(--ink); }
.chip-btn.active { background: var(--ink); border-color: var(--ink); color: var(--surface); }

/* ---------- Sticky action bar (detail pages) — inline on desktop, fixed at the bottom on mobile ---------- */
.sticky-actions { display: flex; flex-direction: column; gap: .6rem; }
.sa-row { display: flex; gap: .6rem; }
.sa-row .btn-primary, .sa-row .btn-ghost { flex: 1; justify-content: center; }
.sa-note { font-size: var(--fs-small); color: var(--ink-soft); }
.sa-spacer { display: none; }

/* Approve toggle — a square box you tick */
.approve-toggle {
    display: inline-flex; align-items: center; gap: .5rem;
    font: inherit; font-size: var(--fs-small); font-weight: 700;
    padding: .35rem .8rem .35rem .55rem; border-radius: var(--radius-control);
    border: 2px solid var(--rule); background: var(--surface); color: var(--ink);
    cursor: pointer;
}
button.approve-toggle:hover { border-color: var(--ink); }
.approve-toggle .tick {
    width: 1.15rem; height: 1.15rem; border-radius: 2px;
    border: 2px solid currentColor; display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; background: var(--surface);
}
.approve-toggle .tick svg { width: .75rem; height: .75rem; opacity: 0; }
.approve-toggle.checked { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.approve-toggle.checked .tick { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.approve-toggle.checked .tick svg { opacity: 1; }
.approve-toggle.done { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); cursor: default; }
.approve-toggle.done .tick { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.approve-toggle.done .tick svg { opacity: 1; }

/* ---------- Auth ---------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: var(--bg); }
.login-card {
    width: 100%; max-width: 380px; background: var(--surface);
    border: 1px solid var(--rule); border-top: 4px solid var(--ink);
    padding: 2rem 1.8rem;
}
.login-brand { display: block; margin-bottom: .25rem; }
.login-brand img { height: 3rem; width: auto; display: block; }
.login-sub { color: var(--ink-soft); margin: .5rem 0 1.5rem; }
.login-form { display: flex; flex-direction: column; gap: 1.1rem; }
.login-form a { color: var(--ink-soft); font-size: var(--fs-small); }
.steps { margin: 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: 1.1rem; }
.qr { margin: .75rem 0 .5rem; width: 200px; max-width: 100%; background: var(--surface); padding: 8px; }
.qr svg { display: block; width: 100%; height: auto; }
.totp-key { display: inline-block; font-family: "IBM Plex Mono", monospace; font-size: var(--fs-body); letter-spacing: .04em; padding: .3rem .5rem; background: var(--bg); border: 1px solid var(--rule); word-break: break-all; }
.recovery-codes { font-family: "IBM Plex Mono", monospace; font-size: var(--fs-body); line-height: 1.7; margin: .5rem 0 0; white-space: pre-wrap; }
.no-passkeys [data-passkey] { display: none; }
.passkey-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.passkey-list li { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.login-or { text-align: center; color: var(--ink-soft); margin: 1rem 0 .25rem; font-size: var(--fs-small); }

/* ---------- Beheer ---------- */
.admin-badge { margin-left: .5rem; font-family: "IBM Plex Mono", monospace; font-size: var(--fs-small); text-transform: uppercase; letter-spacing: .06em; padding: .15rem .4rem; border: 1px solid var(--ink); color: var(--ink); vertical-align: middle; }
.sh-brand { display: inline-flex; align-items: center; }
.admin-nav { display: flex; gap: 1.25rem; padding: .5rem 0 .75rem; font-weight: 700; }
.admin-nav a { color: var(--ink); text-decoration: none; border-bottom: 3px solid transparent; padding-bottom: .2rem; }
.admin-nav a.active { border-bottom-color: var(--ink); }
.admin-filter { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; margin-bottom: 1.25rem; }
.admin-filter .field { min-width: 14rem; }
.admin-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.card-head .small { margin-left: .5rem; font-weight: 400; font-size: var(--fs-small); }

/* ---------- Archive & prullenbak ---------- */
.icon { width: 1.1rem; height: 1.1rem; display: inline-block; vertical-align: middle; }

/* Actief / Archief tabs above a list */
.tabs { display: flex; gap: .3rem; margin: -.4rem 0 1.25rem; border-bottom: 1px solid var(--rule); }
.tab {
    white-space: nowrap; font: inherit; font-size: var(--fs-body); font-weight: 700; color: var(--ink-soft);
    background: none; border: none; border-bottom: 4px solid transparent; margin-bottom: -1px;
    padding: .55rem .9rem; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem;
}
.tab:hover { color: var(--ink); text-decoration: underline; }
.tab.active { color: var(--ink); border-bottom-color: var(--action); }
.tab .icon { width: 1rem; height: 1rem; }
.tab-count {
    font-size: var(--fs-small); font-weight: 700; font-variant-numeric: tabular-nums;
    background: var(--surface); border: 1px solid var(--rule); border-radius: 2px; padding: 0 .4rem;
    color: var(--ink-soft);
}
.tab.active .tab-count { background: var(--ink); border-color: var(--ink); color: var(--surface); }

/* Per-row archive / trash buttons */
.row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: .2rem; }
.row-actions .link { margin-left: .4rem; white-space: nowrap; }
.row-btn {
    display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-size: var(--fs-small); font-weight: 700;
    background: none; border: 2px solid transparent; border-radius: var(--radius-control); padding: .25rem .4rem;
    color: var(--ink-soft); cursor: pointer;
}
.row-btn:hover { color: var(--accent); background: var(--accent-soft); }
.row-btn-label { display: none; }

.card-foot .foot-actions { margin-left: auto; display: inline-flex; gap: .5rem; flex-wrap: wrap; }

fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plain:disabled { opacity: .7; }

/* Prullenbak page */
.trash-actions { display: inline-flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }

/* Confirm dialog */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(27,31,42,.5); z-index: 50; }
.dialog {
    position: fixed; z-index: 51; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: min(480px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); overflow-y: auto;
    background: var(--surface); color: var(--ink); border: 2px solid var(--ink);
    border-radius: 0; box-shadow: 6px 6px 0 rgba(27,31,42,.35); padding: 1.3rem 1.4rem 1.2rem;
}
.dialog h2 { font-size: var(--fs-h3); font-weight: 700; margin: 0 0 .8rem; display: flex; align-items: center; gap: .5rem; }
.dialog-danger { border-top: 6px solid var(--danger); }
.dialog-warning { border-top: 6px solid var(--warn); }
.dialog-warning h2 { color: var(--warn); }
.dialog-warning h2 .icon, .dialog-danger h2 .icon { width: 1.35rem; height: 1.35rem; }
.dialog-danger h2 { color: var(--danger); }
.dialog-body { font-size: var(--fs-body); display: flex; flex-direction: column; gap: .2rem; }
.dialog-body .warning { margin: .3rem 0 0; }
.dialog-body p { margin: 0 0 .5rem; }
.impact-list { margin: 0 0 .7rem; padding-left: 1.2rem; font-weight: 700; }
.confirm-word { margin-top: 1rem; }
.confirm-word input { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .04em; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.25rem; }

/* Bon upload in progress (wwwroot/js/upload.js): outside Blazor, so it shows even with the circuit down */
.upload-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(27,31,42,.5); padding: 1rem; }
.upload-overlay-box {
    width: min(360px, 100%); background: var(--surface); color: var(--ink); border: 2px solid var(--ink);
    box-shadow: 6px 6px 0 rgba(27,31,42,.35); padding: 1.3rem 1.4rem;
}
.upload-overlay-box p { margin: 0; font-weight: 700; font-size: var(--fs-h3); text-align: center; }

/* Toasts — fixed to the screen, so they're seen wherever you've scrolled */
.ntf-stack {
    position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 45;
    display: flex; flex-direction: column; gap: .6rem; align-items: flex-end;
    width: min(420px, calc(100vw - 2.4rem)); pointer-events: none;
}
.ntf {
    pointer-events: auto; width: 100%;
    display: flex; align-items: flex-start; gap: .7rem;
    background: var(--surface); color: var(--ink);
    border: 2px solid var(--ink); border-left: 8px solid var(--ok); border-radius: 0;
    box-shadow: 4px 4px 0 rgba(27,31,42,.2);
    padding: .75rem .8rem .75rem .9rem; font-size: var(--fs-body); line-height: 1.4;
}
.ntf-info { border-left-color: var(--accent); }
.ntf-mark {
    flex-shrink: 0; width: 1.3rem; height: 1.3rem; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: var(--fs-small); font-weight: 700; color: var(--surface); background: var(--ok); margin-top: .05rem;
}
.ntf-info .ntf-mark { background: var(--accent); }
/* min-width 0 + anywhere: a long file name ("image_picker_93888C22-…jpg") wraps inside the toast
   instead of pushing the close button out of it. */
.ntf-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ntf-x {
    flex-shrink: 0; background: none; border: none; color: var(--ink-soft); cursor: pointer;
    font-size: var(--fs-body); line-height: 1; padding: .2rem .3rem; border-radius: var(--radius-control);
}
.ntf-x:hover { color: var(--ink); background: var(--bg); }
.ntf-action {
    flex-shrink: 0; align-self: center; background: none; border: 2px solid var(--ink); color: var(--ink);
    font: inherit; font-weight: 700; padding: .3rem .6rem; cursor: pointer; border-radius: var(--radius-control);
}
.ntf-action:hover { background: var(--bg); }
.ntf-action:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* With a button the message needs the width: the button goes on its own line, under the text */
.ntf:has(.ntf-action) { flex-wrap: wrap; }
.ntf:has(.ntf-action) .ntf-msg { flex: 1 1 calc(100% - 4.5rem); }
.ntf:has(.ntf-action) .ntf-action { order: 3; margin-left: 2rem; }

/* ---------- Original upload on the bon page ---------- */
.doc-card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .4rem; }
.doc-card > summary::-webkit-details-marker { display: none; }
.doc-card > summary::after { content: "▾"; margin-left: auto; font-size: var(--fs-small); }
.doc-card:not([open]) > summary { border-bottom: 0; }
.doc-card:not([open]) > summary::after { content: "▸"; }
.doc-preview { background: var(--bg); display: flex; justify-content: center; }
.doc-preview a { display: block; width: 100%; }
.doc-preview img { display: block; width: 100%; max-height: 560px; object-fit: contain; }
.doc-preview iframe { display: block; width: 100%; height: 480px; border: 0; background: var(--surface); }
.doc-nopreview { margin: 0; padding: 1.2rem 1rem; }
.doc-foot { display: flex; align-items: center; gap: .7rem; padding: .6rem 1rem; border-top: 1px solid var(--rule); }
.doc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duplicate-note { margin: 0 0 1.25rem; }

/* ---------- "Hoe is deze bon gelezen?" on the bon page: a link that opens the OCR's reading ---------- */
.ocr-details { margin: 1.5rem 0 0; }
.ocr-details > summary { cursor: pointer; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: .15em; }
.ocr-details > summary:hover { color: var(--ink); text-decoration-thickness: 2px; }
.ocr-details > summary .tag { text-decoration: none; }
.ocr-body { display: flex; flex-direction: column; gap: .75rem; padding: 1rem 0 0 1rem; border-left: 8px solid var(--rule); margin-top: .75rem; }
.ocr-meta { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .9rem; margin: 0; font-size: var(--fs-small); }
.ocr-meta dt { color: var(--ink-soft); font-weight: 600; }
.ocr-meta dd { margin: 0; }
.ocr-candidate { border: 1px solid var(--rule); padding: .7rem .8rem; display: flex; flex-direction: column; gap: .4rem; }
.ocr-candidate.chosen { border-color: var(--accent); }
.ocr-candidate p { margin: 0; }
.ocr-candidate-head { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.ocr-lines td, .ocr-lines th { padding: .35rem .6rem; font-size: var(--fs-small); }
.ocr-raw > summary { cursor: pointer; color: var(--ink-soft); }
.ocr-raw pre {
    margin: .5rem 0 0; padding: .7rem .8rem; max-height: 360px; overflow: auto;
    background: var(--bg); color: var(--ink); border: 1px solid var(--rule);
    font-family: "IBM Plex Mono", monospace; font-size: var(--fs-small); white-space: pre-wrap; word-break: break-word;
}

/* ---------- Quick links to a klant's lopende factuur / klantgegevens (ClientQuickLinks) ---------- */
.quick-links { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
/* Plain links, not pills: a link looks like a link (nhs.uk). */
.quick-link {
    white-space: nowrap; font-size: var(--fs-small); font-weight: 700;
    color: var(--accent); text-decoration: underline; text-underline-offset: .15em;
}
.quick-link:hover { color: var(--ink); text-decoration-thickness: 2px; }
.quick-row .quick-links { margin-left: auto; }
.sub-links { margin-top: .45rem; }
/* Uren: client name + open hours on the left, the Factuur → link on the right */
.client-head { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .7rem; }
.client-head .quick-links { margin-left: auto; }
/* Facturen list: a client name that links to its card */
.client-link {
    display: inline-flex; align-items: center; gap: .3rem;
    color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: .15em;
}
.client-link .icon { width: 1rem; height: 1rem; flex-shrink: 0; }
.client-link:hover { color: var(--ink); text-decoration-thickness: 2px; }
/* "There is already a klant with this name" on Nieuwe klant */
.duplicate-banner { margin: 0 1rem 1rem; }

/* ---------- Phone ---------- */
.bottom-nav { display: none; }

@media (max-width: 640px) {
    .sh-inner { padding: .6rem 1rem; }
    .sh-brand img { height: 2rem; }
    .sh-nav { display: none; }
    .sh-utility { gap: .1rem; }
    .sh-utility a, .sh-utility button {
        flex-direction: column; gap: .1rem; padding: .25rem .4rem; color: var(--ink);
        font-size: var(--fs-small); font-weight: 700; text-decoration: none;
    }
    .sh-utility svg { width: 1.35rem; height: 1.35rem; }
    .sh-label { display: block; line-height: 1.1; }

    .content { padding: 1.25rem 1rem calc(5rem + env(safe-area-inset-bottom)); max-width: 100%; }

    .page-head { align-items: stretch; }
    .page-head .head-actions, .page-head .btn-primary, .page-head .btn-ghost, .page-head .btn-danger { width: 100%; justify-content: center; }
    .head-actions { flex-direction: column; gap: .9rem; }

    /* Bottom tab bar — the icons stay, drawn a touch heavier */
    .bottom-nav {
        display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
        background: var(--surface); border-top: 2px solid var(--ink);
        padding: 0 .2rem env(safe-area-inset-bottom);
        justify-content: space-around;
    }
    .bn-item {
        flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem;
        text-decoration: none; color: var(--ink-soft); font-size: var(--fs-small); font-weight: 700;
        padding: .5rem 0 .4rem; border-top: 4px solid transparent; margin-top: -2px;
    }
    .bn-item span { text-align: center; line-height: 1.15; }
    .bn-item svg { width: 1.5rem; height: 1.5rem; }
    .bn-item svg * { stroke-width: 2; }
    .bn-item:hover { color: var(--ink); }
    .bn-item.active { color: var(--ink); border-top-color: var(--action); }

    /* Tables become stacked cards */
    .grid { background: none; border: 0; }
    .grid thead { display: none; }
    .grid, .grid tbody { display: block; width: 100%; }
    .grid tr { display: block; background: var(--surface); border: 1px solid var(--rule);
        border-radius: 0; margin-bottom: .75rem; padding: .35rem .2rem; }
    .grid td { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
        padding: .45rem .85rem; border: none !important; text-align: right; }
    .grid td::before {
        content: attr(data-label); color: var(--ink-soft); font-size: var(--fs-small); font-weight: 700;
        text-align: left; white-space: nowrap;
    }
    .grid td.no-label::before, .grid td[data-label=""]::before { content: none; }
    .grid td.cell-primary { font-size: var(--fs-h3); font-weight: 700; }
    .grid td.cell-primary .muted { font-weight: 400; }
    /* Inside a card the rows are already framed: separate them with a rule instead of a box */
    .card .grid tr { border: 0; border-bottom: 1px solid var(--rule); margin-bottom: 0; }
    .card .grid tr:last-child { border-bottom: 0; }
    .grid td.cell-action { padding-top: .6rem; }

    /* Bonnetjes: supplier + status on top, date · klant + actions below — scannable on the job. */
    .grid.bon-list tr {
        display: grid; grid-template-columns: auto 1fr auto; column-gap: .6rem; row-gap: .2rem;
        grid-template-areas: "lev lev status" "datum klant action"; align-items: center; padding: .7rem .85rem;
    }
    .grid.bon-list td { display: block; padding: 0; text-align: left; min-width: 0; }
    .grid.bon-list td::before { content: none; }
    .grid.bon-list td[data-label="Leverancier"] { grid-area: lev; font-size: var(--fs-body); }
    .grid.bon-list td[data-label="Leverancier"] .muted { display: none; }   /* file name: on the bon page */
    .grid.bon-list td[data-label="Status"] { grid-area: status; justify-self: end; font-size: var(--fs-small); }
    .grid.bon-list td[data-label="Datum"] { grid-area: datum; color: var(--ink-soft); font-size: var(--fs-small); }
    .grid.bon-list td[data-label="Klant"] { grid-area: klant; color: var(--ink-soft); font-size: var(--fs-small);
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .grid.bon-list td[data-label="Regels"] { display: none; }
    .grid.bon-list td.cell-action { grid-area: action; padding: 0; justify-self: end; }
    .grid.bon-list td.cell-action > * { width: auto; }
    .grid.bon-list .row-btn { padding: .3rem .45rem; }
    .grid.bon-list .row-btn-label { display: none; }
    .grid td.cell-action::before { content: none; }
    .grid td.cell-action > * { width: 100%; }
    .grid td.cell-action .btn-primary, .grid td.cell-action .btn-ghost,
    .grid td.cell-action .approve-toggle { justify-content: center; }

    .cols { grid-template-columns: 1fr; }
    .client-grid, .inline-form { grid-template-columns: 1fr; }

    /* Sticky action bar pinned above the bottom nav */
    .sticky-actions {
        position: fixed; left: 0; right: 0; bottom: calc(3.75rem + env(safe-area-inset-bottom));
        z-index: 25; background: var(--surface); border-top: 2px solid var(--ink);
        padding: .75rem 1rem 1rem;
    }
    .sticky-actions .btn-primary, .sticky-actions .btn-ghost { flex: 1; justify-content: center; }
    .has-sticky .content { padding-bottom: calc(9rem + env(safe-area-inset-bottom)); }

    .inv { padding: 1.4rem 1.2rem; }
    .inv-head { flex-direction: column; gap: .6rem; }
    .inv-title { text-align: left; }

    .sa-spacer { display: block; height: 7.5rem; } /* the bar with its note is ~7.5rem tall */

    /* Archive / trash on phone: labelled buttons across the card */
    .row-actions { justify-content: flex-end; flex-wrap: wrap; gap: .4rem; }
    .row-btn { border-color: var(--rule); padding: .4rem .7rem; color: var(--ink); }
    .row-btn-label { display: inline; }
    .trash-actions { width: 100%; }
    .trash-actions > * { flex: 1; justify-content: center; }
    .card-foot { flex-wrap: wrap; }
    .card-foot .foot-actions { margin-left: 0; width: 100%; }
    .card-foot .foot-actions > * { flex: 1; justify-content: center; }
    .dialog-actions { flex-direction: column-reverse; }
    .dialog-actions > * { justify-content: center; }
    .tabs { margin-top: 0; }

    /* Toasts: full width just above the tab bar — and above the action bar on detail pages */
    .ntf-stack {
        left: .75rem; right: .75rem; width: auto; align-items: stretch;
        bottom: calc(4.4rem + env(safe-area-inset-bottom));
    }
    body:has(.sticky-actions) .ntf-stack { bottom: calc(10.5rem + env(safe-area-inset-bottom)); }
    .ntf-x { padding: .35rem .45rem; font-size: var(--fs-body); }

    .doc-preview iframe { height: 380px; }
    .doc-preview img { max-height: 420px; }
    .quick-row { flex-wrap: wrap; }
    .quick-row .quick-links { margin-left: 0; }
}

/* Framework error page */
.text-danger { color: var(--danger); }

/* ---------- A klant per bon line ---------- */
.move-qty { width: 5.5rem; }
.lines-error { margin: .75rem 1rem 0; }

/* The bon's lines as a spreadsheet: every cell is an input that saves when you leave it. */
.bon-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .4rem 1rem; padding: 1rem; border-bottom: 1px solid var(--rule); }
.bon-whole { flex: 1 1 18rem; max-width: 28rem; }
.bon-whole > span { font-size: var(--fs-body); }
.bon-whole-hint { flex-basis: 100%; margin: 0; }
.bon-newklant { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem .75rem; padding-top: .5rem; }
.bon-newklant .field { flex: 1 1 16rem; max-width: 24rem; }
.bon-newklant.has-error { padding-left: .8rem; }
/* Spreadsheet look: thin grid lines, cells that read as plain text and only show a box on hover/focus. */
.bon-table { table-layout: fixed; min-width: 42rem; border-collapse: collapse; }
.bon-table th { white-space: nowrap; padding: .55rem .5rem; font-size: var(--fs-small); }
.bon-table td { padding: 0; vertical-align: middle; border-bottom: 1px solid var(--rule); }
.bon-table td + td { border-left: 1px solid var(--rule); }
.bon-table th:first-child { padding-left: 1rem; }
.bon-table td:first-child { padding-left: .5rem; }
.bon-table .c-desc { width: auto; }
.bon-table .c-qty { width: 6.75rem; }
.bon-table .c-price { width: 6rem; }
.bon-table .c-total { width: 6.25rem; }
.bon-table .c-vat { width: 4.25rem; }
.bon-table .c-who { width: 10.5rem; }
.bon-table .c-more { width: 2.5rem; }
.cell-input {
    display: block; width: 100%; min-width: 0; height: 2.6rem; padding: 0 .5rem;
    font: inherit; font-size: var(--fs-body); color: var(--ink); background: transparent;
    border: 1px solid transparent; border-radius: 0; text-overflow: ellipsis;
}
.cell-input:hover { border-color: var(--rule); background: var(--surface); }
.cell-input:focus { outline: 2px solid var(--focus); outline-offset: -2px; border-color: var(--ink); background: var(--surface); }
.cell-input::placeholder { color: var(--ink-soft); }
.bon-table input[type="number"].cell-input { text-align: right; -moz-appearance: textfield; appearance: textfield; }
.bon-table input[type="number"].cell-input::-webkit-inner-spin-button,
.bon-table input[type="number"].cell-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
select.cell-input { padding: 0 .1rem 0 .4rem; cursor: pointer; }
/* Still to be decided: only the "Voor wie" cell is marked, not the whole row. */
select.cell-input.cell-open { background: var(--warn-soft); color: var(--warn); font-weight: 700; }
textarea.cell-desc-input {
    resize: none; overflow: hidden; white-space: nowrap; line-height: 2.5rem; padding-top: 0; padding-bottom: 0;
}
.cell-with-suffix { display: flex; align-items: center; }
.cell-with-suffix .cell-input { flex: 1 1 auto; }
.cell-suffix { flex: none; padding-right: .5rem; color: var(--ink-soft); font-size: var(--fs-small); }
/* The unit next to the aantal: a small field of its own, reading like the unit after the number. */
.cell-with-suffix .cell-unit-input { flex: 0 0 3.4rem; width: 3.4rem; padding: 0 .35rem; color: var(--ink-soft); font-size: var(--fs-small); text-align: left; }
.cell-with-suffix .cell-unit-input:focus { color: var(--ink); }
.cell-text { display: block; padding: 0 .5rem; line-height: 2.6rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-total { font-weight: 700; }
.cell-unit { color: var(--ink-soft); font-size: var(--fs-small); }
/* The app doubted this cell: a red frame, and the reason in a row under the line. */
.bon-table td.cell-doubt { box-shadow: inset 0 0 0 2px var(--danger); }
.bon-table td.cell-doubt .cell-input:not(:focus) { background: var(--surface); }
.table-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .6rem 1rem; }
.table-legend { margin: 0; color: var(--ink-soft); font-size: var(--fs-body); display: flex; align-items: center; gap: .5rem; }
.legend-swatch { flex: none; width: 1.1rem; height: 1.1rem; box-shadow: inset 0 0 0 2px var(--danger); background: var(--surface); }
/* A toggle button that is on (Bewerken while the table is open) */
.btn-ghost[aria-pressed="true"] { background: var(--accent-soft); }
.table-lock { margin-left: auto; }
.bon-table tr.row-doubt > td { padding: .35rem 1rem .55rem; color: var(--danger); font-size: var(--fs-small); }
.row-doubt-note { margin-right: .75rem; }
.row-doubt-ok { font-size: var(--fs-small); white-space: nowrap; }
.bon-table tr:has(+ tr.row-doubt) > td { border-bottom-color: transparent; }
.cell-sub { display: block; padding: 0 .5rem .35rem; margin-top: -.3rem; color: var(--ink-soft); font-size: var(--fs-small); }
/* Under the klant of an invoiced or credit line: its one action (crediteren / ongedaan maken). */
.bon-table .cell-link { display: block; padding: 0 .5rem .45rem; margin-top: -.45rem; font-size: var(--fs-small); line-height: 1.3; }
.bon-table tr.done .cell-input, .bon-table tr.done .cell-text, .bon-table tr.frozen .cell-text { color: var(--ink-soft); }
.bon-table tr.row-error > td { padding: .3rem 1rem .6rem; }
/* ⋯ per line: kopje and splitsen. */
.cell-more {
    display: block; width: 100%; height: 2.6rem; border: 0; border-radius: 0; background: none;
    color: var(--accent); font: inherit; font-size: var(--fs-h3); font-weight: 700; line-height: 1; cursor: pointer;
}
.cell-more:hover, .cell-more[aria-expanded="true"] { background: var(--accent-soft); }
.cell-more:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.cell-more-text { display: none; }
/* What ⋯ opens: one compact line under the row, small labels next to small fields. */
.bon-table tr.row-more > td { padding: .45rem 1rem; background: var(--bg); border-left: 4px solid var(--accent); }
.bon-table tr:has(+ tr.row-more) > td { border-bottom-color: transparent; }
.more-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 2rem; font-size: var(--fs-small); }
.more-item { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.more-label { font-weight: 700; color: var(--ink); }
.more-of { color: var(--ink-soft); }
.more-input {
    height: 2.1rem; padding: 0 .5rem; font: inherit; font-size: var(--fs-small); color: var(--ink);
    background: var(--surface); border: 1px solid var(--input); border-radius: 0;
}
.more-input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--ink); }
.more-kopje { width: 10rem; }
.more-qty { width: 4.25rem; text-align: right; }
.more-chip { padding: .2rem .55rem; }
/* Under a row: splitting it, or crediting an invoiced line. */
.bon-table tr.row-panel > td { padding: .9rem 1rem; background: var(--bg); border-left: 6px solid var(--accent); }
.row-panel .split-box { padding-top: 0; border-top: 0; max-width: 34rem; }
/* Teruggebracht: still on the bon, but greyed out — it counts for nobody. "Voor wie" stays readable: that's the way back. */
.bon-table tr.returned > td { background: var(--bg); }
.bon-table tr.returned > td:not([data-label="Voor wie"]):not(.c-more) { opacity: .55; }
/* Under the table: the status on its own line, then the next step — the primary button on the left
   with "Klaar" beside it, always in the same place (nhs.uk). */
.lines-foot { flex-wrap: wrap; gap: .75rem 1.5rem; padding: 1rem; }
.lines-status { flex-basis: 100%; color: var(--ink-soft); }
.foot-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
/* The table needs the room: a narrower Origineel beside it, and under it sooner than on other pages. */
.bon-cols { grid-template-columns: minmax(0, 1fr) 16rem; }
@media (max-width: 1200px) { .bon-cols { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
    .foot-buttons { width: 100%; }
    .foot-buttons > * { flex: 1 1 100%; justify-content: center; }
    .lines-status { width: 100%; }
    /* On a phone each line is a small card: the description on top, the other cells labelled below.
       There the inputs get a visible box again — no hover to find them by. */
    .bon-table { min-width: 0; table-layout: auto; }
    .bon-table td, .bon-table td + td { padding: .2rem .85rem; text-align: left; border: 0; }
    .bon-table .cell-input { border-color: var(--rule); background: var(--surface); height: 2.75rem; }
    /* Every value in the same right-hand column, left-aligned like a form. */
    .bon-table td > .cell-input, .bon-table td > .cell-with-suffix, .bon-table td > .cell-text { flex: 0 0 60%; width: 60%; }
    .bon-table input[type="number"].cell-input { text-align: left; }
    .bon-table td > .cell-text { text-align: left; padding: 0 .5rem; line-height: 2.75rem; }
    /* A unit or % sits inside the box, so these boxes are as wide as the others. */
    .bon-table .cell-with-suffix { border: 1px solid var(--rule); background: var(--surface); }
    .bon-table .cell-with-suffix:focus-within { outline: 3px solid var(--focus); border-color: var(--ink); }
    .bon-table .cell-with-suffix .cell-input { border: 0; height: calc(2.75rem - 2px); }
    .bon-table .cell-with-suffix .cell-input:focus { outline: none; }
    /* The description: the whole article name, wrapped over as many lines as it needs. */
    .bon-table td.cell-desc { flex-direction: column; align-items: stretch; padding-top: .75rem; padding-bottom: .35rem; }
    .bon-table td.cell-desc::before { content: none; }
    .bon-table td.cell-desc > .cell-input {
        flex: none; width: 100%; height: auto; min-height: 2.75rem; padding: .55rem .6rem; line-height: 1.35;
        white-space: normal; field-sizing: content; font-weight: 700; font-size: var(--fs-body);
    }
    @supports not (field-sizing: content) { .bon-table td.cell-desc > .cell-input { min-height: 4.4rem; } }
    .bon-table td.cell-desc > .cell-text { flex: none; width: 100%; text-align: left; font-weight: 700; font-size: var(--fs-body); padding-left: 0; white-space: normal; line-height: 1.35; }
    .bon-table td.cell-desc > .cell-sub { padding: .3rem 0 0; margin: 0; }
    /* ⋯ becomes a small text button under the card: "Kopje of splitsen". */
    .bon-table td.c-more { display: block; width: auto; padding: .15rem .85rem .6rem; }
    .bon-table td.c-more:empty { display: none; }
    .bon-table .cell-more {
        width: auto; height: auto; padding: .3rem .6rem; text-align: center; font-size: var(--fs-small);
        background: var(--surface); color: var(--ink); border: 1px solid var(--ink); border-radius: var(--radius-control);
    }
    .bon-table .cell-more[aria-expanded="true"] { background: var(--accent-soft); }
    .cell-more-text { display: inline; white-space: nowrap; }
    .cell-more-dots { display: none; }
    .more-input { height: 2.5rem; }
    /* Voor wie with a link under the klant: the link goes under the value, in the same column. */
    .bon-table td:has(> .cell-link) { flex-wrap: wrap; }
    .bon-table td > .cell-link { flex: 0 0 60%; margin: 0 0 0 auto; padding: 0 .5rem .5rem; }
    .bon-table .cell-with-suffix .cell-unit-input { border-left: 1px solid var(--rule); }
    .bon-table tr.row-error > td, .bon-table tr.row-panel > td, .bon-table tr.row-more > td, .bon-table tr.row-doubt > td { display: block; text-align: left; }
    .bon-table td.cell-doubt { box-shadow: none; }
    .bon-table td.cell-doubt > .cell-input, .bon-table td.cell-doubt > .cell-with-suffix, .bon-table td.cell-doubt > .cell-text { box-shadow: 0 0 0 2px var(--danger); }
}
/* Under the bon's table: its total as printed */
.bon-totals { margin: 0; padding: .6rem 1rem; border-top: 2px solid var(--ink); display: flex; flex-direction: column; gap: .35rem; }
.bon-total-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.bon-total-row dt { margin: 0; font-weight: 700; }
.bon-total-row dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tab.has-todo .tab-count { background: var(--warn); color: var(--surface); }

/* A text link that is a button (actions that stay on the page) */
button.link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
button.link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* "Wat moet je nog doen?" on the home page: big rows, one tap to the job */
.tasks .card-head { margin: 0; font-size: var(--fs-h3); }
.tasks-list { list-style: none; margin: 0; padding: 0; }
.tasks-list li + li { border-top: 1px solid var(--rule); }
.task {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem;
    padding: 1rem; color: var(--ink); text-decoration: none; min-height: 3.5rem;
}
.task:hover { background: var(--bg); }
.task:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.task-count {
    min-width: 2.5rem; height: 2.5rem; display: grid; place-items: center; padding: 0 .5rem;
    background: var(--warn-soft); color: var(--warn); font-weight: 700; font-size: var(--fs-h3);
}
.task-text { display: flex; flex-direction: column; gap: .15rem; }
.task-text strong { font-size: var(--fs-h3); }
.task-hint { color: var(--ink-soft); }
.task-go { font-size: var(--fs-h2); font-weight: 700; color: var(--accent); }
.tasks-done { margin: 0; padding: 1rem; font-size: var(--fs-body); }
.tasks-check { color: var(--ok); font-weight: 700; margin-right: .35rem; }


/* Hint text under a label: normal size, its own line (nhs.uk pattern) */
.field-hint, .field > .field-hint { display: block; color: var(--ink-soft); font-size: var(--fs-body); font-weight: 400; line-height: 1.4; }
.check-field { gap: .25rem; }
.check-field > label { display: flex; align-items: center; gap: .6rem; font-weight: 700; cursor: pointer; }
.check-field > label input[type="checkbox"] { width: 1.5rem; height: 1.5rem; flex-shrink: 0; }
.check-field .field-hint { padding-left: 2.1rem; }
.tasks .card-head, .card > h2.card-head { margin: 0; font-size: var(--fs-h3); }

/* Summary list + "Wijzigen" (nhs.uk summary list): read-only rows; editing opens a plain form in place */
.summary-list { list-style: none; margin: 0; padding: 0; }
.summary-list > li { border-top: 1px solid var(--rule); }
.summary-list > li:first-child { border-top: 0; }
.summary-row { display: flex; align-items: flex-start; gap: 1rem; padding: .85rem 1rem; }
.summary-row.open { background: var(--warn-soft); }
.summary-row.done { color: var(--ink-soft); }
.sr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.sr-title { font-weight: 700; font-size: var(--fs-body); overflow-wrap: anywhere; }
.sr-detail { color: var(--ink-soft); }
.sr-side { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; text-align: right; }
.sr-amount { font-weight: 700; white-space: nowrap; }
.sr-action { white-space: nowrap; }
.edit-panel { padding: 1rem; background: var(--bg); border-left: 6px solid var(--accent); display: flex; flex-direction: column; gap: .9rem; }
.edit-panel h3 { margin: 0; font-size: var(--fs-body); }
.edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .9rem; }
.edit-grid .wide { grid-column: 1 / -1; }
/* Fields side by side with different labels/hints: the boxes line up at the bottom, labels at the top. */
.edit-grid > .field > :last-child { margin-top: auto; }
.edit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; }
.edit-actions .link-danger { margin-left: auto; }
@media (max-width: 640px) {
    .summary-row { flex-wrap: wrap; }
    .sr-side { flex-direction: row; align-items: center; justify-content: space-between; width: 100%; text-align: left; }
    .edit-actions .btn-primary, .edit-actions .btn-ghost { flex: 1; justify-content: center; }
    .edit-actions .link-danger { margin-left: 0; width: 100%; }
}
.split-box { display: flex; flex-direction: column; gap: .75rem; padding-top: .75rem; border-top: 1px solid var(--rule); }

/* Errors, the nhs.uk way: a summary box at the top of the form, and a red message + bar at each field */
.error-summary {
    border: 4px solid var(--danger); background: var(--surface); padding: 1rem 1.1rem; margin: 0 0 1rem;
}
.error-summary h2 { margin: 0 0 .5rem; font-size: var(--fs-h3); }
.error-summary ul { margin: 0; padding-left: 1.2rem; color: var(--danger); font-weight: 700; }
.error-summary li + li { margin-top: .25rem; }
.field-error, .field > .field-error { display: block; color: var(--danger); font-weight: 700; }
.has-error { border-left: 5px solid var(--danger); padding-left: .8rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.inline-form .has-error, .edit-grid .has-error { grid-column: 1 / -1; }   /* room for the message */
.quick-row.has-error { flex-wrap: wrap; }
.quick-row .field-error { flex-basis: 100%; }
.kept-link { margin: -.5rem 0 1.25rem; }
/* On an unsent factuur (no number yet): it's a preview, not something to send */
.inv-preview-mark { color: var(--danger); font-weight: 700; font-size: .8rem; margin-top: .2rem; }
/* Klant picker: recent klanten as buttons, the rest in one list */
.klant-picker { display: flex; flex-direction: column; gap: .6rem; flex: 1; min-width: 0; }
.klant-picker-more { max-width: 24rem; }

/* Dropping files (and e-mails) onto Bonnetjes */
.drop-tip { margin: .4rem 0 0; font-size: var(--fs-small); color: var(--ink-soft); }
.drop-hint {
    position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 1rem;
    background: rgba(59, 72, 112, .12); border: 6px dashed var(--accent); pointer-events: none;
}
.drop-hint-box {
    width: min(440px, 100%); background: var(--surface); color: var(--ink); border: 2px solid var(--ink);
    box-shadow: 6px 6px 0 rgba(27,31,42,.35); padding: 1.3rem 1.4rem; text-align: center;
}
.drop-hint-box p { margin: 0; font-weight: 700; font-size: var(--fs-h3); }
.drop-hint-box span { display: block; margin-top: .3rem; color: var(--ink-soft); }
.drop-hint.warn { background: rgba(27,31,42,.35); border-color: var(--danger); }
.drop-hint.warn p { font-size: var(--fs-body); }
@media (max-width: 640px) { .drop-tip { display: none; } }   /* phones don't drag files */
/* Phones: the action bar's buttons full width and stacked, the main one (last in the markup) on top */
@media (max-width: 640px) { .sa-row { flex-direction: column-reverse; } }
/* Phone vs computer variants of one control (e.g. Bon toevoegen: guided flow vs upload) */
.only-phone { display: none !important; }
@media (max-width: 640px) { .only-phone { display: inline-flex !important; } .only-wide { display: none !important; } }
h1[tabindex="-1"]:focus { outline: none; }   /* focus moved here by script on a page change (focus.js) */
.radio-choice { display: flex; align-items: center; gap: .6rem; font-weight: 400; cursor: pointer; padding: .2rem 0; }
.radio-choice input[type="radio"] { width: 1.3rem; height: 1.3rem; flex-shrink: 0; accent-color: var(--ink); }
fieldset.field > legend { padding: 0; margin-bottom: .3rem; font-weight: 700; font-size: var(--fs-small); }
