/* Werfrapport V3 — aanvulling op styles.css.
   Nieuw: rapportstatus als eigen kleurfamilie (altijd samen met tekst of symbool), statuspaneel,
   snelkeuzes met grote tikvlakken, opvolgingsscherm en de instelbare indeling per werf. */
:root {
  --s-approved: #166534; --s-approved-bg: #dcf3e3;
  --s-submitted: #1d4ed8; --s-submitted-bg: #dde8fe;
  --s-draft: #92400e; --s-draft-bg: #fcefd9;
  --s-returned: #7e22ce; --s-returned-bg: #f1e5fd;
  --s-missing: #b91c1c; --s-missing-bg: #fbe3e3;
  --s-neutral: var(--muted-strong); --s-neutral-bg: var(--neutral-cell);
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --s-approved: #4ade80; --s-approved-bg: #12321f; --s-submitted: #9dbcff; --s-submitted-bg: #172a55;
    --s-draft: #fbbf24; --s-draft-bg: #3a2a0c; --s-returned: #d8b4fe; --s-returned-bg: #33194d; --s-missing: #f87171; --s-missing-bg: #3a1717;
  }
}
:root[data-theme="dark"] {
  --s-approved: #4ade80; --s-approved-bg: #12321f; --s-submitted: #9dbcff; --s-submitted-bg: #172a55;
  --s-draft: #fbbf24; --s-draft-bg: #3a2a0c; --s-returned: #d8b4fe; --s-returned-bg: #33194d; --s-missing: #f87171; --s-missing-bg: #3a1717;
}

body { font-size: 15px; }
.card { border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(13, 37, 43, .05); }
.card-h h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-h p { font-size: 13.5px; max-width: 68ch; }
.step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: 13px; font-weight: 700; flex: none; }
.count { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; font-variant-numeric: tabular-nums; }
.txt-bad { color: var(--s-missing); font-weight: 600; }
.btn.big { height: 48px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn.big .ico { width: 18px; height: 18px; }

/* ---- Rapportstatus ---- */
.chip[class*="st-"] { border-color: transparent; }
.chip.st-approved { background: var(--s-approved-bg); color: var(--s-approved); }
.chip.st-submitted { background: var(--s-submitted-bg); color: var(--s-submitted); }
.chip.st-draft { background: var(--s-draft-bg); color: var(--s-draft); }
.chip.st-returned { background: var(--s-returned-bg); color: var(--s-returned); }
.chip.st-missing { background: var(--s-missing-bg); color: var(--s-missing); }
.chip.st-nowork, .chip.st-off, .chip.st-future, .chip.st-pre { background: var(--s-neutral-bg); color: var(--s-neutral); }
.chip[class*="st-"]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.rs-approved { --rs: var(--s-approved); --rs-bg: var(--s-approved-bg); }
.rs-submitted { --rs: var(--s-submitted); --rs-bg: var(--s-submitted-bg); }
.rs-draft { --rs: var(--s-draft); --rs-bg: var(--s-draft-bg); }
.rs-returned { --rs: var(--s-returned); --rs-bg: var(--s-returned-bg); }
.rs-missing { --rs: var(--s-missing); --rs-bg: var(--s-missing-bg); }
.rs-nowork, .rs-off, .rs-pre, .rs-future { --rs: var(--s-neutral); --rs-bg: var(--s-neutral-bg); }

/* Weekstrook op het dagscherm: kleur volgt de rapportstatus in plaats van enkel "iets ingegeven". */
.wday.rs-approved, .wday.rs-submitted, .wday.rs-draft, .wday.rs-returned, .wday.rs-missing, .wday.rs-nowork { background: var(--rs-bg); color: var(--ink); box-shadow: inset 0 -3px 0 var(--rs); }
.wday.sel { outline: 2px solid var(--ink); outline-offset: 1px; }

/* ---- Statuspaneel ---- */
.statuscard { border-left: 5px solid var(--rs, var(--line-strong)); gap: 12px; }
.status-top { display: flex; gap: 14px; align-items: center; justify-content: space-between; }
.status-main { display: grid; gap: 4px; min-width: 0; }
.status-main h2 { font-size: 19px; }
.status-main p { margin: 0; }
.progress { position: relative; width: 58px; height: 58px; flex: none; display: grid; place-items: center; }
.progress svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.progress circle { fill: none; stroke-width: 3.5; }
.pg-bg { stroke: var(--line); }
.pg-fg { stroke: var(--brand); stroke-linecap: round; transition: stroke-dasharray .3s; }
.progress b { font-size: 14px; font-variant-numeric: tabular-nums; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.check-item { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; min-height: 44px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600; }
.check-item:hover { border-color: var(--brand); }
.check-item > i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--s-missing); flex: none; }
.check-item.adv > i { border-color: var(--field-line); border-style: dashed; }
.check-item.adv { font-weight: 500; }
.check-item > span:first-of-type { flex: 1; min-width: 0; }
.check-item .ico { color: var(--muted); }
.flags { display: flex; gap: 6px; flex-wrap: wrap; }
.status-actions { gap: 8px; }
.pulse { animation: pulse 1.4s ease-out; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--brand); } 100% { box-shadow: 0 0 0 14px transparent; } }

/* Vaste indienbalk onderaan: de volgende stap blijft in beeld tijdens het invullen. */
.submitbar { position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 14px; background: var(--nav); color: var(--nav-ink); box-shadow: 0 8px 24px rgba(13, 37, 43, .25); }
.submitbar .sb-text { font-weight: 600; }
.submitbar .btn { border-color: transparent; }
.submitbar .btn:not(.primary) { background: var(--nav-2); color: var(--nav-ink); }

/* ---- Snel starten en snelkeuzes ---- */
.quick { border-color: var(--brand); background: linear-gradient(var(--brand-soft), var(--panel) 120px); }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.qbtn { display: flex; align-items: center; gap: 12px; text-align: left; min-height: 64px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--panel); cursor: pointer; }
.qbtn:hover { border-color: var(--brand); }
.qbtn > span { display: grid; gap: 1px; min-width: 0; }
.qbtn b { overflow-wrap: anywhere; }
.qbtn .small { color: var(--muted); }
.qbtn .ico { width: 22px; height: 22px; color: var(--brand); }
.qbtn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.qbtn.primary .ico, .qbtn.primary .small { color: inherit; }
.tagrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--field-line); background: var(--panel); color: var(--ink); font-weight: 600; cursor: pointer; }
span.tag { cursor: default; }
.tag:hover:not(span) { border-color: var(--brand); }
.tag.on, .tag[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.tag.on::before, .tag[aria-pressed="true"]::before { content: "✓"; font-weight: 700; }
.tag.big { min-height: 48px; }
.tag .ico { width: 15px; height: 15px; }
.temp { width: 84px; }
.fgrid.sub { padding-left: 12px; border-left: 3px solid var(--line-strong); }
#secSite { gap: 16px; }
#secSite > .f { display: grid; gap: 6px; }
.seg.wide { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); height: auto; }
.seg.wide button { min-height: var(--field-h); padding: 8px 10px; line-height: 1.2; color: var(--ink); }
.seg.safety .sf-ok[aria-pressed="true"] { background: var(--s-approved-bg); color: var(--s-approved); box-shadow: inset 0 -3px 0 var(--s-approved); }
.seg.safety .sf-remark[aria-pressed="true"] { background: var(--s-draft-bg); color: var(--s-draft); box-shadow: inset 0 -3px 0 var(--s-draft); }
.seg.safety .sf-incident[aria-pressed="true"] { background: var(--s-missing-bg); color: var(--s-missing); box-shadow: inset 0 -3px 0 var(--s-missing); }
.applyall { padding-top: 2px; }

/* ---- Opvolging ---- */
.ov-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ov-today { margin: 0; font-weight: 600; color: var(--muted-strong); text-transform: capitalize; }
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi-tile { display: grid; gap: 2px; text-align: left; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); border-top: 4px solid var(--kt, var(--line-strong)); background: var(--panel); cursor: pointer; min-height: 76px; }
.kpi-tile b { font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--kt-ink, var(--ink)); }
.kpi-tile span { font-size: 13px; font-weight: 600; color: var(--muted-strong); }
.kpi-tile.review { --kt: var(--s-submitted); --kt-ink: var(--s-submitted); }
.kpi-tile.warn { --kt: var(--s-draft); --kt-ink: var(--s-draft); }
.kpi-tile.bad { --kt: var(--s-missing); --kt-ink: var(--s-missing); }
.kpi-tile.zero { --kt: var(--line-strong); }
.kpi-tile.zero b { color: var(--muted); }
.kpi-tile:hover { border-color: var(--brand); border-top-color: var(--kt, var(--brand)); }
.kpi-tile[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; background: var(--panel-2); }
.ov-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ov-row { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 8px 10px 8px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.ov-row:hover { border-color: var(--brand); background: var(--panel-2); }
.ov-date { display: grid; justify-items: center; width: 52px; flex: none; padding: 5px 0; border-radius: 9px; background: var(--rs-bg, var(--panel-2)); color: var(--ink); line-height: 1.15; box-shadow: inset 0 -3px 0 var(--rs, transparent); }
.ov-date b { font-size: 19px; font-variant-numeric: tabular-nums; }
.ov-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.ov-main b { overflow-wrap: anywhere; }
.ov-end { display: flex; align-items: center; gap: 8px; flex: none; color: var(--muted); }
.today-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.today-card { border-left: 5px solid var(--rs, var(--line-strong)); }
.today-card h2 { font-size: 19px; overflow-wrap: anywhere; }
.today-card p { margin: 0; }
.today-card .btn { width: 100%; }
.mx { display: grid; gap: 14px; }
.mx-site { display: grid; gap: 6px; }
.mx-site + .mx-site { padding-top: 14px; border-top: 1px solid var(--line); }
.mx-head { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; justify-content: space-between; }
.mx-name { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 0; cursor: pointer; text-align: left; min-width: 0; }
.mx-name b { overflow-wrap: anywhere; }
.mx-name:hover b { text-decoration: underline; }
.mx-days { display: grid; grid-template-columns: repeat(var(--n, 14), minmax(0, 1fr)); gap: 4px; }
.mx-cell { display: grid; justify-items: center; gap: 0; padding: 4px 0 3px; border-radius: 8px; border: 1px solid transparent; background: var(--rs-bg, var(--panel-2)); color: var(--ink); cursor: pointer; font-size: 11px; line-height: 1.2; min-height: 54px; min-width: 0; }
.mx-cell b { font-size: 14px; font-variant-numeric: tabular-nums; }
.mx-cell i { font-style: normal; font-weight: 800; font-size: 13px; color: var(--rs); min-height: 16px; }
.mx-cell.rs-future, .mx-cell.rs-pre { background: var(--panel); border: 1px dashed var(--line-strong); color: var(--muted-strong); }
.mx-cell.today { outline: 2px solid var(--ink); outline-offset: 1px; }
.mx-cell:hover { border-color: var(--brand); }
.legend i.lg { width: 18px; height: 18px; display: inline-grid; place-items: center; background: var(--rs-bg); color: var(--rs); font-style: normal; font-weight: 800; font-size: 12px; border-radius: 5px; vertical-align: -4px; }
.remind { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.remind p { margin: 0; }

/* Kalender: rapportstatus als onderlijn en symbool bij elke dag. */
.cell[class*="rv-"] { box-shadow: inset 0 -4px 0 var(--rs); }
.rv-approved { --rs: var(--s-approved); } .rv-submitted { --rs: var(--s-submitted); } .rv-draft { --rs: var(--s-draft); } .rv-returned { --rs: var(--s-returned); }
.ag-row .chip { margin-left: 6px; }

/* ---- Indeling dagrapport (dialoog) ---- */
.cfg-set { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; margin: 0; display: grid; gap: 6px; min-width: 0; }
.cfg-set legend { font-weight: 700; font-size: 13px; padding: 0 6px; }
.cfg-set p { margin: 0; }
.cfg-check { display: flex; align-items: center; gap: 10px; }
.cfg-check > span { display: grid; }
.cfg-check b { font-weight: 600; }
.cfg-fields { display: grid; gap: 10px; }
.cfg-field { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; padding: 8px; border-radius: 8px; background: var(--panel-2); }
.cfg-field .grow { flex: 1 1 180px; }
.dlg { display: grid; gap: 12px; }

@media (max-width: 700px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .submitbar { bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
  .status-actions .btn, .statuscard .btn.big { flex: 1 1 100%; }
  .seg.wide { grid-auto-flow: row; }
  .seg.wide button + button { border-left: 0; border-top: 1px solid var(--field-line); }
  .tag { min-height: 44px; }
  .mx-days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .ov-row { align-items: flex-start; }
  .ov-end { flex-direction: column; align-items: flex-end; }
  .ov-end .ico { display: none; }
  .dayactions .btn:first-child:nth-last-child(3) { grid-column: auto; }
  .toast { bottom: calc(136px + env(safe-area-inset-bottom, 0px)); }
}
@media (min-width: 701px) {
  .mx-days { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
}
@media print { .statuscard .checklist, .submitbar, .quick { display: none !important; } }

/* Lijsten krimpen mee met smalle schermen: lange werfnamen en aandachtspunten breken af in plaats van te duwen. */
.ov-list, .checklist, .mx, .mx-site { grid-template-columns: minmax(0, 1fr); }
.ov-list > li, .checklist > li { min-width: 0; }
.flags .chip, .ov-row .chip.warn, .ov-row .chip.bad { white-space: normal; text-align: left; border-radius: 10px; }
.card, .page { grid-template-columns: minmax(0, 1fr); }
.ov-main > .small { overflow-wrap: anywhere; }

/* ---- Ronde 2 ---- */
.chip.st-changed { background: var(--s-missing-bg); color: var(--s-missing); }
.rs-changed { --rs: var(--s-missing); --rs-bg: var(--s-submitted-bg); }
.wday.rs-changed { background: var(--rs-bg); color: var(--ink); box-shadow: inset 0 -3px 0 var(--rs); }
.ws-g { font-style: normal; font-weight: 800; }
.ov-today { text-transform: none; }
.ov-today::first-letter { text-transform: uppercase; }
.rvlog summary { cursor: pointer; font-weight: 600; color: var(--muted-strong); min-height: 32px; display: flex; align-items: center; }
.rvlog ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13.5px; }
.tooladd > summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: var(--field-h); padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); font-weight: 600; list-style: none; }
.tooladd > summary::-webkit-details-marker { display: none; }
.tooladd[open] > summary { margin-bottom: 12px; }
.tooladd { display: grid; gap: 12px; }
.tooladd > .fgrid + .fgrid { margin-top: 12px; }
.submitbar .row { gap: 8px; flex-wrap: nowrap; }
@media (max-width: 700px) { .submitbar .sb-text { font-size: 13px; } .submitbar .btn.big { padding: 0 12px; } }
@media (max-width: 700px) { .submitbar.lead .sb-text { display: none; } .submitbar.lead .row { flex: 1; } .submitbar.lead .btn { flex: 1; } }
