/* Huisstijl d'Ouffenhoff: oranje, groen, donkerbruin op warm crème */
:root {
  --bg: #f7f2ea;
  --card: #ffffff;
  --ink: #3d3129;
  --muted: #7a6a5c;
  --line: #e7ddd0;
  --accent: #d0661a;
  --accent-ink: #ffffff;
  --accent-text: #b0520f;
  --accent-soft: #fcebdc;
  --good: #5f8a1c;
  --good-soft: #eef5df;
  --warn-bg: #fff1d6;
  --warn-ink: #6b4a00;
  --err: #b3261e;
  --shadow: 0 1px 2px rgba(61, 49, 41, .06), 0 4px 14px rgba(61, 49, 41, .06);
  --radius: 18px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1814;
    --card: #2a231d;
    --ink: #f3ece4;
    --muted: #b5a595;
    --line: #40362d;
    --accent: #ee8a3c;
    --accent-ink: #241306;
    --accent-text: #f2a066;
    --accent-soft: #3d2a1b;
    --good: #9cc44f;
    --good-soft: #2a3319;
    --warn-bg: #3a2f12;
    --warn-ink: #f5d27a;
    --err: #ff8a80;
    --shadow: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 18px/1.4 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  -webkit-user-select: none; user-select: none;
}
main { max-width: 560px; margin: 0 auto; padding: 16px; min-height: 100vh; display: flex; flex-direction: column; gap: 14px; }
h1 { font-size: 26px; margin: 4px 0 0; letter-spacing: -.3px; }
h2 { font-size: 15px; margin: 10px 0 0; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }

/* merkbalk: logo altijd op wit, ook in donkere modus */
.brand { background: #fff; border-radius: var(--radius); padding: 10px 14px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.brand img { height: 52px; width: auto; display: block; }
.brand .who { margin-left: auto; text-align: right; color: #7a6a5c; font-size: 14px; line-height: 1.2; }
.brand .who b { display: block; color: #3d3129; font-size: 16px; }
.brand .menu { width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; border-radius: 12px; border: 1.5px solid #e7ddd0; background: #fff; color: #3d3129; font-size: 20px; flex: none; }
.brand.big { flex-direction: column; padding: 22px; margin-top: 8px; }
.brand.big img { height: 96px; }

button, .btn {
  font: inherit; color: var(--ink); background: var(--card); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 16px; min-height: 64px; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 10px; width: 100%; box-shadow: var(--shadow);
  transition: transform .08s, background-color .15s, border-color .15s;
}
button:active { transform: scale(.97); }
button:disabled { opacity: .45; box-shadow: none; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 800; justify-content: center; text-align: center; font-size: 22px; min-height: 80px; }
.big { min-height: 112px; font-size: 30px; }
.link { background: none; border: none; box-shadow: none; color: var(--accent-text); min-height: 44px; padding: 8px; width: auto; justify-content: center; font-weight: 600; }
.small { min-height: 44px; padding: 8px 14px; font-size: 16px; width: auto; }

.badge { margin-left: auto; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 99px; color: var(--accent-text); background: var(--accent-soft); white-space: nowrap; }
.badge.done { color: var(--good); background: var(--good-soft); }
.badge.bad { color: var(--err); background: none; border: 1.5px solid var(--err); }

.next { font-size: 22px; font-weight: 800; border-color: var(--accent); }
.next small { display: block; font-size: 14px; font-weight: 600; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grid button { justify-content: center; font-size: 22px; font-weight: 800; min-height: 66px; padding: 6px; position: relative; }
.grid button.done { border-color: var(--good); color: var(--good); background: var(--good-soft); }
.grid button.done::after { content: "✓"; position: absolute; top: 3px; right: 7px; font-size: 14px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { flex-direction: column; justify-content: center; text-align: center; min-height: 100px; gap: 6px; font-weight: 700; }
.tile .ico { font-size: 34px; line-height: 1; }
.tile.on, .check.on { border-color: var(--accent); background: var(--accent-soft); }
.tile.on { box-shadow: inset 0 0 0 2px var(--accent); }

.check { box-shadow: none; }
.check .box { width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 800; flex: none; }
.check.on { border-color: var(--good); background: var(--good-soft); }
.check.on .box { background: var(--good); border-color: var(--good); color: #fff; }
.check:not(.on) .lbl { text-decoration: line-through; color: var(--muted); }

.house-head { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); text-align: center; }
.house-head .num { font-size: 64px; font-weight: 800; line-height: 1; color: var(--accent-text); }
.house-head .lbl { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }

.timer { font-size: 84px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -2px; line-height: 1; margin-top: 6px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.list { display: flex; flex-direction: column; gap: 8px; }
.list button { min-height: 58px; font-size: 17px; }
.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius); padding: 12px 14px; }
.err { color: var(--err); }

input, textarea {
  font: inherit; width: 100%; padding: 14px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--card); color: var(--ink); -webkit-user-select: text; user-select: text;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 100px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }

.pin-dots { display: flex; justify-content: center; gap: 18px; margin: 18px 0; }
.pin-dots span { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--accent); }
.pin-dots span.f { background: var(--accent); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { justify-content: center; font-size: 30px; font-weight: 700; min-height: 76px; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }

.scan-wrap { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 3/4; }
.scan-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-wrap .frame { position: absolute; inset: 18%; border: 4px solid #fff; border-radius: 20px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

.rec { color: var(--err); font-weight: 800; }
.sync { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.sync.pending { color: var(--warn-ink); }
.sync.pending::before { background: var(--accent); }
.sync.off::before { background: var(--muted); }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--good); color: #fff; padding: 14px 24px; border-radius: 99px; font-weight: 800; transition: transform .25s, opacity .25s; z-index: 9; max-width: 90vw; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.bad { background: var(--err); }

/* taalkeuze */
.langs { display: flex; justify-content: center; gap: 8px; }
.lang { width: 52px; height: 44px; min-height: 44px; padding: 0; justify-content: center; font-size: 24px; border-radius: 12px; box-shadow: none; }
.lang.on { border-color: var(--accent); background: var(--accent-soft); }

/* dagstatus */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: -4px; }
.chip { font-size: 14px; padding: 5px 12px; border-radius: 99px; background: var(--card); border: 1.5px solid var(--line); color: var(--muted); font-weight: 600; }
.chip b { font-size: 16px; color: var(--ink); }
.chip.done { border-color: var(--good); } .chip.done b { color: var(--good); }
.chip.busy { border-color: var(--accent); } .chip.busy b { color: var(--accent-text); }
.chip.issue { border-color: var(--err); } .chip.issue b { color: var(--err); }
.progress { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: -4px; }
.progress span { display: block; height: 100%; background: var(--good); border-radius: 99px; transition: width .4s; }

/* raster met status */
.grid button { flex-direction: column; gap: 0; line-height: 1.05; }
.grid button small { font-size: 11px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid button.done::after { content: none; }
.grid button.busy { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.grid button.busy::before { content: ""; position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; }
.grid .dot { position: absolute; top: 6px; left: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--err); box-shadow: 0 0 0 2px var(--card); }
.legend { font-size: 13px; margin: -4px 0 0; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }

/* lopende beurt */
.live { font-size: 12px; font-weight: 800; color: var(--accent-text); letter-spacing: 1px; animation: pulse 2s infinite; }
.ring { --p: 0%; width: 232px; height: 232px; margin: 6px auto 0; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--bg) 87%, transparent 88% 100%), conic-gradient(var(--good) var(--p), var(--line) 0); }
.ring.over { background: radial-gradient(closest-side, var(--bg) 87%, transparent 88% 100%), conic-gradient(var(--accent) 0 100%); }
.ring .timer { font-size: 66px; margin: 0; }
.ring .muted { font-size: 14px; }
.secondary { justify-content: center; text-align: center; font-weight: 700; min-height: 56px; color: var(--ink); }

/* meldingen */
.issues { border-color: var(--err); }
.issues .issue { font-size: 15px; padding: 4px 0; border-top: 1px solid var(--line); }
.issues .issue:first-of-type { border-top: 0; }
.thumb { width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--radius); }
