/* ====== Thema (licht + donker via systeeminstelling) ====== */
:root {
  --bg: #f6f7fa;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --border: #e8eaf1;
  --divider: #f0f1f6;
  --text: #1a1e2d;
  --dim: #6d7385;
  --faint: #9ba1b3;

  --primary: #355070;
  --primary-dark: #27405c;
  --primary-soft: #e4eaf1;
  --on-primary: #ffffff;

  --hoog: #e56b6f;      --hoog-text: #d84f54;   --hoog-soft: #fce6e7;
  --middel: #eaac8b;    --middel-text: #c07a4a; --middel-soft: #fbeadf;
  --laag: #6d597a;      --laag-text: #6d597a;   --laag-soft: #ece7ef;

  --open: #8a93a6;      --open-text: #6d7385;   --open-soft: #eef0f4;
  --bezig: #b56576;     --bezig-text: #a04c5e;  --bezig-soft: #f6e4e8;
  --klaar: #355070;     --klaar-text: #27405c;  --klaar-soft: #e4eaf1;

  --radius-card: 16px;
  --radius-ctl: 12px;
  --radius-chip: 9px;
  --radius-pill: 999px;
  --radius-sheet: 22px;

  --shadow-sm: 0 1px 2px rgba(25, 28, 50, 0.04);
  --shadow: 0 6px 22px rgba(30, 32, 60, 0.10);
  --shadow-sheet: 0 -8px 34px rgba(20, 22, 45, 0.16);
  --shadow-fab: 0 6px 18px rgba(53, 80, 112, 0.4);

  --dim-overlay: rgba(20, 24, 36, 0.45);
  --col: 560px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171a22;
    --surface: #1f232e;
    --surface-2: #262b38;
    --border: #2b3040;
    --divider: #262b38;
    --text: #edeef3;
    --dim: #8b91a3;
    --faint: #6d7488;

    --primary: #eaac8b;
    --primary-dark: #f0c3a8;
    --primary-soft: rgba(234, 172, 139, 0.15);
    --on-primary: #34220f;

    --hoog: #e56b6f;      --hoog-text: #ef8d90;   --hoog-soft: rgba(229, 107, 111, 0.18);
    --middel: #eaac8b;    --middel-text: #f0c3a8; --middel-soft: rgba(234, 172, 139, 0.15);
    --laag: #8d76a0;      --laag-text: #b3a1c0;   --laag-soft: rgba(109, 89, 122, 0.28);

    --open: #8b91a3;      --open-text: #8b91a3;   --open-soft: rgba(139, 145, 163, 0.14);
    --bezig: #b56576;     --bezig-text: #d493a0;  --bezig-soft: rgba(181, 101, 118, 0.22);
    --klaar: #eaac8b;     --klaar-text: #f0c3a8;  --klaar-soft: rgba(234, 172, 139, 0.15);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
    --shadow-sheet: 0 -8px 34px rgba(0, 0, 0, 0.5);
    --shadow-fab: 0 6px 18px rgba(234, 172, 139, 0.25);

    --dim-overlay: rgba(8, 10, 16, 0.6);
  }
}

/* ====== Basis ====== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Montserrat', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font-family: inherit; color: var(--text); }

/* ====== Layout ====== */
.layout { display: flex; min-height: 100vh; }
.container {
  flex: 1; width: 100%; max-width: var(--col); margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 18px calc(100px + env(safe-area-inset-bottom));
  min-width: 0;
}

/* Zijbalk: alleen op brede schermen */
.sidebar { display: none; }
@media (min-width: 900px) {
  .layout { align-items: flex-start; }
  .sidebar {
    display: flex; flex-direction: column; gap: 3px;
    width: 250px; flex-shrink: 0;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--surface); border-right: 1px solid var(--border);
    padding: 22px 14px;
  }
  .container { max-width: 760px; padding-bottom: 40px; }
  .tabbar { display: none !important; }
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 18px; }
.side-brand-icon {
  width: 34px; height: 34px; border-radius: 11px; background: var(--primary-soft);
  display: grid; place-items: center; font-size: 17px;
}
.side-brand-name { font-size: 14px; font-weight: 800; letter-spacing: -0.01em; }
.side-brand-sub { font-size: 10.5px; color: var(--faint); font-weight: 600; }
.side-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px; border: none; background: none;
  font-size: 13.5px; font-weight: 600; color: var(--dim); text-align: left; width: 100%;
}
.side-item:hover { background: var(--surface-2); }
.side-item.active { background: var(--primary-soft); color: var(--primary-dark); }
.side-item .side-count { margin-left: auto; font-size: 11px; color: var(--faint); }
.side-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin: 18px 12px 8px; }
.side-emoji { font-size: 14px; width: 18px; text-align: center; }

/* ====== Tabbar (mobiel) ====== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; padding: 7px 8px calc(10px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; color: var(--faint);
  background: none; border: none; padding-top: 4px;
}
.tab.active { color: var(--primary); }
.tab svg { display: block; }

/* ====== Koppen & secties ====== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 0 0; }
.page-date { font-size: 12px; font-weight: 600; color: var(--dim); }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }
.page-sub { font-size: 12.5px; color: var(--dim); margin-top: 3px; }
.page-emblem {
  width: 36px; height: 36px; border-radius: 12px; background: var(--primary-soft);
  display: grid; place-items: center; font-size: 18px; flex-shrink: 0;
}
.sec-row { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 0; }
.sec-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
}
.sec-link { font-size: 12px; font-weight: 600; color: var(--primary); background: none; border: none; padding: 0; }

/* ====== Kaarten ====== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-sm);
}
.card.tappable { transition: transform 0.12s ease; }
.card.tappable:active { transform: scale(0.985); }

/* ====== Badges, chips, avatars ====== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
.b-open { background: var(--open-soft); color: var(--open-text); }
.b-bezig { background: var(--bezig-soft); color: var(--bezig-text); }
.b-klaar { background: var(--klaar-soft); color: var(--klaar-text); }
.b-hoog { background: var(--hoog-soft); color: var(--hoog-text); }
.b-middel { background: var(--middel-soft); color: var(--middel-text); }
.b-laag { background: var(--laag-soft); color: var(--laag-text); }
.badge .pdot { width: 7px; height: 7px; border-radius: 999px; flex-shrink: 0; }

.dot { width: 7px; height: 7px; border-radius: 999px; display: inline-block; flex-shrink: 0; }

.avatar {
  border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark);
  display: inline-grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.avatar.a-sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.a-md { width: 34px; height: 34px; font-size: 12px; }
.avatar.a-lg { width: 42px; height: 42px; font-size: 14px; }
.avatar.a-none { background: var(--open-soft); color: var(--faint); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; padding: 8px 14px;
  border-radius: var(--radius-pill); border: 1px solid var(--border);
  color: var(--dim); background: var(--surface);
}
.chip.sel { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip .pdot { width: 8px; height: 8px; border-radius: 999px; }

/* Filterchips */
.filter-row { display: flex; gap: 6px; margin: 14px 0 0; flex-wrap: wrap; }
.fchip {
  font-size: 12px; font-weight: 600; padding: 7px 13px;
  border-radius: var(--radius-pill); border: 1px solid var(--border);
  color: var(--dim); background: var(--surface);
}
.fchip.sel { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* ====== Voortgang ====== */
.progress { height: 5px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.progress.thick { height: 7px; }
.progress-fill { height: 100%; border-radius: var(--radius-pill); background: var(--klaar); transition: width 0.4s cubic-bezier(.4,0,.2,1); }
.progress-fill.partial { background: var(--bezig); }
.progress-fill.zero { background: var(--open); }

.ring-card { display: flex; align-items: center; gap: 16px; padding: 16px; margin-top: 16px; }
.ring-title { font-size: 15px; font-weight: 700; }
.ring-sub { font-size: 12.5px; color: var(--dim); margin-top: 3px; line-height: 1.45; }

/* ====== Vandaag ====== */
.attn-card {
  padding: 12px 14px; display: flex; align-items: center; gap: 12px;
  border-left: 3px solid var(--hoog); margin-top: 8px;
}
.attn-title { font-size: 14px; font-weight: 700; }
.attn-sub { font-size: 12px; color: var(--dim); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.attn-side { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex-shrink: 0; }

.upc-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--divider); }
.upc-row:last-child { border-bottom: none; }
.upc-date { width: 42px; text-align: center; flex-shrink: 0; }
.upc-num { font-size: 15px; font-weight: 800; line-height: 1; }
.upc-mon { font-size: 10px; font-weight: 600; color: var(--faint); margin-top: 2px; }
.upc-title { flex: 1; font-size: 13.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upc-side { font-size: 11.5px; color: var(--faint); flex-shrink: 0; }

.mini-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.mini-card { padding: 10px 11px; border: none; text-align: left; }
.mini-top { display: flex; align-items: center; gap: 7px; }
.mini-emoji { font-size: 14px; }
.mini-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ====== Agenda ====== */
.ag-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--divider); width: 100%; background: none; border-left: none; border-right: none; border-top: none; text-align: left; }
.ag-row:last-child { border-bottom: none; }
.ag-title { font-size: 13.5px; font-weight: 600; }
.ag-title.done { text-decoration: line-through; color: var(--faint); }
.ag-sub { font-size: 11.5px; color: var(--dim); margin-top: 2px; display: flex; align-items: center; gap: 5px; }

/* ====== Commissies ====== */
.c-row { display: flex; align-items: center; gap: 13px; padding: 13px 14px; width: 100%; background: var(--surface); text-align: left; margin-top: 8px; }
.c-icon { width: 40px; height: 40px; border-radius: var(--radius-ctl); display: grid; place-items: center; font-size: 19px; flex-shrink: 0; }
.c-name { font-size: 14.5px; font-weight: 700; }
.c-sub { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.c-pct { font-size: 11px; font-weight: 700; color: var(--dim); }
.chev { color: var(--faint); flex-shrink: 0; }

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-ctl);
  background: var(--surface); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--dim); flex-shrink: 0;
}
.icon-btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.icon-btn:active { transform: scale(0.94); }

/* ====== Commissie-detail ====== */
.detail-head { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.detail-title { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.detail-sub { font-size: 11.5px; color: var(--dim); }
.summary-card { padding: 14px 16px; margin-top: 16px; }
.summary-top { display: flex; align-items: baseline; justify-content: space-between; }
.summary-pct { font-size: 22px; font-weight: 800; }
.summary-count { font-size: 12px; color: var(--dim); font-weight: 600; }

.search-wrap {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-ctl); padding: 0 12px;
}
.search-input { flex: 1; border: none; background: none; outline: none; font-size: 13px; padding: 10px 0; min-width: 0; }
.search-input::placeholder { color: var(--faint); }
.search-clear { border: none; background: none; color: var(--faint); font-size: 14px; padding: 4px; }

.t-card { padding: 13px 14px; margin-top: 8px; width: 100%; text-align: left; background: var(--surface); }
.t-top { display: flex; align-items: center; gap: 10px; }
.t-title { flex: 1; font-size: 14.5px; font-weight: 700; min-width: 0; }
.t-title.done { text-decoration: line-through; color: var(--faint); }
.t-meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.t-meta .progress { flex: 1; min-width: 60px; margin-left: 6px; }
.t-meta-txt { font-size: 11.5px; color: var(--dim); font-weight: 600; }
.t-meta-txt.overdue { color: var(--hoog-text); }
.t-frac { font-size: 11px; color: var(--faint); font-weight: 600; }

/* ====== Personen ====== */
.p-card { margin-top: 10px; }
.p-head { display: flex; align-items: center; gap: 13px; padding: 14px 14px 10px; }
.p-name { font-size: 15px; font-weight: 700; }
.p-sub { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.p-task { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--divider); font-size: 13px; width: 100%; background: none; border-left: none; border-right: none; border-bottom: none; text-align: left; }
.p-task-title { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-task-side { font-size: 11px; font-weight: 600; color: var(--faint); flex-shrink: 0; }
.p-task-side.overdue { color: var(--hoog-text); }
.p-card.unassigned { border-style: dashed; background: transparent; }

/* ====== FAB ====== */
.fab {
  position: fixed; right: 18px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 25;
  background: var(--primary); color: var(--on-primary);
  border: none; border-radius: var(--radius-pill);
  padding: 13px 20px; display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; box-shadow: var(--shadow-fab);
}
.fab:active { transform: scale(0.96); }
@media (min-width: 900px) { .fab { bottom: 28px; } }

/* ====== Shelf (bottom sheet) ====== */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: var(--dim-overlay);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.18s ease;
}
.sheet-overlay.hidden { display: none; }
.sheet {
  width: 100%; max-width: var(--col);
  background: var(--surface);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  box-shadow: var(--shadow-sheet);
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto;
  animation: slideUp 0.24s cubic-bezier(.3,1,.4,1);
}
.sheet-overlay.closing { animation: fadeOut 0.18s ease forwards; }
.sheet-overlay.closing .sheet { animation: slideDown 0.2s ease forwards; }
.sheet-handle { width: 40px; height: 4px; border-radius: 999px; background: var(--border); margin: 0 auto 14px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(40px); } }
@keyframes slideDown { to { transform: translateY(100%); } }
@media (min-width: 900px) {
  .sheet-overlay { align-items: center; padding: 20px; }
  .sheet { border-radius: var(--radius-sheet); max-height: 84vh; }
  .sheet-handle { display: none; }
}

/* Shelf: taakweergave */
.sh-title { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.sh-badges { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.sh-meta { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.sh-meta-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface-2); border-radius: var(--radius-pill);
  padding: 8px 13px; font-size: 12.5px; font-weight: 600;
}
.sh-meta-chip.with-avatar { padding: 5px 12px 5px 5px; }
.sh-notes { font-size: 13px; color: var(--dim); line-height: 1.5; margin-top: 12px; white-space: pre-line; }

.sh-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }

.segmented { display: flex; gap: 4px; background: var(--surface-2); border-radius: var(--radius-ctl); padding: 4px; margin-top: 8px; }
.seg-btn {
  flex: 1; text-align: center; padding: 10px 0; border-radius: 9px;
  font-size: 13px; font-weight: 700; color: var(--dim); background: none; border: none;
}
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(25,28,50,0.1); }
@media (prefers-color-scheme: dark) {
  .seg-btn.active { background: var(--bg); }
}

.step-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--divider); }
.step-row:last-child { border-bottom: none; }
.step-row.step-in { animation: stepIn 0.22s ease; }
@keyframes stepIn { from { opacity: 0; transform: translateY(-5px); } }
.check {
  width: 26px; height: 26px; border-radius: 9px;
  border: 2px solid var(--border); background: none; flex-shrink: 0;
  display: grid; place-items: center; color: transparent; font-size: 13px;
  transition: transform 0.12s ease;
}
.check.done { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.check.disabled { opacity: 0.55; cursor: default; }
.check.pop { transform: scale(1.15); }
.step-title { flex: 1; font-size: 14px; font-weight: 600; min-width: 0; background: none; border: none; text-align: left; padding: 0; }
.step-title.done { text-decoration: line-through; color: var(--faint); }
.step-edit {
  flex: 1; font-size: 14px; font-weight: 600; border: none; outline: none;
  background: var(--surface-2); border-radius: 8px; padding: 6px 9px; min-width: 0;
}
.step-del { border: none; background: none; color: var(--faint); font-size: 13px; padding: 4px 2px; flex-shrink: 0; }
.steps-hint { font-size: 12px; color: var(--faint); margin-top: 8px; }
.steps-done-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--klaar-text); }

.step-add { display: flex; gap: 8px; margin-top: 10px; }
.step-add input {
  flex: 1; border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-ctl); padding: 10px 12px; font-size: 14px; outline: none; min-width: 0;
}
.step-add input:focus { border-color: var(--primary); }

.sh-danger {
  display: flex; align-items: center; gap: 8px; justify-content: center; width: 100%;
  margin-top: 12px; padding: 12px 0 2px; border: none; border-top: 1px solid var(--divider);
  background: none; color: var(--faint); font-size: 12px; font-weight: 600;
}
.sh-danger:active { color: var(--hoog-text); }

/* Shelf: formulieren */
.f-field { margin-top: 15px; }
.f-label { font-size: 11.5px; font-weight: 700; color: var(--dim); margin-bottom: 7px; }
.f-input, .f-select, .f-textarea {
  width: 100%; border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-ctl); padding: 11px 13px; font-size: 14px; outline: none;
}
.f-input:focus, .f-select:focus, .f-textarea:focus { border-color: var(--primary); }
.f-textarea { resize: vertical; min-height: 64px; }
.choice-row { display: flex; gap: 6px; flex-wrap: wrap; }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.emoji-cell {
  padding: 9px 0; font-size: 18px; text-align: center;
  border: 1px solid var(--border); border-radius: var(--radius-ctl); background: var(--surface);
}
.emoji-cell.sel { border-color: var(--primary); background: var(--primary-soft); }
.color-row { display: flex; gap: 9px; flex-wrap: wrap; }
.color-cell { width: 34px; height: 34px; border-radius: 999px; border: 3px solid transparent; padding: 0; }
.color-cell.sel { border-color: var(--text); }

.sheet-actions { display: flex; gap: 10px; margin-top: 20px; }
.btn {
  border: none; border-radius: var(--radius-ctl);
  padding: 13px 16px; font-size: 14px; font-weight: 700; text-align: center;
}
.btn-primary { flex: 2; background: var(--primary); color: var(--on-primary); }
.btn-ghost { flex: 1; background: var(--surface); border: 1px solid var(--border); color: var(--dim); }
.btn-danger { flex: 1; background: var(--hoog-soft); color: var(--hoog-text); }
.btn:active { transform: scale(0.97); }

.confirm-text { font-size: 14px; line-height: 1.5; color: var(--dim); margin: 6px 0 0; }
.confirm-text b { color: var(--text); }

/* ====== Leeg & fout ====== */
.empty { text-align: center; padding: 44px 20px; }
.empty-emoji { font-size: 38px; }
.empty h3 { margin: 12px 0 4px; font-size: 15px; font-weight: 700; }
.empty p { margin: 0; font-size: 12.5px; color: var(--dim); }

/* ====== Viewanimatie ====== */
.view { animation: viewIn 0.2s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }
