@font-face { font-family: 'Poppins'; font-weight: 400; font-display: swap; src: url('/static/fonts/Poppins-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-display: swap; src: url('/static/fonts/Poppins-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-weight: 600 700; font-display: swap; src: url('/static/fonts/Poppins-Bold.ttf') format('truetype'); }
/* Badpaleis huisstijl: zwart, blauw #42B1E0, Poppins */
:root {
  --ink: #111111;
  --ink-2: #333B42;
  --muted: #5B6670;
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --line: #E1E5EA;
  --line-2: #EEF1F4;
  --blue: #42B1E0;
  --blue-soft: #E8F5FB;
  --blue-text: #156C99;
  --warn-bg: #FFF4E5;
  --warn-line: #F0C48A;
  --warn-text: #7A3E00;
  --radius: 12px;
  font-family: 'Poppins', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.5; font-variant-numeric: tabular-nums; }
a { color: var(--blue-text); }
a:hover { color: #0E4E70; }
h1 { font-size: 28px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code { background: var(--line-2); padding: 2px 6px; border-radius: 4px; font-size: 14px; letter-spacing: 0.05em; }

/* Knoppen en velden */
.btn { min-height: 44px; padding: 0 20px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #2A2F33; color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: #C9D1D8; }
.linklike { background: none; border: none; padding: 0; min-height: 44px; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
label { font-size: 14px; font-weight: 500; }
input, select, textarea { font: inherit; min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid #C9D1D8; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .btn { margin-top: 8px; }
.alert { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text); border-radius: 8px; padding: 10px 14px; font-size: 14px; margin: 0; }

/* Inlogpagina's */
body.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 16px; padding: 36px 32px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { font-size: 22px; font-weight: 600; }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.auth-logo img { height: auto; }
.code-input { font-size: 24px; letter-spacing: 0.25em; text-align: center; min-height: 52px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.qr { display: flex; justify-content: center; }
.qr svg { width: 220px; height: 220px; }

/* App */
body.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar { flex: 1 1 240px; max-width: 100%; background: var(--surface); border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; }
.sidebar-logo { padding: 0 8px; display: block; }
.sidebar-logo img { height: auto; display: block; }
.sidebar ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sidebar ul a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 15px; }
.sidebar ul a:hover { background: var(--line-2); color: var(--ink); }
.sidebar ul a[aria-current="page"] { background: var(--blue-soft); color: var(--ink); font-weight: 600; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; padding: 0 8px; font-size: 13px; color: var(--muted); }
.sidebar-foot .linklike { color: var(--ink); text-align: left; }
.content { flex: 999 1 560px; min-width: 0; padding: 32px 40px 64px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.page-head p { margin: 4px 0 0; font-size: 14px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card p { margin: 0 0 8px; }

@media (max-width: 720px) {
  .content { padding: 24px 16px 48px; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); gap: 16px; }
  .sidebar ul { flex-direction: row; flex-wrap: wrap; }
}

/* ---------- Algemeen ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.strong { font-weight: 600; }
.sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.num { text-align: right; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px !important; }
.btn-quiet { background: transparent; color: var(--ink-2); border-color: transparent; text-decoration: underline; font-weight: 500; }
.inline-form { display: inline; margin: 0; }
.flash { background: #E6F4EC; border: 1px solid #B7DEC7; color: #0E5134; border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.note { background: var(--line-2); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
h2 .small { font-weight: 400; }

/* Tabellen */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.table-wrap.flat { border: none; border-radius: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; background: var(--blue); color: var(--ink); padding: 11px 14px; white-space: nowrap; }
th.num { text-align: right; }
td { padding: 11px 14px; border-top: 1px solid var(--line-2); vertical-align: top; }
td a { color: var(--ink); text-decoration: none; }
td a:hover { text-decoration: underline; }
tbody tr:hover td { background: #FAFBFC; }

/* Statuslabels */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-ok { background: #D6EFE2; color: #0E5134; }
.pill-open { background: var(--blue-soft); color: #0E4E70; }
.pill-late { background: #FDE7CF; color: #7A3E00; }
.pill-draft { background: var(--line-2); color: #3A444C; }
.pill-credit { background: #F1E6F8; color: #5A2A7A; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.badge-warn, .m-warn { background: #FDE7CF; color: #7A3E00; }
.badge-mid, .m-mid { background: var(--line-2); color: var(--ink); }
.badge-good, .m-good { background: #D6EFE2; color: #0E5134; }

/* Werkbalk, zoeken, filters */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.search { display: flex; gap: 8px; flex: 1 1 320px; max-width: 520px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters a { min-height: 40px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 999px; border: 1px solid #C9D1D8; background: #fff; color: var(--ink); text-decoration: none; font-size: 14px; }
.filters a[aria-current="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Overzicht */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); }
.tile:hover { border-color: var(--blue); color: var(--ink); }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { font-size: 26px; font-weight: 700; }
.tile-sub { font-size: 13px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); color: var(--ink); text-decoration: none; }
.list li a > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.list .end { display: flex; align-items: center; gap: 12px; }

/* Formulieren */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px; align-items: start; }
.form-grid h2, .span-all { grid-column: 1 / -1; margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field .label { font-size: 14px; font-weight: 500; }
.hint { font-size: 12px; color: var(--muted); }
.req { color: #B00001; }
textarea { min-height: 0; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--ink); flex-shrink: 0; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.form-actions.sticky { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; }
.settings { display: flex; flex-direction: column; gap: 16px; }
.segmented { display: inline-flex; gap: 4px; background: #F0F2F5; padding: 4px; border-radius: 10px; flex-wrap: wrap; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 500; }
.segmented input:checked + span { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.segmented input:focus-visible + span { outline: 3px solid var(--blue); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid #C9D1D8; background: #fff; font: inherit; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--ink); }

/* Inkoop & marge: alleen zichtbaar met het vinkje */
.cost { display: none; }
body.show-cost .cost { display: revert; }
body.show-cost section.cost, body.show-cost .margin-box { display: flex; }
body.show-cost th.cost, body.show-cost td.cost { display: table-cell; }

/* Editor */
.editor { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.editor-main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.editor-side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.options { display: flex; flex-wrap: wrap; gap: 4px 28px; }
.toggle-box { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.lines-card { padding: 0; overflow: hidden; }
.lines-title { padding: 14px 16px 0; margin: 0; }
.lines { display: flex; flex-direction: column; }
.line { padding: 12px 16px; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 8px; }
.line:nth-child(odd) { background: #FBFCFD; }
.line.below { background: #FFF8EE; }
.line-top, .line-bottom { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.lf { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lf label, .lf .lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.lf input, .lf select { min-height: 40px; padding: 0 10px; font-size: 14px; }
.lf-desc { flex: 1 1 320px; }
.lf-desc input { font-weight: 500; }
.lf-total { width: 120px; align-items: flex-end; }
.line-total { min-height: 40px; display: flex; align-items: center; font-weight: 700; font-size: 15px; white-space: nowrap; }
.lf-details { flex: 1 1 200px; }
.lf-qty { width: 78px; }
.lf-unit { width: 92px; }
.lf-price { width: 104px; }
.lf-disc { width: 82px; }
.lf-vat { width: 80px; }
.lf-cost { width: 104px; }
body.show-cost .lf.cost { display: flex; }
.lf-margin { width: 96px; }
.line-margin { min-height: 26px; display: inline-flex; align-items: center; align-self: flex-start; padding: 0 8px; border-radius: 999px; font-weight: 600; font-size: 13px; }
.line-max { font-size: 11px; color: var(--muted); }
.icon-btn { width: 36px; height: 36px; border-radius: 6px; border: 1px solid #C9D1D8; background: #fff; font-size: 18px; line-height: 1; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: #B00001; border-color: #B00001; }
.add-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border-top: 1px solid var(--line-2); }
.add-row select { max-width: 380px; }
.warn-floor { margin: 0 12px 12px; }
.totals { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.totals h2 { margin-bottom: 4px; }
.row { display: flex; justify-content: space-between; gap: 12px; }
.row > span:first-child { color: var(--muted); }
.totals .total { border-top: 2px solid var(--blue); padding-top: 10px; margin-top: 2px; font-size: 18px; font-weight: 700; }
.totals .total > span:first-child { color: var(--ink); }
.margin-box { flex-direction: column; gap: 8px; font-size: 14px; background: var(--ink); color: #fff; border-color: var(--ink); }
.margin-box .row > span:first-child { color: #C9D1D8; }
.margin-box .big { font-size: 22px; font-weight: 700; }
.margin-box.warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-line); }
.margin-box.warn .row > span:first-child { color: var(--warn-text); }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.side-actions { display: flex; flex-direction: column; gap: 8px; }

/* Detail */
.detail-grid { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.detail-grid > section { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.detail-grid > aside { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.detail-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.margin-details summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.margin-details .row { margin-top: 8px; font-size: 14px; }
.page-actions .btn { min-height: 40px; }
