/* Gedeelde huisstijl voor alle prototypes. Modules gebruiken deze tokens en klassen,
   en zetten eigen stijl onder .m-<module> in css/modules/<module>.css */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --ink: #141820;
  --muted: #5d6573;
  --line: #e2e5ea;
  --line-2: #eef0f3;
  --accent: #2f6fde;          /* per bedrijf overschreven */
  --accent-soft: color-mix(in srgb, var(--accent) 12%, white);   /* opnieuw berekend in .proto-stage */
  --accent-ink: #ffffff;
  --ok: #1d9a55;  --ok-soft: #e3f5ea;
  --warn: #c98100; --warn-soft: #fcf1d9;
  --bad: #d0343d; --bad-soft: #fbe5e6;
  --info: #2b6cb0; --info-soft: #e5effa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 18px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .16);
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14.5px/1.5 var(--sans); overflow-x: hidden; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- layout-hulpjes ---------- */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- kaarten ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h3, .card h3 { font-size: 15px; font-weight: 650; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .kpi-label { font-size: 12px; color: var(--muted); }
.kpi .kpi-val { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.kpi .kpi-sub { font-size: 12px; color: var(--muted); }

/* ---------- knoppen ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 550; line-height: 1.1; text-decoration: none; transition: background-color .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:hover { border-color: #c9ced6; background: var(--panel-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 7px; }
.btn-lg { padding: 13px 20px; font-size: 16px; border-radius: 11px; }
.btn-block { width: 100%; }

/* ---------- formulieren ---------- */
.field { display: grid; gap: 5px; }
.field > span, .label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); transition: border-color .15s, box-shadow .15s; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { min-height: 90px; resize: vertical; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }

/* ---------- tabs en segmenten ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tab { padding: 9px 13px; border: 0; background: none; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.is-active, .tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.seg { display: inline-flex; padding: 3px; background: var(--line-2); border-radius: 9px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 11px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.is-active, .seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }

/* ---------- tabellen ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
.table th { font-size: 12px; font-weight: 650; color: var(--muted); background: var(--panel-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--line-2); color: var(--muted); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel-2); }

/* ---------- gsm-kader ---------- */
.phone { position: relative; width: 340px; max-width: 100%; height: 680px; margin: 0 auto; border-radius: 42px; background: #0d0f13; padding: 12px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.phone-notch { position: absolute; top: 12px; left: 50%; width: 110px; height: 24px; margin-left: -55px; background: #0d0f13; border-radius: 0 0 14px 14px; z-index: 3; }
.phone-status { display: flex; justify-content: space-between; padding: 8px 22px 4px; font-size: 12px; font-weight: 600; color: var(--ink); background: var(--panel); border-radius: 30px 30px 0 0; }
.phone-icons { letter-spacing: 1px; font-size: 10px; }
.phone-title { background: var(--panel); padding: 6px 18px 10px; font-weight: 700; font-size: 17px; border-bottom: 1px solid var(--line-2); }
.phone-screen { flex: 1; overflow-y: auto; background: var(--bg); border-radius: 0 0 30px 30px; position: relative; }
@media (max-width: 420px) { .phone { width: 100%; height: 640px; border-radius: 30px; padding: 8px; } }

/* ---------- grafieken ---------- */
.chart { width: 100%; display: block; }
.chart-labels { display: flex; font-size: 11px; color: var(--muted); }
.chart-labels span { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr { display: block; }

/* ---------- toast en modal ---------- */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 14px); opacity: 0; z-index: 200; pointer-events: none; background: #151a22; color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 550; max-width: min(92vw, 520px); box-shadow: var(--shadow-lg); transition: opacity .25s, transform .25s; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.modal-wrap { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 16px; background: rgba(15, 20, 28, .38); opacity: 0; transition: opacity .2s; }
.modal-wrap.is-on { opacity: 1; }
.modal { width: min(560px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow-lg); transform: translateY(8px); transition: transform .2s; }
.modal-wide { width: min(900px, 100%); }
.modal-wrap.is-on .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 8px 18px 14px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line-2); }

/* ---------- A4-documenten (offertes, werkbonnen, attesten) ---------- */
.print-wrap { position: fixed; inset: 0; z-index: 180; background: #dfe3e8; display: flex; flex-direction: column; }
.print-bar { display: flex; gap: 8px; align-items: center; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.print-scroll { flex: 1; overflow: auto; padding: 24px 12px 60px; }
.doc { width: min(210mm, 100%); min-height: 297mm; margin: 0 auto; background: #fff; box-shadow: var(--shadow-lg); padding: 18mm 16mm; font-size: 13px; color: #111; }
.doc h1 { font-size: 22px; margin-bottom: 4px; }
.doc h2 { font-size: 15px; margin: 18px 0 6px; }
.doc table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.doc th, .doc td { padding: 6px 8px; border-bottom: 1px solid #e3e3e3; text-align: left; }
.doc th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: #555; }
.doc .num { text-align: right; }
.doc .doc-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--accent); padding-bottom: 12px; margin-bottom: 14px; }
.doc .doc-total td { font-weight: 700; border-top: 2px solid #111; }
@media print {
  @page { size: A4; margin: 0; }
  body.is-printing > *:not(.print-wrap) { display: none !important; }
  body.is-printing { background: #fff; }
  .print-wrap { position: static; background: #fff; }
  .print-bar { display: none; }
  .print-scroll { padding: 0; overflow: visible; }
  .doc { box-shadow: none; width: auto; min-height: 0; }
}
@media (max-width: 600px) {
  .print-bar { flex-wrap: wrap; padding: 8px 10px; }
  .print-bar b { flex-basis: 100%; font-size: 13px; }
  .print-bar .spacer { display: none; }
  .print-bar .btn { flex: 1; }
  .print-scroll { padding: 12px 6px 40px; }
  .doc { padding: 10mm 7mm; }
}

/* live AI-label (gedeeld door de AI-modules) */
.ai-badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; border: 1px dashed var(--line); background: var(--panel); color: var(--muted); font: 600 12px var(--sans); cursor: pointer; }
.ai-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #b6bcc6; }
.ai-badge.is-on { border-style: solid; border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); color: var(--ok); background: var(--ok-soft); }
.ai-badge.is-on::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
