:root {
  --bg: #0b1020;
  --bg-2: #121933;
  --surface: #182142;
  --surface-2: #1f2a52;
  --line: #2a3766;
  --text: #eaf0ff;
  --muted: #9aa8d4;
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;   /* native controls (date picker) match the dark UI */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* The [hidden] attribute must always win over class-level display rules
   (e.g. .voice-overlay/.sheet set display, which would otherwise override it). */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(139,92,246,.25), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(99,102,241,.22), transparent 55%),
    var(--bg);
  overscroll-behavior-y: contain;
}
h1, h2 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: rgba(11,16,32,.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 6px 18px rgba(99,102,241,.5);
}
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: -0.03em; }
.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; cursor: pointer; font-size: 16px;
  transition: transform .1s ease, background .2s;
  position: relative; overflow: hidden;   /* clip the tap ripple */
}
.icon-btn:active { transform: scale(.92); }

/* ---------- tabs (mobile) ---------- */
.tabs {
  display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto;
  scrollbar-width: none; position: sticky; top: calc(52px + var(--safe-top)); z-index: 20;
  background: linear-gradient(rgba(11,16,32,.9), rgba(11,16,32,.55));
  backdrop-filter: blur(10px);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 9px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-weight: 600; font-size: 14px; white-space: nowrap; display: flex; gap: 8px; align-items: center;
  transition: all .15s ease;
}
.tab .count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: 12px;
  display: grid; place-items: center; font-weight: 700;
}
.tab.active {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 6px 18px rgba(99,102,241,.4);
}
.tab.active .count { background: rgba(255,255,255,.25); color: #fff; }

/* ---------- board ---------- */
.board { padding: 8px 12px calc(96px + var(--safe-bottom)); }

.column { }
.column.hidden-mobile { display: none; }

.col-title { display: none; } /* header lives in tabs on mobile */

/* lane */
.lane {
  margin: 10px 0 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(31,42,82,.5), rgba(24,33,66,.5));
  border-radius: var(--radius);
  overflow: hidden;
}
.lane-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(18,25,51,.7); backdrop-filter: blur(6px);
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 12px;
}
.lane-name { font-weight: 700; font-size: 14px; }
.lane-count { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 600; }
.lane-body { padding: 10px; min-height: 56px; display: flex; flex-direction: column; gap: 10px; }

/* empty pool lane (Warteschlange) has no head */
.lane.pool .lane-body { min-height: 120px; }

/* card */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--card-accent, var(--primary));
  border-radius: 14px;
  padding: 12px 14px; cursor: grab;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  transition: transform .08s ease, box-shadow .2s, border-color .2s;
  touch-action: manipulation;
}
/* staggered fly-in — only when the board opts in (first load / tab / breakpoint) */
#board.animate .card {
  animation: cardin .34s cubic-bezier(.16,1,.3,1) backwards;
  animation-delay: calc(var(--i, 0) * 26ms);
}
@keyframes cardin {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.card:active { cursor: grabbing; }
.card-title { font-weight: 650; font-size: 15px; line-height: 1.3; }
.card-desc {
  margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.card-person {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.dot { width: 10px; height: 10px; border-radius: 50%; }

.empty-hint { color: var(--muted); font-size: 13px; text-align: center; padding: 14px; opacity: .8; }
@media (prefers-reduced-motion: no-preference) {
  .empty-hint { animation: floaty 3.2s ease-in-out infinite; }
}
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* SortableJS states */
.sortable-ghost { opacity: .35; }
.sortable-drag { box-shadow: var(--shadow); transform: rotate(1.5deg); }
.lane-body.drop-active {
  outline: 2px dashed var(--drop-glow, var(--primary)); outline-offset: -6px; border-radius: 12px;
  background: color-mix(in srgb, var(--drop-glow, var(--primary)) 15%, transparent);
  transition: background .12s ease;
}

/* confetti overlay (completion celebration) — no pointer capture, above the board */
.confetti-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 65;
}

/* ---------- FAB ---------- */
.fab {
  position: fixed; right: 18px; bottom: calc(18px + var(--safe-bottom)); z-index: 25;
  width: 60px; height: 60px; border-radius: 20px; border: none; cursor: pointer;
  color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 28px rgba(99,102,241,.5); display: grid; place-items: center;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1); overflow: hidden;
}
.fab:active { transform: scale(.9); }
.fab.open { transform: rotate(135deg); }   /* ＋ becomes ✕ while the card sheet is open */

/* ---------- sheets ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(4,7,18,.6); z-index: 40;
  backdrop-filter: blur(3px); animation: fade .2s ease;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  background: var(--bg-2); border-top-left-radius: 24px; border-top-right-radius: 24px;
  border-top: 1px solid var(--line);
  max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow);
  padding-bottom: calc(16px + var(--safe-bottom));
  animation: slideup .28s cubic-bezier(.16,1,.3,1);
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet-handle { width: 42px; height: 5px; border-radius: 999px; background: var(--line); margin: 10px auto 4px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 20px 12px; }
.sheet-head h2 { font-size: 20px; }
.sheet-body { padding: 0 20px 8px; display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field-label em { font-style: normal; color: var(--line); text-transform: none; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }

input, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line);
  color: var(--text); border-radius: 12px; padding: 13px 46px 13px 14px;
  font-size: 16px; font-family: inherit; resize: vertical;
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.25); }
textarea { padding-right: 46px; }

/* voice input wrapper */
.voice-input { position: relative; }
.mic {
  position: absolute; right: 8px; top: 8px; width: 34px; height: 34px;
  border-radius: 50%; border: none; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: grid; place-items: center; touch-action: none; user-select: none;
  box-shadow: 0 3px 10px rgba(99,102,241,.5); transition: transform .1s;
}
textarea + .mic { top: auto; bottom: 10px; }
.mic::before {
  content: ""; width: 12px; height: 18px; border-radius: 8px; background: #fff;
  box-shadow: 0 8px 0 -6px #fff, 0 9px 0 -3px transparent; position: relative;
}
.mic::after {
  content: ""; position: absolute; bottom: 5px; width: 16px; height: 8px;
  border: 2px solid #fff; border-top: none; border-radius: 0 0 10px 10px;
}
.mic.listening { animation: micpulse .9s ease-in-out infinite; }
.mic.unsupported { opacity: .35; }
@keyframes micpulse {
  0%,100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(139,92,246,.6); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 10px rgba(139,92,246,0); }
}

/* people picker (in card sheet) */
.people-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); cursor: pointer; font-weight: 600; font-size: 14px; transition: all .12s;
}
.chip[aria-pressed="true"] { border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.chip.none[aria-pressed="true"] { background: var(--surface-2); box-shadow: none; border-color: var(--primary); }

/* column picker */
.col-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.col-opt {
  padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: pointer; font-weight: 700; text-align: center;
  font-size: 14px; transition: all .12s;
}
.col-opt[aria-pressed="true"] { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.col-opt:disabled { opacity: .4; cursor: not-allowed; }

.sheet-actions { display: flex; gap: 10px; margin-top: 6px; }
.btn {
  flex: 1; padding: 15px; border-radius: 14px; border: none; cursor: pointer;
  font-weight: 700; font-size: 16px; font-family: inherit; transition: transform .1s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 8px 20px rgba(99,102,241,.4); }
.btn.danger { flex: 0 0 auto; color: var(--danger); background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.4); }

/* people list */
.people-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.people-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.people-list .pname { font-weight: 650; flex: 1; }
.people-list .lane-badge { font-size: 11px; color: var(--muted); font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); }
.people-list button.del { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 18px; padding: 4px 8px; }
.add-person { display: flex; gap: 10px; margin-top: 14px; }
.add-person .voice-input { flex: 1; }
.add-person .btn { flex: 0 0 56px; font-size: 22px; padding: 0; }

/* ---------- Siri voice overlay ---------- */
.voice-overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(600px 600px at 50% 42%, rgba(99,102,241,.28), rgba(4,7,18,.92));
  backdrop-filter: blur(12px); animation: fade .18s ease;
  padding: 40px;
}
.siri { display: flex; align-items: center; gap: 10px; height: 90px; }
.siri span {
  width: 12px; border-radius: 999px; height: 24px;
  background: linear-gradient(180deg, #a5b4fc, #8b5cf6);
  box-shadow: 0 0 18px rgba(139,92,246,.8);
  animation: siriwave 1s ease-in-out infinite;
}
.siri span:nth-child(1) { animation-delay: 0s; }
.siri span:nth-child(2) { animation-delay: .12s; }
.siri span:nth-child(3) { animation-delay: .24s; }
.siri span:nth-child(4) { animation-delay: .36s; }
.siri span:nth-child(5) { animation-delay: .48s; }
@keyframes siriwave {
  0%,100% { height: 20px; opacity: .7; }
  50% { height: 78px; opacity: 1; }
}
.voice-transcript { color: #fff; font-size: 20px; font-weight: 600; text-align: center; max-width: 620px; min-height: 28px; }
.voice-hint { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-bottom)); transform: translateX(-50%);
  z-index: 70; background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; font-weight: 600;
  animation: fade .2s ease; max-width: 90vw;
}
.toast.error { border-color: rgba(239,68,68,.5); color: #fecaca; }

/* ---------- desktop / tablet board ---------- */
@media (min-width: 900px) {
  .tabs { display: none; }
  .board {
    display: grid;
    grid-template-columns: minmax(240px, 320px) 1fr;
    gap: 16px; align-items: start;
    padding: 18px 22px 40px; max-width: 1500px; margin: 0 auto;
  }
  .column.hidden-mobile { display: block; } /* override; JS manages desktop layout */

  /* Warteschlange column (left) */
  #col-warteschlange {
    position: sticky; top: 92px;
    background: linear-gradient(180deg, rgba(31,42,82,.4), rgba(24,33,66,.4));
    border: 1px solid var(--line); border-radius: var(--radius); padding: 6px;
  }
  #col-warteschlange .col-title {
    display: block; padding: 12px 12px 8px; font-size: 15px; font-weight: 800; letter-spacing: -.02em;
  }
  #col-warteschlange .lane { margin: 0; border: none; background: none; }
  #col-warteschlange .lane-head { display: none; }

  /* working columns become a swimlane grid */
  #working-grid {
    display: grid;
    grid-template-columns: 160px repeat(3, 1fr);
    gap: 0; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--bg-2);
    /* no overflow:hidden — it would trap the sticky header inside the grid and
       stop it from pinning to the viewport. Corners are rounded per-cell below. */
  }
  /* Column headers stay anchored at the top while the swimlanes scroll under them. */
  .grid-corner, .grid-colhead {
    padding: 14px 16px; font-weight: 800; font-size: 14px; letter-spacing: -.01em;
    background: rgba(18,25,51,.97); border-bottom: 1px solid var(--line);
    position: sticky; top: 92px; z-index: 6; backdrop-filter: blur(8px);
  }
  .grid-colhead { text-align: left; border-left: 1px solid var(--line); }
  /* round the four outer corner cells to match the container's radius */
  .grid-corner { border-top-left-radius: var(--radius); }
  .grid-colhead.grid-colhead-last { border-top-right-radius: var(--radius); }
  .grid-row-last .grid-lanehead { border-bottom-left-radius: var(--radius); }
  .grid-row-last .grid-cell.grid-cell-last { border-bottom-right-radius: var(--radius); }
  .grid-lanehead {
    display: flex; align-items: center; gap: 8px; padding: 12px 14px;
    border-bottom: 1px solid var(--line); background: rgba(24,33,66,.5); font-weight: 700; font-size: 13px;
  }
  .grid-cell {
    border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
    padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 90px;
  }
  .grid-row-last .grid-lanehead, .grid-row-last .grid-cell { border-bottom: none; }
}
@media (min-width: 1200px) {
  #working-grid { grid-template-columns: 190px repeat(3, 1fr); }
}

/* ---------- playful additions ---------- */

/* XP-style progress bar per person (fills the lane-head's second row) */
.lane-head, .grid-lanehead { flex-wrap: wrap; }
.xpbar {
  flex: 0 0 100%; height: 6px; margin-top: 8px;
  border-radius: 999px; background: var(--surface-2); overflow: hidden;
}
.xpbar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width .5s cubic-bezier(.16,1,.3,1);
}
.xpbar.full .xpbar-fill { background: linear-gradient(90deg, #10b981, #34d399); }

/* daily streak pill in the top bar */
.streak {
  display: inline-flex; align-items: center; gap: 5px;
  height: 40px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-weight: 800; font-size: 14px; user-select: none;
}
.streak.pop { animation: streakpop .5s cubic-bezier(.16,1,.3,1); }
@keyframes streakpop { 0% { transform: scale(1); } 40% { transform: scale(1.28); } 100% { transform: scale(1); } }

/* undo action button inside the toast */
.toast { display: inline-flex; align-items: center; }
.toast-action {
  margin-left: 14px; padding: 4px 2px; background: none; border: none; cursor: pointer;
  color: #a5b4fc; font-weight: 800; font-size: 14px; font-family: inherit;
}

/* tap ripple + theme-toggle spin */
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(255,255,255,.45); transform: scale(0);
  animation: ripple .6s ease-out forwards;
}
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.spin { animation: spin360 .5s ease; }
@keyframes spin360 { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ---------- light theme ---------- */
:root[data-theme="light"] {
  --bg: #eef1fb;
  --bg-2: #e9edf9;
  --surface: #ffffff;
  --surface-2: #eef1fb;
  --line: #d4dbf0;
  --text: #1a2140;
  --muted: #5c6689;
  --shadow: 0 10px 30px rgba(30,40,90,.15);
  color-scheme: light;
}
:root[data-theme="light"] .topbar { background: rgba(255,255,255,.82); }
:root[data-theme="light"] .tabs {
  background: linear-gradient(rgba(255,255,255,.9), rgba(255,255,255,.55));
}
:root[data-theme="light"] .lane {
  background: linear-gradient(180deg, rgba(255,255,255,.75), rgba(245,247,253,.75));
}
:root[data-theme="light"] .lane-head { background: rgba(255,255,255,.78); }
:root[data-theme="light"] #working-grid { background: var(--bg-2); }
:root[data-theme="light"] .grid-corner,
:root[data-theme="light"] .grid-colhead { background: rgba(255,255,255,.95); }
:root[data-theme="light"] .grid-lanehead { background: rgba(245,247,253,.7); }
:root[data-theme="light"] #col-warteschlange {
  background: linear-gradient(180deg, rgba(255,255,255,.6), rgba(245,247,253,.6));
}
:root[data-theme="light"] .ripple { background: rgba(30,40,90,.14); }

/* ---------- card metadata: due / priority / checklist / time ---------- */
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 8px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.badge.due-over { background: rgba(239,68,68,.16); color: #fca5a5; border-color: rgba(239,68,68,.42); }
.badge.due-soon { background: rgba(245,158,11,.16); color: #fcd34d; border-color: rgba(245,158,11,.42); }
.badge.prio-2   { background: rgba(239,68,68,.14); color: #fca5a5; border-color: rgba(239,68,68,.35); }
.badge.prio-1   { background: rgba(245,158,11,.14); color: #fcd34d; border-color: rgba(245,158,11,.35); }
.badge.check-done { background: rgba(16,185,129,.16); color: #6ee7b7; border-color: rgba(16,185,129,.42); }
.card-foot { justify-content: space-between; }
.card-time { font-size: 11px; color: var(--muted); opacity: .75; white-space: nowrap; }

/* two-up field row (Fällig + Priorität) */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }

/* priority picker */
.prio-picker { display: flex; gap: 8px; }
.prio-opt {
  flex: 1; padding: 11px 6px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: pointer;
  font-weight: 700; font-size: 13px; text-align: center; transition: all .12s; font-family: inherit;
}
.prio-opt[aria-pressed="true"] { color: #fff; border-color: transparent; }
.prio-opt-0[aria-pressed="true"] { background: var(--surface-2); color: var(--text); border-color: var(--primary); }
.prio-opt-1[aria-pressed="true"] { background: linear-gradient(135deg, #f59e0b, #f97316); }
.prio-opt-2[aria-pressed="true"] { background: linear-gradient(135deg, #ef4444, #ec4899); }

/* checklist editor */
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.check-item { display: flex; align-items: center; gap: 10px; }
.check-box {
  width: 22px; height: 22px; flex: 0 0 auto; border-radius: 6px; padding: 0;
  border: 2px solid var(--line); background: var(--surface); cursor: pointer;
  display: grid; place-items: center;
}
.check-box.on { background: var(--primary); border-color: transparent; }
.check-box.on::after { content: "✓"; color: #fff; font-size: 13px; font-weight: 900; }
.check-text { flex: 1; font-size: 14px; }
.check-item.done .check-text { text-decoration: line-through; color: var(--muted); }
.check-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px; }
.checklist-add { display: flex; gap: 8px; margin-top: 8px; }
.checklist-add input { flex: 1; padding: 11px 14px; }
.btn-mini {
  flex: 0 0 46px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 20px; cursor: pointer; font-family: inherit;
}
.btn-mini:active { transform: scale(.94); }
.btn-mini.danger { color: var(--danger); }

/* ---------- filter bar: search + person filter ---------- */
.filterbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 8px 12px 0; }
.search-wrap { position: relative; flex: 1 1 200px; min-width: 160px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .7; pointer-events: none; }
.search-wrap input {
  width: 100%; padding: 10px 14px 10px 36px; font-size: 15px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--text);
}
.person-filter { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; padding-bottom: 2px; }
.person-filter::-webkit-scrollbar { display: none; }
.pf-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-weight: 600; font-size: 13px;
  cursor: pointer; white-space: nowrap; font-family: inherit;
}
.pf-chip.on { color: var(--text); border-color: var(--primary); background: var(--surface-2); }
.pf-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }

/* ---------- archive sheet ---------- */
.btn.ghost { flex: 0 0 auto; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); }
.archive-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.archive-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.archive-info { flex: 1; min-width: 0; }
.archive-t { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.archive-list .hint { padding: 10px 2px; }

/* ---------- data & backup tools (people sheet) ---------- */
.data-tools { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.data-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.data-btns .btn {
  flex: 1 1 30%; min-width: 96px; padding: 12px; font-size: 14px;
  display: grid; place-items: center; text-decoration: none;
}

/* ---------- connection banner ---------- */
.conn-banner {
  padding: 9px 14px; text-align: center; font-size: 13px; font-weight: 700;
  background: rgba(245,158,11,.95); color: #241803;
}

/* ---------- sheet head actions + keyboard focus ---------- */
.sheet-head-actions { display: flex; align-items: center; gap: 8px; }
.card:focus-visible, .icon-btn:focus-visible, .btn:focus-visible, .tab:focus-visible,
.chip:focus-visible, .pf-chip:focus-visible, .col-opt:focus-visible, .prio-opt:focus-visible,
.check-box:focus-visible, .btn-mini:focus-visible {
  outline: 2px solid var(--primary-2); outline-offset: 2px;
}

/* ---------- round 3: cover, labels, links, notes, timer ---------- */

/* card cover strip + label chips */
.card-cover { height: 56px; margin: -12px -14px 10px; border-radius: 11px 11px 0 0; background-size: cover; background-position: center; }
.card-labels { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.clabel { font-size: 10px; font-weight: 800; color: #fff; padding: 2px 7px; border-radius: 6px; text-shadow: 0 1px 2px rgba(0,0,0,.35); }

/* label editor */
.labels-edit { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.label-chip { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-weight: 700; font-size: 13px; padding: 5px 8px 5px 11px; border-radius: 999px; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.label-x { background: rgba(255,255,255,.3); border: none; color: #fff; width: 18px; height: 18px; border-radius: 50%; cursor: pointer; font-size: 10px; display: grid; place-items: center; padding: 0; }
.label-add { display: flex; gap: 8px; }
.label-add #f-label-new { flex: 1; padding: 10px 12px; }
#f-label-color { width: 46px; height: 42px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }

/* cover picker */
.cover-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.cover-swatch { width: 42px; height: 32px; border-radius: 8px; border: 2px solid var(--line); cursor: pointer; padding: 0; display: grid; place-items: center; color: var(--muted); font-size: 15px; background-size: cover; background-position: center; }
.cover-swatch.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.cover-upload { background: var(--surface-2); }

/* links editor */
.links-edit { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.link-item { display: flex; align-items: center; gap: 8px; }
.link-a { flex: 1; color: var(--primary-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-add { display: flex; gap: 8px; }
.link-add input { padding: 10px 12px; }
.link-add #f-link-title { flex: 0 0 34%; }
.link-add #f-link-url { flex: 1; }

/* notes / activity editor */
.notes-edit { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.note-item { display: flex; align-items: flex-start; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.note-body { flex: 1; min-width: 0; }
.note-text { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.note-ts { font-size: 11px; color: var(--muted); margin-top: 3px; }
.note-add { display: flex; gap: 8px; }
.note-add input { flex: 1; padding: 10px 12px; }

/* time tracking */
.timer-row { display: flex; align-items: center; gap: 8px; }
.timer-display { flex: 1; font-weight: 700; font-size: 15px; padding: 11px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; white-space: nowrap; }

/* label filter row */
.label-filter { flex: 1 1 100%; }

/* ---------- round 3 batch B: recurrence + WIP limits ---------- */
.recur-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.tab .count.over { background: var(--danger); color: #fff; }
.wip { margin-left: 8px; font-size: 12px; font-weight: 800; color: var(--muted); }
.wip.over { color: #fca5a5; }
.wip-row { display: flex; gap: 10px; margin-top: 10px; }
.wip-field { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.wip-label { font-size: 12px; color: var(--muted); font-weight: 700; }
.wip-field input { padding: 10px 12px; }

/* ---------- round 3 batch C: stats dashboard ---------- */
.stat-tiles { display: flex; gap: 10px; margin-bottom: 4px; }
.stat-tile { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 10px; text-align: center; }
.stat-tile.danger { border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.1); }
.stat-tile-val { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.stat-tile-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-h { font-size: 13px; font-weight: 800; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-group { display: flex; flex-direction: column; gap: 8px; }
.stat-bar { display: flex; align-items: center; gap: 10px; }
.stat-bar-label { flex: 0 0 34%; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-bar-track { flex: 1; height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 999px; transition: width .5s cubic-bezier(.16,1,.3,1); }
.stat-bar-val { flex: 0 0 auto; font-size: 13px; font-weight: 700; color: var(--muted); min-width: 20px; text-align: right; }
.btn.ghost.on { border-color: var(--primary); color: var(--text); background: var(--surface-2); }

/* narrow screens: free up top-bar space */
@media (max-width: 380px) { .brand-name { display: none; } }

/* ---------- round 3 batch D: PIN lock gate ---------- */
.lock-gate {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(600px 600px at 50% 40%, rgba(99,102,241,.25), rgba(4,7,18,.96));
  backdrop-filter: blur(14px);
}
.lock-card {
  width: 100%; max-width: 340px; text-align: center;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 22px;
  padding: 30px 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.lock-icon { font-size: 40px; }
.lock-card h2 { font-size: 22px; }
.lock-card input { text-align: center; font-size: 20px; letter-spacing: .25em; padding: 14px; }

/* ---------- round 4 batch B: views, agenda, multi-select ---------- */
.view-menu {
  position: fixed; top: 58px; right: 12px; z-index: 35;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 2px; min-width: 190px;
}
.view-menu button {
  text-align: left; background: none; border: none; color: var(--text);
  font-size: 15px; font-weight: 600; padding: 11px 14px; border-radius: 10px; cursor: pointer; font-family: inherit;
}
.view-menu button:active { background: var(--surface-2); }

.agenda-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.agenda-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--card-accent, var(--line)); border-radius: 12px;
}
.agenda-main { flex: 1; min-width: 0; }
.agenda-t { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.badge.age { background: rgba(154,168,212,.16); color: var(--muted); }

.card.selectable { position: relative; cursor: pointer; }
.card.selected { outline: 2px solid var(--primary); outline-offset: 1px; }
.card.selected::after {
  content: "✓"; position: absolute; top: 8px; right: 8px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center;
  font-weight: 900; font-size: 13px;
}
.select-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(16px + var(--safe-bottom)); z-index: 46;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  padding: 10px 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.select-count { font-weight: 700; font-size: 14px; }
.select-actions { margin-left: auto; display: flex; gap: 8px; }
.select-bar .btn-mini { width: 42px; height: 38px; font-size: 16px; padding: 0; }
.select-cols { display: flex; gap: 6px; flex-wrap: wrap; flex-basis: 100%; order: 3; margin-top: 4px; }
.select-cols .btn-mini { width: auto; flex: 1 1 auto; height: 36px; font-size: 13px; padding: 0 10px; }

/* ---------- round 4 batch C: quick-add, templates, markdown, command palette ---------- */
.quickadd { display: flex; gap: 8px; padding: 8px 12px 0; }
.quickadd #qa-input {
  flex: 1; padding: 10px 14px; font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.quickadd .btn-mini { width: 44px; }
.tpl-menu { margin: 4px 12px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.tpl-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; background: none; border: none; color: var(--text); font-size: 14px; font-weight: 600; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-family: inherit; }
.tpl-item:active { background: var(--surface-2); }
.tpl-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.tpl-empty { color: var(--muted); font-size: 13px; padding: 10px 12px; }

/* markdown in card description & notes */
.card-desc strong, .note-text strong { font-weight: 800; }
.card-desc em, .note-text em { font-style: italic; }
.card-desc code, .note-text code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.card-desc a, .note-text a { color: var(--primary-2); }
.card-desc ul, .note-text ul { margin: 4px 0; padding-left: 18px; }

/* command palette */
.cmdk { position: fixed; inset: 0; z-index: 78; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.cmdk-backdrop { position: fixed; inset: 0; background: rgba(4,7,18,.6); backdrop-filter: blur(4px); }
.cmdk-panel { position: relative; width: 100%; max-width: 540px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; }
.cmdk-panel input { border: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px; font-size: 16px; background: var(--surface); }
.cmdk-list { overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.cmdk-item { text-align: left; background: none; border: none; color: var(--text); font-size: 15px; padding: 11px 14px; border-radius: 10px; cursor: pointer; font-family: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item.active { background: var(--primary); color: #fff; }

/* ---------- round 4 batch D: columns & automations ---------- */
.col-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.col-item { display: flex; align-items: center; gap: 6px; }
.col-name { flex: 1; padding: 9px 12px; }
.col-btn { width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 9px; cursor: pointer; font-size: 14px; padding: 0; }
.col-btn.danger { color: var(--danger); }
.col-add { display: flex; gap: 8px; margin-top: 8px; }
.col-add input { flex: 1; padding: 10px 12px; }
.auto-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 8px; flex-wrap: wrap; }
.auto-row input[type="number"] { width: 60px; padding: 6px 8px; }
.auto-row input[type="checkbox"] { width: 18px; height: 18px; }
