:root {
  --bg: #f6f7fb; --card: #ffffff; --text: #1b1f2a; --muted: #6b7280; --border: #e3e6ee;
  --accent: #2563eb; --accent-text: #ffffff; --danger: #dc2626; --today: #eaf1ff;
  --shadow: 0 1px 3px rgba(20, 30, 60, .08), 0 4px 16px rgba(20, 30, 60, .06);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218; --card: #181c25; --text: #eceef4; --muted: #98a0b3; --border: #272c38;
    --accent: #5b8cff; --accent-text: #0b1020; --today: #1c2742; --danger: #f87171;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: contain;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.shell { display: flex; flex-direction: column; min-height: 100dvh; max-width: 1100px; margin: 0 auto; }
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 8px;
  display: flex; align-items: center; gap: 8px;
}
.topbar h1 { flex: 1; font-size: 1.25rem; text-transform: capitalize; }
.iconbtn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); display: grid; place-items: center; font-size: 1.1rem; flex: none;
}
.iconbtn:active { transform: scale(.95); }
.textbtn { border: 1px solid var(--border); background: var(--card); border-radius: 12px; padding: 8px 12px; height: 40px; }
.content { flex: 1; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }

.filters { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1.5px solid var(--c, var(--border)); background: var(--card); white-space: nowrap; flex: none; font-size: .9rem;
}
.chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); display: inline-block; }
.chip.off { opacity: .45; border-color: var(--border); }
.chip.on { background: color-mix(in srgb, var(--c) 16%, var(--card)); }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--card); border-top: 1px solid var(--border);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav button {
  flex: 1; max-width: 220px; background: none; border: 0; padding: 10px 4px 8px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .75rem;
}
.bottomnav button span { font-size: 1.3rem; line-height: 1; }
.bottomnav button.active { color: var(--accent); font-weight: 600; }
.fab {
  position: fixed; right: 18px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 7;
  width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--accent); color: var(--accent-text);
  font-size: 2rem; line-height: 1; box-shadow: 0 6px 20px rgba(37, 99, 235, .4);
}

/* ---------- maandraster ---------- */
.month { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.dow, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dow div { text-align: center; font-size: .72rem; color: var(--muted); padding: 8px 0 4px; text-transform: uppercase; }
.cell {
  min-height: 62px; border: 0; border-top: 1px solid var(--border); background: none; padding: 4px 3px; text-align: left;
  display: flex; flex-direction: column; gap: 2px; overflow: hidden;
}
.cell.other { opacity: .4; }
.cell.today { background: var(--today); }
.cell.sel { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.cell .num { font-size: .8rem; align-self: center; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.cell.today .num { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.bar { height: 6px; border-radius: 3px; flex: none; }
.bar .t { display: none; }
.more { font-size: .65rem; color: var(--muted); text-align: center; }
@media (min-width: 700px) {
  .cell { min-height: 112px; padding: 4px 6px; }
  .bar { height: auto; padding: 1px 6px; font-size: .75rem; color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .35); border-radius: 5px; }
  .bar .t { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cell .num { align-self: flex-start; }
}

/* ---------- lijsten ---------- */
.daylist { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.daytitle { font-weight: 600; text-transform: capitalize; margin: 16px 2px 4px; color: var(--muted); font-size: .9rem; }
.empty { color: var(--muted); text-align: center; padding: 20px 8px; }
.ev {
  display: flex; gap: 12px; text-align: left; width: 100%; background: var(--card); border: 0; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px 12px 12px; align-items: stretch;
}
.ev .stripe { width: 6px; border-radius: 3px; flex: none; }
.ev .time { width: 52px; flex: none; font-size: .85rem; color: var(--muted); line-height: 1.3; }
.ev .body { flex: 1; min-width: 0; }
.ev .ttl { font-weight: 600; overflow-wrap: anywhere; }
.ev .sub { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.avatars { display: flex; margin-top: 6px; }
.av {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 700;
  color: #fff; border: 2px solid var(--card); margin-right: -4px; text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
}

/* ---------- formulieren, kaarten ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 1rem; margin-bottom: 10px; }
.card p.hint { color: var(--muted); font-size: .85rem; margin: 6px 0 10px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=time],
input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
  min-height: 44px;
}
textarea { min-height: 72px; resize: vertical; }
input[type=color] { width: 48px; height: 44px; padding: 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--text); font-size: 1rem; }
.check input { width: 20px; height: 20px; flex: none; }
.btn {
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 600; min-height: 44px;
}
.btn.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: none; color: var(--danger); border: 1px solid var(--danger); }
.btn:disabled { opacity: .5; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.note { font-size: .85rem; padding: 8px 12px; border-radius: 10px; background: var(--today); margin: 6px 0 10px; }
.warn { background: color-mix(in srgb, #f59e0b 20%, var(--card)); }
.err { color: var(--danger); font-size: .9rem; min-height: 1.2em; margin: 4px 0; }
.member { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }

/* ---------- modal ---------- */
.backdrop {
  position: fixed; inset: 0; background: rgba(10, 14, 25, .5); z-index: 20; display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--card); width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
@media (min-width: 700px) { .backdrop { align-items: center; } .sheet { border-radius: 22px; } }
.sheet h2 { margin-bottom: 14px; }
.people { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.people .chip { cursor: pointer; }

/* ---------- login / slot ---------- */
.center { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 14px; text-align: center; }
.center h1 { font-size: 1.5rem; }
.pickers { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 420px; }
.picker { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 84px; font-size: .9rem; }
.picker .big { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; color: #fff; border: 3px solid transparent; }
.picker.sel .big { border-color: var(--text); }
.loginform { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 10px; }
.bigav { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 2.2rem; font-weight: 700; color: #fff; }
.dots { display: flex; gap: 14px; height: 18px; margin: 4px 0 8px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); }
.dots i.f { background: var(--text); border-color: var(--text); }
.pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; }
.pad button { height: 76px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); font-size: 1.7rem; }
.pad button:active { background: var(--today); }
.pad .ghost { border: 0; background: none; font-size: 1.1rem; color: var(--muted); }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none;
  transition: .25s; z-index: 50; max-width: 90vw; font-size: .9rem;
}
#toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- kinderverblijf: bij ons / niet bij ons ---------- */
:root { --home: #0d9488; }
@media (prefers-color-scheme: dark) { :root { --home: #2dd4bf; } }
.stay { display: flex; gap: 1px; height: 5px; margin: -4px -3px 2px; }
.stay .seg { flex: 1; display: block; }
.seg.home { background: var(--home); }
.seg.none { background: transparent; }
.cell.tint-home { background: color-mix(in srgb, var(--home) 14%, var(--card)); }
.staycard { margin-top: 8px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.stayrow { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.stayrow .dot, .legend .dot { width: 12px; height: 12px; border-radius: 3px; flex: none; display: inline-block; }
.stayrow.home .dot, .legend .dot.home { background: var(--home); }
.legend { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.statuspick { display: flex; gap: 10px; margin-bottom: 12px; }
.statusbtn { flex: 1; padding: 12px 8px; border-radius: 12px; border: 2px solid var(--border); background: var(--bg); font-weight: 600; }
.statusbtn.home.on { border-color: var(--home); background: color-mix(in srgb, var(--home) 18%, var(--card)); }
.staylist { margin-top: 8px; }
.stayitem { display: flex; gap: 8px; align-items: center; padding: 10px 0 10px 10px; border-left: 5px solid var(--home); border-top: 1px solid var(--border); }
.stayitem.home { border-left-color: var(--home); }
.stayitem .body { flex: 1; min-width: 0; }
.stayitem .btn { padding: 8px 12px; min-height: 40px; }
