/* Werfrapport v2.0 — LineBuilder
   Layout: vaste kop (werf + sync) boven een tabbalk; inhoud in kaarten op een koel grijsgroen vlak.
   Kleuren volgen de bestaande LineBuilder-modules (petrol nav, teal accent). */
:root {
  --bg: #edf3f4;
  --panel: #ffffff;
  --panel-2: #f5f8f9;
  --ink: #13242a;
  --muted: #5b6f78;
  --line: #d5e0e4;
  --line-strong: #b5c7cf;
  --field-line: #748b95; /* invoerranden: ≥3:1 op wit en panel-2 (WCAG 1.4.11) */
  --ok-ink: #166534; /* tekst in groene chips: 6,1:1 */
  --muted-strong: #4a5e66;
  --brand: #0f766e;
  --brand-strong: #0b5f59;
  --brand-ink: #ffffff;
  --brand-soft: #e2f2ef;
  --nav: #0d252b;
  --nav-2: #143840;
  --nav-ink: #e7f0f2;
  --nav-muted: #9eb4bc;
  --ok: #15803d;
  --ok-soft: #dcf3e3;
  --ok-cell: #c6ebd2;
  --bad: #b91c1c;
  --bad-soft: #fbe3e3;
  --bad-cell: #f6cccc;
  --warn: #a35307;
  --warn-soft: #fcefd9;
  --neutral-cell: #e8eef0;
  --shadow: 0 1px 2px rgba(13, 37, 43, .08), 0 6px 18px rgba(13, 37, 43, .06);
  --radius: 10px;
  --font: 'Inter', ui-sans-serif, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --field-h: 40px;
  --c-ib: #a4b8c0;
  --c-ac: #0f766e;
  --c-eac: #c2560c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a181c; --panel: #0f242a; --panel-2: #132d34; --ink: #e2edef; --muted: #93a9b1; --line: #22424a; --line-strong: #2f5761;
    --field-line: #5a8590; --ok-ink: #4ade80; --muted-strong: #b4c6cc; --brand: #22b3a5; --brand-strong: #34c8b9; --brand-ink: #032421; --brand-soft: #0f3936;
    --nav: #06151a; --nav-2: #0d2930; --nav-ink: #e2edef; --nav-muted: #8aa3ab;
    --ok: #4ade80; --ok-soft: #12321f; --ok-cell: #164a2b; --bad: #f87171; --bad-soft: #3a1717; --bad-cell: #5a1f1f;
    --warn: #fbbf24; --warn-soft: #3a2a0c; --neutral-cell: #17323a; --shadow: 0 1px 2px rgba(0,0,0,.4); --c-ib: #4d6a73; --c-ac: #2dd4bf; --c-eac: #fb923c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a181c; --panel: #0f242a; --panel-2: #132d34; --ink: #e2edef; --muted: #93a9b1; --line: #22424a; --line-strong: #2f5761;
  --field-line: #5a8590; --ok-ink: #4ade80; --muted-strong: #b4c6cc; --brand: #22b3a5; --brand-strong: #34c8b9; --brand-ink: #032421; --brand-soft: #0f3936;
  --nav: #06151a; --nav-2: #0d2930; --nav-ink: #e2edef; --nav-muted: #8aa3ab;
  --ok: #4ade80; --ok-soft: #12321f; --ok-cell: #164a2b; --bad: #f87171; --bad-soft: #3a1717; --bad-cell: #5a1f1f;
  --warn: #fbbf24; --warn-soft: #3a2a0c; --neutral-cell: #17323a; --shadow: 0 1px 2px rgba(0,0,0,.4); --c-ib: #4d6a73; --c-ac: #2dd4bf; --c-eac: #fb923c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--nav); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 20px; }
h3 { font-size: 15px; }
.card-h h2, .card > h2, .stack > h2, .dlg h2 { font-size: 16px; }
.card-h h2 .ico { vertical-align: -2px; }
h1[tabindex="-1"]:focus { outline: none; }
h1[tabindex="-1"]:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
.pagehead { display: grid; gap: 2px; }
.pagehead p { margin: 0; }
.eyebrow { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.num, td.n, th.n { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.page { max-width: 1320px; margin: 0 auto; padding-block: 16px 64px; display: grid; gap: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; margin: -1px; padding: 0; border: 0; }

/* ---- Topbar ---- */
.appbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
.topbar { background: var(--nav); color: var(--nav-ink); }
.skip { position: absolute; left: 8px; top: -60px; z-index: 60; background: var(--panel); color: var(--ink); padding: 10px 14px; border-radius: 8px; font-weight: 700; }
.skip:focus { top: 8px; }
.topbar-in { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding-block: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; margin-right: auto; min-width: 0; }
.brand b { font-size: 11px; letter-spacing: .16em; color: var(--nav-muted); font-weight: 600; }
.brand span { font-size: 17px; font-weight: 700; white-space: nowrap; }
.brand em { font-style: normal; font-weight: 500; color: var(--nav-muted); }
.site-picker { display: flex; align-items: center; gap: 8px; min-width: 0; }
.site-picker select { background: var(--nav-2); color: var(--nav-ink); border: 1px solid transparent; border-radius: 8px; height: 36px; padding: 0 30px 0 10px; max-width: min(440px, 36vw); text-overflow: ellipsis; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 0; cursor: pointer; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.sync-local { background: var(--nav-2); color: var(--nav-muted); }
.sync-synced { background: rgba(74, 222, 128, .16); color: #86efac; }
.sync-syncing { background: rgba(94, 234, 212, .16); color: #5eead4; }
.sync-offline { background: rgba(251, 191, 36, .16); color: #fcd34d; }
.sync-error { background: rgba(248, 113, 113, .18); color: #fca5a5; }
.user-chip { background: var(--nav-2); color: var(--nav-ink); max-width: min(320px, 28vw); min-width: 0; }
.user-chip .uc-name { overflow: hidden; text-overflow: ellipsis; }
.uc-init { display: none; }
.save-state { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--nav-muted); white-space: nowrap; }
.save-state .ico { width: 14px; height: 14px; color: #86efac; }
.tabs { background: var(--nav); border-top: 1px solid var(--nav-2); }
.tabs-in { max-width: 1320px; margin: 0 auto; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs-in.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); }
.tabs-in.more-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 48px), transparent); }
.tabs-in.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent); }
.tabs-in::-webkit-scrollbar { display: none; }
.tab { background: none; border: 0; color: var(--nav-muted); padding: 11px 14px; font-weight: 600; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--nav-ink); }
.tab[aria-current="page"] { color: var(--nav-ink); border-bottom-color: #2dd4bf; }
.tab .badge { margin-left: 6px; font-size: 10px; padding: 1px 6px; border-radius: 6px; background: var(--nav-2); color: var(--nav-muted); }

/* ---- Banner ---- */
.banner { border-radius: var(--radius); padding: 10px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner-info { background: var(--brand-soft); color: var(--ink); }
.banner-warn { background: var(--warn-soft); color: var(--ink); }
.banner-bad { background: var(--bad-soft); color: var(--ink); }
.banner-body { flex: 1; min-width: min(100%, 220px); display: grid; gap: 4px; }
.conflict-list { margin: 4px 0 0; padding-left: 18px; }

/* ---- Cards ---- */
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 14px; min-width: 0; align-content: start; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-h p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.stack { display: grid; gap: 10px; align-content: start; } /* geen uitgerekte rijen naast een langere kolom */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.subtab { border: 1px solid var(--field-line); background: var(--panel); color: var(--muted-strong); border-radius: 999px; padding: 6px 14px; font-weight: 600; cursor: pointer; }
.dot-badge { color: var(--warn); margin-left: 2px; }
.subtab[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* ---- Werfkop ---- */
.sitehead { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.sitehead.open { grid-template-columns: minmax(0, 1fr) minmax(0, 340px); }
.sitehead-main { min-width: 0; }
.sitehead-title { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.wbs-chip { font-family: var(--mono); font-weight: 600; background: var(--nav); color: var(--nav-ink); border-radius: 6px; padding: 3px 9px; font-size: 13px; }
.sitehead h1 { font-size: 20px; }
.sitehead:not(.open) .kv { margin-top: 8px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px 18px; margin-top: 12px; }
.kv div { min-width: 0; }
.kv dt { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.kv dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.btn.head-toggle { margin-left: auto; }
.sitehead.open .head-toggle .ico { transform: rotate(180deg); }
@media (max-width: 700px) {
  /* Mobiel: één regel met WBS, status en een icoonknop; naam eronder; adres en supervisor elk op één regel. */
  .sitehead { padding: 10px 12px; gap: 10px; }
  .sitehead .eyebrow { margin-bottom: 2px; }
  .sitehead-title { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; }
  .sitehead-title .wbs-chip { grid-row: 1; grid-column: 1; justify-self: start; }
  .sitehead-title > .chip { grid-row: 1; grid-column: 2; justify-self: start; }
  .sitehead-title h1 { grid-row: 2; grid-column: 1 / -1; font-size: 17px; line-height: 1.25; }
  .sitehead-title .head-toggle { grid-row: 1; grid-column: 4; width: 44px; padding: 0; margin: 0; }
  .sitehead-title .head-toggle .ht-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .sitehead:not(.open) .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; margin-top: 6px; }
  .sitehead:not(.open) .kv div { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
  .sitehead:not(.open) .kv dt { flex: none; font-size: 10px; }
  .sitehead:not(.open) .kv dd { margin: 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
}
.map-box { display: grid; gap: 8px; align-content: start; min-width: 0; }
.map-frame { width: 100%; aspect-ratio: 16 / 10; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); display: block; }
.map-empty { display: grid; place-content: center; gap: 6px; justify-items: center; text-align: center; color: var(--muted); font-size: 12px; padding: 12px; }
.addr-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Forms ---- */
label.f { display: grid; gap: 4px; min-width: 0; align-content: start; }
/* Omhulsel bij een veldfout: label en fouttekst onder elkaar, zonder dat het buurveld in de rij verspringt. */
.f-field { display: grid; gap: 4px; min-width: 0; align-content: start; }
label.f > span { font-size: 12px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=number], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=password], input[type=search], select, textarea {
  height: var(--field-h); border: 1px solid var(--field-line); border-radius: 8px; background: var(--panel); padding: 0 10px; min-width: 0; width: 100%;
}
input:disabled, select:disabled, textarea:disabled { background: var(--panel-2); color: var(--muted-strong); border-color: var(--line-strong); }
.f-l { font-size: 12px; font-weight: 600; color: var(--muted); }
.f-err { font-size: 12px; font-weight: 600; color: var(--bad); }
.f-err::before { content: "! "; content: "! " / ""; }
[aria-invalid="true"] { border-color: var(--bad) !important; box-shadow: 0 0 0 1px var(--bad); }
textarea { height: auto; min-height: 70px; padding: 8px 10px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 10px 12px; }
.fgrid .span2 { grid-column: span 2; }
@media (max-width: 520px) { .fgrid .span2 { grid-column: auto; } }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--field-h); padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-strong); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 32px; height: 32px; padding: 0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.file-btn { position: relative; overflow: hidden; }
.file-btn .file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { outline: 2px solid var(--brand); outline-offset: 1px; }
.linkbtn { background: none; border: 0; padding: 0; min-height: 36px; color: var(--brand); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { color: var(--brand-strong); }
.linkbtn:disabled { opacity: .55; cursor: progress; }
.btn svg, .ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- Datum-navigatie ---- */
.datebar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.datebar input[type=date] { width: auto; font-weight: 600; }
.daytitle { font-size: 18px; font-weight: 700; }
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok-ink); border-color: transparent; }
button.chip { cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.weekstrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wday { border: 0; border-radius: 8px; padding: 6px 4px; text-align: center; cursor: pointer; display: grid; gap: 1px; font-size: 12px; color: var(--ink); }
.wday b { font-size: 15px; }
.wday .ws-short { display: none; }
.wday.has { background: var(--ok-cell); }
.wday.none { background: var(--bad-cell); }
.wday.off { background: var(--neutral-cell); color: var(--muted-strong); }
.wday.future, .cell.future { background: var(--panel); border: 1px dashed var(--field-line); color: var(--muted-strong); }
.wday.pre, .cell.pre { background: var(--panel-2); border: 1px solid var(--line); color: var(--muted-strong); }
.wday.sel { outline: 2px solid var(--brand); outline-offset: 1px; }

/* ---- Prestaties ---- */
.entries { display: grid; gap: 8px; }
.entry { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--panel); }
.entry-body { display: grid; grid-template-columns: minmax(150px, 1.3fr) auto minmax(250px, 1.6fr) minmax(120px, .8fr) minmax(170px, 1.2fr) auto; gap: 8px 10px; align-items: end; grid-auto-flow: row dense; }
.entry-body > .f-err-row { grid-column: 1 / -1; }
.entry-sum { display: none; }
.entry-ro { display: grid; gap: 4px; }
.entry-ro .es-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.entry-ro .es-meta { font-variant-numeric: tabular-nums; }
.entry-ro .calc { display: flex; gap: 6px; flex-wrap: wrap; }
.entry-ro .hb { font-variant-numeric: tabular-nums; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--brand-soft); }
.entry-ro .hb b { margin-left: 4px; }
.entry .who { display: grid; align-self: center; min-width: 0; }
.entry .who b { overflow-wrap: anywhere; }
.entry .times { display: grid; grid-template-columns: 1fr 1fr 70px; gap: 6px; }
.entry .calc { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.entry .calc .hb { font-variant-numeric: tabular-nums; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); }
.entry .calc .hb b { margin-left: 4px; }
.entry .calc .hb.on { background: var(--brand-soft); border-color: transparent; }
.entry .manual { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.seg { display: inline-flex; border: 1px solid var(--field-line); border-radius: 8px; overflow: hidden; height: var(--field-h); }
.seg button { border: 0; background: var(--panel); padding: 0 10px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--field-line); }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
/* Smalle schermen: personeelsregels inklapbaar met een samenvatting van alle kerngegevens. */
.only-stacked { display: none; }
@media (max-width: 1100px) {
  .only-stacked { display: inline-flex; }
  .entry-body { grid-template-columns: minmax(0, 1fr) auto; }
  .entry-body > * { grid-column: 1 / -1; }
  .entry-body .who { display: none; }
  .entry-body .seg { grid-column: 1; grid-row: 1; justify-self: start; }
  .entry-body .del { grid-column: 2; grid-row: 1; justify-self: end; }
  /* Premie-uren en taak naast elkaar: een opengeklapte regel blijft korter. */
  .entry-body { grid-template-columns: minmax(84px, .45fr) minmax(0, 1fr) auto; }
  .entry-body .seg { grid-column: 1 / 3; }
  .entry-body .del { grid-column: 3; }
  .entry-body > label.f:has(input[data-field="premium"]) { grid-column: 1; }
  .entry-body > label.f:has(select[data-field="taskId"]) { grid-column: 2 / -1; }
  .entry-sum { display: grid; gap: 3px; width: 100%; text-align: left; background: none; border: 0; padding: 2px 40px 2px 0; position: relative; cursor: pointer; color: inherit; min-height: 44px; }
  .entry-sum .es-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
  .entry-sum .es-meta { font-variant-numeric: tabular-nums; }
  .entry-sum .es-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .entry-sum .es-chev { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--panel-2); }
  .entry.open .entry-sum .es-chev .ico { transform: rotate(180deg); }
  .entry.open .entry-sum { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 10px; }
  .entry:not(.open) .entry-body { display: none; }
  .entry.open { border-color: var(--brand); }
}
.dayactions { border-top: 1px solid var(--line); padding-top: 12px; }
.totals-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.totals-bar .t { display: grid; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; padding-right: 12px; }
.totals-bar .t b { font-size: 17px; color: var(--ink); letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }

/* ---- Tabellen ---- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; max-width: 100%; position: relative; /* houdt sr-only-labels binnen de scrollcontainer */ }
.tbl-wrap.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), rgba(0,0,0,.25)); mask-image: linear-gradient(to right, #000 calc(100% - 56px), rgba(0,0,0,.25)); }
.tbl-wrap:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--panel-2); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td input, .tbl td select { height: 32px; font-size: 13px; padding: 0 8px; }
.tbl td input.w-s { width: 90px; }
.tbl tfoot td { font-weight: 700; background: var(--panel-2); border-top: 1px solid var(--line-strong); }
.tbl tr.sub td { font-weight: 700; background: var(--panel-2); }
.tbl tr.calc td { font-weight: 700; }
.tbl tr.key td { background: var(--brand-soft); font-weight: 800; }
.tbl tr.grouphead td { background: var(--panel-2); font-weight: 700; }
.tbl tbody th { text-align: left; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: inherit; background: transparent; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: normal; }
/* Vaste eerste kolom: bij zijwaarts scrollen blijft zichtbaar welke rij je leest of bewerkt. */
.tbl.sticky1 tr > :first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); box-shadow: 1px 0 0 var(--line); min-width: 150px; }
.tbl.sticky1 thead tr > :first-child { background: var(--panel-2); z-index: 2; }
.tbl.sticky1 tr.sub > :first-child, .tbl.sticky1 tfoot tr > :first-child, .tbl.sticky1 tr.grouphead > :first-child { background: var(--panel-2); }
.tbl.sticky1 tr.key > :first-child { background: var(--brand-soft); }
.tbl td input.amt { width: 110px; }
/* Alleen lezen in lijsten: tekst in plaats van uitgeschakelde velden. */
.ro-val { display: block; padding: 4px 0; overflow-wrap: anywhere; }
.ro-title { margin: 0; font-size: 15px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rep-note { margin: 0; align-self: center; }
.neg { color: var(--bad); }
.pos { color: var(--ok); }
.bar { height: 6px; border-radius: 3px; background: var(--neutral-cell); overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--brand); }
.bar i.over { background: var(--bad); }

/* ---- Kalender ---- */
.cal-head { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.cal-head h2 { margin-right: auto; }
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-nav .subtabs { margin-left: 8px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .hd { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; padding: 0 4px; }
.cell { border: 0; border-radius: 8px; min-height: 86px; padding: 8px; text-align: left; display: grid; align-content: start; gap: 2px; cursor: pointer; color: var(--ink); font-size: 12px; min-width: 0; overflow: hidden; overflow-wrap: anywhere; }
.cell .det { display: grid; gap: 2px; min-width: 0; }
.cell .c-mini { display: none; }
.c-hol { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); margin-left: 2px; vertical-align: 1px; }
.cell b { font-size: 16px; }
.cell.has { background: var(--ok-cell); }
.cell.none { background: var(--bad-cell); }
.cell.off { background: var(--neutral-cell); color: var(--muted-strong); }
.cell.out { opacity: .6; }
.cell.today { outline: 2px solid var(--brand); }
.cal.week .cell { min-height: 150px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }
.legend i.lg-future { border: 1px dashed var(--field-line); background: var(--panel); }
.legend i.lg-pre { border: 1px solid var(--line); background: var(--panel-2); }
.legend i.c-hol.lg { width: 8px; height: 8px; border-radius: 50%; vertical-align: 0; }
.agenda { display: none; list-style: none; margin: 0; padding: 0; gap: 6px; }
.ag-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto 18px; gap: 10px; align-items: center; width: 100%; min-height: 56px; padding: 8px 10px; border: 1px solid var(--line); border-left: 5px solid var(--line-strong); border-radius: 10px; background: var(--panel); color: var(--ink); text-align: left; cursor: pointer; }
.ag-row.has { border-left-color: var(--ok); }
.ag-row.none { border-left-color: var(--bad); background: var(--bad-soft); }
.ag-row.future { border-left-style: dashed; }
.ag-row.today { box-shadow: inset 0 0 0 2px var(--brand); }
.ag-date { display: grid; justify-items: center; line-height: 1.1; }
.ag-date b { font-size: 18px; }
.ag-main { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.ag-status { font-weight: 600; }
.ag-h { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- KPI ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 12px; }
.kpi { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: grid; gap: 4px; min-width: 0; }
.kpi .l { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.kpi .v { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi .hint { font-size: 12px; color: var(--muted-strong); line-height: 1.3; }
.hbars { display: grid; gap: 14px; }
.hgroup { display: grid; gap: 4px; }
.hbar { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 12px; }
.hbar-l { color: var(--muted-strong); }
.hbar-t { height: 10px; border-radius: 3px; background: var(--neutral-cell); overflow: hidden; }
.hbar-t i { display: block; height: 100%; border-radius: 3px; }
.hbar-v { font-variant-numeric: tabular-nums; min-width: 76px; text-align: right; font-weight: 600; }
.chart.chart-narrow { display: none; }
.chart-values { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 8px 14px; margin: 0; }
.chart-values dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.chart-values dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid line { stroke: var(--line); }

/* ---- Lijsten ---- */
.cart { position: sticky; top: 116px; align-self: start; }
.listgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 16px; align-items: start; }
@media (max-width: 900px) { .listgrid { grid-template-columns: minmax(0, 1fr); } .cart { position: static; } .sitehead { grid-template-columns: minmax(0, 1fr); } }
.team-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 8px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px 2px 8px; font-size: 12px; }
.tag button { border: 0; background: none; cursor: pointer; color: var(--muted-strong); padding: 0 6px; min-width: 28px; min-height: 28px; font-size: 16px; }

/* ---- Werven ---- */
.sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.sitecard { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: grid; gap: 8px; align-content: start; border-top: 3px solid var(--brand); }
.sitecard.closed { border-top-color: var(--line-strong); }
.sitecard h3 { overflow-wrap: anywhere; }

/* ---- Dialoog / toast ---- */
dialog { border: 0; border-radius: 12px; padding: 0; background: var(--panel); color: var(--ink); width: min(640px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(7, 21, 25, .55); }
.dlg { padding: 18px; display: grid; gap: 14px; max-height: calc(100vh - 80px); overflow: auto; }
dialog.sheet .menu-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font-weight: 600; text-align: left; cursor: pointer; }
.menu-item .ico { width: 20px; height: 20px; }
.menu-item .chip { margin-left: auto; }
.menu-item[aria-current="page"] { border-color: var(--brand); background: var(--brand-soft); }
/* Meldingen rechtsonder en compact, zodat ze geen invoer bedekken. */
.toast { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--nav); color: var(--nav-ink); padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 13px; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: min(420px, calc(100vw - 32px)); display: flex; gap: 12px; align-items: center; }
.toast[hidden] { display: none; }
.toast-hint { color: var(--nav-muted); font-weight: 500; white-space: nowrap; }
.toast-btn { display: inline-flex; align-items: center; gap: 6px; background: transparent; color: #5eead4; border: 1px solid currentColor; border-radius: 8px; min-height: 36px; padding: 0 10px; font-weight: 700; cursor: pointer; white-space: nowrap; }

/* ---- Login ---- */
.login { max-width: 420px; margin: 8vh auto; }
.login-links { display: flex; flex-wrap: wrap; gap: 0 18px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 84px; }
.pw-toggle { position: absolute; right: 2px; top: 2px; height: calc(var(--field-h) - 4px); padding: 0 12px; }
.msg-bad { color: var(--bad); font-weight: 600; }
form[aria-busy="true"] { cursor: progress; }

/* ---- Rapport (papier) ---- */
.paper { -webkit-print-color-adjust: exact; print-color-adjust: exact; background: #fff; color: #142126; border-radius: 6px; box-shadow: var(--shadow); padding: 28px; display: grid; gap: 18px; overflow-x: auto; }
.paper .rp-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid #0d252b; padding-bottom: 12px; }
.paper .rp-head h2 { font-size: 22px; }
.paper .rp-brand { font-size: 11px; letter-spacing: .16em; font-weight: 700; color: #0f766e; }
.paper .rp-site { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 16px; background: #f2f6f7; border-radius: 6px; padding: 12px; }
.paper .rp-site dt { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #61727c; font-weight: 700; }
.paper .rp-site dd { margin: 0; font-weight: 600; }
.paper h3 { font-size: 14px; border-bottom: 1px solid #c9d6dc; padding-bottom: 4px; }
.paper table { border-collapse: collapse; width: 100%; font-size: 12px; }
.paper th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: #61727c; border-bottom: 1px solid #b9c9d1; padding: 5px 6px; }
.paper td { padding: 4px 6px; border-bottom: 1px solid #e3eaed; }
.paper tr.dayrow td { background: #e8f1f0; font-weight: 700; }
.paper tfoot td { font-weight: 700; border-top: 2px solid #0d252b; }
.paper .rp-sum { display: flex; gap: 22px; flex-wrap: wrap; }
.paper .rp-sum div { display: grid; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: #61727c; font-weight: 700; }
.paper .rp-sum b { font-size: 18px; color: #142126; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.paper .rp-note { font-size: 12px; background: #f7f9fa; border-left: 3px solid #0f766e; padding: 6px 10px; }
.paper .rp-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 12px; }
.paper .rp-sign div { border-top: 1px solid #8fa6b0; padding-top: 6px; font-size: 11px; color: #61727c; min-height: 50px; }


/* ---- Mobiel en aanraakschermen ---- */
.bottomnav { display: none; }
.tbl td.rc-more { display: none; }
.only-narrow { display: none; }
@media (max-width: 700px), (pointer: coarse) {
  :root { --field-h: 44px; }
  .btn.sm { height: 44px; }
  .btn.icon { width: 44px; height: 44px; }
  .subtab { min-height: 44px; }
  .seg button { min-width: 44px; }
  .tbl td input, .tbl td select { height: 44px; }
  .check { min-height: 44px; }
  input[type=checkbox] { width: 22px; height: 22px; }
  .linkbtn { min-height: 44px; }
  .toast-btn { min-height: 44px; }
  button.chip { min-height: 44px; }
  .wday { min-height: 56px; }
}
@media (max-width: 700px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .only-narrow { display: inline-flex; }
  .appbar { position: static; }
  .tabs { display: none; }
  .topbar-in { gap: 8px; padding-block: 8px; }
  .brand b { display: none; }
  .brand span { font-size: 16px; }
  .site-picker { order: 10; flex: 1 1 100%; }
  .site-picker select { width: 100%; max-width: none; height: 44px; }
  .pill { height: 36px; padding: 0 10px; }
  .user-chip { width: 36px; padding: 0; justify-content: center; }
  .user-chip .uc-name { display: none; }
  .uc-init { display: inline; }
  .brand em { display: none; }
  .bottomnav { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--nav); border-top: 1px solid var(--nav-2); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .bn-in { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .bn-item { background: none; border: 0; border-top: 3px solid transparent; color: var(--nav-muted); display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 58px; padding: 6px 2px; font-size: 11px; font-weight: 600; cursor: pointer; min-width: 0; }
  .bn-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bn-item .ico { width: 22px; height: 22px; }
  .bn-item[aria-current="page"] { color: var(--nav-ink); border-top-color: #2dd4bf; background: var(--nav-2); }
  .toast { left: 16px; right: 16px; max-width: none; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); justify-content: space-between; }
  dialog.sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 16px 16px 0 0; }
  dialog.sheet .dlg { padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
  .page { padding-block: 12px 32px; gap: 12px; }
  .card { padding: 14px; }
  .pagehead h1 { font-size: 20px; }
  .datebar input[type=date] { flex: 1; min-width: 0; }
  .dayactions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dayactions .btn { white-space: normal; text-align: center; line-height: 1.2; }
  .dayactions .btn:first-child:nth-last-child(3) { grid-column: 1 / -1; }
  .wday .ws-full { display: none; }
  .wday .ws-short { display: block; font-weight: 600; }
  .wday { padding: 6px 2px; }
  .banner .btn { flex: 1 1 auto; }
  /* Kalender: compact maandraster, details in de agendalijst eronder; week als lijst. */
  .cal { gap: 4px; }
  .cal .hd { text-align: center; padding: 0; }
  .cell { min-height: 50px; padding: 6px 2px; text-align: center; justify-items: center; gap: 0; }
  .cell b { font-size: 15px; }
  .cal.month .cell .det { display: none; }
  .cell .c-mini { display: block; font-size: 11px; font-weight: 600; min-height: 14px; }
  .cal.week { display: none; }
  .agenda { display: grid; }
  /* Financieel: kernkolommen, met knop voor alle kolommen; grafieken in mobiele opmaak. */
  .cols-key .opt { display: none; }
  /* Leesbanner op smalle schermen korter: de kernboodschap blijft, de verwijzing naar de beheerder valt weg. */
  #roBanner .ro-more { display: none; }
  /* IB-invoer: IB-lijn, uren en bedrag passen samen in beeld; toeslagen via de kolommenknop. */
  .tbl.sticky1.ib-input tr > :first-child { min-width: 0; width: 40%; }
  .tbl.ib-input th, .tbl.ib-input td { padding-inline: 6px; }
  .tbl.ib-input td input.w-s { width: 64px; }
  .tbl.ib-input td input.amt { width: 96px; }
  .chart.chart-wide { display: none; }
  .chart.chart-narrow { display: block; }
  .chart text { font-size: 12px; }
  /* Brede bewerktabellen als kaarten: alle velden blijven zichtbaar, zonder zijwaarts scrollen. */
  .tbl-wrap:has(> .rcards) { border: 0; overflow: visible; }
  .tbl.rcards, .tbl.rcards > tbody, .tbl.rcards > tfoot { display: block; }
  .tbl.rcards > thead { display: none; }
  .tbl.rcards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; position: relative; margin-bottom: 8px; background: var(--panel); }
  .tbl.rcards td { display: block; border: 0; padding: 0; min-width: 0 !important; position: static !important; box-shadow: none !important; background: none !important; text-align: left; white-space: normal; }
  .tbl.rcards td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
  .tbl.rcards td.rc-title { grid-column: 1 / -1; padding-right: 52px; font-weight: 600; }
  .tbl.rcards td.rc-act { position: absolute !important; top: 6px; right: 6px; }
  .tbl.rcards td.rc-empty { display: none; }
  .tbl.rcards td:empty { display: none; }
  .tbl.rcards td input:not([type=checkbox]), .tbl.rcards td select { width: 100% !important; min-width: 0 !important; }
  .tbl.rcards td:has(> input[type=checkbox]) { display: flex; align-items: center; gap: 10px; }
  .tbl.rcards td:has(> input[type=checkbox])::before { margin: 0; order: 2; font-size: 13px; color: var(--ink); }
  .tbl.rcards tfoot tr { background: var(--panel-2); }
  .tbl.rcards td.rc-more { display: block; grid-column: 1 / -1; }
  .tbl.rcards td.rc-more .btn { width: 100%; justify-content: center; }
  .tbl.rcards tr.open td.rc-more .ico { transform: rotate(180deg); }
  .tbl.rcards tr:not(.open) td.rc-more-f { display: none; }
  .tbl.rcards tfoot td:not([data-label]) { grid-column: 1 / -1; }
  .sites { grid-template-columns: minmax(0, 1fr); }
  .tbl.rcards .chip { white-space: normal; max-width: 100%; overflow-wrap: anywhere; }
  .cal-head h2 { flex: 1 1 100%; }
  .cal-nav { flex: 1 1 100%; gap: 6px; flex-wrap: nowrap; }
  .cal-nav .subtabs { margin-left: auto; gap: 4px; flex-wrap: nowrap; }
  .cal-nav .subtab { padding: 6px 11px; }
  .col-toggle { align-items: center; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px; }
  .kpi .v { font-size: 19px; }
}
@media (max-width: 380px) { .kpis { grid-template-columns: minmax(0, 1fr); } }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  body::before, .topbar, .tabs, .appbar, .bottomnav, .skip, .no-print, .toast { display: none !important; }
  .page { padding: 0; max-width: none; }
  .paper { box-shadow: none; padding: 0; overflow: visible; }
  .paper tr { break-inside: avoid; }
  .wrap { padding: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
