/* ============================================================
   MyList - 个人清单系统 | CSS Design System
   蓝白配色体系 · Flat Design · Mobile-First
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
  /* Primary (Blue) */
  --primary: #3B82F6;
  --primary-50: #EFF6FF;
  --primary-100: #DBEAFE;
  --primary-200: #BFDBFE;
  --primary-300: #93C5FD;
  --primary-400: #60A5FA;
  --primary-500: #3B82F6;
  --primary-600: #2563EB;
  --primary-700: #1D4ED8;
  --primary-800: #1E40AF;
  --primary-900: #1E3A8A;

  /* Background */
  --bg-body: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-hover: #F1F5F9;
  --bg-surface-active: #E2E8F0;

  /* Text */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-inverse: #FFFFFF;

  /* Border */
  --border-light: #E2E8F0;
  --border-default: #CBD5E1;
  --border-focus: #3B82F6;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-focus: 0 0 0 3px rgba(59,130,246,0.15);

  /* Status Colors */
  --success: #10B981;
  --success-bg: #ECFDF5;
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --info: #06B6D4;

  /* Priority */
  --priority-high: #EF4444;
  --priority-medium: #F59E0B;
  --priority-low: #3B82F6;

  /* Overdue (Purple) */
  --overdue: #8B5CF6;
  --overdue-bg: #F5F3FF;

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 56px;
  --quick-add-height: 52px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Transition */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Dark Mode ---------- */
[data-theme="dark"] {
  --bg-body: #0F172A;
  --bg-surface: #1E293B;
  --bg-surface-hover: #27354A;
  --bg-surface-active: #334155;

  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --border-light: #334155;
  --border-default: #475569;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);

  --success-bg: #064E3B;
  --warning-bg: #78350F;
  --danger-bg: #7F1D1D;

  --overdue-bg: #2E1065;

  --shadow-focus: 0 0 0 3px rgba(59,130,246,0.25);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100dvh;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

ul { list-style: none; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ---------- App Layout ---------- */
.app {
  display: flex;
  height: 100dvh;
  position: relative;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100dvh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.app-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-600);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.02em;
}

.logo-icon {
  width: 24px;
  height: 24px;
  color: var(--primary-500);
}

.sidebar-close {
  display: none;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.sidebar-close:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.sidebar-close svg {
  width: 18px;
  height: 18px;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--primary-50);
  color: var(--primary-600);
  font-weight: 600;
}

.nav-item.active svg {
  opacity: 1;
}

[data-theme="dark"] .nav-item.active {
  background: rgba(59,130,246,0.12);
}

.nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface-hover);
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}

.nav-item.active .nav-count {
  background: var(--primary-100);
  color: var(--primary-600);
}

[data-theme="dark"] .nav-item.active .nav-count {
  background: rgba(59,130,246,0.2);
  color: var(--primary-400);
}

/* Custom Lists in Sidebar */
.custom-lists {
  margin-bottom: 4px;
}

.custom-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.custom-list-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.custom-list-item.active {
  background: var(--primary-50);
  color: var(--primary-600);
  font-weight: 600;
}

[data-theme="dark"] .custom-list-item.active {
  background: rgba(59,130,246,0.12);
}

.list-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.list-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.custom-list-item.active .list-count {
  color: var(--primary-400);
}

.list-delete-btn {
  width: 22px;
  height: 22px;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.custom-list-item:hover .list-delete-btn {
  opacity: 1;
}

.list-delete-btn:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.list-delete-btn svg {
  width: 14px;
  height: 14px;
}

/* Add List Button */
.nav-add-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}

.nav-add-btn:hover {
  color: var(--primary-500);
  background: var(--primary-50);
}

[data-theme="dark"] .nav-add-btn:hover {
  background: rgba(59,130,246,0.1);
}

.nav-add-btn svg {
  width: 16px;
  height: 16px;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.footer-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.footer-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.footer-btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- Sidebar Overlay (Mobile) ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 35;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  margin-left: var(--sidebar-width);
}

/* ---------- Topbar ---------- */
.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-surface);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.menu-btn:hover {
  background: var(--bg-surface-hover);
}

.menu-btn svg {
  width: 20px;
  height: 20px;
}

.view-title {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Search Box */
.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface-hover);
  border: 1.5px solid transparent;
  transition: all var(--transition-fast);
  max-width: 280px;
  width: 200px;
}

.search-box:focus-within {
  border-color: var(--primary-300);
  background: var(--bg-surface);
  box-shadow: var(--shadow-focus);
  width: 260px;
}

.search-box svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.search-clear:hover {
  color: var(--text-secondary);
  background: var(--bg-surface-active);
}

.search-clear svg {
  width: 12px;
  height: 12px;
}

/* Sort Dropdown */
.sort-dropdown {
  position: relative;
}

.sort-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface-hover);
  border: 1.5px solid transparent;
  transition: all var(--transition-fast);
}

.sort-btn:hover {
  background: var(--bg-surface-active);
  color: var(--text-primary);
}

.sort-btn svg {
  width: 15px;
  height: 15px;
}

.sort-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  padding: 4px;
  z-index: 30;
}

.sort-menu.open {
  display: block;
  animation: slideDown 0.15s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.sort-option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  transition: all var(--transition-fast);
}

.sort-option:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.sort-option.active {
  color: var(--primary-600);
  background: var(--primary-50);
}

[data-theme="dark"] .sort-option.active {
  background: rgba(59,130,246,0.12);
}

/* ---------- Quick Add Bar ---------- */
.quick-add {
  padding: 12px 20px 8px;
  flex-shrink: 0;
}

.quick-add-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}

.add-btn-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary-500);
  color: white;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.add-btn-icon:hover {
  background: var(--primary-600);
  transform: scale(1.05);
}

.add-btn-icon:active {
  transform: scale(0.95);
}

.add-btn-icon svg {
  width: 20px;
  height: 20px;
}

.quick-add-input {
  flex: 1;
  height: 38px;
  padding: 0 14px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.quick-add-input:focus {
  border-color: var(--primary-400);
  box-shadow: var(--shadow-focus);
  outline: none;
}

.quick-add-input::placeholder {
  color: var(--text-muted);
}

.quick-add-shortcuts {
  display: flex;
  gap: 4px;
}

.shortcut-btn {
  padding: 5px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-light);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.shortcut-btn:hover {
  color: var(--primary-600);
  border-color: var(--primary-200);
  background: var(--primary-50);
}

[data-theme="dark"] .shortcut-btn:hover {
  background: rgba(59,130,246,0.1);
}

/* ---------- Task Area ---------- */
.task-area {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ---------- PC 左右分栏布局 ---------- */
.task-panel-left {
  flex: 0 0 auto;
  width: 620px;
  min-width: 280px;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 16px 16px;
  background: var(--bg-body);
}

/* task-panel-left 内部的 date-header / task-list / stats-bar 继承原有样式 */
.task-panel-left .date-header {
  position: sticky;
  top: 0;
  background: var(--bg-body);
  z-index: 5;
}
.task-panel-left .task-list {
  flex: 1;
}
.task-panel-left .stats-bar {
  flex-shrink: 0;
}

/* ---------- 右侧任务详情面板 ---------- */
.task-detail-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  overflow-y: auto;
  min-width: 0;
  position: relative;
}

.detail-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 40px;
}

.detail-placeholder svg {
  width: 56px;
  height: 56px;
  opacity: 0.35;
}

.detail-placeholder p {
  font-size: 14px;
  font-weight: 500;
}

/* 详情面板头部 */
.detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 10;
}

.detail-title-input {
  flex: 1;
  font-size: 20px;
  font-weight: 700;
  border: none;
  outline: none;
  background: none;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.detail-close-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.detail-close-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.detail-close-btn svg {
  width: 20px;
  height: 20px;
}

/* 详情面板内容区 */
.detail-body {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

/* 详情属性行 */
.detail-prop {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-prop-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-prop-label svg {
  width: 15px;
  height: 15px;
  opacity: 0.7;
}

/* 清单选择器 */
.detail-list-select {
  padding: 8px 12px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.detail-list-select:focus {
  border-color: var(--primary-500);
  box-shadow: var(--shadow-focus);
}

/* 优先级选项 */
.detail-priority-group {
  display: flex;
  gap: 8px;
}

.detail-priority-opt {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--border-light);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.detail-priority-opt:hover {
  border-color: var(--border-default);
}

.detail-priority-opt.active[data-priority="high"] {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.detail-priority-opt.active[data-priority="medium"] {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning);
}

.detail-priority-opt.active[data-priority="low"] {
  background: #EFF6FF;
  border-color: var(--primary-500);
  color: var(--primary-600);
}

.detail-priority-opt.active[data-priority="none"] {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

/* 截止日期 */
.detail-date-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-date-input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.detail-date-input:focus {
  border-color: var(--primary-500);
  box-shadow: var(--shadow-focus);
}

.detail-date-clear {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.detail-date-clear:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* 备注文本框 */
.detail-notes-textarea {
  width: 100%;
  min-height: 500px;
  max-height: 500px;
  padding: 12px 14px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.8;
  resize: vertical;
  outline: none;
  font-family: inherit;
  transition: border-color var(--transition-fast);
  word-break: break-word;
  overflow-y: auto;
  overflow-x: hidden;
}

/* 备注工具栏（背景色选择 + 富文本格式化） */
.notes-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  flex-wrap: wrap;
}

.notes-toolbar-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.notes-toolbar-divider {
  width: 1px;
  height: 22px;
  background: var(--border-light);
}

.notes-color-picker {
  display: inline-flex;
  gap: 4px;
}

.notes-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notes-color-dot:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.3);
}

.notes-color-dot.active {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.25);
}

/* ── 富文本格式化工具栏 ── */
.notes-format-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.notes-format-btn {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  padding: 0;
}

.notes-format-btn svg {
  width: 13px;
  height: 13px;
}

.notes-format-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.notes-format-btn:active {
  transform: scale(0.92);
}

.notes-format-btn.active {
  background: var(--primary-50);
  border-color: var(--primary-300);
  color: var(--primary-600);
}

.notes-format-sep {
  width: 1px;
  height: 18px;
  background: var(--border-light);
  margin: 0 4px;
}

/* contenteditable 占位符 */
.detail-notes-textarea:empty::before {
  content: attr(placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

.detail-notes-textarea:focus {
  border-color: var(--primary-500);
  box-shadow: var(--shadow-focus);
}

/* 标签区域 */
.detail-tags-area {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.detail-tag-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1.5px dashed var(--border-default);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.detail-tag-add:hover {
  border-color: var(--primary-400);
  color: var(--primary-500);
}

.detail-tag-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: #EFF6FF;
  color: var(--primary-700);
}

.tag-remove-btn {
  display: inline-flex;
  cursor: pointer;
  color: var(--primary-500);
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.tag-remove-btn:hover {
  opacity: 1;
}

.tag-remove-btn svg {
  width: 13px;
  height: 13px;
}

/* 子任务区域 */
-detail-subtasks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-subtask-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-body);
  font-size: 13px;
}

.detail-subtask-check {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid var(--border-default);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.detail-subtask-check.checked {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.detail-subtask-check.checked svg {
  width: 11px;
  height: 11px;
}

.detail-subtask-text {
  flex: 1;
  font-size: 13px;
}

.detail-subtask-text.done {
  text-decoration: line-through;
  color: var(--text-muted);
}

.detail-subtask-delete {
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast);
  padding: 2px;
}

.detail-subtask-item:hover .detail-subtask-delete {
  opacity: 1;
}

.detail-subtask-add-row {
  display: flex;
  gap: 6px;
}

.detail-subtask-input {
  flex: 1;
  padding: 7px 10px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-body);
  color: var(--text-primary);
  outline: none;
}

.detail-subtask-input:focus {
  border-color: var(--primary-400);
}

.detail-subtask-add-btn {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  background: var(--primary-500);
  color: #fff;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.detail-subtask-add-btn:hover {
  background: var(--primary-600);
}

/* 元信息 */
/* ---------- 属性行（清单·优先级·日期·创建时间 合并为一行）---------- */
.detail-meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 4px;
  flex-wrap: nowrap;
}

.meta-cell {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
}

.meta-cell-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}

.meta-cell-label svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

/* 属性行内的清单选择器 */
.detail-meta-row .detail-list-select {
  padding: 5px 8px;
  font-size: 13px;
  border-width: 1px;
  min-width: 90px;
}

/* 属性行内的优先级组 */
.detail-meta-row .detail-priority-group {
  display: inline-flex;
  gap: 2px;
}

.detail-meta-row .detail-priority-opt {
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 12px;
  border-width: 1px;
}

/* 属性行内的日期输入 */
.detail-meta-row .detail-date-input {
  padding: 5px 8px;
  font-size: 13px;
  width: 140px;
  border-width: 1px;
}

.detail-meta-row .detail-date-input.overdue {
  color: var(--overdue);
  border-color: var(--overdue);
}

.detail-meta-row .detail-date-clear {
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 4px;
  border-color: transparent;
}

.detail-meta-row .detail-date-clear:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* 属性行内创建时间文本 */
.meta-cell-date {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-created {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.detail-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

/* 底部操作栏 */
.detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  background: var(--bg-surface);
}

.detail-footer-left {
  display: flex;
  gap: 8px;
}

.detail-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--border-light);
  background: var(--bg-body);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.detail-action-btn:hover {
  border-color: var(--border-default);
  background: var(--bg-surface-hover);
}

.detail-action-btn.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
}

.detail-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 22px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  background: var(--primary-500);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.detail-save-btn:hover {
  background: var(--primary-600);
}

/* 任务卡片选中态（左侧列表） */
.task-card.selected {
  border-color: var(--primary-400);
  background: #EFF6FF;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.12);
}

[data-theme="dark"] .task-card.selected {
  background: rgba(59,130,246,0.12);
  border-color: var(--primary-500);
}

/* Date Header */
.date-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px 0 10px;
  position: sticky;
  top: 0;
  background: var(--bg-body);
  z-index: 5;
}

.date-text {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.date-full {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Task List */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 20px;
  gap: 12px;
}

.empty-state.hidden {
  display: none;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--border-default);
  opacity: 0.6;
}

.empty-state p {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state span {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- Task Card ---------- */
.task-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  transition: all var(--transition-fast);
  cursor: default;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  animation: taskIn 0.2s ease-out both;
}

@keyframes taskIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes taskOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(30px); }
}

.task-card.removing {
  animation: taskOut 0.25s ease-in forwards;
}

.task-card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
  background: var(--bg-surface-hover);
}

.task-card.completed {
  opacity: 0.55;
}

.task-card.completed:hover {
  opacity: 0.75;
}

.task-card.completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-card.overdue {
  border-left: 3px solid var(--overdue);
}

.task-card.priority-high:not(.completed) {
  border-left: 3px solid var(--priority-high);
}

.task-card.priority-medium:not(.completed) {
  border-left: 3px solid var(--priority-medium);
}

.task-card.priority-low:not(.completed) {
  border-left: 3px solid var(--priority-low);
}

.task-card.priority-none:not(.completed) {
  border-left: 3px solid var(--success);
}

/* Checkbox */
.task-checkbox {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid var(--border-default);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 1px;
  background: var(--bg-surface);
  -webkit-tap-highlight-color: transparent;
}

.task-checkbox:hover {
  border-color: var(--primary-400);
}

.task-checkbox.checked {
  background: var(--primary-500);
  border-color: var(--primary-500);
}

.task-checkbox svg {
  width: 14px;
  height: 14px;
  color: white;
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--transition-fast);
}

.task-checkbox.checked svg {
  opacity: 1;
  transform: scale(1);
}

/* Task Content */
.task-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Task Right Column (Actions + List Name) */
.task-right-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 52px;
  padding-top: 2px;
}

.task-list-name {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.task-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.task-title:hover {
  color: var(--primary-600);
}

/* Task Meta */
.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.task-meta svg {
  width: 13px;
  height: 13px;
  opacity: 0.7;
}

.task-due {
  display: flex;
  align-items: center;
  gap: 3px;
}

.task-due.overdue {
  color: var(--overdue);
  font-weight: 600;
}

.task-due.today {
  color: var(--primary-500);
  font-weight: 500;
}

/* Task Tags */
.task-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.task-tag {
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 550;
  background: var(--bg-surface-active);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

/* Subtask Progress */
.subtask-progress {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.subtask-progress-bar {
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-surface-active);
  overflow: hidden;
}

.subtask-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--primary-500);
  transition: width var(--transition-fast);
}

/* Task Actions */
.task-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
  padding-top: 1px;
}

.task-card:hover .task-actions {
  opacity: 1;
}

.task-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.task-action-btn:hover {
  background: var(--bg-surface-active);
  color: var(--text-primary);
}

.task-action-btn.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.task-action-btn svg {
  width: 15px;
  height: 15px;
}

/* ---------- Stats Bar ---------- */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px 4px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  margin-top: 8px;
}

.stats-action {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.stats-action:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* ---------- Modal ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.modal-sm {
  max-width: 400px;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.modal-title-input {
  flex: 1;
  font-size: 18px;
  font-weight: 650;
  border: none;
  outline: none;
  background: none;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.modal-title-text {
  font-size: 16px;
  font-weight: 650;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

/* Modal Body */
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── 属性三联横排（清单·优先级·截止日期） ── */
.prop-trio-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.prop-trio-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.prop-trio-date-cell {
  flex: 1.3;
}

.prop-trio-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.prop-trio-label svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.prop-trio-select,
.prop-trio-input {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.prop-trio-select:focus,
.prop-trio-input:focus {
  border-color: var(--primary-400);
  box-shadow: var(--shadow-focus);
}

/* 优先级 select 颜色 */
/* 优先级 select 选中态颜色 + 小圆点前缀 */
.prop-priority-select[data-val="none"]  { color: #10B981; }
.prop-priority-select[data-val="low"]   { color: #3B82F6; }
.prop-priority-select[data-val="medium"]{ color: #F59E0B; }
.prop-priority-select[data-val="high"]  { color: #EF4444; }

/* select option 内置颜色（浏览器兼容补充）*/
.prop-priority-select option[value="none"]  { color: #10B981; font-weight: 400; }
.prop-priority-select option[value="low"]   { color: #3B82F6; font-weight: 500; }
.prop-priority-select option[value="medium"]{ color: #F59E0B; font-weight: 600; }
.prop-priority-select option[value="high"]  { color: #EF4444; font-weight: 700; }

.prop-trio-date-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.prop-trio-date-wrap .prop-trio-input {
  flex: 1;
}

/* Property Rows */
.prop-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.prop-row-block {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.prop-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 72px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.prop-label svg {
  width: 14px;
  height: 14px;
}

.prop-select,
.prop-input {
  padding: 8px 12px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  transition: all var(--transition-fast);
  outline: none;
}

.prop-select:focus,
.prop-input:focus {
  border-color: var(--primary-400);
  box-shadow: var(--shadow-focus);
}

.prop-action {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.prop-action:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.prop-action svg {
  width: 14px;
  height: 14px;
}

/* Priority Options */
.priority-options {
  display: flex;
  gap: 4px;
}

.priority-opt {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-light);
  background: var(--bg-surface);
  transition: all var(--transition-fast);
}

.priority-opt:hover {
  border-color: var(--border-default);
  background: var(--bg-surface-hover);
}

.priority-opt.active {
  border-color: currentColor;
  background: color-mix(in srgb, currentColor 8%, transparent);
}

.priority-opt.active[data-priority="none"] {
  border-color: var(--success);
  color: var(--success);
}

.priority-opt svg {
  width: 14px;
  height: 14px;
}

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.priority-dot.low { background: var(--priority-low); }
.priority-dot.medium { background: var(--priority-medium); }
.priority-dot.high { background: var(--priority-high); }

/* Tags */
.tags-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tag-input-wrap {
  position: relative;
}

.tag-input {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px dashed var(--border-default);
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.tag-input:focus {
  border-color: var(--primary-400);
  border-style: solid;
  box-shadow: var(--shadow-focus);
}

.tag-input::placeholder {
  color: var(--text-muted);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 550;
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--primary-200);
}

[data-theme="dark"] .tag-item {
  background: rgba(59,130,246,0.15);
  border-color: rgba(59,130,246,0.25);
  color: var(--primary-300);
}

.tag-remove {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--primary-500);
  cursor: pointer;
  opacity: 0.65;
  transition: opacity var(--transition-fast);
}

.tag-remove:hover {
  opacity: 1;
}

.tag-remove svg {
  width: 10px;
  height: 10px;
}

/* Subtasks */
.subtask-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.subtask-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-hover);
  transition: all var(--transition-fast);
}

.subtask-item:hover {
  background: var(--bg-surface-active);
}

.subtask-check {
  width: 16px;
  height: 16px;
  min-width: 16px;
  border: 1.5px solid var(--border-default);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.subtask-check.checked {
  background: var(--success);
  border-color: var(--success);
}

.subtask-check svg {
  width: 10px;
  height: 10px;
  color: white;
  opacity: 0;
}

.subtask-check.checked svg {
  opacity: 1;
}

.subtask-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}

.subtask-item.completed .subtask-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.subtask-remove {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--text-muted);
  opacity: 0;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.subtask-item:hover .subtask-remove {
  opacity: 1;
}

.subtask-remove:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.subtask-remove svg {
  width: 13px;
  height: 13px;
}

.subtask-add input {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px dashed var(--border-default);
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.subtask-add input:focus {
  border-color: var(--primary-400);
  border-style: solid;
  box-shadow: var(--shadow-focus);
}

.subtask-add input::placeholder {
  color: var(--text-muted);
}

/* Notes Textarea */
.notes-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  transition: all var(--transition-fast);
  outline: none;
}

.notes-textarea:focus {
  border-color: var(--primary-400);
  box-shadow: var(--shadow-focus);
}

.notes-textarea::placeholder {
  color: var(--text-muted);
}

/* Modal Footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  gap: 8px;
}

.modal-footer-center {
  justify-content: center;
}

.modal-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-item {
  font-size: 11px;
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-500);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-600);
  box-shadow: 0 2px 8px rgba(59,130,246,0.35);
}

.btn-secondary {
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-surface-active);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: white;
  padding: 8px 14px;
}

.btn-danger:hover {
  background: #DC2626;
  box-shadow: 0 2px 8px rgba(239,68,68,0.35);
}

.btn-danger svg {
  width: 15px;
  height: 15px;
}

/* ---------- Color Picker ---------- */
.color-picker {
  display: flex;
  gap: 8px;
  padding: 4px 0;
}

.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
  flex-shrink: 0;
}

.color-dot:hover {
  transform: scale(1.15);
}

.color-dot.active {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px currentColor;
  transform: scale(1.1);
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  pointer-events: auto;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  max-width: 340px;
}

.toast.removing {
  animation: toastOut 0.2s ease-in forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(8px) scale(0.95); }
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-info .toast-icon { color: var(--primary-500); }

/* ---------- Context Menu ---------- */
.context-menu {
  display: none;
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 160px;
  z-index: 150;
}

.context-menu.show {
  display: block;
  animation: fadeIn 0.12s ease-out;
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.ctx-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.ctx-danger {
  color: var(--danger);
}

.ctx-danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.ctx-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 8px;
}

.ctx-item svg {
  width: 15px;
  height: 15px;
  opacity: 0.7;
}

/* ---------- Responsive ---------- */

/* Tablet & Below */
@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 40;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-close {
    display: flex;
  }

  .sidebar-overlay.show {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  /* 恢复单列布局，隐藏右侧面板 */
  .task-area {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 20px 20px;
  }

  .task-panel-left {
    flex: none;
    width: 100%;
    max-width: none;
    min-width: 0;
    border-right: none;
    padding: 0;
  }

  .task-detail-panel {
    display: none;
  }

  .menu-btn {
    display: flex;
  }

  .quick-add-shortcuts {
    display: none;
  }

  .search-box {
    max-width: 180px;
    width: 140px;
  }

  .search-box:focus-within {
    width: 200px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .view-title {
    font-size: 15px;
  }

  .quick-add {
    padding: 10px 12px 6px;
  }

  .task-panel-left .task-area-inner,
  .task-panel-left {
    padding: 0;
  }

  .sort-btn span {
    display: none;
  }

  .sort-btn svg {
    margin: 0;
  }

  .search-box {
    max-width: none;
    width: 120px;
    flex: 1;
  }

  .search-box:focus-within {
    width: 100%;
  }

  .task-actions {
    opacity: 1;
  }

  .modal {
    max-height: 90dvh;
    border-radius: var(--radius-md);
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .toast-container {
    left: 12px;
    right: 12px;
  }

  .toast {
    max-width: none;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
