/* Klantportaal in de huisstijl van builtbynoah.nl: wit en lichtgrijs, Built by Noah-blauw als accent, Plus Jakarta Sans. */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-ink: #ffffff;
  --accent-soft: #eff4ff;
  --focus: #2563eb;
  --logo-ink: #3A3F4E;
  --logo-muted: #727682;

  --s-nieuw: #1d4ed8; --s-nieuw-bg: #eff4ff;
  --s-bezig: #a16207; --s-bezig-bg: #fef6e0;
  --s-wacht: #7c3aed; --s-wacht-bg: #f3edff;
  --s-klaar: #15803d; --s-klaar-bg: #e8f8ee;
  --danger: #dc2626; --danger-bg: #fef0f0;
  --intern-bg: #fffbeb; --intern-line: #fde68a;

  --f-display: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 16px;
  --r-sm: 11px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
  --btn-shadow: 0 8px 20px -6px rgba(37,99,235,.55);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111a2e;
    --surface-2: #0f172a;
    --ink: #e2e8f0;
    --ink-2: #cbd5e1;
    --muted: #94a3b8;
    --line: #1f2a44;
    --line-strong: #334155;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-ink: #ffffff;
    --accent-soft: #172554;
    --focus: #60a5fa;
    --logo-ink: #e2e8f0;
    --logo-muted: #94a3b8;
    --s-nieuw: #93b4ff; --s-nieuw-bg: #172554;
    --s-bezig: #fbbf24; --s-bezig-bg: #3a2a0c;
    --s-wacht: #c4b5fd; --s-wacht-bg: #2e1f57;
    --s-klaar: #4ade80; --s-klaar-bg: #14321f;
    --danger: #f87171; --danger-bg: #3b1515;
    --intern-bg: #2b230c; --intern-line: #594813;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --btn-shadow: 0 8px 20px -8px rgba(59,130,246,.6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 800; line-height: 1.15; margin: 0; text-wrap: balance; letter-spacing: -.02em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.1rem); }
h2 { font-size: 1.05rem; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.min0 { min-width: 0; }
.inline { display: inline; }
.stack { display: grid; gap: 14px; }
.stack-lg { display: grid; gap: 22px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.align-start { align-items: start; }

/* ---------- Kopbalk ---------- */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-in {
  max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 20px;
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
.logo { display: flex; align-items: center; gap: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.logo:hover { color: var(--muted); }
.brand-logo { height: 38px; width: auto; display: block; flex: none; }
.logo-sub { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding-left: 12px; border-left: 1px solid var(--line-strong); }
@media (max-width: 480px) { .logo-sub { display: none; } .brand-logo { height: 34px; } }
.nav { display: flex; gap: 2px; flex: 1; }
.nav a { color: var(--muted); text-decoration: none; padding: 7px 11px; border-radius: var(--r-sm); font-weight: 500; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a.on { color: var(--ink); background: var(--accent-soft); }
.count { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 600; margin-left: 3px; }
.top-act { display: flex; gap: 6px; align-items: center; }
@media (max-width: 760px) {
  .top-in { flex-wrap: wrap; gap: 8px 12px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; margin: 0 -4px; }
  .top-act { margin-left: auto; }
  .top-act .btn-ghost { padding-inline: 8px; }
}
@media (max-width: 480px) {
  .top-act form { display: none; }
  .account-logout { display: block !important; }
}

/* ---------- Hoofdinhoud ---------- */
.main {
  max-width: 1120px; margin: 0 auto;
  padding-block: 28px 64px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
.main-auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding-block: 32px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .muted { margin-top: 6px; }
.crumb { margin-bottom: 8px; font-size: .9rem; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--ink); }
.h-sec { margin-bottom: 12px; }

/* ---------- Knoppen & velden ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 .93rem/1 var(--f-body); padding: 11px 16px; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-sm { padding: 8px 12px; font-size: .86rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--btn-shadow); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--muted); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-bg); }
.btn[disabled] { opacity: .6; cursor: progress; }

.field { display: grid; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span, .field > legend, .field > .label { font-weight: 600; font-size: .9rem; padding: 0; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field small, .form-card small { color: var(--muted); font-size: .82rem; }
.field legend { margin-bottom: 6px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 10px 12px;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.plain { padding: 2px 0; }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.alert { background: var(--danger-bg); color: var(--danger); border-radius: var(--r-sm); padding: 11px 14px; margin-bottom: 16px; font-weight: 500; }
.flash { border-radius: var(--r-sm); padding: 11px 14px; margin-bottom: 18px; background: var(--s-klaar-bg); color: var(--s-klaar); font-weight: 500; }
.notice { background: var(--s-wacht-bg); color: var(--s-wacht); border-radius: var(--r-sm); padding: 12px 14px; margin-bottom: 18px; font-weight: 500; }
.notice a { color: inherit; font-weight: 700; }

/* ---------- Inlogschermen ---------- */
.auth { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px 28px; box-shadow: var(--shadow); display: grid; gap: 16px; }
.auth-brand { display: flex; align-items: center; gap: 12px; color: var(--muted); margin-bottom: 8px; }
.auth-foot { text-align: center; font-size: .9rem; }
@media (max-width: 440px) { .auth { padding: 26px 18px; } }

/* ---------- Kaarten ---------- */
.form-card, .panel, .side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.form-card h2, .side-card h2 { margin-bottom: 2px; }
.panel.narrow { max-width: 560px; display: grid; gap: 14px; }
details.form-card { margin-bottom: 22px; }
details.form-card > summary { cursor: pointer; list-style: none; }
details.form-card > summary::-webkit-details-marker { display: none; }
details.form-card > summary h2::after { content: " +"; color: var(--muted); }
details.form-card[open] > summary { margin-bottom: 16px; }
details.form-card[open] > summary h2::after { content: ""; }
.form-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding-top: 4px; }

/* ---------- Overzicht ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; text-decoration: none; color: var(--ink); display: grid; gap: 2px; }
.stat:hover { border-color: var(--line-strong); color: var(--ink); }
.stat-n { font-family: var(--f-display); font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-l { color: var(--muted); font-size: .86rem; }
.stat:nth-child(1) .stat-n { color: var(--s-nieuw); }
.stat:nth-child(2) .stat-n { color: var(--s-bezig); }
.stat:nth-child(3) .stat-n { color: var(--s-wacht); }
.stat:nth-child(4) .stat-n { color: var(--s-klaar); }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.tab { padding: 7px 11px; border-radius: 20px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: .9rem; white-space: nowrap; border: 1px solid transparent; }
.tab:hover { color: var(--ink); }
.tab.on { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.tab-n { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .8rem; margin-left: 2px; }
.search { flex: 0 1 280px; min-width: 180px; }
.search input { padding: 8px 12px; border-radius: 20px; }
@media (max-width: 640px) { .search { flex-basis: 100%; } }

.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.row + .row { border-top: 1px solid var(--line); }
.row-link { display: flex; gap: 16px; justify-content: space-between; align-items: center; padding: 14px 18px; text-decoration: none; color: var(--ink); }
.row-link:hover { background: var(--surface-2); color: var(--ink); }
.row-main { display: grid; gap: 4px; min-width: 0; }
.row-title { display: flex; align-items: center; gap: 8px; font-weight: 500; min-width: 0; }
.row-title .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.unread .row-title { font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.row-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .84rem; color: var(--muted); }
.row-meta .who { color: var(--ink); font-weight: 500; }
.num { font-variant-numeric: tabular-nums; color: var(--muted); }
.late { color: var(--danger); font-weight: 600; }
.row-side { display: grid; justify-items: end; gap: 4px; flex: none; }
.when { font-size: .8rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 560px) {
  .row-link { flex-direction: column; align-items: stretch; gap: 8px; padding: 13px 14px; }
  .row-side { display: flex; justify-content: space-between; align-items: center; }
  .row-title .t { white-space: normal; }
}

.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 8px; border-radius: 20px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-nieuw { color: var(--s-nieuw); background: var(--s-nieuw-bg); }
.status-bezig { color: var(--s-bezig); background: var(--s-bezig-bg); }
.status-wacht { color: var(--s-wacht); background: var(--s-wacht-bg); }
.status-klaar { color: var(--s-klaar); background: var(--s-klaar-bg); }
.tag { display: inline-block; padding: 2px 7px; border-radius: 5px; font-size: .72rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); vertical-align: middle; }
.tag-spoed { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.tag-intern { background: var(--intern-bg); color: var(--s-bezig); border-color: var(--intern-line); }
.tag-wait { background: var(--s-bezig-bg); color: var(--s-bezig); border-color: transparent; }

.empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r); padding: 40px 20px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.empty-h { font-weight: 600; }

/* Snelkeuze en soortkeuze */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; margin-bottom: 26px; }
.quick-item { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.quick-item:hover { border-color: var(--accent); color: var(--ink); }
.quick-item strong, .choice-box strong { display: block; font-size: .93rem; }
.quick-item small, .choice-box small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.4; margin-top: 2px; }
.quick-ic { width: 34px; height: 34px; border-radius: 9px; flex: none; background: var(--accent-soft) center / 18px no-repeat; }
.ic-wijziging { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E"); }
.ic-nieuw { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='3'/%3E%3Cpath d='M12 8v8M8 12h8'/%3E%3C/svg%3E"); }
.ic-probleem { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E"); }
.ic-content { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='3'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21'/%3E%3C/svg%3E"); }
.ic-vraag { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) { .quick-ic { filter: brightness(1.7); } }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice-box { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--r); height: 100%; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.choice:hover .choice-box { border-color: var(--muted); }
.choice input:checked + .choice-box { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.choice input:focus-visible + .choice-box { outline: 2px solid var(--focus); outline-offset: 2px; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; width: fit-content; }
.seg label { cursor: pointer; position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 9px 16px; font-weight: 500; font-size: .9rem; }
.seg label + label span { border-left: 1px solid var(--line-strong); }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg input[value=spoed]:checked + span { background: var(--danger); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -3px; }

/* Bestanden */
.drop { display: block; position: relative; border: 1.5px dashed var(--line-strong); border-radius: var(--r); padding: 22px 16px; text-align: center; cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop-txt { color: var(--muted); font-size: .9rem; }
.drop-txt strong { color: var(--accent); }
.drop-sm { padding: 12px; }
.file-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: .86rem; }
.file-list:empty { display: none; }
.file-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; background: var(--surface-2); border-radius: 6px; }
.file-list li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list li.bad { color: var(--danger); background: var(--danger-bg); }

/* ---------- Verzoek ---------- */
.req-title { overflow-wrap: anywhere; }
.req-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; color: var(--muted); font-size: .88rem; }
.req-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.req-main { display: grid; gap: 14px; }
.req-side { display: grid; gap: 14px; position: sticky; top: 76px; }
@media (max-width: 900px) { .req-layout { grid-template-columns: 1fr; } .req-side { position: static; } }

.msg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 10px; }
.msg-first { border-color: var(--line-strong); }
.msg-team { border-left: 3px solid var(--accent); }
.msg-intern { background: var(--intern-bg); border-color: var(--intern-line); border-left: 3px solid var(--s-bezig); }
.msg-head { display: flex; align-items: center; gap: 10px; font-size: .9rem; flex-wrap: wrap; }
.msg-head time { margin-left: auto; font-size: .8rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: .75rem; font-weight: 700; flex: none; }
.msg-body { overflow-wrap: anywhere; max-width: 68ch; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: .88rem; }
.facts dt { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.event { display: flex; align-items: center; gap: 10px; font-size: .84rem; padding: 0 6px; flex-wrap: wrap; }
.atts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.atts li { display: grid; gap: 4px; max-width: 220px; min-width: 0; }
.att-img img { width: 220px; max-width: 100%; height: 140px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); }
.att { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: .84rem; text-decoration: none; color: var(--ink); background: var(--surface-2); min-width: 0; }
.att:hover { border-color: var(--accent); color: var(--ink); }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { color: var(--muted); flex: none; }

.reply { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 10px; margin-top: 8px; }
.reply.is-intern { background: var(--intern-bg); border-color: var(--intern-line); }
.reply-foot { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; justify-content: flex-end; }
.reply-foot .check { margin-right: auto; }
.inline-select { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--muted); }
.inline-select select { width: auto; padding: 7px 10px; }

.side-card { padding: 18px; display: grid; gap: 10px; }
.side-card h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-family: var(--f-body); font-weight: 600; }
.status-buttons { display: grid; gap: 6px; }
.sbtn { font: 500 .9rem var(--f-body); text-align: left; padding: 9px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: flex; align-items: center; gap: 8px; }
.sbtn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--line-strong); }
.sbtn:hover { border-color: var(--line-strong); }
.sbtn.on { font-weight: 700; }
.sbtn.status-nieuw.on { background: var(--s-nieuw-bg); border-color: transparent; color: var(--s-nieuw); }
.sbtn.status-bezig.on { background: var(--s-bezig-bg); border-color: transparent; color: var(--s-bezig); }
.sbtn.status-wacht.on { background: var(--s-wacht-bg); border-color: transparent; color: var(--s-wacht); }
.sbtn.status-klaar.on { background: var(--s-klaar-bg); border-color: transparent; color: var(--s-klaar); }
.sbtn.on::before { background: currentColor; border-color: currentColor; }
.danger summary { cursor: pointer; color: var(--danger); font-size: .88rem; font-weight: 500; }
.danger[open] summary { margin-bottom: 6px; }
.account-logout { display: none; margin-top: 18px; }
.copy { cursor: copy; overflow-wrap: anywhere; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.steps li { position: relative; padding: 0 0 16px 26px; color: var(--muted); font-weight: 500; }
.steps li:last-child { padding-bottom: 0; }
.steps li::before { content: ""; position: absolute; left: 0; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 7px; top: 20px; bottom: 2px; width: 2px; background: var(--line); }
.steps li.done { color: var(--ink); }
.steps li.done::before { background: var(--s-klaar); border-color: var(--s-klaar); }
.steps li.done.wait::before { background: var(--s-wacht); border-color: var(--s-wacht); }

/* ---------- Klanten ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table a { text-decoration: none; }
.table .num-col { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.inactive td { opacity: .55; }
.list.compact .row-link { padding: 11px 14px; }

.invite { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--r); padding: 18px; display: grid; gap: 10px; margin-bottom: 22px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .84rem; min-width: 0; }
.invite details { display: grid; gap: 8px; }
.invite summary { cursor: pointer; font-weight: 500; }
.invite textarea { margin: 8px 0; font-size: .86rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Live chat ---------- */
.online-dot { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--s-klaar); border: 2px solid var(--surface); }
.avatar { position: relative; }
.avatar-brand { background: transparent; }
.avatar-brand img { width: 32px; height: 32px; border-radius: 9px; }

.chat { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; min-height: 0; height: 100%; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chat-who { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.chat-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-status { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chat-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); flex: none; }
.chat-status.on { color: var(--s-klaar); }
.chat-status.on::before { background: var(--s-klaar); }
.chat-head-act { flex: none; }
.chat-expand { color: var(--muted); text-decoration: none; font-size: 1.1rem; padding: 4px 6px; border-radius: 6px; }
.chat-expand:hover { background: var(--surface-2); color: var(--ink); }
.chat-close { border: 0; background: none; color: var(--muted); font-size: 1.5rem; line-height: 1; padding: 2px 8px; border-radius: 6px; cursor: pointer; }
.chat-close:hover { background: var(--surface-2); color: var(--ink); }

.chat-log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); overscroll-behavior: contain; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); max-width: 34ch; display: grid; gap: 6px; font-size: .9rem; padding: 20px 0; }
.chat-empty-h { color: var(--ink); font-weight: 600; font-size: 1rem; }
.chat-day { align-self: center; font-size: .74rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 2px 10px; border-radius: 20px; margin: 8px 0 4px; }
.bubble-row { display: flex; }
.bubble-row.mine { justify-content: flex-end; }
.bubble { max-width: min(78%, 520px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 8px 11px 6px; display: grid; gap: 4px; min-width: 0; }
.bubble-row.mine .bubble { background: var(--accent); color: var(--accent-ink); border-color: transparent; border-radius: 14px 14px 4px 14px; }
.bubble-row.mine .bubble a { color: inherit; }
.bubble-who { font-size: .76rem; font-weight: 600; color: var(--accent); }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-meta { font-size: .7rem; opacity: .7; text-align: right; display: flex; justify-content: flex-end; gap: 10px; }
.bubble-act { font-weight: 600; }
.bubble-img img { max-height: 260px; width: auto; border-radius: 9px; }
.bubble-file { display: block; padding: 7px 10px; border-radius: 8px; background: var(--surface-2); color: var(--ink); text-decoration: none; font-size: .86rem; overflow-wrap: anywhere; }
.bubble-row.mine .bubble-file { background: rgb(255 255 255 / .16); }
.chat-seen { align-self: flex-end; font-size: .72rem; color: var(--muted); margin-top: -2px; }

.chat-form { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 6px; background: var(--surface); }
.chat-input { display: flex; align-items: flex-end; gap: 6px; }
.chat-input textarea { min-height: 42px; max-height: 160px; resize: none; padding: 10px 12px; border-radius: 20px; line-height: 1.4; }
.chat-attach, .chat-send { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; position: relative; }
.chat-attach { color: var(--muted); }
.chat-attach:hover { background: var(--surface-2); color: var(--ink); }
.chat-attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.chat-attach:focus-within { outline: 2px solid var(--focus); }
.chat-send { border: 0; background: var(--accent); color: var(--accent-ink); }
.chat-send:hover { background: var(--accent-hover); }
.chat.sending .chat-send { opacity: .6; cursor: progress; }
.chat-file { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .84rem; background: var(--accent-soft); color: var(--accent); padding: 5px 6px 5px 12px; border-radius: 20px; }
.chat-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-file button { border: 0; background: none; color: inherit; font-size: 1.1rem; cursor: pointer; padding: 0 6px; }
.chat-error { color: var(--danger); font-size: .84rem; }

/* Chatpagina */
body.page-chat .main { padding-bottom: 16px; }
.chat-page { height: calc(100dvh - 58px - 44px); min-height: 420px; display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; }
.chat-page-client { grid-template-columns: minmax(0, 760px); justify-content: center; }
.convos { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.convos-head { padding: 16px 14px 12px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.convos-head h1 { font-size: 1.4rem; }
.convos-new select { padding: 8px 10px; font-size: .88rem; }
.convos-empty { padding: 16px 14px; }
.convo-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.convo { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink); }
.convo:hover { background: var(--surface-2); color: var(--ink); }
.convo.on { background: var(--accent-soft); }
.convo-main { display: grid; min-width: 0; flex: 1; gap: 1px; }
.convo-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.convo-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.convo.unread .convo-top strong { font-weight: 700; }
.convo-top time { font-size: .74rem; color: var(--muted); flex: none; }
.convo-last { font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo.unread .convo-last { color: var(--ink); }
.chat-pane { min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.chat-pane .chat { flex: 1; }
.chat-back { display: none; font-size: .9rem; text-decoration: none; color: var(--muted); }
.chat-placeholder { flex: 1; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: var(--r); color: var(--muted); padding: 20px; text-align: center; }
@media (max-width: 800px) {
  .chat-page { grid-template-columns: 1fr; height: calc(100dvh - 104px - 44px); }
  .chat-page.has-open .convos { display: none; }
  .chat-page:not(.has-open) .chat-pane { display: none; }
  .chat-back { display: block; }
}

/* Zwevende chat voor klanten */
.chat-widget { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 50; display: grid; justify-items: end; gap: 12px; }
.chat-fab { display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--accent); color: var(--accent-ink); font: 600 .95rem var(--f-body); padding: 13px 18px 13px 15px; border-radius: 28px; cursor: pointer; box-shadow: 0 6px 20px rgb(30 40 110 / .28); position: relative; }
.chat-fab:hover { background: var(--accent-hover); }
.fab-count { position: absolute; top: -5px; right: -5px; background: var(--danger); color: #fff; border: 2px solid var(--bg); }
.chat-widget.open .fab-label { display: none; }
.chat-widget.open .chat-fab { padding: 13px; }
.chat-pop { width: min(380px, calc(100vw - 36px)); height: min(560px, calc(100dvh - 120px)); box-shadow: 0 12px 40px rgb(20 24 40 / .22); border-radius: var(--r); }
.chat-pop .chat { border-color: var(--line-strong); }
@media (max-width: 640px) {
  .chat-widget.open { inset: 0; display: block; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: var(--surface); gap: 0; }
  .chat-widget.open .chat-pop { width: 100%; height: 100%; box-shadow: none; }
  .chat-widget.open .chat-pop .chat { border: 0; border-radius: 0; }
  .chat-widget.open .chat-fab { display: none; }
  .chat-fab .fab-label { display: none; }
  .chat-fab { padding: 14px; }
}
body.in:not(.page-chat) .main { padding-bottom: 96px; }

/* ---------- Uren ---------- */
.flash-err { background: var(--danger-bg); color: var(--danger); }
.warn { color: var(--danger); font-weight: 600; }
.nowrap { white-space: nowrap; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.head-actions select { width: auto; padding: 8px 12px; }
.stats-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .stats-3 { grid-template-columns: 1fr; } }
.time-total { font-size: .95rem; }
.time-total strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; margin-right: 2px; }
.time-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; font-size: .86rem; }
.time-list li { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.time-list li:first-child { border-top: 0; }
.time-list-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 16px; }
.time-dur { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 3.4em; }
.time-dur.pos { color: var(--s-klaar); }
.time-dur.neg { color: var(--danger); }
.time-desc { flex: 1; min-width: 0; overflow-wrap: anywhere; display: grid; }
.time-desc small { color: var(--muted); font-size: .78rem; }
.time-del button { border: 0; background: none; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 4px; }
.time-del button:hover { color: var(--danger); background: var(--danger-bg); }
.time-form { padding-top: 10px; border-top: 1px solid var(--line); }
.time-row { display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; }
.credit-form { padding-top: 12px; border-top: 1px solid var(--line); }

.meter-link { display: block; text-decoration: none; color: inherit; margin-bottom: 22px; }
.meter-link:hover { color: inherit; }
.meter-link:hover .meter-card { border-color: var(--accent); }
.meter-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 10px; }
.side-card .meter-card { padding: 14px; background: var(--surface-2); }
.page-head + .meter-card { margin-bottom: 26px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; }
.meter-label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.meter-num strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.meter-num span { color: var(--muted); font-size: .9rem; }
.meter { height: 10px; border-radius: 10px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 10px; background: var(--accent); transition: width .4s; }
.meter-card.is-low .meter span { background: var(--danger); }
.meter-use span { background: var(--accent); }
.meter-note { font-size: .86rem; color: var(--muted); }
.meter-card.is-low .meter-note { color: var(--danger); font-weight: 500; }
.hours-toolbar { margin-top: 4px; }
.hours-toolbar select { width: auto; padding: 8px 12px; }
.hours-sub { margin-top: 28px; }
.hours-foot { margin-top: 12px; max-width: 70ch; }
.table tfoot td { border-top: 1px solid var(--line-strong); border-bottom: 0; }
.row-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Financiën ---------- */
.notice-info { background: var(--accent-soft); color: var(--s-nieuw); }
.notice-danger { background: var(--danger-bg); color: var(--danger); }
.fin-tabs { margin-bottom: 14px; }
.amount { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; font-size: .9rem; }
.qs-concept { color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.qs-verstuurd { color: var(--s-bezig); background: var(--s-bezig-bg); }
.qs-akkoord, .is-betaald { color: var(--s-klaar); background: var(--s-klaar-bg); }
.qs-afgewezen, .is-geannuleerd { color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.is-open { color: var(--s-nieuw); background: var(--s-nieuw-bg); }
.is-late { color: var(--danger); background: var(--danger-bg); }
.inner-2 { gap: 12px; }

.lines-wrap { background: var(--surface); }
.lines-table td { padding: 8px 10px; vertical-align: middle; }
.lines-table th:first-child, .lines-table td:first-child { min-width: 220px; }
.lines-table input { padding: 8px 10px; }
.lines-table .in-qty { width: 72px; text-align: right; }
.lines-table .in-price { width: 120px; text-align: right; }
.line-total { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.totals { margin: 0; display: grid; gap: 6px; align-self: end; font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; gap: 16px; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; }
.totals .grand { border-top: 1px solid var(--line-strong); padding-top: 8px; font-weight: 800; font-size: 1.1rem; }
.totals .grand dt { color: var(--ink); }

.doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(18px, 4vw, 36px); display: grid; gap: 20px; box-shadow: var(--shadow); }
.doc-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-start; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.doc-head .brand-logo { height: 44px; }
.doc-meta { display: grid; gap: 6px; font-size: .88rem; }
.doc-meta div { display: flex; gap: 12px; justify-content: space-between; }
.doc-meta span { color: var(--muted); }
.doc-intro { max-width: 68ch; }
.doc-table { box-shadow: none; }
.doc-totals { justify-self: end; min-width: min(100%, 300px); }
.doc-planning { padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-sm); }
.approve-card { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.decision-akkoord { background: var(--s-klaar-bg); border-color: transparent; }
.decision-akkoord h2 { color: var(--s-klaar); }
.decision-afgewezen { background: var(--surface-2); }
details.side-card summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
details.side-card[open] summary { margin-bottom: 8px; }

.pay-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; display: grid; gap: 16px; box-shadow: var(--shadow); }
.pay-amount { display: grid; gap: 2px; }
.pay-amount span { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.pay-amount strong { font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.pay-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Kennisbank ---------- */
.kb-search { margin-bottom: 26px; max-width: 620px; }
.kb-search input { padding: 14px 18px; font-size: 1rem; border-radius: 30px; box-shadow: var(--shadow); }
.kb-groups { display: grid; gap: 28px; }
.kb-group h2 { margin-bottom: 12px; font-size: 1.1rem; }
.kb-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.kb-list a { display: grid; gap: 6px; height: 100%; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--ink); transition: border-color .15s; }
.kb-list a:hover { border-color: var(--accent); color: var(--ink); }
.kb-list span { color: var(--muted); font-size: .88rem; line-height: 1.5; }
.kb-foot { margin-top: 24px; }
.kb-body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(18px, 4vw, 32px); max-width: 760px; line-height: 1.7; }
.kb-body > * + * { margin-top: 14px; }
.kb-body h2 { font-size: 1.25rem; margin-top: 26px; }
.kb-body h3 { font-size: 1.05rem; margin-top: 20px; }
.kb-body ul, .kb-body ol { padding-left: 1.3em; }
.kb-body li + li { margin-top: 6px; }
.kb-tip { background: var(--accent-soft); border-radius: var(--r-sm); padding: 12px 16px; color: var(--ink); }
.kb-related { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .9rem; }
.kb-help dl { margin: 0; display: grid; gap: 8px; font-size: .85rem; }
.kb-help dl div { display: flex; justify-content: space-between; gap: 10px; }
.kb-help dd { margin: 0; color: var(--muted); text-align: right; }
.kb-help code { font-size: .8rem; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- App & meldingen ---------- */
.app-card { margin-top: 18px; }
.chat-bell { border: 0; background: var(--accent-soft); color: var(--accent); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; }
.chat-bell:hover { background: var(--accent); color: var(--accent-ink); }
