/* ============================================================
   TODO 待办区（Apple Reminders 清单 + Things 3 看板双视图）
   令牌全部复用 style.css :root 与各 themes/<id>.css，7 套主题自适应
   ============================================================ */

body[data-zone="todo"] #list,
body[data-zone="todo"] #list-sentinel { display: none !important; }
body:not([data-zone="todo"]) #todo-shell { display: none !important; }
body[data-zone="todo"] #todo-shell:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100%;
}
body[data-zone="todo"] #list-scroll {
  padding: 12px 24px 36px !important;
}

/* ---------- 顶栏内联工具组：进度 + 轻量按钮 + 清单/看板 Apple 分段器 ---------- */
#zone-tools:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.zt-ghost-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid color-mix(in srgb, var(--ink) 9%, transparent);
  background: transparent;
  color: var(--text-dim);
  font: 500 12px/1 var(--sans);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.zt-ghost-btn:hover {
  background: var(--paper-tint);
  color: var(--text);
}
.apple-seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2.5px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ink) 6%, var(--paper-tint));
}
.apple-seg button {
  height: 24px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font: 500 12px/1 var(--sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.apple-seg button:hover { color: var(--text); }
.apple-seg button.active {
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.todo-progress { display: inline-flex; align-items: center; gap: 7px; }
.tp-track {
  width: 72px;
  height: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 9%, transparent);
  overflow: hidden;
}
.todo-progress[data-pct="0"] .tp-track { opacity: 0.45; }
.tp-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width var(--dur) var(--ease);
}
.tp-fill.full { background: var(--heat-use); }
.tp-label {
  font-size: 11.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* ---------- 侧栏「智能视图」：待办区恢复全宽 Apple 导航行（取代馆藏的双列小胶囊） ---------- */
body[data-zone="todo"]:not(.sidebar-collapsed) #type-drawers.type-chips-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
}
body[data-zone="todo"]:not(.sidebar-collapsed) #type-drawers.type-chips-grid .nav-row {
  width: 100%;
  padding: 6.5px 10px;
  gap: 9px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid transparent;
}
body[data-zone="todo"]:not(.sidebar-collapsed) #type-drawers.type-chips-grid .nav-row .nav-ic {
  display: inline-block;
  width: 15px;
  height: 15px;
  color: var(--side-ink-faint);
}
body[data-zone="todo"]:not(.sidebar-collapsed) #type-drawers.type-chips-grid .nav-row.active .nav-ic {
  color: var(--accent-ink);
}
body[data-zone="todo"]:not(.sidebar-collapsed) #type-drawers.type-chips-grid .nav-row em.count {
  margin-left: auto;
  font-size: 11.5px;
}
body[data-zone="todo"]:not(.sidebar-collapsed) #type-drawers.type-chips-grid .nav-row.active {
  background: var(--card);
  border-color: var(--border-soft);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  font-weight: 600;
}

/* ---------- Apple Reminders 极速新建输入槽（静默浅槽，聚焦浮起） ---------- */
.todo-quick-bar {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  min-height: 42px;
  padding: 5px 8px 5px 14px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--ink) 3.4%, var(--paper));
  border: 1px solid transparent;
  box-shadow: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
#todo-shell:has(#todo-board:not([hidden])) .todo-quick-bar {
  max-width: none;
}
.todo-quick-bar:focus-within {
  background: var(--card);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.todo-quick-plus {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.todo-quick-plus .icon { width: 13px; height: 13px; }
#todo-quick-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font: 14px/1.4 var(--sans);
  color: var(--ink);
  padding: 4px 0;
}
#todo-quick-input::placeholder { color: var(--ink-faint); }
.todo-quick-pill {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  background: transparent;
  color: var(--ink-soft);
  font: 500 11.5px/1 var(--sans);
  cursor: pointer;
  flex: none;
  transition: all var(--dur) var(--ease);
}
.todo-quick-pill:hover { border-color: var(--accent); color: var(--accent-ink); }
.todo-quick-pill.active {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: #ffffff;
}
.todo-quick-more {
  height: 26px;
  padding: 0 10px;
  border-radius: 7px;
  border: 0;
  background: var(--paper-tint);
  color: var(--ink-soft);
  font: 500 11.5px/1 var(--sans);
  cursor: pointer;
  flex: none;
}
.todo-quick-more:hover { color: var(--ink); background: var(--paper-edge); }

/* ---------- 清单视图（Apple Reminders × Things 3 分组列表） ---------- */
.todo-list-view {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.todo-list-view[hidden] { display: none; }

.tlist-sec {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tlist-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 6px;
  font: 600 12.5px/1.3 var(--sans);
  color: var(--ink-soft);
}
.tlist-head em {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-faint);
}
.tlist-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.tlist-dot.doing { background: var(--accent); }
.tlist-dot.open { background: var(--ink-faint); }

.tlist-fold-btn {
  border: 0;
  background: transparent;
  padding: 4px 6px;
  margin-left: -6px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 12.5px/1.3 var(--sans);
  color: var(--ink-faint);
  cursor: pointer;
}
.tlist-fold-btn:hover { background: var(--paper-tint); color: var(--ink); }
.tlist-fold-btn .tri {
  width: 13px;
  height: 13px;
  transform: rotate(90deg);
  transition: transform var(--dur) var(--ease);
}
.done-sec.collapsed .tlist-fold-btn .tri { transform: rotate(0deg); }
.tlist-fold-btn em { font-style: normal; font-weight: 500; }

.tlist-ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--ink) 7%, transparent);
  overflow: hidden;
}

.trow.tcard {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 11px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transform: none !important;
  box-shadow: none;
  transition: background 120ms ease;
}
.trow.tcard + .trow.tcard {
  border-top: 1px solid color-mix(in srgb, var(--ink) 6%, transparent);
}
.trow.tcard:hover {
  background: color-mix(in srgb, var(--ink) 2.2%, var(--card));
}
.trow.tcard.selected {
  background: color-mix(in srgb, var(--accent) 5%, var(--card));
}
.trow.is-doing .tk-check {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.trow-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.trow-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.trow-title {
  flex: 1 1 0;
  font: 500 14px/1.42 var(--sans);
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trow.done .trow-title {
  color: var(--ink-faint);
  text-decoration: line-through;
}
.trow-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.trow-sub {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-faint);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.trow-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}
.trow:hover .trow-actions,
.trow:focus-visible .trow-actions {
  opacity: 1;
  pointer-events: auto;
}
@media (hover: none) {
  .trow-actions { opacity: 1; pointer-events: auto; }
}

.trow-act-btn {
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  background: var(--paper);
  color: var(--ink-soft);
  font: 500 11px/1 var(--sans);
  cursor: pointer;
}
.trow-act-btn:hover,
.trow-act-btn.on {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-soft);
}
.trow-ic-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.trow-ic-btn:hover { background: var(--paper-tint); color: var(--ink); }
.trow-ic-btn.danger:hover { background: var(--danger-soft); color: var(--danger-ink); }
.trow-ic-btn .icon { width: 14px; height: 14px; }

/* ---------- 看板视图（三阶段拖拽列，去重框轻量化） ---------- */
.todo-board {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
  padding: 2px 0 12px;
  overflow-x: auto;
}
.todo-board[hidden] { display: none !important; }

.tcol {
  flex: 1 1 0;
  min-width: 240px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: color-mix(in srgb, var(--ink) 2.6%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--ink) 6%, transparent);
  border-radius: 14px;
  padding: 12px;
}
.tcol-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 4px;
}
.tcol-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.tcol-title::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--col-dot, var(--ink-faint));
}
.tcol[data-status="open"] { --col-dot: var(--ink-faint); }
.tcol[data-status="doing"] {
  --col-dot: var(--accent);
  background: color-mix(in srgb, var(--accent) 3.5%, var(--paper));
}
.tcol[data-status="doing"] .tcol-title { color: var(--accent-ink); }
.tcol[data-status="done"] { --col-dot: var(--heat-use); }

.tcol-n {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.tcol-list {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 2px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.tcol-list:empty { min-height: 64px; }
.tcol-list:empty::after {
  content: attr(data-hint);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  border-radius: 10px;
  font-size: 12px;
  color: color-mix(in srgb, var(--ink-faint) 75%, transparent);
}

/* 看板卡 */
.todo-board .tcard {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--ink) 7%, transparent);
  border-radius: 11px;
  padding: 11px 13px;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.todo-board .tcard:hover {
  border-color: color-mix(in srgb, var(--accent) 32%, transparent);
  box-shadow: var(--shadow-card);
}
.todo-board .tcard.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.todo-board .tcard.done { opacity: 0.68; }
.todo-board .tcard.done .entry-title {
  color: var(--ink-faint);
  text-decoration: line-through;
}

.tcard-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.todo-board .tcard .entry-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  line-height: 1.4;
  font-size: 13.5px;
  font-weight: 500;
}
.tcard-note {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-faint);
}
.tcard-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.tcard-meta:empty { display: none; }

.tcard-tag {
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--paper-tint);
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tcard .due-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--paper-tint);
  border-radius: 999px;
  padding: 1.5px 8px;
}
.tcard .due-badge.overdue {
  color: var(--danger-ink);
  background: var(--danger-soft);
}
.tcard .due-badge.today {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

/* Apple 20px 正圆完成环 */
.tcard .tk-check {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1.6px solid color-mix(in srgb, var(--ink-faint) 62%, transparent);
  border-radius: 50%;
  background: none;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tcard .tk-check .icon { width: 12px; height: 12px; stroke-width: 3; }
.tcard .tk-check:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.tcard .tk-check[aria-pressed="true"] {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
}

/* 拖拽与完成动效 */
.tcard-ghost { opacity: 0.35; border: 1.5px dashed var(--accent); }
.tcard-chosen { box-shadow: var(--shadow-card); }
.tcard-drag { opacity: 0.96; box-shadow: var(--shadow-pop); transform: rotate(1deg) scale(1.015); cursor: grabbing; }
.tcard-drag .tk-check { visibility: hidden; }

@keyframes tk-pop-done {
  0% { transform: scale(1); }
  35% { transform: scale(1.015); }
  100% { transform: scale(1); }
}
@keyframes tk-pop-reopen {
  0% { transform: scale(0.985); }
  100% { transform: scale(1); }
}
.tcard.just-done { animation: tk-pop-done 0.35s var(--ease); }
.tcard.just-reopened { animation: tk-pop-reopen 0.28s var(--ease); }

@media (max-width: 719px) {
  body[data-zone="todo"] #list-scroll { padding: 10px 14px 28px !important; }
  .todo-board { flex-direction: column; height: auto; }
  .tcol-list { overflow: visible; }
  .trow-top { flex-wrap: wrap; gap: 4px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .tcard, .tcard .tk-check, .tp-fill { transition: none; }
  .tcard.just-done, .tcard.just-reopened { animation: none; }
}

.tcol.col-hidden { display: none; }
.todo-cols-pop {
  position: fixed; z-index: 120; min-width: 148px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.todo-cols-pop .todo-cols-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 10px; border-radius: 8px;
  font-size: 13px; color: var(--text); text-align: left;
}
.todo-cols-pop .todo-cols-row:hover { background: var(--paper-hi); }
.todo-cols-pop input[type="checkbox"] { accent-color: var(--accent); pointer-events: none; }

/* 空抽屉坍缩与只读任务检查器宽度（严格 1:1 绑定 .detail-drawer 与 .task-card，杜绝被 --drawer-w 撑破左裁切） */
@media (min-width: 720px) {
  body[data-zone="todo"] .shell:not(.capture-open):has(#panel-empty:not([hidden])) .detail-drawer,
  body.trash-page-open .shell:not(.capture-open):has(#panel-empty:not([hidden])) .detail-drawer { display: none; }
  body[data-zone="todo"] .shell.panel-open:not(.capture-open) .detail-drawer,
  body.trash-page-open .shell.panel-open:not(.capture-open) .detail-drawer {
    width: 372px !important;
  }
  body[data-zone="todo"] .shell.panel-open:not(.capture-open) .detail-drawer > .task-card,
  body.trash-page-open .shell.panel-open:not(.capture-open) .detail-drawer > .task-card {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 0;
    min-width: 0;
  }
  body[data-zone="todo"] .shell.panel-open:not(.capture-open) #drawer-resizer,
  body.trash-page-open .shell.panel-open:not(.capture-open) #drawer-resizer {
    display: none;
  }
}
@media (min-width: 720px) and (max-width: 1024px) {
  body[data-zone="todo"] .shell.panel-open:not(.capture-open) .detail-drawer {
    position: fixed; right: 0; top: 0; bottom: 0;
    width: min(380px, 92vw) !important; z-index: 90;
    box-shadow: var(--shadow-pop);
    border-left: 1px solid var(--border);
  }
}
