*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[x-cloak] { display: none !important; }

/* ════════════════════════════════════════════════════
   THEMES
   ════════════════════════════════════════════════════ */

:root {
  /* legacy alias kept for component styles that still reference --text2 */
  --text2: var(--text-muted);
}

[data-theme="cyber"] {
  --bg:          #020509;
  --surface:     #0f1e35;
  --surface2:    #162846;
  --border:      #1e4268;
  --text:        #c8e6ff;
  --text-muted:  #4a7fa0;
  --active:      #00ffe5;
  --maintenance: #ffb800;
  --completed:   #3d9dff;
  --abandon:     #3a4a5a;
  --accent:      #00ffe5;
  --accent-dim:  rgba(0,255,229,0.12);
  --glow:        0 0 12px rgba(0,255,229,0.3);
  --header-bg:   #020408;
  --card-shadow: 0 4px 14px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.05), inset 0 1px 0 rgba(255,255,255,0.06);
  --card-shadow-active:      0 4px 22px rgba(0,255,229,0.22),  0 0 0 1px rgba(0,255,229,0.18),  inset 0 1px 0 rgba(255,255,255,0.07);
  --card-shadow-maintenance: 0 4px 22px rgba(255,184,0,0.22),  0 0 0 1px rgba(255,184,0,0.18),  inset 0 1px 0 rgba(255,255,255,0.07);
  --card-shadow-completed:   0 4px 22px rgba(61,157,255,0.22), 0 0 0 1px rgba(61,157,255,0.18), inset 0 1px 0 rgba(255,255,255,0.07);
  --card-shadow-abandon:     0 4px 14px rgba(0,0,0,0.6),       0 0 0 1px rgba(255,255,255,0.04);
  --drag-over:   rgba(0,255,229,0.08);
}
[data-theme="macaron"] {
  --bg:          #f0d8e8;
  --surface:     #fff5f9;
  --surface2:    #ffe8f1;
  --border:      #f0b8d0;
  --text:        #3a1828;
  --text-muted:  #a06080;
  --active:      #d04878;
  --maintenance: #d88028;
  --completed:   #6080c8;
  --abandon:     #a898a8;
  --accent:      #d04878;
  --accent-dim:  rgba(208,72,120,0.1);
  --glow:        none;
  --header-bg:   #e8c8d8;
  --card-shadow: 0 4px 16px rgba(140,60,100,0.18), 0 0 0 1px rgba(255,255,255,0.85), inset 0 1px 0 #fff;
  --card-shadow-active:      0 4px 20px rgba(208,72,120,0.28), 0 0 0 1px rgba(208,72,120,0.22), inset 0 1px 0 #fff;
  --card-shadow-maintenance: 0 4px 20px rgba(216,128,40,0.28), 0 0 0 1px rgba(216,128,40,0.22), inset 0 1px 0 #fff;
  --card-shadow-completed:   0 4px 20px rgba(96,128,200,0.28), 0 0 0 1px rgba(96,128,200,0.22), inset 0 1px 0 #fff;
  --card-shadow-abandon:     0 3px 12px rgba(140,60,100,0.12), 0 0 0 1px rgba(168,152,168,0.3);
  --drag-over:   rgba(208,72,120,0.07);
}
[data-theme="danger"] {
  --bg:          #080004;
  --surface:     #200014;
  --surface2:    #2c001c;
  --border:      #660030;
  --text:        #f0c8d8;
  --text-muted:  #904868;
  --active:      #ff2060;
  --maintenance: #ff8c00;
  --completed:   #c060ff;
  --abandon:     #503040;
  --accent:      #ff2060;
  --accent-dim:  rgba(255,32,96,0.12);
  --glow:        0 0 14px rgba(255,32,96,0.35);
  --header-bg:   #050002;
  --card-shadow: 0 4px 18px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.05), inset 0 1px 0 rgba(255,80,120,0.1);
  --card-shadow-active:      0 4px 26px rgba(255,32,96,0.32),   0 0 0 1px rgba(255,32,96,0.24),   inset 0 1px 0 rgba(255,80,100,0.18);
  --card-shadow-maintenance: 0 4px 26px rgba(255,140,0,0.28),   0 0 0 1px rgba(255,140,0,0.22),   inset 0 1px 0 rgba(255,140,0,0.12);
  --card-shadow-completed:   0 4px 26px rgba(192,96,255,0.28),  0 0 0 1px rgba(192,96,255,0.22),  inset 0 1px 0 rgba(192,96,255,0.12);
  --card-shadow-abandon:     0 4px 16px rgba(0,0,0,0.7),        0 0 0 1px rgba(80,48,64,0.6);
  --drag-over:   rgba(255,32,96,0.08);
}
[data-theme="summer"] {
  --bg:          #ceeeff;
  --surface:     #ffffff;
  --surface2:    #e8f6ff;
  --border:      #90c8e8;
  --text:        #0e2a40;
  --text-muted:  #4a80a0;
  --active:      #008c52;
  --maintenance: #d08000;
  --completed:   #1870e0;
  --abandon:     #7890a8;
  --accent:      #0080cc;
  --accent-dim:  rgba(0,128,204,0.1);
  --glow:        none;
  --header-bg:   #a8dcf8;
  --card-shadow: 0 4px 16px rgba(0,60,120,0.16), 0 0 0 1px rgba(255,255,255,0.95), inset 0 1px 0 #fff;
  --card-shadow-active:      0 4px 20px rgba(0,140,82,0.25),   0 0 0 1px rgba(0,140,82,0.2),   inset 0 1px 0 #fff;
  --card-shadow-maintenance: 0 4px 20px rgba(208,128,0,0.25),  0 0 0 1px rgba(208,128,0,0.2),  inset 0 1px 0 #fff;
  --card-shadow-completed:   0 4px 20px rgba(24,112,224,0.25), 0 0 0 1px rgba(24,112,224,0.2), inset 0 1px 0 #fff;
  --card-shadow-abandon:     0 3px 12px rgba(0,60,120,0.12),   0 0 0 1px rgba(120,144,168,0.25);
  --drag-over:   rgba(0,128,204,0.07);
}
[data-theme="glass"] {
  --bg:          #dfe3ee;
  --surface:     rgba(255,255,255,0.45);
  --surface2:    rgba(255,255,255,0.25);
  --border:      rgba(255,255,255,0.55);
  --text:        #1a1a2e;
  --text-muted:  #6b7094;
  --active:      #16a34a;
  --maintenance: #d97706;
  --completed:   #2563eb;
  --abandon:     #9ca3af;
  --accent:      #6366f1;
  --accent-dim:  rgba(99,102,241,0.12);
  --glow:        0 0 16px rgba(99,102,241,0.28);
  --header-bg:   rgba(255,255,255,0.35);
  --card-shadow: 0 4px 24px rgba(0,0,0,0.07), 0 0 0 1px rgba(255,255,255,0.7), inset 0 1px 0 rgba(255,255,255,0.85);
  --card-shadow-active:      0 4px 24px rgba(22,163,74,0.2),   0 0 0 1px rgba(255,255,255,0.65), inset 0 1px 0 rgba(255,255,255,0.85);
  --card-shadow-maintenance: 0 4px 24px rgba(217,119,6,0.2),   0 0 0 1px rgba(255,255,255,0.65), inset 0 1px 0 rgba(255,255,255,0.85);
  --card-shadow-completed:   0 4px 24px rgba(37,99,235,0.2),   0 0 0 1px rgba(255,255,255,0.65), inset 0 1px 0 rgba(255,255,255,0.85);
  --card-shadow-abandon:     0 3px 16px rgba(0,0,0,0.05),      0 0 0 1px rgba(255,255,255,0.5);
  --drag-over:   rgba(99,102,241,0.08);
}

/* ════════════════════════════════════════════════════
   LIQUID GLASS OVERRIDES
   ════════════════════════════════════════════════════ */
body[data-theme="glass"] {
  background: linear-gradient(135deg, #e0e7ff 0%, #fce7f3 28%, #dbeafe 55%, #ede9fe 78%, #e0f2fe 100%);
  background-attachment: fixed;
}
[data-theme="glass"] header {
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
}
[data-theme="glass"] .card {
  isolation: auto; /* override isolation:isolate so backdrop-filter can sample the body gradient */
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
}
[data-theme="glass"] .modal {
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}
[data-theme="glass"] .modal-overlay {
  background: rgba(30,30,60,0.18);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
[data-theme="glass"] .tab.active {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
[data-theme="glass"] .urgency-picker,
[data-theme="glass"] .assign-picker,
[data-theme="glass"] .tab-dropdown,
[data-theme="glass"] .mobile-search-popover {
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}

/* ════════════════════════════════════════════════════
   BASE
   ════════════════════════════════════════════════════ */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Microsoft YaHei', '微软雅黑', 'PingFang SC', sans-serif;
  font-size: 14px;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* ── Header ───────────────────────────────────────── */
header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 9px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
header h1 {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-shadow: var(--glow);
  white-space: nowrap;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.panel-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.panel-nav::-webkit-scrollbar {
  display: none;
}
.panel-nav-icon {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.2;
}
.panel-nav-icon:hover,
.panel-nav-icon.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ── Edit mode toggle ─────────────────────────────── */
.edit-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: all 0.2s;
}
.edit-toggle.on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
  box-shadow: var(--glow);
}
.edit-toggle-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.2s;
}
.edit-toggle.on .edit-toggle-dot { background: var(--accent); }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover { opacity: 0.85; box-shadow: var(--glow); }
.btn-ghost {
  background: var(--accent-dim);
  border: 1px solid var(--border);
  color: var(--accent);
}
.btn-ghost:hover { border-color: var(--accent); }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-danger-ghost {
  background: transparent;
  border: 1px solid #ef4444;
  color: #ef4444;
  font-family: inherit;
}
.btn-danger-ghost:hover { background: rgba(239,68,68,0.1); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Tabs ─────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  padding: 10px 20px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 7px 16px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  transition: all 0.15s;
  user-select: none;
  font-weight: 500;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tab:hover { color: var(--text); background: var(--surface2); }
.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tab.active {
  color: var(--accent);
  background: var(--surface);
  border-color: var(--border);
  border-bottom: 1px solid var(--surface);
  margin-bottom: -1px;
  font-weight: 700;
}
.tab-badge {
  display: inline-block;
  background: var(--surface2);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  margin-left: 5px;
}
.tab.active .tab-badge { background: var(--accent); color: var(--bg); }

/* ════════════════════════════════════════════════════
   MASONRY
   ════════════════════════════════════════════════════ */
.masonry {
  --masonry-columns: 1;
  display: grid;
  grid-template-columns: repeat(var(--masonry-columns), minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  padding: 16px 20px 40px;
}

.masonry-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.masonry-skeleton {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(var(--masonry-columns, 1), minmax(0, 1fr));
  gap: 16px;
}

.masonry-item {
  min-width: 0;
}

/* drag states */
.masonry-item.dragging .card {
  opacity: 0.35;
  box-shadow: none;
}
.masonry-item.drag-over .card {
  outline: 2px dashed var(--accent);
  background: var(--drag-over);
}

/* ── Card ─────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  border-left: 3px solid var(--border);
  overflow: hidden;
  position: relative;
  isolation: isolate;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.25s, transform 0.15s;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
}
.card:hover { transform: translateY(-1px); }
.card[data-status="active"]      { border-left-color: var(--active);      box-shadow: var(--card-shadow-active); }
.card[data-status="maintenance"] { border-left-color: var(--maintenance);  box-shadow: var(--card-shadow-maintenance); }
.card[data-status="completed"]   { border-left-color: var(--completed);    box-shadow: var(--card-shadow-completed); }
.card[data-status="abandon"]     { border-left-color: var(--abandon);      box-shadow: var(--card-shadow-abandon); }
.card.deadline-urgent {
  border-color: rgba(239, 68, 68, 0.58);
  box-shadow: var(--card-shadow), 0 0 0 1px rgba(239, 68, 68, 0.32), 0 10px 26px rgba(239, 68, 68, 0.12);
}
.card.deadline-overdue {
  border-color: rgba(185, 28, 28, 0.72);
  box-shadow: var(--card-shadow), 0 0 0 1px rgba(185, 28, 28, 0.42), 0 12px 30px rgba(185, 28, 28, 0.16);
}

.card-header {
  padding: 10px 13px 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
/* drag handle — used to reorder cards within the active status group */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px 0 0;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
  background: none;
  border: none;
  font-family: inherit;
  user-select: none;
}
.drag-handle:hover { opacity: 1; }
.drag-handle:active { cursor: grabbing; }
.drag-handle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  opacity: 1;
}
/* Hide drag handle when drag-reorder doesn't make sense (events/todos aggregate views render on different DOM) */
.masonry-item.dragging { opacity: 0.6; }
.masonry-item.drag-over { outline: 2px dashed var(--accent); outline-offset: -4px; background: var(--drag-over); }

.card-title-wrap { flex: 1; min-width: 0; }
.card-num {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}
.status-dot[data-s="active"]      { background: var(--active);      box-shadow: 0 0 5px var(--active); }
.status-dot[data-s="maintenance"] { background: var(--maintenance);  box-shadow: 0 0 5px var(--maintenance); }
.status-dot[data-s="completed"]   { background: var(--completed);    box-shadow: 0 0 5px var(--completed); }
.status-dot[data-s="abandon"]     { background: var(--abandon); }

.card-actions { display: flex; gap: 5px; flex-shrink: 0; margin-top: 1px; align-items: center; }
.card-collapse-btn {
  min-width: 52px;
  text-align: center;
}
.card-edit-btn {
  min-width: 44px;
  text-align: center;
}
.deadline-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.deadline-badge.warning {
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
}
.deadline-badge.urgent {
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
}
.deadline-badge.overdue {
  color: #fff;
  border-color: rgba(185, 28, 28, 0.9);
  background: #b91c1c;
}
@media (prefers-reduced-motion: reduce) {
  .deadline-badge.urgent,
  .deadline-badge.overdue,
  .card.deadline-urgent,
  .card.deadline-overdue,
  .card.deadline-urgent::after,
  .card.deadline-overdue::after { animation: none; }
}

/* ── Section ──────────────────────────────────────── */
.section { border-top: 1px solid var(--border); }
.sec-label {
  padding: 7px 13px 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.sec-body { padding: 6px 13px 12px; }
.collapsed-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
}
.summary-chip strong {
  color: var(--text);
  font-size: 11px;
}

/* ── Preview image ────────────────────────────────── */
.preview-img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 5px;
  display: block;
  margin-bottom: 6px;
}
.img-upload-area {
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s;
  margin-bottom: 6px;
}
.img-upload-area:hover { border-color: var(--accent); color: var(--accent); }
.img-upload-area input { display: none; }

/* ── Meta ─────────────────────────────────────────── */
.meta-row {
  display: flex;
  gap: 7px;
  margin-bottom: 5px;
  font-size: 11px;
  flex-wrap: wrap;
  align-items: baseline;
}
.meta-lbl {
  color: var(--text-muted);
  min-width: 50px;
  flex-shrink: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.meta-val { color: var(--text); word-break: break-all; }
.meta-val a { color: var(--accent); text-decoration: none; font-weight: 600; }
.meta-val a:hover { text-decoration: underline; }
.tag-chip {
  display: inline-block;
  background: var(--accent-dim);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 10px;
  color: var(--accent);
  margin: 1px 2px 1px 0;
}

/* ── Events ───────────────────────────────────────── */
.event-item {
  display: flex;
  gap: 7px;
  margin-bottom: 6px;
  font-size: 11px;
  align-items: flex-start;
}
.item-edit-btn {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 4px 6px;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.item-edit-btn:hover {
  border-color: var(--border);
  background: var(--surface2);
}
.item-edit-btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: var(--accent-dim);
}
.event-edit-btn {
  flex: 1;
  min-width: 0;
  padding-left: 0;
}
.event-ts {
  color: var(--text-muted);
  white-space: nowrap;
  font-size: 10px;
  padding-top: 2px;
  min-width: 82px;
  font-variant-numeric: tabular-nums;
}
.event-main { display:flex; flex:1; min-width:0; flex-direction:column; gap:2px; }
.event-text { color: var(--text); line-height: 1.5; word-break: break-word; }
.item-sub { color: var(--text-muted); font-size: 11px; line-height: 1.45; word-break: break-word; }
.image-count-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}
.del-btn {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px; line-height: 1;
  padding: 0 2px; flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s;
  font-family: inherit;
}
.del-btn:hover { color: #ef4444; opacity: 1; }

.events-more-btn {
  font-size: 10px;
  color: var(--accent);
  background: none; border: none;
  cursor: pointer;
  padding: 2px 0 6px;
  display: block;
  font-family: inherit;
}
.events-more-btn:hover { text-decoration: underline; }
.add-trigger {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 999px;
  color: var(--accent);
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  padding: 5px 10px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.add-trigger:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.input-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* ── Todos ────────────────────────────────────────── */
.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 12px;
}
.todo-edit-btn {
  flex: 1;
  min-width: 0;
  padding: 2px 6px;
}
.todo-item input[type="checkbox"] {
  margin-top: 5px;
  width: 13px; height: 13px;
  accent-color: var(--active);
  flex-shrink: 0;
}
.todo-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.todo-text-wrap { display:flex; flex:1; min-width:0; flex-direction:column; gap:2px; }
.todo-text { flex: 1; line-height: 1.5; word-break: break-word; }
.todo-text.done { text-decoration: line-through; color: var(--text-muted); }
.todo-ddl {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}
.todo-ddl.warning {
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
}
.todo-ddl.urgent,
.todo-ddl.overdue {
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
}
.todo-done-at {
  color: var(--text-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.todo-assigned-icon {
  font-size: 13px;
  opacity: 0.3;
  cursor: pointer;
  margin: 0 4px;
  flex-shrink: 0;
  user-select: none;
}
.todo-assigned-icon:hover {
  opacity: 0.6;
}
.todo-assigned-icon.assigned {
  opacity: 1;
}
.todo-action-icon {
  font-size: 13px;
  opacity: 0.3;
  cursor: pointer;
  margin: 0 2px;
  flex-shrink: 0;
  user-select: none;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  display: inline-flex;
  align-items: center;
}
.todo-action-icon:hover {
  opacity: 0.6;
}
.todo-action-icon.active {
  opacity: 1;
}

/* ── Card todo two-row layout ─────────────────────── */
.card-todo-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  overflow: hidden;
}
.card-todo-line1 {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}
.card-todo-line2 {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 5px 8px;
}
.card-todo-ts {
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.card-todo-line2 input[type="checkbox"] {
  margin-top: 3px;
  width: 13px; height: 13px;
  accent-color: var(--active);
  flex-shrink: 0;
  cursor: pointer;
}
.card-todo-text-btn {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  font-size: 12px;
  text-align: left;
  line-height: 1.5;
  word-break: break-word;
}
.card-todo-text-btn .todo-text { display: block; }

/* ── Notes ────────────────────────────────────────── */
.notes-pre {
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: var(--surface2);
  border-radius: 5px;
  padding: 9px 11px;
  font-family: inherit;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.comment-item {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
}
.comment-item:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.comment-author {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.comment-title {
  color: var(--text);
  font-size: 11px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.comment-body {
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: var(--surface2);
  border-radius: 6px;
  padding: 12px;
}

/* ── Input areas ──────────────────────────────────── */
.input-row { display: flex; gap: 6px; margin-top: 8px; align-items: flex-start; }
.input-col { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
@media (max-width: 640px) {
  .input-row,
  .input-actions {
    flex-direction: column;
  }
}

textarea, input[type="text"], input[type="datetime-local"], select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-family: 'Microsoft YaHei', '微软雅黑', 'PingFang SC', sans-serif;
  font-size: 12px;
  padding: 6px 9px;
  width: 100%;
  transition: border-color 0.15s;
  resize: vertical;
}
textarea:focus, input[type="text"]:focus, input[type="datetime-local"]:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
select option { background: var(--surface2); }

/* ── Modal ────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
@media (max-width: 640px) {
  .modal { max-height: 100vh; border-radius: 0; }
  .modal-overlay { padding: 0; align-items: flex-end; }
}
.modal-header { display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 14px; font-weight: 800; color: var(--accent); }
.modal-close {
  background: none; border: none;
  color: var(--text-muted); font-size: 20px;
  cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--text); }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 10px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; }
.project-picker-list { min-height: 148px; }
.project-picker-list:disabled { opacity: 0.65; cursor: wait; }
.project-picker-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 11px;
}
.project-picker-empty {
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 0 0;
}
.modal-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.node-attachment-panel { gap: 8px; }
.node-attachment-toolbar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.node-attachment-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap:8px; }
.node-attachment-card {
  display:flex; flex-direction:column; gap:7px;
  border:1px solid var(--border); border-radius:8px;
  padding:8px; background:var(--surface2);
}
.node-attachment-card img { width:100%; height:76px; object-fit:cover; border-radius:6px; border:1px solid var(--border); }
.node-attachment-card input { font-size:11px; padding:6px 7px; }
.node-attachment-pending { font-size:11px; color:var(--text-muted); padding:7px 8px; border:1px dashed var(--border); border-radius:8px; }
.node-attachment-empty { color:var(--text-muted); font-size:11px; padding:4px 0; }

/* ── Empty / Toast ────────────────────────────────── */
.empty { text-align: center; color: var(--text-muted); padding: 60px 20px; font-size: 13px; grid-column: 1 / -1; }

.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 12px;
  color: var(--accent);
  z-index: 400;
  opacity: 0; transform: translateY(8px);
  transition: all 0.25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── AGGREGATE VIEWS ──────────────────────────────── */
.aggregate-view { max-width: 900px; margin: 0 auto; padding: 0 16px 40px; }
.agg-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.agg-header-title { font-size: 16px; font-weight: 700; color: var(--text); }
.agg-count-badge { background: var(--surface2); color: var(--text-muted); font-size: 11px;
  padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.agg-header-spacer { flex: 1 1 auto; }
.agg-toggle-label { display: flex; align-items: center; gap: 5px; font-size: 12px;
  color: var(--text-muted); cursor: pointer; user-select: none; }
.agg-toggle-label input { cursor: pointer; accent-color: var(--accent); }
.todo-sort-btns { display: flex; align-items: center; gap: 2px; }
.todo-sort-btn { background: none; border: 1px solid transparent; border-radius: 4px;
  padding: 2px 6px; cursor: pointer; font-size: 13px; color: var(--text-muted); line-height: 1;
  transition: border-color 0.15s, color 0.15s, background 0.15s; }
.todo-sort-btn:hover { border-color: var(--border); color: var(--text); }
.todo-sort-btn.active { border-color: var(--accent); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); }
.todo-sort-dir { font-size: 10px; margin-left: 1px; }

.project-badge { display: inline-block; font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }
.project-badge[data-s="active"]      { background: color-mix(in srgb, var(--active) 18%, transparent);      color: var(--active); }
.project-badge[data-s="maintenance"] { background: color-mix(in srgb, var(--maintenance) 18%, transparent); color: var(--maintenance); }
.project-badge[data-s="completed"]   { background: color-mix(in srgb, var(--completed) 18%, transparent);   color: var(--completed); }
.project-badge[data-s="abandon"]     { background: color-mix(in srgb, var(--abandon) 18%, transparent);     color: var(--abandon); }
.agg-badge-btn { border: none; cursor: pointer; font-family: inherit; line-height: inherit;
  transition: opacity 0.15s; }
.agg-badge-btn:hover { opacity: 0.75; }

.agg-event-row { display: flex; flex-direction: column; gap: 4px; padding: 7px 10px;
  border-radius: 6px; border: 1px solid var(--border); margin-bottom: 5px;
  background: var(--surface); transition: background 0.15s; }
.agg-event-row:hover { background: var(--surface2); }
.agg-event-source-icon { font-size: 11px; color: var(--accent); flex-shrink: 0; opacity: 0.8; }

.agg-todo-row { display: flex; flex-direction: column; gap: 4px; padding: 7px 10px;
  border-radius: 6px; border: 1px solid var(--border); margin-bottom: 5px;
  background: var(--surface); transition: background 0.15s; }
.agg-todo-row:hover { background: var(--surface2); }
.agg-todo-row-btn { flex: 1; text-align: left; background: none; border: none;
  padding: 0; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
  color: var(--text); min-width: 0; }
.agg-todo-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.agg-todo-done-at { font-size: 10px; color: var(--text-muted); opacity: 0.7; }

.agg-row-line1 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.agg-row-line2 { display: flex; align-items: flex-start; padding-left: 2px; min-width: 0; }
.agg-content-btn { flex: 1; text-align: left; background: none; border: none;
  padding: 0; cursor: pointer; color: var(--text); font-size: 13px; min-width: 0;
  word-break: break-word; white-space: normal; }

.agg-del { transition: color 0.15s; }
.agg-del:hover { color: #ef4444; }
.agg-badge-col { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; flex-shrink: 0; }

/* urgency icons */
.urgency-icon { font-size: 15px; cursor: pointer; border-radius: 50%; padding: 1px 3px;
  transition: transform 0.15s; user-select: none; opacity: 1; }
.urgency-icon:hover { transform: scale(1.2); }
.urgency-urgent   { background: rgba(239,68,68,0.15); }
.urgency-soon     { background: rgba(234,179,8,0.15); }
.urgency-normal   { background: rgba(34,197,94,0.15); }
.urgency-whenever { background: rgba(59,130,246,0.15); }
.urgency-none     { opacity: 0.35; font-size: 12px; }

/* assign icons */
.assign-icon { font-size: 15px; cursor: pointer; border-radius: 50%; padding: 1px 3px;
  transition: transform 0.15s; user-select: none; opacity: 1; }
.assign-icon:hover { transform: scale(1.2); }
.assign-pending { opacity: 0.35; font-size: 12px; }
.assign-retry   { background: rgba(249,115,22,0.15); }
.assign-waiting { background: rgba(59,130,246,0.15); }
.assign-bot     { background: rgba(168,85,247,0.15); }
.assign-self    { background: rgba(239,68,68,0.15); }

/* urgency picker popup */
.urgency-picker { position: absolute; top: calc(100% + 4px); right: 0; z-index: 200;
  display: flex; gap: 2px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  outline: none; }
.urgency-picker-opt { background: none; border: none; cursor: pointer; font-size: 17px;
  border-radius: 6px; padding: 2px 5px; transition: background 0.12s; line-height: 1; }
.urgency-picker-opt:hover { background: var(--surface2); }
.urgency-picker-opt.selected { background: var(--surface2); outline: 2px solid var(--accent); }

/* flash animation when todo priority changes */
@keyframes todoFlash {
  0%   { background: color-mix(in srgb, var(--accent) 25%, var(--surface)); }
  100% { background: var(--surface); }
}
.agg-todo-row.todo-flash { animation: todoFlash 0.7s ease-out; }

/* label color picker */
.label-color-picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.label-color-swatch { width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: border-color 0.15s, transform 0.15s; flex-shrink: 0; }
.label-color-swatch:hover { transform: scale(1.15); }
.label-color-swatch.selected { border-color: var(--text); }
.label-color-reset { font-size: 11px; color: var(--text-muted); cursor: pointer; padding: 2px 6px;
  border: 1px solid var(--border); border-radius: 8px; background: none; }
.label-color-reset:hover { background: var(--surface2); }

.agg-empty { text-align: center; padding: 48px 16px; color: var(--text-muted);
  font-size: 14px; opacity: 0.6; }

/* ════════════════════════════════════════════════════
   MOBILE / NARROW SCREEN ADAPTATIONS
   ════════════════════════════════════════════════════ */

/* ── Header top/bottom rows (used on mobile) ──────── */
.header-top-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}
.header-bottom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
input.search-input { width: 180px; }

/* ── Tabs: desktop vs mobile ──────────────────────── */
.tabs-desktop { display: flex; }
.tabs-mobile  { display: none; }

/* ── Tab mobile dropdown ──────────────────────────── */
.tab-mobile-bar {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  position: relative;
}
.tab-select-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  font-family: inherit;
  transition: border-color 0.15s;
}
.tab-select-trigger:hover { border-color: var(--accent); }
.tab-select-label { flex: 1; text-align: left; }
.tab-select-badge {
  background: var(--accent);
  color: var(--bg);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
}
.tab-select-arrow {
  color: var(--text-muted);
  font-size: 11px;
  transition: transform 0.2s;
}
.tab-select-arrow.open { transform: rotate(180deg); }
.tab-dropdown {
  position: absolute;
  top: calc(100% - 1px);
  left: 14px;
  right: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.25);
  z-index: 150;
  overflow: hidden;
}
.tab-dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 11px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  gap: 8px;
  transition: background 0.12s;
}
.tab-dropdown-item:last-child { border-bottom: none; }
.tab-dropdown-item:hover { background: var(--surface2); }
.tab-dropdown-item.active { color: var(--accent); font-weight: 700; background: var(--accent-dim); }
.tab-dropdown-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}
.tab-dropdown-item.active .tab-dropdown-dot { background: var(--accent); }
.tab-dropdown-item-label { flex: 1; }
.tab-dropdown-item-count {
  background: var(--surface2);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  color: var(--text-muted);
}
.tab-dropdown-item.active .tab-dropdown-item-count {
  background: var(--accent);
  color: var(--bg);
}

.mobile-fab-stack {
  position: fixed;
  right: 12px;
  bottom: 88px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  z-index: 180;
}
.mobile-search-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.mobile-fab-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mobile-fab-btn.btn-ghost {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}
.mobile-fab-btn.btn-ghost:hover {
  background: var(--accent-dim);
}
.mobile-fab-btn.btn-ghost.mobile-fab-active {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.mobile-fab-primary {
  border: 1px solid transparent;
  box-shadow: var(--glow), 0 12px 28px rgba(0,0,0,0.2);
}
.mobile-fab-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.mobile-fab-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.mobile-search-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(280px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 16px 36px rgba(0,0,0,0.22);
}
.mobile-search-popover input {
  width: 100%;
  min-width: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 10px 12px;
  outline: none;
}
.mobile-search-popover input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}
.mobile-search-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Mobile breakpoints ───────────────────────────── */
@media (max-width: 640px) {
  header {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 14px;
    gap: 8px;
  }
  input.search-input {
    flex: 1;
    min-width: 0;
    width: auto;
  }
  /* Increase touch targets for action buttons */
  .btn-sm { min-height: 34px; padding: 6px 12px; }
  /* Toast: full width bar at bottom on mobile */
  .toast {
    bottom: 12px;
    left: 12px;
    right: 12px;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .header-bottom-row { display: none; }
  .tabs-desktop { display: none; }
  .tabs-mobile  { display: block; }
  .mobile-fab-stack { display: flex; }
  .masonry { padding: 12px 12px 136px; padding-bottom: calc(136px + env(safe-area-inset-bottom)); }
  .aggregate-view { padding: 0 12px 136px; padding-bottom: calc(136px + env(safe-area-inset-bottom)); }
}
@media (min-width: 641px) {
  .tabs-mobile  { display: none; }
  .tabs-desktop { display: flex; }
  .mobile-fab-stack { display: none; }
  /* On desktop, header-top-row/bottom-row collapse back into single flex row */
  header { flex-direction: row; align-items: center; padding: 9px 20px; }
  .header-top-row { flex: 0 0 auto; }
  .header-bottom-row { flex: 1; justify-content: flex-end; flex-wrap: nowrap; gap: 6px; }
}

/* Detail polish for the project board. */
header h1 {
  letter-spacing: 0;
}

header,
.tabs,
.tab-mobile-bar {
  border-color: color-mix(in srgb, var(--border) 84%, transparent);
}

.btn,
.tab,
.tab-select-trigger,
.tab-dropdown-item,
.mobile-fab-btn,
.todo-sort-btn {
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease,
    transform 0.15s ease;
}

.btn:hover,
.mobile-fab-btn:hover,
.tab:hover,
.tab-select-trigger:hover {
  transform: translateY(-1px);
}

.tabs {
  gap: 4px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 34%, transparent), transparent);
}

.tab {
  min-height: 36px;
  border-radius: 8px 8px 0 0;
}

.tab.active {
  box-shadow: 0 -1px 0 var(--accent-dim), var(--shadow-sm, none);
}

.tab-badge,
.agg-count-badge,
.project-badge,
.deadline-badge,
.summary-chip,
.tag-chip {
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 999px;
}

.masonry,
.masonry-column {
  gap: 18px;
}

.card {
  border-radius: 10px;
  border-color: color-mix(in srgb, var(--border) 88%, transparent);
  box-shadow: var(--card-shadow), var(--shadow-sm, none);
}

.card:hover {
  box-shadow: var(--card-shadow), var(--shadow-md, 0 8px 24px rgba(15, 23, 42, 0.12));
}

.card-header {
  padding: 12px 14px 10px;
}

.card-title {
  line-height: 1.45;
}

.section {
  border-color: color-mix(in srgb, var(--border) 84%, transparent);
}

.sec-label,
.form-label,
.meta-lbl {
  letter-spacing: 0;
}

textarea,
input[type="text"],
input[type="datetime-local"],
select {
  min-height: 36px;
  border-radius: 7px;
}

.item-edit-btn,
.events-more-btn,
.todo-action-icon,
.del-btn,
.card-todo-text-btn,
.agg-content-btn,
.agg-todo-row-btn {
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.card-todo-row,
.agg-event-row,
.agg-todo-row {
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--border) 86%, transparent);
  box-shadow: var(--shadow-sm, none);
}

.card-todo-row:hover,
.agg-event-row:hover,
.agg-todo-row:hover {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--border));
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.modal-overlay {
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal {
  border-color: color-mix(in srgb, var(--border) 86%, transparent);
  box-shadow: var(--shadow-lg, 0 18px 52px rgba(15, 23, 42, 0.2));
}

.toast {
  border-color: color-mix(in srgb, var(--border) 78%, var(--accent) 22%);
  background: color-mix(in srgb, var(--surface) 94%, var(--bg));
  color: var(--text);
  box-shadow: var(--shadow-lg, 0 14px 38px rgba(0, 0, 0, 0.2));
}

@media (max-width: 640px) {
  .card-header,
  .agg-header {
    gap: 8px;
  }

  .card-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .modal {
    border-radius: 14px 14px 0 0;
  }
}
