/* ============================================================
   1. CSS VARIABLES & RESET
   ============================================================ */
:root {
  --font: -apple-system, "SF Pro Text", system-ui, sans-serif;
  --primary: #D97757;
  --primary-hover: #c4663d;
  --primary-light: #D9775720;
  --nav-h: 49px;
  --header-h: 52px;
  --radius: 12px;
  --bg-page: #f2f2f7;
  --bg-card: #ffffff;
  --bg-surface: #e5e5ea;
  --text: #000000;
  --text-secondary: rgba(60,60,67,0.6);
  --text-muted: rgba(60,60,67,0.3);
  --separator: rgba(60,60,67,0.12);
  --separator-strong: rgba(60,60,67,0.25);
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-sheet: 0 -4px 24px rgba(0,0,0,0.12);
  --transition: 0.2s ease;
  /* Legacy aliases */
  --bg: var(--bg-page);
  --bg-primary: var(--bg-page);
  --bg-secondary: var(--bg-surface);
  --text-primary: var(--text);
  --accent: var(--primary);
  --accent-hover: var(--primary-hover);
  --border: var(--separator-strong);
  --border-light: var(--separator);
  --ios-separator: var(--separator);
  --radius-card: var(--radius);
  --radius-sheet: 20px 20px 0 0;
  --shadow-card: var(--shadow);
  --nav-height: var(--nav-h);
  --header-height: var(--header-h);
  --sidebar-width: 260px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #000000;
    --bg-card: #1c1c1e;
    --bg-surface: #2c2c2e;
    --text: #ffffff;
    --text-secondary: rgba(235,235,245,0.6);
    --text-muted: rgba(235,235,245,0.3);
    --separator: rgba(84,84,88,0.65);
    --separator-strong: rgba(84,84,88,0.85);
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-sheet: 0 -4px 24px rgba(0,0,0,0.5);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ============================================================
   2. APP SHELL
   ============================================================ */
body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text);
  height: 100dvh;
  line-height: 1.5;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}

/* --- Header --- */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 0.5px solid var(--separator);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.hamburger-btn {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
}
.hamburger-btn:hover { background: var(--bg-surface); }
.hamburger-btn svg { display: block; }
.header-board-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  padding: 4px 0;
}
.header-board-name:hover { color: var(--primary); }
.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.header-icon-btn {
  background: none;
  border: none;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 10px;
  position: relative;
  transition: background var(--transition), color var(--transition);
}
.header-icon-btn:hover { background: var(--bg-surface); color: var(--text); }
.header-icon-btn svg { display: block; }
.header-icon-btn .badge-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

#offlineBadge {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #c05621;
  background: #fff8f0;
  border: 1px solid #f6a85a;
  border-radius: 6px;
  padding: 3px 8px;
}
#autoSaveStatus { display: none; }

/* --- Content Area --- */
.app-content {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
}
.app-content::-webkit-scrollbar { display: none; }

/* --- Bottom Navigation (Mobile) --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-card);
  border-top: 0.5px solid var(--separator);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 0;
  flex: 1;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  border: none;
  background: none;
  transition: color var(--transition), transform 0.15s ease;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:active { transform: scale(0.92); }
.nav-item.active { color: var(--primary); }
.nav-item.active svg { stroke: var(--primary); }
.nav-item svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- FAB --- */
.nav-fab {
  position: relative;
  top: -12px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(217,119,87,0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
  padding: 0;
}
.nav-fab:active { transform: scale(0.9); }
.nav-fab:hover { box-shadow: 0 6px 16px rgba(217,119,87,0.5); }
.nav-fab svg {
  width: 24px;
  height: 24px;
  stroke: white;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
}

/* --- Desktop Sidebar --- */
@media (min-width: 768px) {
  body { flex-direction: row; }

  .app-header {
    position: static;
  }

  .app-content {
    position: static;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .bottom-nav {
    position: static;
    flex-direction: column;
    width: var(--sidebar-width);
    height: 100dvh;
    border-top: none;
    border-right: 0.5px solid var(--separator);
    justify-content: flex-start;
    padding: 0;
    flex-shrink: 0;
    order: -1;
    gap: 2px;
  }
  .sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
  }
  .sidebar-logo svg { flex-shrink: 0; }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 10px;
    margin: 0 10px;
    min-height: 42px;
    flex: unset;
  }
  .nav-item:hover { background: var(--bg-surface); color: var(--text); }
  .nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

  .nav-fab {
    top: 0;
    width: auto;
    border-radius: 10px;
    margin: 12px 16px;
    padding: 10px 20px;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
  }
  .nav-fab::after { content: 'Neue Aufgabe'; }

  .nav-divider {
    height: 1px;
    background: var(--separator);
    margin: 8px 16px;
  }
  .nav-section-title {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
    padding: 12px 20px 4px;
  }
  .sidebar-boards {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px;
  }
  .sidebar-board-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: background var(--transition);
  }
  .sidebar-board-item:hover { background: var(--bg-surface); color: var(--text); }
  .sidebar-board-item.active { color: var(--primary); font-weight: 600; }

  .sidebar-bottom {
    padding: 12px 16px;
    border-top: 0.5px solid var(--separator);
  }
  .app-main-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100dvh;
  }
  .app-content { padding-bottom: 0; }
  .nav-label-mobile { display: none; }
}

@media (max-width: 767px) {
  .sidebar-logo,
  .nav-divider,
  .nav-section-title,
  .sidebar-boards,
  .sidebar-bottom,
  .nav-label-desktop { display: none !important; }
}

/* ============================================================
   3. BOARD VIEW
   ============================================================ */
.board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 16px;
  flex: 1;
  min-height: 0;
  scroll-snap-type: x proximity;
}
.column {
  background: var(--bg-card);
  border-radius: var(--radius);
  min-width: 280px;
  max-width: 360px;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  scroll-snap-align: start;
  box-shadow: var(--shadow);
}
.column-header {
  padding: 14px 16px;
  font-weight: 400;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
  position: relative;
  z-index: 2;
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 0.5px solid var(--separator);
}
.column-header:active { cursor: grabbing; }
.column.dragging-column { opacity: 0.5; }
.column-drop-indicator {
  width: 3px;
  background: var(--primary);
  border-radius: 2px;
  margin: 0 -2px;
  min-height: 100px;
}
.column-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.column-title {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.column-title:hover { color: var(--text); }
.column-header .count {
  background: var(--bg-page);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.sort-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 13px;
  border-radius: 6px;
  line-height: 1;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.15s;
}
.column:hover .sort-btn,
.list-section-header .sort-btn { opacity: 1; }
.sort-btn:hover { color: var(--text); background: var(--bg-surface); }

.cards-wrapper {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: visible;
}
.cards {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 8px 10px 10px;
  min-height: 80px;
}
.cards.drag-over {
  background: var(--primary-light);
  border-radius: 8px;
}

/* Empty column state */
.column-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
}
.column-empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
  stroke: var(--primary);
  fill: none;
  stroke-width: 1.2;
}
.column-empty-state p {
  font-size: 13px;
  line-height: 1.4;
}

.add-section-btn {
  flex-shrink: 0;
  width: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 20px;
  border: 2px dashed var(--separator);
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.2s;
  height: 100%;
  background: none;
}
.add-section-btn:hover { opacity: 1; }

.done-archive-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.done-archive-toggle span { cursor: pointer; }
.done-archive-toggle span:hover { color: var(--text-secondary); }
.archive-delete-btn {
  font-size: 12px;
  color: #ef4444;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  font-family: var(--font);
}
.archive-delete-btn:hover { text-decoration: underline; }

/* ============================================================
   4. TASK CARDS — unified (board, list, today)
   ============================================================ */
.task-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border-radius: 10px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
  position: relative;
  overflow: visible;
  box-shadow: var(--shadow);
}
.task-card:active { opacity: 0.6; }
.task-card:hover { box-shadow: var(--shadow-hover); }
.task-card.dragging { opacity: 0.5; transform: rotate(2deg); }

/* Checkbox — 22px iOS circle */
.task-cb {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--separator-strong);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
  z-index: 1;
}
.task-cb:hover { border-color: var(--primary); }
.task-cb.checked {
  background: #34c759;
  border-color: #34c759;
}
.task-cb.checked::after {
  content: '';
  width: 5px;
  height: 9px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

/* Card body */
.task-body {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.task-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}
.task-title.done-title,
.task-card.done .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  align-items: center;
}
.task-meta:empty { display: none; }
.meta-chip {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
}
.meta-due { color: var(--text-muted); }
.meta-overdue { color: #ff3b30; font-weight: 600; }
.meta-today-due { color: #ff9500; }

/* Legacy chip style */
.task-chip {
  font-size: 12px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.task-chip.overdue { color: #ff3b30; font-weight: 600; }
.task-chip.today { color: #ff9500; }
.task-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.task-chip .dot.prio-high { background: #ff3b30; }
.task-chip .dot.prio-medium { background: #ff9500; }
.task-chip .dot.prio-low { background: #34c759; }

/* Card layout row (legacy) */
.task-card-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* Mood canvas */
.mood-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  border-radius: 10px;
}

/* Subtask progress bar */
.subtask-progress {
  height: 3px;
  background: var(--separator);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.subtask-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Card note */
.card-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Legacy checkbox (list-item etc) */
.checkbox {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  flex-shrink: 0;
  border: 1.5px solid var(--separator-strong);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
}
.checkbox:hover { border-color: var(--primary); }
.checkbox.checked {
  background: #34c759;
  border-color: #34c759;
}
.checkbox.checked::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

/* Badge dropdown */
.badge-dropdown {
  position: absolute;
  z-index: 10000;
  background: var(--bg-card);
  border: 1px solid var(--separator);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  padding: 4px;
  min-width: 160px;
}
.badge-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: var(--text);
  font-family: var(--font);
  min-height: 36px;
}
.badge-dropdown-item:hover { background: var(--bg-surface); }
.badge-dropdown-item.remove { color: var(--text-muted); font-style: italic; }

/* Add card */
.add-card { padding: 10px; }
.add-card button {
  width: 100%;
  background: transparent;
  border: 2px dashed var(--separator);
  color: var(--text-muted);
  font-weight: 500;
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  font-family: var(--font);
}
.add-card button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.new-task-input {
  width: 100%;
  background: var(--bg-card);
  border: 2px solid var(--primary);
  border-radius: 10px;
  padding: 12px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  resize: none;
}
.new-task-input:focus { outline: none; }
.new-task-input::placeholder { color: var(--text-muted); }

/* Drop indicator */
.drop-indicator {
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
  margin: 4px 0;
}

/* ============================================================
   5. MOOD CARDS
   ============================================================ */
@keyframes sucks-float {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.7; }
  50% { transform: translateY(-4px) rotate(5deg); opacity: 1; }
}
@keyframes fun-sparkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.7; }
  50% { transform: scale(1.2) rotate(8deg); opacity: 1; }
}

.task-card.overdue-card {
  box-shadow: 0 0 0 2px #f8717180, var(--shadow);
  animation: overdue-pulse 3s ease-in-out infinite;
}
@keyframes overdue-pulse {
  0%, 100% { box-shadow: 0 0 0 2px #f8717150, var(--shadow); }
  50% { box-shadow: 0 0 0 3px #f8717190, 0 2px 12px rgba(239, 68, 68, 0.2); }
}

.task-card.sucks-card { position: relative; overflow: visible; }
.task-card.sucks-card::before {
  content: '💩';
  position: absolute;
  top: -4px; right: 24px;
  font-size: 22px;
  animation: sucks-float 3s ease-in-out infinite;
  pointer-events: none; z-index: 10;
}
.task-card.sucks-card::after {
  content: '🤢';
  position: absolute;
  top: -2px; right: 4px;
  font-size: 16px;
  animation: sucks-float 3.5s ease-in-out infinite 1s;
  pointer-events: none; z-index: 10;
}
.sucks-stink-lines {
  position: absolute;
  top: -6px; right: 54px;
  font-size: 14px;
  color: #8B7355;
  opacity: 0.5;
  animation: sucks-float 2.5s ease-in-out infinite 0.5s;
  pointer-events: none; z-index: 10;
}

.task-card.fun-card {
  position: relative;
  overflow: visible;
  box-shadow: var(--shadow), 0 0 8px rgba(251, 191, 36, 0.15);
}
.task-card.fun-card::before {
  content: '🎉';
  position: absolute;
  top: -4px; right: 24px;
  font-size: 20px;
  animation: fun-sparkle 2.5s ease-in-out infinite;
  pointer-events: none; z-index: 10;
}
.task-card.fun-card::after {
  content: '⭐';
  position: absolute;
  top: -2px; right: 4px;
  font-size: 16px;
  animation: fun-sparkle 3s ease-in-out infinite 0.8s;
  pointer-events: none; z-index: 10;
}
.fun-sparkle-lines {
  position: absolute;
  top: -4px; right: 54px;
  font-size: 14px;
  opacity: 0.6;
  animation: fun-sparkle 2.5s ease-in-out infinite 0.4s;
  pointer-events: none; z-index: 10;
}

@keyframes sucks-wobble {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-0.5deg); }
  75% { transform: rotate(0.5deg); }
}
.task-card.sucks-card:hover {
  animation: sucks-wobble 0.4s ease;
  filter: saturate(0.85);
}

/* ============================================================
   6. LIST VIEW
   ============================================================ */
.list-view {
  max-width: 720px;
  margin: 0 auto;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  width: 100%;
  padding: 16px;
}
.list-section { margin-bottom: 24px; }
.list-section.drag-over {
  background: var(--primary-light);
  border-radius: 10px;
  margin: 0 -12px 24px;
  padding: 0 12px;
}
.list-section-header {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  padding: 4px 0;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.list-section-header .section-title { cursor: pointer; }
.list-section-header .section-title:hover { color: var(--text); }
.list-section-header .count { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.list-section-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.list-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
  border-radius: var(--radius);
  transition: all 0.15s ease;
  box-shadow: var(--shadow);
}
.list-item:active { background: var(--bg-surface); }
.list-item:hover { box-shadow: var(--shadow-hover); }
.list-item.dragging { opacity: 0.5; background: var(--bg-surface); }
.list-item .checkbox { margin-top: 1px; flex-shrink: 0; }

.list-item-content { flex: 1; min-width: 0; }
.list-item-title { font-size: 15px; font-weight: 500; color: var(--text); line-height: 1.4; }
.list-item-title.checked { color: var(--text-muted); text-decoration: line-through; }

.list-item-note { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.list-item-subtasks { margin-top: 8px; padding-left: 2px; }
.list-item-subtask {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.list-item-subtask .checkbox { width: 16px; height: 16px; min-width: 16px; min-height: 16px; margin-top: 1px; }

.list-add-section {
  margin-top: 12px;
  padding: 14px;
  border: 2px dashed var(--separator);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  background: none;
}
.list-add-section:hover { border-color: var(--primary); color: var(--primary); }

.quick-add { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.quick-add-input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 15px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
}
.quick-add-input::placeholder { color: var(--text-muted); }
.quick-add-section {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--separator);
}
.quick-add-section:hover { border-color: var(--primary); }

/* ============================================================
   7. TODAY VIEW
   ============================================================ */
.today-view {
  max-width: 720px;
  margin: 0 auto;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  width: 100%;
  padding: 16px;
}
.today-header { padding: 8px 0 20px; }
.today-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.today-header .today-date {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.today-section { margin-bottom: 24px; }
.today-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}
.today-section-header .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.today-section-header .dot.red { background: #ff3b30; }
.today-section-header .dot.orange { background: #ff9500; }
.today-section-header .dot.blue { background: #007aff; }
.today-section-header .section-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: auto;
}

/* Today empty state */
.today-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.today-empty svg {
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
  opacity: 0.5;
  stroke: var(--primary);
  fill: none;
  stroke-width: 1;
}
.today-empty h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.today-empty p { font-size: 14px; }

/* ============================================================
   8. SEARCH OVERLAY
   ============================================================ */
.search-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-page);
  z-index: 20000;
  display: flex;
  flex-direction: column;
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.2s ease;
  will-change: transform;
}
.search-overlay.open {
  transform: translateY(0);
  opacity: 1;
}
.search-overlay-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--separator);
  background: var(--bg-card);
}
.search-overlay-header input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 17px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  padding: 8px 0;
}
.search-overlay-header input::placeholder { color: var(--text-muted); }
.search-overlay-close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 20px;
  border-radius: 10px;
}
.search-overlay-close:hover { background: var(--bg-surface); color: var(--text); }

.search-result-count-overlay {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.search-overlay-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}
.search-result-item {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg-card);
  margin-bottom: 8px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.15s;
}
.search-result-item:active { background: var(--bg-surface); }
.search-result-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}
.search-result-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}
.search-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
  font-size: 14px;
}

/* Active filter pills */
.active-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 8px;
  width: 100%;
}
.active-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--pill-bg, var(--bg-surface));
  color: var(--pill-color, var(--text));
  border: 1px solid var(--pill-color, var(--separator-strong));
  border-radius: 20px;
  padding: 4px 8px 4px 12px;
  font-size: 12px;
  font-weight: 500;
}
.pill-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pill-remove:hover { background: rgba(0,0,0,0.1); }

.filter-section-label {
  width: 100%;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  padding: 8px 16px 2px;
}
.filter-pill.dimmed { opacity: 0.35; }

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
}
.filter-pill {
  border: 1px solid var(--pill-color, var(--separator-strong));
  background: transparent;
  color: var(--pill-color, var(--text-secondary));
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  transition: all 0.15s;
  line-height: 1.5;
  min-height: 32px;
}
.filter-pill:hover { background: var(--pill-bg, var(--bg-surface)); }
.filter-pill.active {
  background: var(--pill-color, var(--primary));
  color: white;
  border-color: var(--pill-color, var(--primary));
}
.filter-pill.disabled { opacity: 0.35; pointer-events: none; }

/* ============================================================
   9. BOTTOM SHEET & BACKDROP
   ============================================================ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32,0.72,0,1);
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  will-change: transform;
  box-shadow: var(--shadow-sheet);
}
.bottom-sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--separator-strong);
  border-radius: 2px;
  margin: 10px auto 6px;
  flex-shrink: 0;
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 12px;
  flex-shrink: 0;
}
.sheet-header h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.sheet-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
}
.sheet-close:hover { color: var(--text); }
.sheet-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 16px 20px;
  scrollbar-width: none;
}
.sheet-body::-webkit-scrollbar { display: none; }

/* More menu items */
.more-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 4px;
  cursor: pointer;
  border-radius: 10px;
  transition: background var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  min-height: 44px;
}
.more-menu-item:hover { background: var(--bg-surface); }
.more-menu-item svg {
  width: 22px;
  height: 22px;
  stroke: var(--text-secondary);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.more-menu-item .toggle-switch {
  margin-left: auto;
  width: 51px;
  height: 31px;
  border-radius: 31px;
  background: rgba(120,120,128,0.32);
  position: relative;
  cursor: pointer;
  transition: background 0.25s;
}
.more-menu-item .toggle-switch.on { background: #34c759; }
.more-menu-item .toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: white;
  transition: transform 0.25s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.more-menu-item .toggle-switch.on::after {
  transform: translateX(20px);
}

/* New task sheet */
.new-task-sheet-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 17px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--separator);
  margin-bottom: 16px;
}
.new-task-sheet-input:focus { border-bottom-color: var(--primary); }
.new-task-sheet-input::placeholder { color: var(--text-muted); }

.new-task-chips {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}
.new-task-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1.5px solid var(--separator-strong);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font);
  transition: all var(--transition);
  min-height: 36px;
  font-weight: 500;
}
.new-task-chip:hover { border-color: var(--primary); color: var(--primary); }
.new-task-chip.active { background: var(--primary); border-color: var(--primary); color: white; }

.new-task-submit {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--transition);
  margin-top: 8px;
  min-height: 50px;
}
.new-task-submit:hover { background: var(--primary-hover); }
.new-task-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   10. TASK DETAIL SHEET (ios-* classes)
   ============================================================ */
.task-detail-sheet {
  background: var(--bg-page) !important;
}
.task-detail-sheet .sheet-body {
  padding: 0 16px 48px;
  scrollbar-width: none;
  overflow-y: auto;
  overflow-x: hidden;
}
.task-detail-sheet .sheet-body::-webkit-scrollbar { display: none; }

/* iOS nav bar header */
.td-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 4px 52px 12px;
}
.td-header-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font);
}
.td-close-btn {
  position: absolute;
  right: 16px;
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(120,120,128,0.15);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.td-close-btn:active { opacity: 0.6; }

/* iOS Groups */
.ios-group {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: visible;
  margin-bottom: 8px;
}
.ios-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 16px;
  cursor: pointer;
  position: relative;
}
.ios-row + .ios-row { border-top: 0.5px solid var(--separator); }
.ios-row-icon { font-size: 17px; width: 24px; text-align: center; flex-shrink: 0; }
.ios-row-label { flex: 1; font-size: 15px; color: var(--text); font-family: var(--font); }
.ios-row-value { font-size: 15px; color: var(--text-secondary); font-family: var(--font); text-align: right; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ios-row-chevron { color: var(--text-muted); font-size: 16px; opacity: 0.4; flex-shrink: 0; }

.ios-expand {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.28s cubic-bezier(0.4,0,0.2,1);
  background: var(--bg-card);
}
.ios-expand.open { max-height: 400px; }
.ios-expand-inner {
  padding: 12px 16px 16px 52px;
  border-top: 0.5px solid var(--separator);
}
.ios-expand-inner input[type=date],
.ios-expand-inner input[type=time] {
  width: 100%;
  border: none;
  background: var(--bg-page);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  box-sizing: border-box;
}

.ios-section-header {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
  padding: 16px 4px 6px;
  font-family: var(--font);
}

.ios-title-card {
  background: var(--bg-card);
  border-radius: 12px;
  margin-bottom: 8px;
  overflow: hidden;
}
.ios-title-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  padding: 14px 16px 10px;
  box-sizing: border-box;
}
.ios-note-sep {
  height: 0.5px;
  background: var(--separator);
  margin: 0 16px;
}
.ios-note-textarea {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  padding: 10px 16px 14px;
  resize: none;
  min-height: 60px;
  box-sizing: border-box;
}
.ios-note-textarea::placeholder,
.ios-title-input::placeholder { color: var(--text-muted); }

.ios-chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
}
.ios-chip-row::-webkit-scrollbar { display: none; }
.ios-chip {
  white-space: nowrap;
  border: 1.5px solid var(--separator-strong);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  flex-shrink: 0;
  min-height: 34px;
  display: flex;
  align-items: center;
}
.ios-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.ios-segmented {
  display: flex;
  background: rgba(120,120,128,0.12);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}
.ios-seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 4px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  border-radius: 7px;
  font-weight: 500;
  transition: all 0.15s;
}
.ios-seg-btn.active {
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.ios-subtask-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 16px;
  position: relative;
}
.ios-subtask-row + .ios-subtask-row { border-top: 0.5px solid var(--separator); }
.ios-subtask-cb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--separator-strong);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ios-subtask-cb.checked { background: #34c759; border-color: #34c759; color: white; font-size: 12px; }
.ios-subtask-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  padding: 0;
}
.ios-subtask-del {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ios-add-row,
.ios-add-subtask-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 16px;
  cursor: pointer;
  border-top: 0.5px solid var(--separator);
}
.ios-add-icon,
.ios-add-subtask-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #34c759;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 400;
  flex-shrink: 0;
}
.ios-add-label,
.ios-add-subtask-label { font-size: 15px; color: var(--text); font-family: var(--font); }

/* Toggle row (hidden standalone, lives inside ios-row) */
.td-toggle-row { display: none; }
.td-toggle-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}
.td-toggle-switch input { opacity: 0; width: 0; height: 0; }
.td-toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(120,120,128,0.32);
  border-radius: 31px;
  cursor: pointer;
  transition: background 0.25s;
}
.td-toggle-slider::before {
  content: '';
  position: absolute;
  width: 27px;
  height: 27px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.td-toggle-switch input:checked + .td-toggle-slider { background: #34c759; }
.td-toggle-switch input:checked + .td-toggle-slider::before { transform: translateX(20px); }

/* Footer buttons */
.td-footer {
  display: flex;
  gap: 10px;
  padding: 8px 0 0;
}
.td-delete-btn {
  flex: 1;
  border: none;
  background: rgba(255,59,48,0.1);
  color: #ff3b30;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  padding: 14px;
  border-radius: 12px;
  min-height: 50px;
}
.td-delete-btn:active { opacity: 0.75; }
.td-done-btn {
  flex: 2;
  border: none;
  background: #34c759;
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  padding: 14px;
  border-radius: 12px;
  min-height: 50px;
}
.td-done-btn.reopen { background: var(--primary); }
.td-done-btn:active { opacity: 0.8; }

/* ============================================================
   11. FAB & NEW TASK FORM
   ============================================================ */
.fab-project-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.fab-project-chips::-webkit-scrollbar { display: none; }
.fab-section-label {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 2px;
  margin-top: 8px;
  width: 100%;
}
.fab-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

/* Date inputs in new task form */
.td-date-input,
.td-time-input {
  flex: 1;
  border: 1.5px solid var(--separator-strong);
  background: transparent;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 15px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
  min-height: 44px;
}
.td-date-input:focus,
.td-time-input:focus { border-color: var(--primary); }

/* ============================================================
   12. MISC (status bar, undo, swipe, drag, empty states)
   ============================================================ */

/* Swipe actions */
.swipe-container {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
}
.swipe-action-left,
.swipe-action-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: white;
  padding: 0 24px;
  opacity: 0;
  transition: opacity 0.15s;
}
.swipe-action-left {
  left: 0;
  background: #34c759;
  justify-content: flex-start;
}
.swipe-action-right {
  right: 0;
  background: #ff3b30;
  justify-content: flex-end;
}
.swipe-action-left.active,
.swipe-action-right.active { opacity: 1; }

/* Status bar */
.status-bar {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg-page);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  z-index: 20000;
  max-width: 90vw;
  text-align: center;
  pointer-events: none;
}
.status-bar.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Undo toast */
.undo-toast {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: var(--bg-page);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  z-index: 20001;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
  max-width: 90vw;
}
.undo-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.undo-toast-msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.undo-toast-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  white-space: nowrap;
  min-height: 32px;
}
.undo-toast-btn:hover { background: rgba(255,255,255,0.1); }

/* Touch drag */
.touch-drag-ghost {
  position: fixed;
  z-index: 30000;
  opacity: 0.85;
  transform: rotate(2deg) scale(1.02);
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  pointer-events: none;
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 14px 16px;
}
.touch-dragging { opacity: 0.3; }
.touch-drop-indicator {
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
  margin: 4px 0;
  animation: drop-pulse 1s ease infinite;
}
@keyframes drop-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.touch-drop-highlight {
  box-shadow: inset 0 0 0 2px var(--primary) !important;
  border-radius: var(--radius);
}

/* ============================================================
   13. MOBILE OVERRIDES
   ============================================================ */
@media (max-width: 767px) {
  .board {
    scroll-snap-type: x mandatory;
  }
  .column {
    min-width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }
}

/* ============================================================
   14. BOARD DRAWER
   ============================================================ */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 8000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.board-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--bg-card);
  z-index: 8500;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.32,0.72,0,1);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  padding-top: env(safe-area-inset-top, 0px);
  overflow: hidden;
}
.board-drawer.open {
  transform: translateX(0);
}
.board-drawer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 12px;
  border-bottom: 0.5px solid var(--separator);
  flex-shrink: 0;
}
.board-drawer-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.board-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}
.board-drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  transition: background 0.15s;
  min-height: 44px;
}
.board-drawer-item:hover { background: var(--bg-surface); }
.board-drawer-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.board-delete-btn {
  margin-left: auto;
  font-size: 18px;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.board-delete-btn:hover { color: #ff3b30; }
.board-drawer-footer {
  padding: 12px 16px;
  border-top: 0.5px solid var(--separator);
  flex-shrink: 0;
}
.board-drawer-add {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1.5px solid var(--separator-strong);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font);
  min-height: 44px;
  transition: all 0.15s;
}
.board-drawer-add:hover {
  border-color: var(--primary);
  color: var(--primary);
}

@media (min-width: 768px) {
  .board-drawer,
  .drawer-backdrop { display: none !important; }
}
