/* ════════════════════════════════════════════════════════════════
   BlackBoks PWA — design-systeem
   Geport vanuit de Claude Design-handoff (dark navy, Geist, #378ADD)
   ════════════════════════════════════════════════════════════════ */

* { -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Geist', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--text);
  overscroll-behavior-y: none;
}

/* ── thema-tokens ── */
:root, [data-theme="dark"] {
  --bg: #14141f; --surface: #1e1e30; --surface-2: #2a2a40; --seg-active: #3a3a55;
  --border: rgba(255,255,255,0.08);
  --text: #f3f4fb; --text-muted: #a0a0bd; --text-dim: #6d6d88;
  --accent: #378ADD;
  --c-green: #34C759; --c-amber: #F0A832; --c-red: #FF5A5F; --c-slate: #9a9ab5;
  --c-purple: #C77DFF; --c-orange: #FF9F45; --c-cyan: #5AC8FA;
  --toast-bg: #2a2a40; --toast-fg: #f3f4fb;
}
[data-theme="light"] {
  --bg: #f4f5fa; --surface: #ffffff; --surface-2: #eceef4; --seg-active: #ffffff;
  --border: rgba(20,20,45,0.08);
  --text: #16162a; --text-muted: #5b5b78; --text-dim: #9a9ab2;
  --c-green: #2BA84A; --c-amber: #D98A12; --c-red: #E5484D; --c-slate: #8585a0;
  --toast-bg: #16162a; --toast-fg: #ffffff;
}

[x-cloak] { display: none !important; }

/* ── kaarten & oppervlakken ── */
.bb-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.bb-rowbtn { transition: background .12s ease; }
.bb-rowbtn:active { background: var(--surface-2) !important; }
.bb-pressable:active { background: var(--surface-2) !important; }

/* ── formuliervelden ── */
.bb-field {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; color: var(--text); font-size: 16px; font-family: inherit;
  box-sizing: border-box; transition: border-color .15s ease; width: 100%;
}
.bb-field:focus-within, .bb-field:focus { border-color: var(--accent); outline: none; }
input.bb-field, textarea.bb-field, select.bb-field { outline: none; }
input.bb-field::placeholder, textarea.bb-field::placeholder { color: var(--text-dim); }
input[type="time"].bb-field { -webkit-appearance: none; appearance: none; }
input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(0.6); cursor: pointer; }
[data-theme="light"] input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(0.3); }
.bb-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 7px; letter-spacing: 0.1px; }

/* veld met icoon ervoor (login, zoekbalk) */
.bb-field-row { display: flex; align-items: center; gap: 9px; }
.bb-field-row > input {
  flex: 1; border: none; background: transparent; color: var(--text);
  font-size: 16px; font-family: inherit; outline: none; min-width: 0; padding: 0;
}
.bb-field-row > input::placeholder { color: var(--text-dim); }
.bb-field-row .bb-ico { color: var(--text-dim); flex-shrink: 0; }

/* ── knoppen ── */
.bb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 46px; padding: 0 16px; border-radius: 13px; border: none; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 650; letter-spacing: -0.1px;
  transition: transform .1s ease, opacity .15s ease;
}
.bb-btn:active { transform: scale(0.97); }
.bb-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.bb-btn.primary { background: var(--accent); color: #fff; }
.bb-btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.bb-btn.warn { background: var(--c-red); color: #fff; }
.bb-btn.sm { height: 34px; font-size: 13px; padding: 0 12px; border-radius: 10px; gap: 5px; }

.bb-iconbtn {
  width: 38px; height: 38px; border-radius: 11px; border: none; background: transparent;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .12s ease; color: var(--text-muted); padding: 0;
}
.bb-iconbtn:active { background: var(--surface-2); }
.bb-iconbtn.sm { width: 30px; height: 30px; border-radius: 9px; }

/* ── FAB ── */
.bb-fab {
  position: fixed; right: 18px; bottom: calc(86px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--accent); color: #fff; border: none; cursor: pointer; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: transform .12s ease;
}
.bb-fab:active { transform: scale(0.92); }

/* ── tabbar (glas) ── */
.bb-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; padding: 7px 6px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border);
}
.bb-tab {
  flex: 1; border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 2px;
  color: var(--text-dim); font-family: inherit; transition: color .15s ease;
}
.bb-tab.active { color: var(--accent); }
.bb-tab span { font-size: 10.5px; font-weight: 500; letter-spacing: 0.1px; }
.bb-tab.active span { font-weight: 650; }

/* ── schermkop ── */
.bb-header { padding: 14px 20px 10px; display: flex; align-items: flex-start; gap: 6px; }
.bb-header h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.7px; color: var(--text); line-height: 1.12; }
.bb-header .bb-sub { margin-top: 3px; font-size: 13.5px; color: var(--text-muted); font-weight: 500; }
.bb-header .bb-back { margin-top: 4px; margin-left: -8px; color: var(--text); }

/* ── statkaart ── */
.bb-stat { flex: 1; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.bb-stat .bb-stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.bb-stat .bb-stat-value { font-size: 26px; font-weight: 650; color: var(--text); letter-spacing: -0.5px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.bb-stat .bb-stat-sub { font-size: 11.5px; color: var(--text-dim); }

/* ── segment-control ── */
.bb-segment { display: flex; background: var(--surface-2); border-radius: 11px; padding: 3px; gap: 2px; }
.bb-segment button {
  flex: 1; border: none; cursor: pointer; padding: 8px 4px; border-radius: 8.5px;
  font-size: 13.5px; font-weight: 600; font-family: inherit;
  color: var(--text-muted); background: transparent; transition: all .18s ease;
}
.bb-segment button.active { color: var(--text); background: var(--seg-active); box-shadow: 0 1px 2px rgba(0,0,0,0.25); }

/* ── filter-pills ── */
.bb-pill {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-muted);
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  white-space: nowrap; flex-shrink: 0;
}
.bb-pill.active { background: var(--accent); color: #fff; border-color: transparent; }

/* ── badges ── */
.bb-badge {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600;
  font-size: 12.5px; padding: 4px 10px; border-radius: 999px; letter-spacing: 0.1px; white-space: nowrap;
}
.bb-badge.sm { font-size: 11.5px; padding: 3px 8px; }
.bb-badge .bb-dot { width: 6px; height: 6px; }
.bb-badge-open   { background: rgba(142,142,163,0.16); color: var(--c-slate); }
.bb-badge-bezig  { background: rgba(240,168,50,0.16);  color: var(--c-amber); }
.bb-badge-gereed { background: rgba(52,199,89,0.16);   color: var(--c-green); }
.bb-badge-accent { background: rgba(55,138,221,0.14);  color: var(--accent); }

.bb-dot { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; display: inline-block; background: var(--c-slate); }

.bb-count {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface-2);
  color: var(--text-muted); font-size: 12px; font-weight: 700; display: inline-flex;
  align-items: center; justify-content: center; box-sizing: border-box;
}

/* ── avatar (initialen) ── */
.bb-avatar {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; letter-spacing: 0.3px;
}
.bb-avatar.lg { width: 54px; height: 54px; font-size: 19px; }

/* ── lijstrijen ── */
.bb-row {
  display: flex; align-items: center; gap: 13px; padding: 14px;
  border: none; cursor: pointer; text-align: left; font-family: inherit;
  width: 100%; box-sizing: border-box; background: transparent; color: var(--text);
}
.bb-row-title { font-size: 15.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-row-sub { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-row-main { flex: 1; min-width: 0; }
.bb-divider { border-bottom: 1px solid var(--border); }

/* ── sectiekop ── */
.bb-section-title { font-size: 13px; font-weight: 650; color: var(--text); padding: 0 4px 9px; letter-spacing: 0.1px; }

/* ── timer ── */
.bb-timer {
  font-size: 56px; font-weight: 600; letter-spacing: 1px; color: var(--text);
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; line-height: 1;
}
.bb-pulse-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--text-dim); transition: all .2s; flex-shrink: 0; }
.bb-pulse-dot.on { background: var(--c-green); box-shadow: 0 0 0 4px rgba(52,199,89,0.18); }

/* ── bottom sheet ── */
.bb-sheet-wrap { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; justify-content: flex-end; }
.bb-sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.bb-sheet {
  position: relative; background: var(--surface); border-top-left-radius: 26px; border-top-right-radius: 26px;
  max-height: 88%; display: flex; flex-direction: column; box-shadow: 0 -8px 40px rgba(0,0,0,0.4);
  border-top: 1px solid var(--border);
}
.bb-sheet-grab { display: flex; align-items: center; justify-content: center; padding: 10px 0 2px; }
.bb-sheet-grab span { width: 38px; height: 5px; border-radius: 999px; background: var(--text-dim); opacity: 0.5; }
.bb-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 20px 12px; }
.bb-sheet-head .bb-sheet-title { font-size: 18px; font-weight: 650; color: var(--text); }
.bb-sheet-body { overflow-y: auto; padding: 0 20px calc(28px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }

/* sheet-overgangen (Alpine x-transition koppelt aan deze klassen) */
.bb-fade-enter { transition: opacity .28s ease; }
.bb-fade-leave { transition: opacity .22s ease; }
.bb-fade-hidden { opacity: 0; }
.bb-slide-enter { transition: transform .3s cubic-bezier(.32,.72,0,1); }
.bb-slide-leave { transition: transform .25s cubic-bezier(.32,.72,0,1); }
.bb-slide-hidden { transform: translateY(100%); }

/* picker-opties in een sheet */
.bb-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px; border-radius: 12px; border: none; cursor: pointer; text-align: left;
  background: transparent; font-family: inherit; width: 100%; box-sizing: border-box;
}
.bb-opt.selected { background: var(--surface-2); }
.bb-opt .bb-opt-label { color: var(--text); font-size: 15.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-opt .bb-opt-sub { color: var(--text-dim); font-size: 12.5px; }

/* selectknop die een picker-sheet opent */
.bb-select {
  display: flex; align-items: center; justify-content: space-between;
  text-align: left; cursor: pointer; gap: 9px;
}
.bb-select:disabled { cursor: not-allowed; opacity: 0.5; }
.bb-select .bb-select-value { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 9px; min-width: 0; }
.bb-select .bb-select-value.placeholder { color: var(--text-dim); }

/* ── toast ── */
.bb-toasts {
  position: fixed; left: 0; right: 0; bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; padding: 0 18px;
}
.bb-toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 13px;
  max-width: 100%; background: var(--toast-bg); color: var(--toast-fg);
  box-shadow: 0 8px 30px rgba(0,0,0,0.45); font-size: 14px; font-weight: 500;
  animation: bb-toast-in .26s cubic-bezier(.32,.72,0,1);
}
.bb-toast.error { background: var(--c-red); color: #fff; }
.bb-toast .bb-ico-ok { color: var(--c-green); display: inline-flex; }
.bb-toast.error .bb-ico-ok { color: #fff; }

/* ── update-balk ── */
.bb-update {
  display: flex; align-items: center; gap: 10px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
  padding: 8px 14px; flex-shrink: 0;
}
.bb-update-btn {
  border: none; cursor: pointer; font-family: inherit;
  background: rgba(255,255,255,0.18); color: #fff;
  font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 999px;
  transition: background .12s ease, transform .1s ease;
}
.bb-update-btn:active { background: rgba(255,255,255,0.3); transform: scale(0.96); }

/* ── offline-banner ── */
.bb-offline {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--c-amber); color: #1a1208; font-size: 12.5px; font-weight: 600;
  padding: 6px 12px; flex-shrink: 0;
}

/* ── leeg & skeleton ── */
.bb-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 52px 30px; text-align: center; }
.bb-empty .bb-empty-ico { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-dim); }
.bb-empty .bb-empty-title { font-size: 16px; font-weight: 600; color: var(--text); }
.bb-empty .bb-empty-sub { font-size: 13.5px; color: var(--text-muted); max-width: 240px; }

.bb-skel {
  background: linear-gradient(100deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 50%, var(--text-dim) 18%) 50%, var(--surface-2) 70%);
  background-size: 220% 100%; animation: bb-shimmer 1.3s ease-in-out infinite;
  border-radius: 7px; height: 16px;
}
.bb-skel-row { padding: 16px; display: flex; flex-direction: column; gap: 10px; }

.bb-spin-icon { display: inline-flex; animation: bb-spin .8s linear infinite; }

/* ── scroll ── */
.bb-scroll { -webkit-overflow-scrolling: touch; }
.bb-scroll::-webkit-scrollbar, .bb-noscrollbar::-webkit-scrollbar { width: 0; height: 0; }
.bb-noscrollbar { scrollbar-width: none; }

/* ── login ── */
.bb-login {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  padding: 0 28px; justify-content: center; box-sizing: border-box;
  max-width: 440px; margin: 0 auto;
}
.bb-logo { display: flex; align-items: center; gap: 11px; }
.bb-logo-mark {
  width: 40px; height: 40px; border-radius: 11px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(55,138,221,0.4);
}
.bb-logo-mark span { width: 16px; height: 16px; border-radius: 4px; border: 3px solid #fff; display: block; }
.bb-logo-text { font-size: 25px; font-weight: 700; letter-spacing: -0.6px; color: var(--text); }
.bb-logo-text em { font-style: normal; color: var(--accent); }

/* ── app-layout ── */
.bb-app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.bb-screen { flex: 1; display: flex; flex-direction: column; padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
.bb-content { padding: 2px 16px 40px; display: flex; flex-direction: column; gap: 14px; }

/* ── animaties ── */
@keyframes bb-spin { to { transform: rotate(360deg); } }
@keyframes bb-shimmer { 0% { background-position: 180% 0; } 100% { background-position: -180% 0; } }
@keyframes bb-toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .bb-toast, .bb-skel, .bb-spin-icon { animation: none; }
}
