:root {
  --bg: #f5f6f4; --surface: #ffffff; --surface-2: #eef0ec; --text: #1f2328; --muted: #5f6b66; --border: #d8ddd6;
  --primary: #7b1c38; --primary-hover: #511123; --primary-soft: #f4dfe5; --danger: #c62828; --warn-bg: #fff4d6; --warn: #7a5a00;
  --ok: #1a7f37; --shadow: 0 1px 2px #0000001a, 0 0 1px #00000030; --topbar: #511123; --navy: #0f1c2d; --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141816; --surface: #1d2320; --surface-2: #272e2a; --text: #e3e8e5; --muted: #9aa8a1; --border: #34403a;
    --primary: #e58aa3; --primary-hover: #f2b3c4; --primary-soft: #3a1a24; --danger: #ff7b72; --warn-bg: #3d3110; --warn: #f2d27a;
    --ok: #56d364; --shadow: 0 1px 2px #00000080; --topbar: #3a0c19; --navy: #0f1c2d; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); }
h1 { font-size: 22px; margin: 0 0 12px; } h2 { font-size: 18px; margin: 0 0 8px; } h3 { font-size: 15px; margin: 0; }
[hidden] { display: none !important; }
button, .button, input, select, textarea { font: inherit; color: inherit; }
button, .button { background: var(--surface-2); border: 1px solid transparent; border-radius: 6px; padding: 6px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; line-height: 20px; text-decoration: none; }
button:hover { filter: brightness(.96); }
button.primary, .button.primary { background: var(--primary); color: #fff; }
@media (prefers-color-scheme: dark) { button.primary, .button.primary { color: #2a0912; } }
button.ghost { background: transparent; border-color: var(--border); }
button.link { background: none; border: 0; padding: 0; color: var(--primary); }
button.link:hover { text-decoration: underline; }
button.danger, .danger { color: var(--danger); }
button.small { font-size: 13px; padding: 3px 9px; }
button:disabled { opacity: .55; cursor: default; }
input, select, textarea { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--primary); margin: 0; }
input[type=color] { padding: 2px; height: 36px; width: 56px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
label > input, label > select, label > textarea { font-weight: 400; font-size: 15px; color: var(--text); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; color: var(--text); cursor: pointer; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.error { color: var(--danger); }
.notice { background: var(--warn-bg); color: var(--warn); padding: 8px 12px; border-radius: 6px; }
.row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .spacer { flex: 1; } .grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }

/* Bovenbalk */
.topbar { background: var(--topbar); border-bottom: 4px solid var(--navy); color: #fff; display: flex; align-items: center; gap: 4px; padding: 0 12px; height: 52px; position: sticky; top: 0; z-index: 20; }
.topbar .brand { font-weight: 700; margin-right: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; color: #fff; text-decoration: none; }
.topbar nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.topbar nav a { color: #f1d9e0; text-decoration: none; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.topbar nav a.active, .topbar nav a:hover { background: #ffffff22; color: #fff; }
.topbar .me { color: #f1d9e0; white-space: nowrap; }
@media (max-width: 700px) { .topbar { height: auto; flex-wrap: wrap; padding: 6px 10px; } .topbar nav { order: 3; width: 100%; } .topbar .brand { max-width: 60vw; } }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.section { margin-bottom: 16px; }

/* Agenda */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-head h1 { margin: 0; min-width: 190px; text-transform: capitalize; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { border-radius: 0; background: var(--surface); border: 0; }
.seg button.on { background: var(--primary); color: #fff; }
.team-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 13px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; }
.chip.off { opacity: .45; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--border); gap: 1px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.month .dow { background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px; text-align: center; }
.month .day { background: var(--surface); min-height: 112px; padding: 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.month .day.other { background: var(--surface-2); }
.month .day.today .num { background: var(--primary); color: #fff; border-radius: 50%; }
.month .num { font-size: 12px; width: 22px; height: 22px; display: grid; place-items: center; color: var(--muted); }
.ev { display: block; border-radius: 5px; padding: 2px 6px; font-size: 12px; line-height: 16px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 4px solid; text-align: left; width: 100%; }
.ev.cancelled { text-decoration: line-through; opacity: .55; }
.ev .need { float: right; margin-left: 4px; font-weight: 700; }
.ev.mine { box-shadow: inset 0 0 0 2px var(--primary); }
.more { font-size: 12px; color: var(--muted); }
@media (max-width: 760px) { .month .day { min-height: 70px; } .ev { font-size: 11px; padding: 1px 3px; } .ev .t { display: none; } }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week .col { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; min-height: 200px; display: flex; flex-direction: column; gap: 6px; }
.week .col h3 { font-size: 13px; text-transform: capitalize; }
.week .ev { white-space: normal; padding: 5px 7px; }
@media (max-width: 900px) { .week { grid-template-columns: 1fr; } .week .col { min-height: 0; } }
.agenda-list .daygroup { margin-bottom: 14px; }
.agenda-list .daygroup h3 { text-transform: capitalize; margin-bottom: 6px; }
.agenda-list .ev { white-space: normal; font-size: 14px; padding: 8px 10px; line-height: 20px; margin-bottom: 4px; }
.legend { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* Bezetting */
.badge { display: inline-block; border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 600; line-height: 20px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.full { background: #dafbe1; color: #116329; }
.badge.short { background: #ffebe9; color: #a40e26; }
@media (prefers-color-scheme: dark) { .badge.full { background: #12361f; color: #7ee2a1; } .badge.short { background: #4a1418; color: #ffa198; } }

/* Evenement */
.ev-header { border-radius: var(--radius); padding: 16px; color: #fff; margin-bottom: 14px; }
.ev-header h1 { margin: 2px 0 4px; }
.ev-header .meta { opacity: .92; display: flex; gap: 14px; flex-wrap: wrap; }
.ev-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .ev-layout { grid-template-columns: 1fr; } }
.dept-block { margin-bottom: 14px; }
.dept-block > h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.dept-block > h2 .bar { width: 6px; height: 18px; border-radius: 3px; }
.task { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 8px; }
.task.done { opacity: .7; }
.task.cancelled { opacity: .5; }
.task-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.task-title { font-weight: 600; }
.kind { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.people { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.person { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 999px; padding: 2px 10px 2px 2px; font-size: 13px; }
.person.me { background: var(--primary-soft); }
.person button { background: none; border: 0; padding: 0 0 0 2px; color: var(--muted); }
.slot-free { border: 1px dashed var(--border); border-radius: 999px; padding: 2px 10px; font-size: 13px; color: var(--muted); }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 600; flex-shrink: 0; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.items { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.item { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--surface-2); }
.item.done .txt { text-decoration: line-through; color: var(--muted); }
.item select { width: auto; max-width: 150px; padding: 3px 6px; font-size: 13px; }
.item .qty { color: var(--muted); font-size: 13px; }
.add-item { display: flex; gap: 6px; margin-top: 6px; }
.add-item input { padding: 5px 8px; }
.comments { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.comment { font-size: 14px; background: var(--surface-2); border-radius: 8px; padding: 6px 10px; }
.comment .who { font-weight: 600; font-size: 12px; }
.sub-select { width: auto; font-size: 13px; padding: 3px 6px; }
.history { font-size: 13px; display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow: auto; }
.history .h-at { color: var(--muted); font-size: 12px; }
details > summary { cursor: pointer; color: var(--muted); font-size: 13px; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--surface-2); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 6px; text-decoration: none; color: var(--text); background: var(--surface-2); }
.tabs a.active { background: var(--primary); color: #fff; }
.swatch { width: 18px; height: 18px; border-radius: 4px; display: inline-block; vertical-align: middle; }
.dept-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.dept-card { border-top: 5px solid; cursor: pointer; }
.rule { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--surface-2); flex-wrap: wrap; }

/* Inloggen */
.login { max-width: 380px; margin: 10vh auto; }
.login .card { padding: 24px; }

/* Modaal en meldingen */
.overlay { position: fixed; inset: 0; background: #0008; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; z-index: 50; overflow: auto; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 520px; position: relative; box-shadow: 0 10px 40px #0005; }
.modal.wide { max-width: 760px; }
.modal-close { position: absolute; top: 8px; right: 8px; background: none; border: 0; font-size: 22px; color: var(--muted); }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(120px); background: #1f2328; color: #fff; padding: 10px 16px; border-radius: 8px; transition: transform .2s; z-index: 100; max-width: 90vw; }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); }
.popover { position: fixed; background: var(--surface); border-radius: 8px; box-shadow: 0 8px 30px #0004; padding: 10px; z-index: 60; }
.popover-head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.pw-rules { list-style: none; margin: 4px 0 0; padding: 0; font-weight: 400; font-size: 13px; color: var(--muted); display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.pw-rules li.ok { color: var(--ok); }
@media (max-width: 420px) { .pw-rules { grid-template-columns: 1fr; } }
.person.swap { background: var(--warn-bg); }
.swap-tag { font-size: 11px; color: var(--warn); margin-left: 2px; }
a.button.wa { text-decoration: none; color: inherit; }
.join-card .row { margin-top: 8px; }
.stat { font-size: 28px; font-weight: 700; color: var(--primary); }
