/* Layout: a graphite rail (desktop) or bottom tab bar (phone) around an aluminium work surface;
   condensed stencil-style labels, gaffer-tape number tags, amber tally-light accent. */
:root {
  --bg: var(--p-bg, #eceef1);
  --surface: #ffffff;
  --surface-2: var(--p-surface-2, #f5f6f8);
  --line: var(--p-line, #d8dce2);
  --line-strong: var(--p-line-strong, #bdc4cd);
  --fg: #15181c;
  --muted: #5a626d;
  --accent: var(--brand, #f2a31b);
  --accent-ink: var(--brand-ink, #1c1403);
  --accent-text: var(--brand-text-l, #8a5300);
  --accent-rail: var(--brand-rail, #f2a31b);
  --rail: var(--p-rail, #1a1d21);
  --rail-fg: var(--p-rail-fg, #c3c9d1);
  --rail-active: var(--p-rail-active, #2b3036);
  --tape: #e7e2cf;
  --tape-ink: #3b3626;
  --danger: #b8322a;
  --danger-bg: #fbe8e6;
  --warn: #9a5c00;
  --warn-bg: #fff2d9;
  --ok: #1b7a4e;
  --ok-bg: #e2f3ea;
  --st-concept: #6f7883;
  --st-optie: #7048cc;
  --st-bevestigd: #1b8556;
  --st-afgerond: #33659a;
  --st-geannuleerd: #b23f35;
  --chart-bev: #1b8556;
  --chart-opt: #7048cc;
  --ar-open: #33659a;
  --ar-late: #b8322a;
  --ar-bill: #a47a00;
  --weekend: var(--p-weekend, #e4e7eb);
  --shadow: 0 1px 2px rgba(16, 20, 26, .06), 0 6px 20px rgba(16, 20, 26, .07);
  --font-display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --font-body: 'Barlow', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --radius: 8px;
  --rail-w: 228px;
  --tabbar-h: 62px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--p-bg-d, #111316);
    --surface: var(--p-surface-d, #191c20);
    --surface-2: var(--p-surface-2-d, #20242a);
    --line: var(--p-line-d, #2c3137);
    --line-strong: var(--p-line-strong-d, #3b424b);
    --fg: #e7e9ec;
    --muted: #9aa2ac;
    --accent: var(--brand-d, #f5b13a);
    --accent-ink: var(--brand-ink-d, #1c1403);
    --accent-text: var(--brand-text-d, #f5b13a);
    --rail: var(--p-rail, #0b0d0f);
    --rail-fg: var(--p-rail-fg, #aeb5be);
    --rail-active: var(--p-rail-active, #1e2227);
    --tape: #39362a;
    --tape-ink: #ebe3c4;
    --danger: #f07a6f;
    --danger-bg: #3a1c19;
    --warn: #f2b24c;
    --warn-bg: #352812;
    --ok: #5ccb93;
    --ok-bg: #15301f;
    --st-concept: #9aa2ad;
    --st-optie: #a88cf2;
    --st-bevestigd: #4fc48a;
    --st-afgerond: #7aa7da;
    --st-geannuleerd: #ee8075;
    --chart-bev: #3aa874;
    --chart-opt: #9478e8;
    --ar-open: #4f86c6;
    --ar-late: #e0675c;
    --ar-bill: #b0901c;
    --weekend: var(--p-weekend-d, #16191d);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: var(--p-bg-d, #111316);
  --surface: var(--p-surface-d, #191c20);
  --surface-2: var(--p-surface-2-d, #20242a);
  --line: var(--p-line-d, #2c3137);
  --line-strong: var(--p-line-strong-d, #3b424b);
  --fg: #e7e9ec;
  --muted: #9aa2ac;
  --accent: var(--brand-d, #f5b13a);
  --accent-ink: var(--brand-ink-d, #1c1403);
  --accent-text: var(--brand-text-d, #f5b13a);
  --rail: var(--p-rail, #0b0d0f);
  --rail-fg: var(--p-rail-fg, #aeb5be);
  --rail-active: var(--p-rail-active, #1e2227);
  --tape: #39362a;
  --tape-ink: #ebe3c4;
  --danger: #f07a6f;
  --danger-bg: #3a1c19;
  --warn: #f2b24c;
  --warn-bg: #352812;
  --ok: #5ccb93;
  --ok-bg: #15301f;
  --st-concept: #9aa2ad;
  --st-optie: #a88cf2;
  --st-bevestigd: #4fc48a;
  --st-afgerond: #7aa7da;
  --st-geannuleerd: #ee8075;
  --chart-bev: #3aa874;
  --chart-opt: #9478e8;
  --ar-open: #4f86c6;
  --ar-late: #e0675c;
  --ar-bill: #b0901c;
  --weekend: var(--p-weekend-d, #16191d);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.num, .money { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: .86em; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.fill { fill: currentColor; stroke: none; }

/* ---------- App shell ---------- */
.app { min-height: 100%; }

.rail {
  display: none;
  background: var(--rail);
  color: var(--rail-fg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .02em;
  color: #f1f3f5;
  text-decoration: none;
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--accent);
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .18);
}
.brand-mark span { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-ink); box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--rail-fg);
  font-weight: 500;
}
.nav a:hover { background: var(--rail-active); color: #fff; }
.nav a[aria-current="page"] { background: var(--rail-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent-rail); }
.nav-label {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 12px;
  color: #7d858f;
  padding: 14px 12px 6px;
}
.rail-foot { margin-top: auto; font-size: 12px; color: #7d858f; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.mode-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; }
.mode-dot.local { background: var(--warn); }

.main {
  min-width: 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom, 0px));
}
.main-inner { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.view { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
#banner { display: flex; flex-direction: column; gap: 8px; }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--rail);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: max(4px, env(safe-area-inset-left, 0px));
  padding-right: max(4px, env(safe-area-inset-right, 0px));
  border-top: 1px solid rgba(255, 255, 255, .06);
}
.tabbar a, .tabbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--tabbar-h);
  background: none; border: 0;
  color: var(--rail-fg);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .03em;
  text-transform: uppercase;
  cursor: pointer;
  min-width: 0;
}
.tabbar span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar svg.i { width: 22px; height: 22px; }
.tabbar [aria-current="page"] { color: var(--accent-rail); }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .rail {
    display: flex; flex-direction: column; gap: 8px;
    position: sticky; top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 18px 12px;
  }
  .rail .brand { padding: 4px 8px 14px; }
  .tabbar { display: none; }
  .main { padding-block: 28px 48px; padding-left: 32px; padding-right: max(32px, env(safe-area-inset-right, 0px)); }
}

/* ---------- Page structure ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.page-head .titles { flex: 1 1 260px; min-width: 0; }
.eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 2px;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; text-wrap: balance; letter-spacing: .01em; }
h1 { font-size: clamp(28px, 4vw, 38px); line-height: 1.05; }
h2 { font-size: 21px; line-height: 1.15; }
h3 { font-size: 17px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; }
.back:hover { color: var(--fg); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 19px; }
.card-head .count { color: var(--muted); font-family: var(--font-mono); font-size: 13px; }

.banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 500;
  font-size: 14px;
}
.banner.info { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.banner .btn { margin-left: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--fg);
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.05); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-bg); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 13.5px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-bg); }
body.readonly [data-write] { display: none !important; }

/* ---------- Pills, tags ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px 2px 8px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--pc, var(--muted));
  background: color-mix(in srgb, var(--pc, var(--muted)) 14%, transparent);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-concept { --pc: var(--st-concept); }
.st-optie { --pc: var(--st-optie); }
.st-bevestigd { --pc: var(--st-bevestigd); }
.st-afgerond { --pc: var(--st-afgerond); }
.st-geannuleerd { --pc: var(--st-geannuleerd); }
.st-verzonden { --pc: var(--st-afgerond); }
.st-betaald { --pc: var(--ok); }
.st-vervallen { --pc: var(--danger); }
.st-geaccepteerd { --pc: var(--ok); }
.st-afgewezen { --pc: var(--st-geannuleerd); }
.st-verlopen { --pc: var(--warn); }

.tape {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--tape-ink);
  background: var(--tape);
  padding: 2px 9px;
  clip-path: polygon(0 8%, 3px 0, 100% 4%, calc(100% - 3px) 50%, 100% 96%, 4px 100%, 0 88%, 3px 50%);
  white-space: nowrap;
}

.flag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
  white-space: nowrap;
}
.flag svg.i { width: 14px; height: 14px; }
.flag.danger { color: var(--danger); background: var(--danger-bg); }
.flag.warn { color: var(--warn); background: var(--warn-bg); }
.flag.ok { color: var(--ok); background: var(--ok-bg); }
.flag.neutral { color: var(--muted); background: var(--surface-2); }
.example-tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--warn); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
  text-decoration: none;
}
.stat .k { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stat .v { font-family: var(--font-display); font-weight: 700; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .s { font-size: 13px; color: var(--muted); }
.stat.alert .v { color: var(--danger); }
.stat.alert { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.list > .row:first-child { border-top: 0; }
a.row:hover, button.row:hover { background: var(--surface-2); }
button.row { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; font: inherit; }
.row .main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .title { font-weight: 600; overflow-wrap: anywhere; }
.row .sub { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.row .side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; max-width: 48%; min-width: 0; text-align: right; }
.row .side:empty { display: none; }
.row .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.group-head {
  padding: 14px 16px 6px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-top: 1px solid var(--line);
  display: flex; gap: 8px; align-items: baseline;
}
.list > .group-head:first-child { border-top: 0; }
.group-head .sum { margin-left: auto; font-family: var(--font-mono); letter-spacing: 0; text-transform: none; font-size: 12.5px; }

.date-stub {
  flex: none;
  width: 48px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}
.date-stub .m { display: block; background: var(--rail); font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; font-size: 11px; font-weight: 700; padding: 1px 0; color: var(--accent-rail); }
.date-stub .d { display: block; font-family: var(--font-display); font-weight: 700; font-size: 21px; line-height: 1.25; }

.avatar {
  flex: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  color: #fff;
  background: var(--av, #556);
}

.empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty h3 { color: var(--fg); }
.empty p { margin: 0; max-width: 46ch; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search {
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 220px;
  min-width: 0;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 10px;
}
.search input, .search input[type="search"] { border: 0; background: transparent; padding: 8px 0; min-height: 0; min-width: 0; flex: 1; outline: none; border-radius: 0; }
.search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.search svg.i { color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.chip-btn[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip-btn .c { font-family: var(--font-mono); font-size: 11.5px; opacity: .7; margin-left: 4px; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600; font-size: 14px;
  cursor: pointer;
  color: var(--muted);
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button {
  border: 0; background: none;
  padding: 10px 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.tabs .c { font-family: var(--font-mono); font-size: 12px; margin-left: 4px; }

/* ---------- Forms ---------- */
input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="date"], input[type="time"], input[type="search"], input:not([type]), select, textarea {
  width: 100%;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 8px 10px;
  min-height: 38px;
}
textarea { resize: vertical; min-height: 76px; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.field { grid-column: span 6; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.half { grid-column: span 3; }
.field.third { grid-column: span 2; }
@media (max-width: 520px) { .field.half, .field.third { grid-column: span 6; } .field.third.keep { grid-column: span 3; } }
.field label, .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.field .hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.req { color: var(--danger); }
.form-section { grid-column: span 6; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .12em; font-size: 13px; font-weight: 600; color: var(--muted); padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.form-error { grid-column: span 6; margin: 0; color: var(--danger); font-weight: 600; font-size: 14px; }
.affix { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px; min-width: 0; }
.affix span { padding: 0 2px 0 10px; color: var(--muted); font-size: 14px; }
.affix span.after { padding: 0 10px 0 2px; }
.affix input { border: 0 !important; background: transparent !important; outline: none; min-width: 0; }
.affix:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Project detail ---------- */
.project-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1360px) { .project-layout { grid-template-columns: minmax(0, 1fr) 320px; } .project-layout > .project-aside { position: sticky; top: 20px; } }
.project-aside { display: flex; flex-direction: column; gap: 16px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.facts > div { background: var(--surface); padding: 10px 14px; min-width: 0; }
.facts .k { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; font-size: 12px; font-weight: 600; color: var(--muted); }
.facts .v { font-weight: 600; overflow-wrap: anywhere; }
.status-select {
  width: auto;
  min-height: 32px;
  padding: 3px 28px 3px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--pc);
  background-color: color-mix(in srgb, var(--pc) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--pc) 40%, transparent);
}

.lines { display: flex; flex-direction: column; }
.line {
  display: grid;
  gap: 8px 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  align-items: center;
}
.line:first-child { border-top: 0; }
.line .name { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.line .name strong { font-weight: 600; overflow-wrap: anywhere; }
.line .name small { color: var(--muted); font-size: 12.5px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.line .total { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.line input, .line select { min-height: 34px; padding: 5px 8px; }
.line .affix input { padding: 5px 6px; }
.cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cell > .lbl { font-size: 11.5px; }
.line-head { display: none; }

/* Phone: each line is a small card. Wide screens: materiaal and kosten collapse into one row. */
.line { grid-template-columns: minmax(0, 1fr) auto; }
.line .rm { display: flex; gap: 2px; justify-content: flex-end; }
.line .ctrls { display: grid; gap: 8px; align-items: end; min-width: 0; }
.line .issues { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }

.line.eq .name { grid-row: 1; grid-column: 1; }
.line.eq .total { grid-row: 1; grid-column: 2; align-self: start; }
.line.eq .ctrls { grid-row: 2; grid-column: 1; grid-template-columns: 64px minmax(0, 1fr) 78px; }
.line.eq .rm { grid-row: 2; grid-column: 2; align-self: end; }

.line.cost .name { grid-row: 1; grid-column: 1; }
.line.cost .rm { grid-row: 1; grid-column: 2; align-self: end; }
.line.cost .ctrls { grid-row: 2; grid-column: 1; grid-template-columns: 64px minmax(0, 1fr); }
.line.cost .total { grid-row: 2; grid-column: 2; align-self: end; padding-bottom: 8px; }

.line.crew .name { grid-row: 1; grid-column: 1; }
.line.crew .rm { grid-row: 1; grid-column: 2; }
.line.crew .ctrls { grid-row: 2; grid-column: 1 / -1; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.line.crew .issues { grid-row: 3; }
.line.crew .c-date { grid-column: span 6; }
.line.crew .c-time, .line.crew .c-time-e { grid-column: span 3; }
.line.crew .c-role, .line.crew .c-person { grid-column: span 6; }
.line.crew .c-rtype, .line.crew .c-rate, .line.crew .c-tot { grid-column: span 4; }
.line.crew .c-tot { align-self: center; }
.line .issues .flag, .line .name .flag { white-space: normal; }
@media (min-width: 760px) {
  .line.crew .ctrls { grid-template-columns: 150px 100px 100px minmax(0, 1fr) minmax(0, 1fr); }
  .line.crew .c-date, .line.crew .c-time, .line.crew .c-time-e, .line.crew .c-role, .line.crew .c-person { grid-column: auto; }
  .line.crew .c-rtype { grid-column: 1; }
  .line.crew .c-rate { grid-column: 2 / span 2; }
  .line.crew .c-tot { grid-column: 4 / span 2; }
  .line.crew .ctrls.has-end { grid-template-columns: 150px 150px 100px 100px minmax(0, 1fr) minmax(0, 1fr); }
  .line.crew .ctrls.has-end .c-tot { grid-column: 4 / span 3; }
}

@media (min-width: 900px) {
  .line-head { display: grid; padding: 8px 16px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); background: var(--surface-2); gap: 10px; }
  .line.eq .cell > .lbl, .line.cost .cell > .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .line.eq .ctrls, .line.cost .ctrls { display: contents; }
  .line.eq .name, .line.eq .total, .line.eq .rm, .line.eq .ctrls > *,
  .line.cost .name, .line.cost .total, .line.cost .rm, .line.cost .ctrls > * { grid-row: auto; grid-column: auto; }
  .line.eq, .line-head.eq { grid-template-columns: minmax(0, 1fr) 72px 116px 84px 108px 40px; }
  .line.eq .ctrls > * { order: 1; }
  .line.eq .total { order: 2; align-self: center; }
  .line.eq .rm { order: 3; align-self: center; }
  .line.cost, .line-head.cost { grid-template-columns: minmax(0, 1fr) 72px 116px 108px 40px; }
  .line.cost .total { padding-bottom: 0; align-self: center; }
  .line.cost .rm { align-self: center; }
}
.line.has-issue { background: color-mix(in srgb, var(--danger) 5%, transparent); }
.lines-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.lines-foot .sum { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

.totals { display: flex; flex-direction: column; }
.totals > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 16px; font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 2px solid var(--fg); margin-top: 4px; padding-top: 10px; font-family: var(--font-display); font-weight: 700; font-size: 22px; }
.totals .sub { border-top: 1px solid var(--line); }

/* ---------- Planning grid ---------- */
.plan-wrap { --who-w: 128px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
@media (min-width: 700px) { .plan-wrap { --who-w: 176px; } }
table.plan { border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.plan col.who-col { width: var(--who-w); }
.plan th, .plan td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; vertical-align: top; }
.plan thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; font-weight: 600; font-size: 12.5px; padding: 6px 4px; text-align: center; }
.plan thead th .dw { display: block; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-size: 11.5px; }
.plan thead th .dd { display: block; font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.plan thead th.today .dd { color: var(--accent-text); }
.plan .who {
  position: sticky; left: 0; z-index: 1;
  background: var(--surface);
  padding: 8px 10px;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-align: left;
  font-weight: 600;
  font-size: 13.5px;
}
.plan thead .who { z-index: 3; background: var(--surface-2); }
.plan .who small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan .who a { text-decoration: none; }
.plan td.day { height: 46px; }
.plan td.we, .plan th.we { background-color: var(--weekend); }
.plan td.today { box-shadow: inset 2px 0 0 var(--accent), inset -2px 0 0 var(--accent); }
.plan td.off { background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--muted) 22%, transparent) 0 2px, transparent 2px 7px); }
.plan .cell-btn { display: flex; flex-direction: column; gap: 3px; width: 100%; height: 100%; min-height: 46px; padding: 3px; background: none; border: 0; cursor: pointer; text-align: left; }
.plan .cell-btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.plan .off-label { font-size: 11px; font-weight: 600; color: var(--muted); padding: 2px 4px; }
.pchip {
  display: block;
  font-size: 11.5px;
  line-height: 1.25;
  padding: 3px 5px;
  border-radius: 4px;
  text-decoration: none;
  color: var(--fg);
  background: color-mix(in srgb, var(--pc) 20%, var(--surface));
  border-left: 3px solid var(--pc);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pchip b { font-weight: 600; }
.pchip.conflict { --pc: var(--danger); background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.pchip.open { border-left-style: dashed; }
.plan td.bar-cell { padding: 6px 3px; vertical-align: middle; }
.pbar {
  display: flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: 5px;
  text-decoration: none;
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  background: color-mix(in srgb, var(--pc) 22%, var(--surface));
  border-left: 4px solid var(--pc);
  overflow: hidden;
  white-space: nowrap;
}
.pbar span { overflow: hidden; text-overflow: ellipsis; }
.pbar small { font-weight: 500; color: var(--muted); }
.pbar.clip-l { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left-style: dotted; }
.eqcell { display: grid; place-items: center; height: 100%; min-height: 40px; font-family: var(--font-mono); font-size: 13px; cursor: pointer; border: 0; background: none; width: 100%; }
.eqcell.used { background: color-mix(in srgb, var(--st-afgerond) 12%, transparent); font-weight: 600; }
.eqcell.tight { background: var(--warn-bg); color: var(--warn); font-weight: 700; }
.eqcell.short { background: var(--danger-bg); color: var(--danger); font-weight: 700; }
.eqcell.idle { color: var(--muted); opacity: .6; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; background: var(--pc); }
.legend i.box { background: var(--sw); border: 1px solid var(--line-strong); }

/* ---------- Invoice paper ---------- */
.invoice-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1240px) { .invoice-layout { grid-template-columns: minmax(0, 1fr) 300px; } }
.paper-wrap { overflow-x: auto; }
.paper {
  background: #fff;
  color: #15181c;
  border-radius: 4px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 34px 38px 28px;
  max-width: 820px;
  font-size: 13.5px;
  border-top: 6px solid var(--accent);
}
.paper .p-head { display: flex; justify-content: space-between; gap: 20px; }
.paper .p-company { font-family: var(--font-display); font-weight: 700; font-size: 24px; }
.paper .p-addr { text-align: right; color: #5a626d; font-size: 12.5px; line-height: 1.5; }
.paper .p-title { font-family: var(--font-display); font-weight: 700; font-size: 34px; letter-spacing: .06em; margin: 22px 0 14px; }
.paper .p-parties { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.paper .p-client { line-height: 1.5; }
.paper dl { display: grid; grid-template-columns: auto auto; gap: 3px 18px; margin: 0; font-size: 13px; }
.paper dt { color: #5a626d; }
.paper dd { margin: 0; text-align: right; font-weight: 600; }
.paper table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.paper th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #5a626d; background: #f3f4f6; padding: 7px 8px; }
.paper td { padding: 7px 8px; border-bottom: 1px solid #e5e8ec; vertical-align: top; }
.paper td.n, .paper th.n { text-align: right; white-space: nowrap; }
.paper tr.sec td { font-weight: 700; padding-top: 14px; border-bottom: 1px solid #c9ced6; }
.paper td small { display: block; color: #6b737e; font-size: 11.5px; }
.paper .p-totals { margin-left: auto; width: 280px; margin-top: 12px; }
.paper .p-totals div { display: flex; justify-content: space-between; padding: 4px 8px; }
.paper .p-totals .g { border-top: 2px solid #15181c; font-weight: 700; font-size: 16px; padding-top: 8px; margin-top: 4px; }
.paper .p-note { margin-top: 22px; color: #3a4048; line-height: 1.55; white-space: pre-wrap; }
.paper .p-foot { margin-top: 26px; padding-top: 10px; border-top: 1px solid #e5e8ec; color: #6b737e; font-size: 11.5px; text-align: center; }

/* ---------- Modal ---------- */
.modal-wrap {
  position: fixed; inset: 0;
  z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(10, 12, 15, .5);
  padding-top: max(24px, env(safe-area-inset-top, 0px));
}
.modal {
  background: var(--surface);
  color: var(--fg);
  width: 100%;
  max-height: 100%;
  display: flex; flex-direction: column;
  border-radius: 14px 14px 0 0;
  box-shadow: var(--shadow);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; font-size: 22px; }
.modal-body { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-body p { margin: 0 0 8px; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); border-top: 1px solid var(--line); background: var(--surface-2); }
@media (min-width: 700px) {
  .modal-wrap { align-items: center; padding: 32px; }
  .modal { width: min(640px, 100%); max-height: calc(100vh - 64px); border-radius: 12px; padding-bottom: 0; }
  .modal.small { width: min(440px, 100%); }
  .modal.wide { width: min(820px, 100%); }
  .modal-foot { border-radius: 0 0 12px 12px; }
}
.pick-list { display: flex; flex-direction: column; margin: 10px -16px 0; }
.pick-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); }
.pick-item .main-col { flex: 1; min-width: 0; }
.pick-item .title { font-weight: 600; overflow-wrap: anywhere; }
.pick-item .sub { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; flex: none; }
.stepper button { width: 34px; height: 34px; border: 0; background: var(--surface-2); cursor: pointer; font-size: 18px; font-weight: 600; }
.stepper span { min-width: 34px; text-align: center; font-family: var(--font-mono); font-size: 14px; }
.stepper.on { border-color: var(--accent); }
.period-list { display: flex; flex-direction: column; gap: 8px; }
.period { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr) 34px; gap: 8px; align-items: center; }
@media (max-width: 520px) { .period { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; } .period .reason { grid-column: 1 / 3; grid-row: 2; } }

/* ---------- Toast ---------- */
#toast-root {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: min(440px, calc(100% - 32px));
  pointer-events: none;
}
@media (min-width: 900px) { #toast-root { bottom: 24px; } }
.toast {
  background: var(--rail);
  color: #f1f3f5;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-weight: 500;
  font-size: 14px;
  border-left: 4px solid var(--accent);
  animation: toast-in .18s ease-out;
}
.toast.error { border-left-color: #f07a6f; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } * { transition: none !important; } }

/* ---------- Welcome & misc ---------- */
.welcome { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .welcome { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; display: flex; flex-direction: column; }
.steps li { counter-increment: s; display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps li::before {
  content: counter(s);
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  background: var(--rail); color: var(--accent-rail);
}
.steps li.done::before { content: "✓"; background: var(--ok-bg); color: var(--ok); }
.steps .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.steps .txt p { margin: 0; color: var(--muted); font-size: 14px; }
.two-col { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .two-col { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.copyable { user-select: all; }
.loading { padding: 60px 20px; text-align: center; color: var(--muted); }
.loading .bar { width: 160px; height: 3px; margin: 14px auto 0; background: var(--line); border-radius: 2px; overflow: hidden; position: relative; }
.loading .bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--accent); animation: load 1.1s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .loading .bar::after { animation: none; width: 100%; } }
.sheet-menu { display: flex; flex-direction: column; margin: -8px -16px; }
.sheet-menu a { display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none; font-weight: 600; border-top: 1px solid var(--line); }
.sheet-menu a:first-child { border-top: 0; }
.sheet-user { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px 6px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.sheet-user:first-child { border-top: 0; }
.sheet-user b { color: var(--fg); font-size: 15px; }
.sheet-logout { display: flex; align-items: center; gap: 14px; padding: 12px 16px 14px; background: none; border: 0; font: inherit; font-weight: 600; color: var(--danger); cursor: pointer; text-align: left; }
.doc-list .row { padding: 10px 16px; }
.hide-sm { display: none; }
@media (min-width: 700px) { .hide-sm { display: initial; } }
.stack { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; min-width: 0; }
.stack > p { margin: 0; }
.stack > .search, .stack > .chips { align-self: stretch; }
.search.wide { max-width: none; }
.small { font-size: 13px; }
.prewrap { white-space: pre-wrap; margin: 4px 0 0; overflow-wrap: anywhere; }
.range-label { font-family: var(--font-display); font-size: 17px; font-weight: 600; white-space: nowrap; }
.align-start { align-self: flex-start; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--fg); font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
a.flag { text-decoration: none; }
a.flag:hover { text-decoration: underline; }
.paper-wrap { min-width: 0; }
.facts .v a { text-decoration: none; }
.facts .v a:hover { text-decoration: underline; }

/* Invoice preview on a phone: stack the address blocks, drop the optional columns. */
@media (max-width: 640px) {
  .paper { padding: 22px 18px 18px; font-size: 12.5px; }
  .paper .p-head, .paper .p-parties { flex-direction: column; gap: 12px; }
  .paper .p-addr { text-align: left; }
  .paper .p-title { font-size: 26px; margin: 16px 0 10px; }
  .paper .opt { display: none; }
  .paper th, .paper td { padding: 6px 4px; }
  .paper .p-totals { width: 100%; }
}
.paper small.mob-only { display: none; }
@media (max-width: 640px) { .paper small.mob-only { display: block; } }

/* ---------- House style: logo ---------- */
.brand-logo { display: inline-flex; align-items: center; border-radius: 8px; padding: 8px 12px; max-width: 100%; }
.brand-logo img { display: block; max-height: 44px; max-width: 100%; width: auto; height: auto; }
.brand-logo.tone-dark, .logo-preview.tone-dark { background: #ffffff; }
.brand-logo.tone-light, .logo-preview.tone-light { background: #15181c; }
.rail .brand-logo { width: 100%; justify-content: center; }
.mobile-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  color: var(--fg);
  min-width: 0;
}
.mobile-brand .brand-logo { padding: 6px 10px; border: 1px solid var(--line); }
.mobile-brand .brand-logo img { max-height: 30px; max-width: 200px; }
@media (min-width: 900px) { .mobile-brand { display: none; } }
.logo-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.logo-preview { min-width: 160px; min-height: 64px; max-width: 100%; border: 1px dashed var(--line-strong); border-radius: 8px; display: grid; place-items: center; padding: 10px 14px; }
.logo-preview img { display: block; max-height: 56px; max-width: 240px; }
.color-row { display: flex; flex-direction: column; gap: 6px; }
.color-row input[type="color"] { width: 46px; height: 38px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); cursor: pointer; }
.color-row input.hex { width: 120px; font-family: var(--font-mono); font-size: 14px; }
.paper .p-logo { display: block; max-height: 64px; max-width: 260px; }

.brand-logo.bare { padding: 0; background: none; border: 0; }
.brand-logo .logo-d { display: none; }
/* Stats that act as buttons */
button.stat { font: inherit; color: inherit; text-align: left; cursor: pointer; }
a.stat:hover, button.stat:hover { border-color: var(--line-strong); }

/* Colour swatches (legend keys) */
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--sw, var(--muted)); }
.sw.rv-bev { --sw: var(--chart-bev); } .sw.rv-opt { --sw: var(--chart-opt); }
.sw.seg-open { --sw: var(--ar-open); } .sw.seg-late { --sw: var(--ar-late); } .sw.seg-bill { --sw: var(--ar-bill); }

/* Openstaande facturen */
.dash-money { align-items: stretch; }
.dash-money > .card { display: flex; flex-direction: column; }
.ar { display: flex; flex-direction: column; gap: 14px; }
.ar-total .k { display: block; color: var(--muted); font-size: 13.5px; }
.ar-total .v { display: block; font-family: var(--font-display); font-weight: 700; font-size: 32px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ar-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ar-item { display: grid; grid-template-columns: auto 1fr; column-gap: 7px; row-gap: 1px; align-items: center; text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: inherit; font: inherit; cursor: pointer; min-width: 0; }
.ar-item:hover { background: var(--surface-2); }
.ar-item .l { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.ar-item strong, .ar-item small { grid-column: 1 / -1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ar-item small { color: var(--muted); font-size: 12px; }
.ar-bar { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-2); }
.ar-bar > span { min-width: 6px; border-radius: 4px; }
.ar-bar .seg-open { background: var(--ar-open); } .ar-bar .seg-late { background: var(--ar-late); } .ar-bar .seg-bill { background: var(--ar-bill); }
@media (max-width: 520px) { .ar-legend { grid-template-columns: minmax(0, 1fr); } .ar-item { grid-template-columns: auto 1fr auto; } .ar-item strong { grid-column: 3; grid-row: 1; } .ar-item small { grid-column: 2 / -1; } }

/* Omzet per maand */
.rv { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.rv-legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.rv-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rv-plot { position: relative; height: 210px; margin-left: 46px; margin-bottom: 22px; }
.rv-grids { position: absolute; inset: 0; pointer-events: none; }
.rv-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.rv-grid span { position: absolute; right: calc(100% + 6px); top: -8px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rv-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2px; }
.rv-col { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; border-radius: 4px; }
.rv-col:hover, .rv-col:focus-visible { background: color-mix(in srgb, var(--fg) 5%, transparent); outline: none; }
.rv-col.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.rv-stack { display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; width: min(70%, 22px); height: 100%; }
.rv-stack > span { display: block; min-height: 2px; }
.rv-stack .rv-bev { background: var(--chart-bev); border-radius: 0 0 1px 1px; }
.rv-stack .rv-opt { background: var(--chart-opt); }
.rv-stack > span:first-child { border-top-left-radius: 4px; border-top-right-radius: 4px; }
.rv-x { position: absolute; top: calc(100% + 4px); font-size: 11.5px; color: var(--muted); white-space: nowrap; line-height: 1; }
.rv-x small { margin-left: 2px; font-size: 10px; }
.rv-col.on .rv-x { color: var(--fg); font-weight: 700; }
.rv-tip { display: none; position: absolute; bottom: calc(100% - 6px); left: 50%; transform: translateX(-50%); z-index: 5; min-width: 168px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-align: left; font-size: 12.5px; pointer-events: none; }
.rv-tip > strong { display: block; margin-bottom: 4px; font-size: 13px; }
.rv-tip > span { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.rv-tip > span b { margin-left: auto; color: var(--fg); font-variant-numeric: tabular-nums; }
.rv-tip > span.t { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; color: var(--fg); }
.rv-col:hover .rv-tip, .rv-col:focus-visible .rv-tip { display: block; }
.rv { container-type: inline-size; }
@container (max-width: 520px) { .rv-x { font-size: 10.5px; } .rv-x small { display: none; } .rv-col:nth-child(even) .rv-x { visibility: hidden; } .rv-col.on .rv-x { visibility: visible; } }
.rv-col:nth-child(-n+2) .rv-tip { left: 0; transform: none; }
.rv-col:nth-last-child(-n+2) .rv-tip { left: auto; right: 0; transform: none; }
@media (hover: none) { .rv-col:hover .rv-tip { display: none; } }

/* Maandoverzicht */
.month-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.month-sum > div { background: var(--surface); padding: 10px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.month-sum .k { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; font-size: 12px; font-weight: 600; color: var(--muted); }
.month-sum .v { font-family: var(--font-display); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.month-sum .s { font-size: 12.5px; color: var(--muted); }
@media (max-width: 520px) { .month-sum { grid-template-columns: minmax(0, 1fr); } .month-sum > div { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 10px; } .month-sum .v { font-size: 19px; margin-left: auto; } .month-sum .s { flex-basis: 100%; } }

/* Subprojecten */
.sub-card .card-head { flex-wrap: wrap; }
.sub-pick { max-width: min(100%, 340px); min-width: 0; flex: 1 1 200px; }
.sub-list { max-height: 420px; overflow: auto; }
.sub-detail { padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.sub-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sub-title h3 { font-size: 18px; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.sub-facts .status-select { width: 100%; }
.sub-notes { margin: 0; }
.group-head.sub-head { color: var(--fg); background: var(--surface-2); padding-top: 10px; padding-bottom: 8px; }
.status-derived { display: inline-flex; align-items: center; }
.line.in-set { opacity: .82; }
.bill-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 16px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.check-row { cursor: pointer; }
.check-row input { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.check-row .money { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

/* Functies */
.fn-badge { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); color: var(--fg); }
.fn-badge svg.i { width: 18px; height: 18px; }

/* Folding cards and groups */
.fold-btn { margin-left: 4px; }
.card.folded > :not(.card-head) { display: none !important; }
.card.folded > .card-head { border-bottom: 0; }
.card.folded { align-self: start; }
.fold-head { padding-top: 10px; }
.fold { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.fold svg.i { width: 14px; height: 14px; }
.fold-empty { padding: 4px 16px 12px; margin: 0; }

/* Collapsible menu (desktop) */
.rail-toggle { display: none; align-items: center; gap: 8px; background: none; border: 0; color: inherit; font: inherit; padding: 6px 4px; cursor: pointer; border-radius: 6px; text-align: left; }
.rail-toggle:hover { background: var(--rail-active); color: #fff; }
.rail-toggle svg.i { width: 16px; height: 16px; flex: none; }
.rail-user { display: flex; flex-direction: column; gap: 1px; padding: 8px 4px 2px; border-top: 1px solid rgba(255, 255, 255, .08); }
.rail-user b { color: #f1f3f5; font-size: 13px; font-weight: 600; }
.rail-foot .rail-logout { margin: 6px 0 8px; padding: 8px 10px; border: 1px solid rgba(255, 255, 255, .22); color: #f1f3f5; font-size: 14px; font-weight: 600; justify-content: center; }
.rail-foot .rail-logout svg.i { width: 18px; height: 18px; }
body.rail-small .rail-foot .rail-logout { padding: 8px; }
@media (min-width: 900px) {
  .rail-toggle { display: inline-flex; }
  body.rail-small { --rail-w: 68px; }
  body.rail-small .nav a span, body.rail-small .nav-label, body.rail-small .rail-foot > span, body.rail-small .rail-toggle span { display: none; }
  body.rail-small .nav a { justify-content: center; padding-left: 0; padding-right: 0; }
  body.rail-small .rail .brand { font-size: 0; justify-content: center; }
  body.rail-small .rail .brand-logo img { max-width: 44px; }
  body.rail-small .rail-foot { align-items: center; }
}

/* Search-as-you-type */
.combo { position: relative; }
.combo input[type="text"], .combo input:not([type]) { width: 100%; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px; }
.combo-item { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: inherit; text-decoration: none; }
.combo-item small { color: var(--muted); font-size: 12px; }
.combo-item:hover, .combo-item.on { background: var(--surface-2); }
.combo-item.combo-new, .combo-item.combo-maps { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 8px; border-top: 1px solid var(--line); margin-top: 2px; font-weight: 600; }
.combo-item.combo-maps small { flex-basis: 100%; padding-left: 24px; font-weight: 400; }
.combo-item svg.i { width: 16px; height: 16px; }
.color-pick { display: flex; align-items: center; gap: 10px; }
.color-pick input[type="color"] { width: 48px; height: 34px; padding: 2px; border-radius: 6px; }
.map-link { display: inline-block; margin-top: 2px; }

/* Crew folders */
.group-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.group-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 6px; align-items: center; }
.row-inline { display: flex; gap: 8px; }
.row-inline input { flex: 1; min-width: 0; }

/* Project calendar */
.cal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cal-head strong { font-family: var(--font-display); font-size: 19px; min-width: 150px; text-align: center; }
.cal { overflow-x: auto; }
.cal-dow, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-width: 340px; }
.cal-dow span { padding: 8px 10px; font-family: var(--font-display); font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
.cal-dow i { display: none; font-style: normal; }
.cal-week { grid-template-rows: 30px repeat(var(--lanes), 24px) 10px; row-gap: 3px; border-bottom: 1px solid var(--line); position: relative; }
.cal-day { grid-row: 1 / -1; border-left: 1px solid var(--line); padding: 4px 8px; font-size: 13px; color: var(--fg); }
.cal-day:first-child { border-left: 0; }
.cal-day span { display: inline-flex; align-items: baseline; gap: 6px; }
.cal-day small { color: var(--muted); font-size: 11px; }
.cal-day.out { color: var(--muted); background: color-mix(in srgb, var(--fg) 3%, transparent); }
.cal-day.today span { color: var(--accent-text); font-weight: 700; }
.cal-bar { position: relative; z-index: 1; display: block; margin: 0 2px; padding: 3px 8px; border-radius: 4px; background: var(--bar); color: var(--bar-ink); font-size: 12.5px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; box-shadow: inset 3px 0 0 color-mix(in srgb, var(--bar-ink) 35%, transparent); }
.cal-bar:hover { filter: brightness(1.08); }
.cal-bar.clip-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; box-shadow: none; }
.cal-bar.clip-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.cal-bar.st-optie { outline: 2px dashed color-mix(in srgb, var(--bar-ink) 70%, transparent); outline-offset: -3px; }
.cal-bar.st-concept { opacity: .75; }
@media (max-width: 640px) {
  .cal-dow b { display: none; } .cal-dow i { display: inline; }
  .cal-week { grid-template-rows: 26px repeat(var(--lanes), 20px) 8px; }
  .cal-bar { font-size: 11px; line-height: 14px; padding: 3px 4px; }
  .cal-day { padding: 3px 4px; font-size: 12px; }
  .cal-day small { display: none; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo .logo-l { display: none; }
  :root:not([data-theme="light"]) .brand-logo .logo-d { display: block; }
}
:root[data-theme="dark"] .brand-logo .logo-l { display: none; }
:root[data-theme="dark"] .brand-logo .logo-d { display: block; }
.rail .brand-logo.bare { justify-content: flex-start; padding: 2px 4px; }
.rail .brand-logo.bare img { max-height: 72px; }
.mobile-brand .brand-logo.bare { border: 0; padding: 0; }
.mobile-brand .brand-logo.bare img { max-height: 44px; }

/* ---------- Import ---------- */
.imp-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.imp-file { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.imp-file > span { display: inline-flex; gap: 6px; align-items: center; overflow-wrap: anywhere; }
.imp-file select { width: auto; }
.imp-map { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.imp-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); }
.imp-row:first-child { border-top: 0; }
.imp-row label { font-weight: 600; font-size: 14px; }
.imp-row select { min-height: 34px; padding: 5px 8px; }
.imp-ex { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) {
  .imp-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .imp-ex { grid-column: 1 / -1; margin-top: -4px; }
}
.imp-summary { padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.progress { width: 100%; height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.table-wrap { width: 100%; overflow-x: auto; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mini-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.stack > .field { align-self: stretch; }
.field > .seg { align-self: flex-start; }

/* ---------- Round 2: material groups, timeline, side panel, crew places, staffels ---------- */
.tabs-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding-right: 8px; }
.tabs-row .tabs { border-bottom: 0; flex: 1; min-width: 0; }
.panel-show { flex: 0 0 auto; }

/* Material groups (like Rentman's groups), each with its own period and factor */
.eq-group { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.lines > .eq-group:first-child, .lines > .group-head + .eq-group { border-top: 0; }
.grp-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 9px 12px 9px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.grp-title { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.grp-title strong { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: .02em; overflow-wrap: anywhere; }
.grp-meta { grid-column: 1; overflow-wrap: anywhere; }
.grp-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 2px; }
.grp-head.targeted { box-shadow: inset 3px 0 0 var(--accent); }
.grp-empty { margin: 0; padding: 12px 16px; }
.eq-group > .line:first-of-type { border-top: 0; }
.icon-btn.on { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); color: var(--accent-text); }

/* Drop targets while dragging from the side panel */
.drop-over { outline: 2px dashed var(--accent); outline-offset: -3px; background: color-mix(in srgb, var(--accent) 9%, transparent); }
body.drag-eq [data-drop-group], body.drag-fn [data-drop-crew], body.drag-crew [data-drop-crew] { transition: background .1s; }

/* Timeline (tijdschema) */
.timeline-card .phase-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 14px; }
.phase-item { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--surface-2); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.phase-item strong { font-weight: 600; }
.phase-box { display: flex; flex-direction: column; gap: 8px; }
.phase-box .lbl { font-weight: 600; }
.phase-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr) 34px; gap: 6px; align-items: center; }
.phase-row input { min-height: 36px; padding: 5px 8px; min-width: 0; }
.phase-sum { margin: 0; font-variant-numeric: tabular-nums; }
.align-start { align-self: flex-start; }
@media (max-width: 560px) {
  .phase-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .phase-row .ph-name { grid-column: 1 / 3; }
  .phase-row .ph-start { grid-column: 1; grid-row: 2; }
  .phase-row .ph-end { grid-column: 2; grid-row: 2; }
  .phase-row .icon-btn { grid-column: 3; grid-row: 1; }
}

/* Crew line: function, number of people, one select per place */
.line.crew.targeted { box-shadow: inset 3px 0 0 var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.line.crew .c-role { grid-column: span 8; }
.line.crew .c-qty { grid-column: span 4; }
.line.crew .c-phase { grid-column: span 12; }
.line.crew .c-people { grid-column: 1 / -1; }
.line-actions { display: flex; gap: 2px; }
.slots { display: flex; flex-wrap: wrap; gap: 6px; }
.slot { flex: 1 1 190px; min-width: 0; border-radius: 6px; }
.slot select { width: 100%; }
.slot.open select { border-style: dashed; color: var(--muted); background-color: transparent; }
.slot.bad select { border-color: var(--danger); color: var(--danger); }
.slot.extra select { opacity: .7; }
@media (min-width: 760px) {
  .line.crew .ctrls, .line.crew .ctrls.has-end { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .line.crew .c-date { grid-column: span 3; }
  .line.crew .c-time, .line.crew .c-time-e { grid-column: span 2; }
  .line.crew .c-role { grid-column: span 3; }
  .line.crew .c-qty { grid-column: span 2; }
  .line.crew .ctrls.has-end .c-date { grid-column: span 2; }
  .line.crew .ctrls.has-end .c-role { grid-column: span 3; }
  .line.crew .ctrls.has-end .c-qty { grid-column: span 1; }
  .line.crew .c-phase, .line.crew .c-rtype, .line.crew .c-rate { grid-column: span 3; }
  .line.crew .c-tot, .line.crew .ctrls.has-end .c-tot { grid-column: span 3; }
  .line.crew .c-people { grid-column: 1 / -1; }
}

/* Side panel: a column on wide screens, a sheet from below on phones and tablets */
.add-panel { display: none; flex-direction: column; gap: 10px; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.ap-head { display: flex; align-items: center; gap: 8px; }
.ap-head strong { font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.ap-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.ap-tabs button { border: 0; background: transparent; padding: 7px 4px; border-radius: 6px; font: inherit; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.ap-tabs button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.ap-search { width: 100%; }
.ap-target { line-height: 1.35; }
.ap-target b { color: var(--fg); font-weight: 600; }
.ap-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; margin: 0 -6px; padding: 0 6px; }
.ap-sec { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 4px 4px; }
.ap-item { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 8px; border-radius: 6px; cursor: grab; }
.ap-item:hover { background: var(--surface-2); }
.ap-item:active { cursor: grabbing; }
.ap-item .main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ap-item .title { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.ap-item .sub { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.ap-none { padding: 8px 4px; }
.sheet-scrim { position: fixed; inset: 0; background: rgba(8, 10, 12, .4); z-index: 44; }
@media (max-width: 1279px) {
  .add-panel.open { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; max-height: min(78vh, 640px); border-radius: 14px 14px 0 0; border-bottom: 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0, 0, 0, .25); }
}
@media (min-width: 1280px) {
  .main-inner:has(.project-layout.has-panel:not(.panel-closed)) { max-width: 1640px; }
  .project-layout.has-panel:not(.panel-closed) { grid-template-columns: 280px minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .project-layout.has-panel:not(.panel-closed) > .add-panel { display: flex; grid-column: 1; grid-row: 1 / -1; align-self: start; position: sticky; top: 20px; max-height: calc(100vh - 40px); }
  .project-layout.has-panel:not(.panel-closed) > .proj-main { grid-column: 2; grid-row: 1; }
  .project-layout.has-panel:not(.panel-closed) > .project-aside { grid-column: 2; grid-row: 2; }
  .project-layout.has-panel:not(.panel-closed) .panel-show { display: none; }
  .sheet-scrim { display: none; }
}
@media (min-width: 1720px) {
  .project-layout.has-panel:not(.panel-closed) { grid-template-columns: 280px minmax(0, 1fr) 300px; }
  .project-layout.has-panel:not(.panel-closed) > .project-aside { grid-column: 3; grid-row: 1; position: sticky; top: 20px; }
}

/* Staffel editor */
.st-rows { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.st-row { display: grid; grid-template-columns: 62px auto 62px auto 76px auto 34px; justify-content: start; gap: 6px 8px; align-items: center; font-size: 13.5px; color: var(--muted); }
.st-row input { min-height: 34px; padding: 4px 8px; min-width: 0; text-align: right; font-variant-numeric: tabular-nums; }

.modal [data-ph-form] .phase-box > .lbl { display: none; }
.timeline-card.empty-tl .card-head { border-bottom: 0; }
.tl-per { font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .hide-xs { display: none; } .panel-show { padding-left: 8px; padding-right: 8px; } }
@media (max-width: 520px) {
  .line.crew input[type="time"] { padding-left: 6px; padding-right: 4px; }
  .line.crew input[type="time"]::-webkit-calendar-picker-indicator { display: none; }
}

/* Delete buttons are red, so they are easy to find */
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-bg); }
/* Project category tag and filter */
.flag.cat { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.eyebrow .flag.cat { margin-left: 8px; vertical-align: middle; }
.cat-pick { width: auto; min-height: 36px; }
.card-pad .row-inline { align-items: center; }
/* Rental period over a range of phases */
.tl-use { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 0 16px 14px; }
.tl-use .lbl { font-weight: 600; font-size: 13.5px; }
.tl-use label { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); }
.tl-use select { width: auto; min-height: 32px; padding: 3px 28px 3px 8px; }
.staffel-sum { margin: -4px 0 0; font-variant-numeric: tabular-nums; }
/* Crew line: phase range and day calculation */
.line.crew .c-phase { grid-column: span 6; }
.line.crew .c-calc { grid-column: span 12; }
@media (min-width: 760px) {
  .line.crew .ctrls.has-ph .c-phase, .line.crew .ctrls.has-ph .c-rtype, .line.crew .ctrls.has-ph .c-rate { grid-column: span 2; }
  .line.crew .c-calc { grid-column: span 4; }
  .line.crew .ctrls.has-ph .c-tot { grid-column: span 3; }
}
.cat-color { flex: 0 0 38px !important; width: 38px; height: 36px; padding: 2px; border-radius: 7px; cursor: pointer; }
.linklike { border: 0; background: none; padding: 0; font: inherit; color: var(--accent-text); text-decoration: underline; cursor: pointer; }
/* Templates on the paper preview */
.paper tr.part td { font-family: var(--font-display); font-weight: 700; font-size: 17px; padding-top: 18px; color: #15181c; }
.paper tr.ptot td { font-weight: 700; text-align: right; border-top: 1px solid #15181c; padding-top: 6px; }
.paper tr.ptot td.n { text-align: right; }
.paper tr.pbreak td { padding: 10px 0 4px; text-align: center; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #8a929c; border-bottom: 1px dashed #b9c0c9; }
.p-intro { margin: 0 0 14px; white-space: pre-wrap; }
/* Category rows with their templates */
.cat-row { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.cat-row:last-of-type { border-bottom: 0; }
.cat-tpl { display: flex; flex-wrap: wrap; gap: 8px 14px; padding-left: 46px; }
.cat-tpl label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.cat-tpl select { width: auto; min-height: 32px; padding: 3px 28px 3px 8px; }
/* Holidays and absence */
.plan td.off-vakantie { background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--st-afgerond) 26%, transparent) 0 2px, transparent 2px 7px); }
.plan td.off-ziek { background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--danger) 18%, transparent) 0 2px, transparent 2px 7px); }
.plan .off-label.t-vakantie { color: var(--st-afgerond); }
.legend .lg-off i { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--st-afgerond) 45%, transparent) 0 2px, transparent 2px 5px); border: 1px solid color-mix(in srgb, var(--st-afgerond) 50%, transparent); }
.cal-bar.cal-abs { border: 1px dashed color-mix(in srgb, var(--st-afgerond) 60%, transparent); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--st-afgerond) 16%, var(--surface)) 0 4px, var(--surface) 4px 9px); color: var(--fg); box-shadow: none; font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; }
.abs-card .row .side .flag { white-space: nowrap; }
.check.small { font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.period { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr) 34px; }
@media (max-width: 520px) {
  .period { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; }
  .period select { grid-column: 1; grid-row: 2; }
  .period .reason { grid-column: 2 / 4; grid-row: 2; }
}
/* Client window: overview per year */
.client-facts { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.year-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.year-table th, .year-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.year-table thead th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); }
.year-table .n { text-align: right; }
.year-table tbody th { font-weight: 700; }
.client-projects { max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.client-projects .money.small { font-size: 13px; }
/* Without financial rights: no prices, rates or totals in the lines */
body.no-fin .line.eq .ctrls > .cell:not(:first-child), body.no-fin .line.eq .total,
body.no-fin .line-head.eq span:nth-child(n+3), body.no-fin .line-head.eq span:last-child,
body.no-fin .line.crew .c-rtype, body.no-fin .line.crew .c-rate, body.no-fin .line.crew .c-calc, body.no-fin .line.crew .c-tot,
body.no-fin .lines-foot .sum, body.no-fin .row .side .money, body.no-fin .group-head .sum:not(.gmeta) { display: none !important; }
@media (min-width: 900px) { body.no-fin .line.eq, body.no-fin .line-head.eq { grid-template-columns: minmax(0, 1fr) 90px 40px; } }
/* Accounts */
.acc-how p { margin: 0 0 8px; line-height: 1.5; }
.acc-table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.acc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.acc-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 8px 12px; background: var(--surface-2); }
.acc-table td { padding: 8px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.acc-table td small { display: block; color: var(--muted); font-size: 12.5px; }
.acc-table select { width: auto; min-height: 34px; }
.acc-add select { flex: 0 0 auto; width: auto; }
.acc-act { white-space: nowrap; }
.acc-joins .row-inline { align-items: center; flex-wrap: wrap; }
.acc-joins .grow { flex: 1 1 160px; font-weight: 600; }
.acc-joins select { width: auto; }

/* ---------- Test login ---------- */
body.login-screen .rail, body.login-screen .tabbar, body.login-screen .mobile-brand, body.login-screen #banner { display: none !important; }
body.login-screen .app { display: block; }
body.login-screen .main { padding-bottom: 32px; }
.login-wrap { min-height: calc(100vh - 64px); min-height: calc(100dvh - 64px); display: grid; place-items: center; padding: 16px 0; }
.login-card { width: 100%; max-width: 380px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--fg); }
.login-brand .brand-logo img { max-height: 40px; max-width: 220px; }
.login-card h1 { font-size: 30px; margin: 4px 0 0; }
.login-card .btn-primary { width: 100%; min-height: 44px; }
.login-card .btn-ghost { align-self: center; }
.login-card > .hint { text-align: center; }
.login-bar { flex-wrap: nowrap; padding: 6px 6px 6px 14px; }
.login-bar > span { min-width: 0; }
.login-bar b { color: var(--fg); }
.login-bar .btn { flex: none; }
.acc-act select { max-width: 200px; }

/* ---------- Sections that fold shut ---------- */
.fold-sec.shut > .fold-body { display: none; }
.fold-head .fold { flex: 1 1 auto; min-width: 0; text-align: left; }
.fold-sec > .fold-head .fold svg.i, .fold-sec > .grp-head .fold svg.i { transition: transform .12s ease; }
.fold-sec.shut > .fold-head .fold svg.i, .fold-sec.shut > .grp-head .fold svg.i { transform: rotate(-90deg); }
.grp-fold { gap: 8px; text-align: left; }
.grp-fold strong { overflow-wrap: anywhere; }
.list > .fold-sec:first-child > .group-head, .lines > .fold-sec:first-child > .group-head { border-top: 0; }
.fold-sec > .fold-body > .line:first-child { border-top: 1px solid var(--line); }
.eq-group > .fold-body > .line:first-child, .fold-body > .eq-group:first-child { border-top: 0; }
.eq-group.fold-sec.shut > .grp-head { border-bottom: 0; }
.fold-all { flex: 0 0 auto; }
@media (max-width: 520px) { .fold-all { padding-left: 8px; padding-right: 8px; } }


/* Equipment folders: own material and rented-in material, with the categories inside */
.group-head.folder-head { color: var(--fg); background: var(--surface-2); font-size: 14px; padding-top: 12px; padding-bottom: 10px; }
.fold-body > .fold-sec > .cat-head { padding-left: 30px; }
.fold-body > .fold-sec > .fold-body > .row { padding-left: 30px; }

/* Settings, split into tabs */
.set-tabs { margin-top: -4px; flex-wrap: wrap; overflow: visible; row-gap: 0; }
.settings-body { display: flex; flex-direction: column; gap: 16px; max-width: 920px; min-width: 0; }

/* Light / dark choice per device */
.theme-pick { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.theme-pick button { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; border-radius: 6px; padding: 5px 8px; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.theme-pick button svg.i { width: 15px; height: 15px; }
.theme-pick button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.rail-foot .theme-pick { align-self: stretch; justify-content: space-between; background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); margin-bottom: 4px; }
.rail-foot .theme-pick button { color: var(--rail-fg); padding: 5px 6px; }
.rail-foot .theme-pick button[aria-pressed="true"] { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: none; }
.rail-foot .theme-pick button span { display: none; }
.rail-foot .theme-pick button[aria-pressed="true"] span { display: inline; }
body.rail-small .rail-foot .theme-pick { display: inline-flex; flex-direction: column; align-self: center; }
body.rail-small .rail-foot .theme-pick button[aria-pressed="true"] span { display: none; }
.sheet-theme { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); font-weight: 600; }
.login-theme { align-self: center; }
