/* ==========================================================================
   todo.css — Todo rows, custom checkboxes, meta, actions, drag, states
   UI/UX Pro Max — Content-first todo list with Notion/Linear-level polish
   ========================================================================== */

/* ---------- Todo List ---------- */
.todo-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
}

/* ---------- Todo Section ---------- */
.todo-section {
  margin-bottom: var(--space-xl);
}

.todo-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-sm);
  cursor: pointer;
  user-select: none;
  transition: color 150ms ease;
}

.todo-section-header:hover {
  color: var(--text);
}

.todo-section-header:focus-visible {
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

.todo-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.todo-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-hover);
  border-radius: var(--radius-full);
  transition: background 150ms ease;
}

.todo-section-header:hover .todo-section-count {
  background: var(--gray-200);
}

.todo-section-header .chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.todo-section-header[aria-expanded="true"] .chevron {
  transform: rotate(90deg);
}

/* ---------- Todo Row ---------- */
.todo-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid #F3F4F6;
  transition: background 150ms ease;
  min-height: 40px;
  position: relative;
}

.todo-row:last-child {
  border-bottom: none;
}

/* ---------- Note wrapper & button ---------- */
.todo-row-wrap {
  border-bottom: 1px solid #F3F4F6;
}
.todo-row-wrap:last-child {
  border-bottom: none;
}
.todo-row-wrap .todo-row {
  border-bottom: none;
}

.todo-note-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: #9CA3AF;
  border-radius: 4px;
  cursor: pointer;
  transition: all 120ms ease;
}
.todo-note-btn:hover {
  color: var(--primary, #6366F1);
  background: #EEF2FF;
}
.todo-note-btn.has-note {
  color: var(--primary, #6366F1);
  background: #EEF2FF;
  border-color: #C7D2FE;
}
.todo-note-btn.has-note:hover {
  background: #E0E7FF;
}
.todo-note-btn .todo-note-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary, #6366F1);
}
.todo-note-btn[aria-expanded="true"] {
  background: #E0E7FF;
}

/* ---------- Note panel ---------- */
.todo-note-panel {
  padding: 10px 16px 12px 48px;
  background: #FAFAFB;
  border-top: 1px dashed #E5E7EB;
  font-size: 0.875rem;
}
.todo-note-content {
  color: #374151;
  line-height: 1.6;
}
.todo-note-content p { margin: 0 0 8px 0; }
.todo-note-content p:last-child { margin-bottom: 0; }
.todo-note-content img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 4px;
  margin: 4px 0;
}
.todo-note-content a { color: var(--primary, #6366F1); text-decoration: underline; }
.todo-note-content pre, .todo-note-content code {
  background: #F3F4F6;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.85em;
}
.todo-note-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.todo-note-textarea {
  width: 100%;
  min-height: 120px;
  font-family: inherit;
  font-size: 0.875rem;
}
.todo-note-panel .todo-note-empty {
  color: #9CA3AF;
  font-style: italic;
}

/* ---------- Sort toggle button ---------- */
.sort-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid #E5E7EB;
  border-radius: 4px;
  background: transparent;
  color: #6B7280;
  font-size: 12px;
  cursor: pointer;
  transition: all 120ms ease;
  white-space: nowrap;
}
.sort-toggle-btn:hover {
  background: #F3F4F6;
  color: var(--primary, #6366F1);
  border-color: #C7D2FE;
}
.sort-toggle-btn .sort-label {
  font-size: 11px;
}

/* ---------- Input shake (empty submit feedback) ---------- */
@keyframes input-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}
.input-shake {
  animation: input-shake 0.3s ease;
  border-color: #F87171 !important;
}

.todo-row:hover {
  background: #F9FAFB;
}

/* Done state */
.todo-row.done {
  opacity: 0.55;
}

.todo-row.done .todo-content {
  text-decoration: line-through;
  text-decoration-color: var(--gray-300);
  color: #9CA3AF;
}

/* ---------- Drag Handle ---------- */
.todo-drag-handle {
  display: flex;
  align-items: center;
  padding: 2px 4px;
  color: var(--gray-300);
  cursor: grab;
  opacity: 0.3;
  transition: opacity 150ms ease, color 150ms ease;
  flex-shrink: 0;
  font-size: 14px;
  letter-spacing: 1px;
  user-select: none;
}

.todo-row:hover .todo-drag-handle,
.todo-section-editable:hover .todo-drag-handle {
  opacity: 0.6;
  color: var(--gray-400);
}

.todo-drag-handle:hover {
  opacity: 1 !important;
  color: var(--primary-500) !important;
}

.todo-drag-handle:active {
  cursor: grabbing;
}

.todo-drag-handle svg {
  width: 14px;
  height: 14px;
}

/* ---------- Custom Checkbox (16x16, rounded-4px, indigo) ---------- */
.todo-checkbox {
  position: relative;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.todo-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid #D1D5DB;
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.todo-checkbox input[type="checkbox"]:hover {
  border-color: #6366F1;
  background: #EEF2FF;
}

.todo-checkbox input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2), 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.todo-checkbox input[type="checkbox"]:active {
  transform: scale(0.9);
}

.todo-checkbox input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.todo-checkbox input[type="checkbox"]:checked {
  background: #6366F1;
  border-color: #6366F1;
  animation: checkbox-pop 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.todo-checkbox input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 4px;
  width: 5px;
  height: 8px;
  border: solid #FFFFFF;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  animation: checkmark-draw 0.15s ease-out;
}

@keyframes checkbox-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes checkmark-draw {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

/* ---------- Todo Content ---------- */
.todo-content {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #111827;
  padding-top: 0;
}

.todo-content.strikethrough {
  text-decoration: line-through;
  text-decoration-color: #D1D5DB;
  color: #9CA3AF;
}

.todo-content p {
  margin: 0;
}

.todo-content a {
  color: #6366F1;
  text-decoration: underline;
  text-decoration-color: rgba(99, 102, 241, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 150ms ease;
}

.todo-content a:hover {
  text-decoration-color: #6366F1;
}

.todo-content a:focus-visible {
  box-shadow: var(--focus-ring);
  border-radius: 2px;
}

/* ---------- Todo Meta ---------- */
.todo-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* Assignee badge (pill) */
.todo-assignee {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 9999px;
  background: #EEF2FF;
  color: #4F46E5;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.todo-assignee-select {
  font-size: var(--text-xs);
  padding: 2px 22px 2px 8px;
  border-radius: var(--radius-sm);
  height: 26px;
  min-width: 72px;
}

/* Date / Source text */
.todo-date,
.todo-source {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---------- Reminder Pill ---------- */
.todo-reminder {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 12px;
  font-weight: 500;
  color: var(--warning-500);
  background: var(--warning-50);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1.4;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 150ms ease;
}

.todo-reminder:hover {
  border-color: var(--warning-500);
  background: rgba(245, 158, 11, 0.15);
}

.todo-reminder:focus-visible {
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2), 0 0 0 4px var(--warning-500);
}

.todo-reminder:active {
  transform: scale(0.97);
}

.todo-reminder svg {
  width: 12px;
  height: 12px;
}

.todo-reminder.overdue {
  color: #B91C1C;
  background: var(--danger-50);
}

.todo-reminder.overdue:hover {
  border-color: var(--danger-500);
  background: rgba(239, 68, 68, 0.12);
}

.todo-reminder.upcoming {
  color: #0369A1;
  background: var(--info-50);
}

.todo-reminder.upcoming:hover {
  border-color: var(--info-500);
  background: rgba(59, 130, 246, 0.12);
}

/* ==========================================================================
   Reminder Popover (<details> based)
   HTML: <details class="reminder-popover">
           <summary class="reminder-trigger">M/D or ＋</summary>
           <div class="reminder-popover-body">...</div>
         </details>
   ========================================================================== */

.reminder-popover {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.reminder-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-400);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 150ms ease;
  list-style: none;
  user-select: none;
}
.reminder-trigger::-webkit-details-marker { display: none; }
.reminder-trigger::marker { display: none; content: ""; }

.reminder-trigger:hover {
  background: var(--primary-50);
  border-color: var(--primary-200);
  color: var(--primary-600);
}

.reminder-trigger.has-date {
  color: var(--primary-600);
  background: var(--primary-50);
  border-color: var(--primary-200);
  font-weight: 600;
}

.reminder-popover-body {
  position: fixed;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
  padding: 12px;
  z-index: 9999;
  animation: popover-in 0.15s ease-out;
}
.reminder-popover:not([open]) .reminder-popover-body {
  display: none !important;
}

.reminder-popover-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.reminder-popover-body input[type="date"] {
  width: 100%;
  margin-bottom: 8px;
}

.reminder-popover-actions {
  display: flex;
  gap: 6px;
}

@keyframes popover-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   Assignee Multi-select (<details> based)
   HTML: <div class="assignee-multiselect">
           <details class="assignee-dropdown">
             <summary class="assignee-summary">badges or placeholder</summary>
             <div class="assignee-dropdown-body">checkboxes + confirm</div>
           </details>
         </div>
   ========================================================================== */

.assignee-multiselect {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.assignee-dropdown {
  position: relative;
}

.assignee-summary {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 100px;
  min-height: 26px;
  padding: 3px 8px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 150ms ease;
  list-style: none;
  box-sizing: border-box;
}
.assignee-summary::-webkit-details-marker { display: none; }
.assignee-summary::marker { display: none; content: ""; }

.assignee-summary:hover {
  background: var(--primary-50);
  border-color: var(--primary-200);
}

.assignee-summary .assignee-tag {
  font-size: 11px;
  padding: 1px 6px;
  background: var(--primary-50);
  color: var(--primary-700);
  border-radius: var(--radius-full);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: left;
  font-weight: 500;
  box-sizing: border-box;
}

.assignee-summary .text-muted {
  font-size: 12px;
}

/* Hidden by default — JS positions and shows it when <details> opens */
.assignee-dropdown-body {
  position: fixed;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
  padding: 0;
  z-index: 9999;
  animation: popover-in 0.15s ease-out;
  flex-direction: column;
}
/* Only show as flex when parent details is open */
.assignee-dropdown:not([open]) .assignee-dropdown-body {
  display: none !important;
}
.assignee-dropdown[open] .assignee-dropdown-body {
  display: flex;
}

.assignee-search {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: none;
  border-bottom: 1px solid var(--gray-100);
  outline: none;
  background: var(--gray-50);
}
.assignee-search:focus {
  background: var(--surface);
  box-shadow: inset 0 -2px 0 var(--primary-500);
}
.assignee-search::placeholder {
  color: var(--gray-400);
}

.assignee-options-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 8px 8px;
}

.assignee-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 13px;
  color: var(--gray-700);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 150ms ease;
}

.assignee-option:hover {
  background: var(--primary-50);
  color: var(--primary-700);
}

.assignee-option input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary-500);
  cursor: pointer;
  flex-shrink: 0;
}

.assignee-dropdown-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--gray-100);
}

/* ---------- Todo Actions (visible on hover) ---------- */
.todo-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 150ms ease;
}

.todo-row:hover .todo-actions {
  opacity: 1;
}

/* Jump button */
.todo-jump-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #6366F1;
  background: #EEF2FF;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 150ms ease;
}

.todo-jump-btn:hover {
  background: var(--primary-100);
  color: var(--primary-700);
}

.todo-jump-btn:focus-visible {
  box-shadow: var(--focus-ring);
}

.todo-jump-btn:active {
  transform: scale(0.95);
}

.todo-jump-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.todo-jump-btn svg {
  width: 12px;
  height: 12px;
}

/* Delete / edit action buttons */
.todo-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 150ms ease;
}

.todo-action-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.todo-action-btn:focus-visible {
  box-shadow: var(--focus-ring);
}

.todo-action-btn:active {
  transform: scale(0.9);
}

.todo-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.todo-action-btn.danger:hover {
  background: var(--danger-50);
  color: var(--danger-500);
}

/* ---------- SortableJS States ---------- */
.todo-row.sortable-ghost {
  opacity: 0.4;
  background: #EEF2FF;
}

.todo-row.sortable-chosen {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
  border-radius: var(--radius);
  z-index: 10;
  background: var(--surface);
}

.todo-row.sortable-drag {
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
  border-radius: var(--radius);
}

/* ---------- Todo Empty State ---------- */
.todo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.todo-empty svg {
  width: 48px;
  height: 48px;
  color: var(--gray-300);
  margin-bottom: var(--space-lg);
}

/* ---------- Todo Add Form ---------- */
.todo-add-form {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--surface);
  border-top: 1px solid var(--border-light);
}

.todo-add-form input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  height: 32px;
  padding: 0;
  color: #111827;
}

.todo-add-form input:focus {
  outline: none;
  box-shadow: none;
}

.todo-add-form input::placeholder {
  color: var(--text-muted);
}

/* ==========================================================================
   Todo Row — Left/Right layout for progress tab
   ========================================================================== */

/* Row two-part layout */
.todo-row-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.todo-row-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* ---------- Section Divider (date headers) ---------- */
.todo-section-divider {
  padding: 14px 12px 6px;
  margin-top: 8px;
  border-bottom: 1px solid var(--gray-100);
}
.todo-section-divider:first-child {
  margin-top: 0;
  padding-top: 10px;
}

/* ---------- Filters toolbar ---------- */
.card-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 8px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}

/* Toggle labels */
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color var(--transition-fast);
}
.toggle-label:hover {
  color: var(--text);
}
.toggle-input {
  width: 14px;
  height: 14px;
  accent-color: var(--primary-500);
  cursor: pointer;
}
.toggle-text {
  font-size: 13px;
}

/* ==========================================================================
   Edit Mode — clean single-row layout per item
   ========================================================================== */

/* Header row (date/title) */
.todo-edit-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 6px;
  border-bottom: 1px solid var(--gray-100);
  margin-top: 4px;
}
.todo-edit-header:first-child { margin-top: 0; }

.todo-edit-header-input {
  flex: 1;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  padding: 2px 0;
  outline: none;
  transition: border-color var(--transition-fast);
}
.todo-edit-header-input:focus {
  border-bottom-color: var(--primary-500);
}

/* Todo item row */
.todo-edit-item {
  display: grid;
  grid-template-columns: 20px 18px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--gray-50);
  transition: background var(--transition-fast);
}
.todo-edit-item:hover {
  background: var(--gray-50);
}
.todo-edit-item.done {
  opacity: 0.5;
}

/* Content input */
.todo-edit-input {
  border: none;
  border-bottom: 1px solid transparent;
  background: transparent;
  font-size: 14px;
  color: var(--gray-800);
  padding: 4px 0;
  outline: none;
  min-width: 0;
  transition: border-color var(--transition-fast);
}
.todo-edit-input:focus {
  border-bottom-color: var(--primary-400);
}

/* Meta: assignee + date side by side */
.todo-edit-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.todo-edit-date {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 12px;
  padding: 2px 6px;
  height: 26px;
  color: var(--gray-600);
  background: var(--gray-50);
  outline: none;
  max-width: 130px;
}
.todo-edit-date:focus {
  border-color: var(--primary-400);
}

/* Delete button (shared by header and item) */
.todo-edit-del {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--gray-300);
  font-size: 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.todo-edit-item:hover .todo-edit-del,
.todo-edit-header:hover .todo-edit-del {
  opacity: 1;
}
.todo-edit-del:hover {
  color: var(--danger-500);
  background: var(--danger-50);
}

/* ---------- Section date (h3 style) ---------- */
.todo-section-date {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
  letter-spacing: -0.01em;
}

/* ---------- Delete button (per row, visible on hover) ---------- */
.todo-delete-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--gray-300);
  opacity: 0;
  transition: all 150ms ease;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.todo-row:hover .todo-delete-btn {
  opacity: 1;
  color: var(--gray-400);
}
.todo-delete-btn:hover {
  color: var(--danger-500) !important;
  background: var(--danger-50);
}

/* ---------- Add todo bar ---------- */
.todo-add-bar {
  padding: 8px 12px;
  border-top: 1px dashed var(--gray-200);
}
.todo-add-btn {
  width: 100%;
  justify-content: center;
  gap: 6px;
  color: var(--gray-400);
  border: 1px dashed var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 6px;
  transition: all 150ms ease;
}
.todo-add-btn:hover {
  color: var(--primary-600);
  border-color: var(--primary-300);
  background: var(--primary-50);
}

/* ---------- Editable section header (edit mode) ---------- */
.todo-section-editable {
  display: flex;
  align-items: center;
  gap: 8px;
}
.todo-section-date-input {
  flex: 1;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
  padding: 2px 0;
  outline: none;
  transition: border-color var(--transition-fast);
}
.todo-section-date-input:hover {
  border-bottom-color: var(--gray-300);
}
.todo-section-date-input:focus {
  border-bottom-color: var(--primary-500);
}
.todo-section-delete {
  color: var(--gray-300);
  opacity: 0;
  transition: all 150ms ease;
}
.todo-section-editable:hover .todo-section-delete {
  opacity: 1;
  color: var(--gray-400);
}
.todo-section-delete:hover {
  color: var(--danger-500) !important;
}

/* ==========================================================================
   Mobile Responsive (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* --- Todo row: 文字佔滿第一行，按鈕換第二行 --- */
  .todo-row {
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 8px 10px;
  }
  .todo-row-left {
    flex: 1 1 100%;
    min-width: 0;
  }
  .todo-row-right {
    flex: 1 1 100%;
    padding-left: 26px; /* 對齊 checkbox 後面 */
    gap: 6px;
    flex-wrap: wrap;
  }

  /* --- 進度 tab: 左右分欄 → 上下堆疊 --- */
  .layout-split {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
  }
  .layout-split > .split-resizer {
    display: none;
  }
  .progress-scroll-area {
    max-height: none;
  }

  /* --- Filter toolbar 換行 --- */
  .card-toolbar {
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 6px 10px;
  }

  /* --- 新增待辦列 --- */
  .todo-add-bar {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  /* --- 備註 panel 在手機上少一點左 padding --- */
  .todo-note-panel {
    padding-left: 16px;
  }

  /* --- Edit mode: grid 改 flex 讓內容可換行 --- */
  .todo-edit-item {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
  }
  .todo-edit-input {
    flex: 1 1 60%;
    min-width: 120px;
  }
  .todo-edit-meta {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* --- Assignee multiselect 不要太寬 --- */
  .assignee-multiselect .assignee-summary {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* --- Sort button 文字隱藏，只留 icon --- */
  .sort-toggle-btn .sort-label {
    display: none;
  }
}
