/* ===========================================================================
   Bootlijst — clean, modern, mobile-first (light + dark)
   =========================================================================== */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --border: #e5e7eb;
  --border-strong: #d6dae0;
  --text: #0f1117;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-press: #4338ca;
  --accent-weak: #eef2ff;
  --on-accent: #ffffff;
  --good: #15a34a;
  --good-weak: #e7f6ec;
  --warn: #b45309;
  --warn-weak: #fbf0dd;
  --danger: #dc2626;
  --danger-weak: #fdecec;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-full: 999px;
  --maxw: 560px;

  --shadow-sm: 0 1px 2px rgba(15, 17, 23, .06);
  --shadow: 0 1px 2px rgba(15, 17, 23, .04), 0 6px 20px rgba(15, 17, 23, .07);
  --shadow-pop: 0 12px 44px rgba(15, 17, 23, .20);

  --dot-safety: #ef4444;
  --dot-food: #f97316;
  --dot-drinks: #06b6d4;
  --dot-kitchen: #8b5cf6;
  --dot-clothing: #ec4899;
  --dot-tools: #64748b;
  --dot-fun: #eab308;
  --dot-other: #94a3b8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d11;
    --surface: #15181e;
    --surface-2: #1c2027;
    --border: #282d36;
    --border-strong: #333a45;
    --text: #e7e9ee;
    --muted: #9099a6;
    --accent: #818cf8;
    --accent-press: #a5b0ff;
    --accent-weak: #1e2230;
    --on-accent: #0b0d11;
    --good: #4ade80;
    --good-weak: #14251b;
    --warn: #fbbf24;
    --warn-weak: #2a2113;
    --danger: #f87171;
    --danger-weak: #2a1717;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .4);
    --shadow-pop: 0 16px 50px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
svg { display: block; }

/* ---------------------------------------------------- knoppen -------------- */
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
.btn-primary {
  background: var(--accent); color: var(--on-accent); border-radius: var(--r-full);
  padding: 14px 20px; font-weight: 650; font-size: 1rem; width: 100%;
  transition: transform .08s ease, background .15s ease;
}
.btn-primary:active { transform: scale(.98); background: var(--accent-press); }
.btn-ghost {
  display: block; width: 100%; text-align: center; color: var(--muted);
  padding: 12px; font-weight: 600; margin-top: 6px; border-radius: var(--r-full);
}
.btn-ghost:active { background: var(--surface-2); }
.btn-danger {
  background: var(--danger-weak); color: var(--danger); border-radius: var(--r-full);
  padding: 13px 18px; font-weight: 650; flex: 1;
}

/* =====================================================  LOGIN  ============== */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 32px 24px 24px; max-width: 420px; width: 100%;
}
.brand-mark {
  width: 56px; height: 56px; border-radius: 16px; background: var(--accent);
  color: var(--on-accent); display: grid; place-items: center; margin: 0 auto 16px;
}
.brand-mark svg { width: 30px; height: 30px; }
.login h1 { margin: 0 0 8px; font-size: 1.85rem; letter-spacing: -0.02em; text-align: center; }
.login-sub { color: var(--muted); margin: 0 0 24px; line-height: 1.5; text-align: center; }
#login-form label { font-weight: 650; font-size: 0.92rem; display: block; margin-bottom: 8px; }
#name-input {
  width: 100%; padding: 14px 15px; font-size: 1.1rem; border: 1.5px solid var(--border-strong);
  border-radius: var(--r); margin-bottom: 14px; background: var(--surface); color: var(--text);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
#name-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.how { margin: 24px 0 4px; display: grid; gap: 10px; }
.how-row {
  display: flex; gap: 12px; align-items: flex-start; background: var(--surface-2);
  padding: 13px 14px; border-radius: var(--r); font-size: 0.9rem; line-height: 1.45; color: var(--muted);
}
.how-row b { color: var(--text); }
.how-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.dot-personal { background: var(--accent); }
.dot-shared { background: var(--dot-drinks); }
.login-tip { color: var(--muted); font-size: 0.8rem; margin: 18px 0 0; text-align: center; }

/* =====================================================  APP shell  ========== */
.app { max-width: var(--maxw); margin: 0 auto; min-height: 100dvh; padding-bottom: 110px; }

.app-header {
  position: sticky; top: 0; z-index: 30; background: var(--bg);
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--border);
}
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px 8px;
}
.topbar-left { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.topbar h1 { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.crew-btn {
  align-self: flex-start; color: var(--muted); background: var(--surface-2);
  border-radius: var(--r-full); padding: 3px 10px; font-size: 0.78rem; font-weight: 600;
}
.crew-btn span { color: var(--text); font-weight: 700; }
.icon-btn {
  color: var(--muted); width: 40px; height: 40px; border-radius: var(--r-sm);
  display: grid; place-items: center; flex-shrink: 0;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:active { background: var(--surface-2); }

.search-wrap { position: relative; padding: 4px 16px 10px; }
.search-icon {
  position: absolute; left: 28px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; margin-top: -3px;
}
.search-icon svg { width: 18px; height: 18px; }
#search {
  width: 100%; padding: 11px 14px 11px 40px; border-radius: var(--r);
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 1rem; outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
#search::-webkit-search-cancel-button { -webkit-appearance: none; }

.tabs {
  display: flex; gap: 4px; margin: 0 16px 12px; padding: 4px;
  background: var(--surface-2); border-radius: var(--r-full);
}
.tab {
  flex: 1; padding: 9px 4px; border-radius: var(--r-full); font-weight: 600; font-size: 0.85rem;
  color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 5px;
  white-space: nowrap; transition: color .15s ease;
}
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.badge {
  background: var(--accent); color: var(--on-accent); border-radius: var(--r-full);
  font-size: 0.72rem; padding: 1px 7px; font-weight: 700; min-width: 20px; text-align: center;
}

/* =====================================================  LIST  =============== */
.list { padding: 14px 16px; }

.cat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-sm); margin-bottom: 12px; overflow: hidden;
}
.cat-head {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 15px;
  font-weight: 650; font-size: 0.98rem;
}
.cat-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.cat-label { flex: 1; text-align: left; }
.cat-count {
  background: var(--surface-2); color: var(--muted); border-radius: var(--r-full);
  padding: 1px 9px; font-size: 0.78rem; font-weight: 700;
}
.cat-arrow { color: var(--muted); transition: transform .2s ease; }
.cat-arrow svg { width: 18px; height: 18px; }
.cat-arrow.is-collapsed { transform: rotate(-90deg); }
.cat-body { border-top: 1px solid var(--border); }

.todo-head {
  display: flex; align-items: center; gap: 10px; font-weight: 700;
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  padding: 16px 4px 8px;
}
.todo-head .cat-count { text-transform: none; letter-spacing: 0; }
.todo-head + .cat-body {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-sm); border-top: 1px solid var(--border);
  margin-bottom: 6px; overflow: hidden;
}

/* item -------------------------------------------------------------------- */
.item { padding: 13px 15px; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: none; }
.item.personal { display: flex; align-items: center; gap: 13px; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 550; line-height: 1.3; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.item-note { color: var(--muted); font-size: 0.84rem; margin-top: 3px; }
.item-sub { color: var(--accent); font-size: 0.78rem; margin-top: 3px; font-weight: 600; }

.checkbox {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border-strong); display: grid; place-items: center;
  color: var(--on-accent); transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.checkbox svg { width: 16px; height: 16px; opacity: 0; transition: opacity .12s ease; }
.checkbox.on { background: var(--good); border-color: var(--good); animation: pop .25s ease; }
.checkbox.on svg { opacity: 1; }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.item.is-done .item-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }

.kebab {
  color: var(--muted); width: 32px; height: 32px; border-radius: var(--r-sm);
  display: grid; place-items: center; flex-shrink: 0;
}
.kebab svg { width: 18px; height: 18px; }
.kebab:active { background: var(--surface-2); }

.tag {
  font-size: 0.68rem; font-weight: 700; border-radius: var(--r-full); padding: 2px 8px;
  letter-spacing: 0.01em; line-height: 1.4; white-space: nowrap;
}
.tag-star { background: var(--warn-weak); color: var(--warn); }
.tag-once { background: var(--accent-weak); color: var(--accent); }
.tag-qty { background: var(--good-weak); color: var(--good); }

/* shared ------------------------------------------------------------------ */
.item.shared .item-row { display: flex; align-items: flex-start; gap: 10px; }
.cover {
  flex-shrink: 0; border-radius: var(--r-full); padding: 3px 10px; font-weight: 700;
  font-size: 0.82rem; font-variant-numeric: tabular-nums;
}
.cover.need { background: var(--warn-weak); color: var(--warn); }
.cover.ok { background: var(--good-weak); color: var(--good); }
.item.shared.is-done .item-title { color: var(--muted); }

.item-actions { display: flex; align-items: center; gap: 10px; margin-top: 11px; flex-wrap: wrap; }
.mine-label { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.stepper {
  display: inline-flex; align-items: center; background: var(--surface-2);
  border-radius: var(--r-full); border: 1px solid var(--border);
}
.stepper .step {
  width: 34px; height: 34px; font-size: 1.25rem; font-weight: 600; color: var(--accent);
  display: grid; place-items: center;
}
.stepper .step:disabled { color: var(--border-strong); }
.stepper.small .step { width: 32px; height: 32px; }
.mine-qty { min-width: 22px; text-align: center; font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums; }
.mine-qty.on { color: var(--good); }
.who-toggle {
  margin-left: auto; color: var(--accent); font-weight: 600; font-size: 0.85rem;
  padding: 6px 4px; display: inline-flex; align-items: center; gap: 3px;
}
.who-toggle svg { width: 15px; height: 15px; transition: transform .2s ease; }
.who-toggle.open svg { transform: rotate(180deg); }
.who { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.who-chip {
  background: var(--surface-2); color: var(--muted); border-radius: var(--r-full);
  padding: 3px 11px; font-size: 0.82rem; font-weight: 600;
}
.who-chip.me { background: var(--accent); color: var(--on-accent); }

/* empty ------------------------------------------------------------------- */
.empty { text-align: center; padding: 64px 24px; color: var(--muted); }
.empty-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px;
  background: var(--surface-2); color: var(--muted); display: grid; place-items: center;
}
.empty-icon svg { width: 28px; height: 28px; }
.empty h3 { margin: 6px 0; color: var(--text); font-size: 1.05rem; }
.empty p { margin: 0; line-height: 1.5; }

/* ==============================================  INPAKKEN (packing)  ======= */
.pack-progress {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-sm); padding: 14px 16px; margin-bottom: 4px;
}
.pack-progress-top {
  display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px;
}
.pack-progress-label { font-weight: 650; }
.pack-progress-count { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.pack-progress.done .pack-progress-label,
.pack-progress.done .pack-progress-count { color: var(--good); }
.pack-bar { height: 8px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; }
.pack-bar span {
  display: block; height: 100%; border-radius: var(--r-full);
  background: var(--accent); transition: width .3s ease;
}
.pack-progress.done .pack-bar span { background: var(--good); }

/* =====================================================  FAB  ================ */
.fab {
  position: fixed; z-index: 25; right: max(18px, env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; color: var(--on-accent);
  background: var(--accent); box-shadow: 0 8px 24px rgba(79, 70, 229, .4);
  display: grid; place-items: center; left: auto;
  transition: transform .1s ease, background .15s ease;
}
.fab svg { width: 26px; height: 26px; }
.fab:active { transform: scale(.92); background: var(--accent-press); }
@media (min-width: 600px) {
  .fab { right: calc(50% - (var(--maxw) / 2) + 18px); }
}

/* =====================================================  SHEETS  ============= */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(10, 12, 16, .5);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .2s ease;
}
.sheet-backdrop.open { opacity: 1; }
.sheet {
  background: var(--surface); width: 100%; max-width: var(--maxw); border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-pop);
  border-top: 1px solid var(--border);
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .9, .3, 1);
  max-height: 92dvh; overflow-y: auto;
}
.sheet-backdrop.open .sheet { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; background: var(--border-strong); border-radius: var(--r-full); margin: 6px auto 16px; }
.sheet h2 { margin: 0 0 14px; font-size: 1.25rem; letter-spacing: -0.01em; }
.sheet label { display: block; font-weight: 650; margin: 14px 0 7px; font-size: 0.92rem; }
.sheet input[type=text], .sheet input[type=number], .sheet select {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--border-strong); border-radius: var(--r);
  font-size: 1rem; background: var(--surface); color: var(--text); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.sheet select { appearance: none; }
.sheet input:focus, .sheet select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.check-line {
  display: flex; align-items: center; gap: 11px; background: var(--surface-2);
  padding: 13px 14px; border-radius: var(--r); font-weight: 450; margin-top: 10px; color: var(--muted);
}
.check-line input { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.check-line b { font-weight: 700; color: var(--text); }

.seg { display: flex; gap: 8px; }
.seg-btn {
  flex: 1; padding: 12px 8px; border-radius: var(--r); border: 1.5px solid var(--border-strong);
  font-weight: 600; background: var(--surface); color: var(--muted); transition: all .15s ease;
}
.seg-btn.is-active { border-color: var(--accent); background: var(--accent-weak); color: var(--accent); }

#qty-row .stepper { margin-top: 4px; }
#qty-row input { text-align: center; max-width: 90px; }
#qty-row .stepper input { border: none; background: transparent; box-shadow: none; }

.sheet-actions { display: flex; gap: 10px; margin-top: 22px; }
.sheet-actions .btn-primary { flex: 2; }

.menu-item {
  display: flex; flex-direction: column; align-items: flex-start; width: 100%;
  padding: 15px 16px; border-radius: var(--r); background: var(--surface-2);
  font-weight: 650; margin-bottom: 10px; text-align: left;
}
.menu-item:active { background: var(--border); }
.menu-hint { font-weight: 450; color: var(--muted); font-size: 0.8rem; margin-top: 3px; }

.crew-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.crew-pill {
  background: var(--surface-2); color: var(--text); border-radius: var(--r-full);
  padding: 8px 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px;
}
.crew-pill.me { background: var(--accent); color: var(--on-accent); }
.crew-pill .x { opacity: .55; font-size: 0.95rem; line-height: 1; }

/* =====================================================  TOAST  ============== */
.toast {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: var(--r-full);
  font-weight: 650; font-size: 0.9rem; box-shadow: var(--shadow-pop); animation: rise .25s ease;
}
@keyframes rise { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
