/* 清单 —— 视觉方向：纸灰底 + 单张白纸 + 墨线分隔；唯一的强调色是深青，
   唯一的动效是用在「划掉」这个动作上。 */

:root {
  --canvas: #f1f2f4;
  --paper: #ffffff;
  --paper-sunk: #f7f8f9;
  --ink: #14171a;
  --ink-soft: #5b6470;
  --ink-faint: #98a1ab;
  --rule: #e3e6ea;
  --rule-soft: #eef0f2;
  --rule-strong: #c9cfd6;
  --accent: #0e6e6b;
  --accent-ink: #0a5451;
  --accent-wash: #e3efee;
  --amber: #a96b12;
  --danger: #a23b32;
  --strike: #9aa3ad;
  --shadow-panel: 0 1px 2px rgba(20, 23, 26, .06), 0 12px 32px rgba(20, 23, 26, .14);

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;

  --r-xs: 3px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  --rail-w: 224px;
  --sheet-w: 660px;
}

:root[data-theme="dark"] {
  --canvas: #101214;
  --paper: #191c1f;
  --paper-sunk: #202428;
  --ink: #eef1f3;
  --ink-soft: #a6aeb8;
  --ink-faint: #737c86;
  --rule: #2b3036;
  --rule-soft: #23272b;
  --rule-strong: #3d444c;
  --accent: #46b3ac;
  --accent-ink: #7fd0ca;
  --accent-wash: #1d3333;
  --amber: #d3a054;
  --danger: #d98a80;
  --strike: #6b737c;
  --shadow-panel: 0 1px 2px rgba(0, 0, 0, .5), 0 16px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

/* 有些元素用 flex/grid 布局，会盖掉浏览器默认的 [hidden]，这里统一兜住 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button, input, textarea { font: inherit; color: inherit; }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }

/* ---------- 骨架 ---------- */

.shell {
  min-height: 100%;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
}

.rail {
  padding: 34px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  border-right: 1px solid var(--rule);
  position: sticky;
  top: 0;
  height: 100vh;
}

.wordmark {
  margin: 0;
  font-size: 19px;
  font-weight: 620;
  letter-spacing: .16em;
}

.wordmark em {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: .2em;
  color: var(--ink-faint);
  margin-left: 8px;
  vertical-align: 3px;
}

.rail-sub {
  margin: 6px 0 0;
  color: var(--ink-faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.rail-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
}

.nav-item:hover { background: var(--rule-soft); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--accent-wash); color: var(--accent-ink); font-weight: 560; }

.nav-main { display: flex; align-items: baseline; gap: 8px; }

.nav-en {
  font-size: 10.5px;
  letter-spacing: .05em;
  color: var(--ink-faint);
  font-weight: 400;
}

.nav-item[aria-current="page"] .nav-en { color: var(--accent-ink); opacity: .7; }

.nav-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.rail-lower { flex: 1; min-height: 0; overflow: auto; }

.rail-block { margin-bottom: 22px; }

.rail-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-faint);
}

.rail-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.stats { margin: 0; display: grid; grid-template-columns: 1fr; gap: 7px; }

.stats div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.stats dt { font-size: 12.5px; color: var(--ink-faint); }
.stats dd { margin: 0; font-size: 13.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.stats dd strong { color: var(--ink); font-weight: 580; }

.tag-btn {
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tag-btn::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c, var(--ink-faint));
  flex: none;
}

.tag-btn:hover { border-color: var(--ink-faint); color: var(--ink); }
.tag-btn[aria-current="page"] { border-color: var(--c, var(--accent)); color: var(--ink); background: color-mix(in srgb, var(--c, var(--accent)) 12%, transparent); }

.rail-foot { display: flex; gap: 8px; }
.rail-foot .ghost-btn { flex: 1; white-space: nowrap; text-align: center; }

.ghost-btn {
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink-soft);
  padding: 7px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
}

.ghost-btn:hover { border-color: var(--ink-faint); color: var(--ink); }

.primary-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
}

.primary-btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); }

.sheet {
  min-width: 0;
  padding: 58px 44px 100px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  max-width: calc(var(--sheet-w) + 80px);
  margin-inline: auto;
  width: 100%;
}

/* ---------- 页眉：日期 + 当日刻度 ---------- */

.sheet-head { display: flex; flex-direction: column; gap: 14px; }

.head-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 2px 0;
  border: 0;
  background: none;
  position: relative;
  z-index: 0;
}

.head-main { display: flex; flex-direction: column; gap: 9px; min-width: 0; }

.head-title {
  margin: 0;
  font-size: 36px;
  font-weight: 640;
  letter-spacing: -.038em;
  text-wrap: balance;
}

.head-meta { margin: 0; color: var(--ink-soft); font-size: 13px; font-variant-numeric: tabular-nums; }

/* 今日完成度：一个环，替代纯数字 */
.ring { position: relative; width: 62px; height: 62px; flex: none; }
.ring svg { width: 62px; height: 62px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring-bg { stroke: var(--rule-soft); }
.ring-fg {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 119.4;
  stroke-dashoffset: 119.4;
  transition: stroke-dashoffset .5s cubic-bezier(.4, 0, .2, 1);
}
.ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 560;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

.ticks { display: flex; flex-wrap: wrap; gap: 3px; min-height: 16px; align-items: center; }

.tick {
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: var(--rule);
  transition: background-color .18s ease, transform .18s ease;
}

.tick.on { background: var(--accent); }
.tick.now { transform: scaleY(1.35); }

/* ---------- 速记行 ---------- */

.capture {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(20, 23, 26, .04), 0 10px 30px -18px rgba(20, 23, 26, .18);
  padding: 10px 12px 9px;
}

.capture-row { display: flex; align-items: center; gap: 10px; }
.capture-icon { color: var(--accent); flex: none; }

.capture input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 6px 0;
  font-size: 16px;
}

.capture input::placeholder { color: var(--ink-faint); }
.capture input:focus { outline: none; }

.capture-submit {
  border: 0;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 6px 14px;
  cursor: pointer;
  flex: none;
}

.capture-submit:hover { background: var(--accent-ink); }

.capture-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-left: 30px;
  min-height: 20px;
}

.hint-chip {
  border: 1px dashed var(--rule);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  color: var(--ink-faint);
  cursor: pointer;
  user-select: none;
}

.hint-chip:hover { color: var(--accent-ink); border-color: var(--accent); }
.hint-text { font-size: 12px; color: var(--ink-faint); }

.capture-notes {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--rule-soft);
  background: transparent;
  padding: 9px 0 3px;
  margin-top: 5px;
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
  color: var(--ink);
  caret-color: var(--accent);
}

.capture-notes:focus { outline: none; }

.capture-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-left: 30px;
  padding-top: 7px;
}

.chipset { display: flex; flex-wrap: wrap; gap: 6px; }

.chip-sm { padding: 2px 10px; font-size: 12.5px; }

/* 原生日期框藏起来，由按钮代劳唤起日历，这样整颗按钮都能点 */
.visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: 0;
  padding: 0;
}

.seg-mini .seg-btn { padding: 3px 11px; font-size: 12.5px; }

/* 自绘月历，替换手机系统那个蓝色日期控件 */
.picker {
  position: absolute;
  left: 8px;
  right: 8px;
  top: calc(100% + 6px);
  z-index: 30;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: 14px;
  box-shadow: 0 20px 50px -22px rgba(0, 0, 0, .45);
  padding: 10px 12px 12px;
}

.picker-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.picker-head .icon-btn { width: 28px; height: 28px; }
.picker-title { flex: 1; text-align: center; font-size: 14px; font-weight: 560; font-variant-numeric: tabular-nums; }

.picker-week, .picker-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.picker-week { font-size: 11.5px; color: var(--ink-faint); text-align: center; margin-bottom: 3px; }

.picker-grid button {
  border: 0;
  background: transparent;
  border-radius: 9px;
  height: 34px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.picker-grid button:hover { background: var(--rule-soft); }
.picker-grid button.is-out { color: var(--ink-faint); }
.picker-grid button.is-today { color: var(--accent-ink); font-weight: 620; }
.picker-grid button.is-on { background: var(--accent); color: #fff; font-weight: 560; }
.picker-foot { display: flex; gap: 6px; margin-top: 8px; }

/* ---------- 工具条 ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search {
  flex: 1 1 190px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  padding: 6px 10px;
  color: var(--ink-faint);
}

.search svg { width: 16px; height: 16px; flex: none; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 14px;
  padding: 3px 0;
}
.search input:focus { outline: none; }

.seg {
  display: inline-flex;
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm);
  background: var(--paper);
  overflow: hidden;
}

.seg-btn { border-left-color: var(--rule-soft); }

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  padding: 6px 11px;
  font-size: 13px;
  cursor: pointer;
  border-left: 1px solid var(--rule);
}

.seg-btn:first-child { border-left: 0; }
.seg-btn:hover { background: var(--rule-soft); color: var(--ink); }
.seg-btn[aria-pressed="true"] { background: var(--accent-wash); color: var(--accent-ink); font-weight: 560; }

.seg-icons .seg-btn { display: grid; place-items: center; padding: 6px 8px; }
.seg-icons .seg-btn svg { width: 15px; height: 15px; stroke-width: 1.6; }

.panel-section {
  margin: 0 0 -4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-faint);
}

/* 批量操作属于列表，不属于排序控件那一排，所以单独放在列表末尾，用文字按钮 */
.list-actions {
  display: flex;
  gap: 18px;
  padding: 16px 4px 4px;
}

.list-actions:empty { display: none; }

.list-actions .ghost-btn {
  border: 0;
  background: none;
  padding: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.list-actions .ghost-btn:hover { color: var(--accent-ink); border: 0; }

/* ---------- 列表 ---------- */

.list-wrap { flex: 1; }
.view-host { flex: 1; display: flex; flex-direction: column; }
.view-host > [hidden] { display: none; }
.list { list-style: none; margin: 0; padding: 0; }

.task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 6px;
  border-bottom: 1px solid var(--rule-soft);
  position: relative;
}

.prio-dot { display: none; }
.prio-dot[data-p="2"] { background: var(--amber); }
.prio-dot[data-p="1"] { background: var(--rule-strong); }

.task:first-child { border-top: 1px solid var(--rule-soft); }

.group-head {
  padding: 20px 4px 7px;
  font-size: 12.5px;
  color: var(--ink-faint);
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
}

.group-head:first-child { padding-top: 4px; }
.task[data-dragging="true"] { opacity: .45; }
.task[data-drop="above"]::before,
.task[data-drop="below"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}
.task[data-drop="above"]::before { top: -1px; }
.task[data-drop="below"]::after { bottom: -1px; }

.check {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 1.5px solid var(--ink-faint);
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}

.check:hover { border-color: var(--accent); }
.check svg { width: 13px; height: 13px; stroke-width: 2.6; color: #fff; opacity: 0; transition: opacity .15s ease; }
.task.done .check { background: var(--accent); border-color: var(--accent); }
.task.done .check svg { opacity: 1; }

.grip {
  flex: none;
  width: 16px;
  align-self: stretch;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  cursor: grab;
  opacity: 0;
  transition: opacity .15s ease;
  touch-action: none;
  padding: 0;
}

.task:hover .grip, .grip:focus-visible { opacity: 1; }

.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }

.task-title {
  position: relative;
  display: inline;
  overflow-wrap: anywhere;
}

.task-title::after {
  position: absolute;
  left: -1px;
  right: -1px;
  top: 54%;
  height: 1.5px;
  background: var(--strike);
  border-radius: 1px;
  transform: scaleX(0) rotate(-.35deg);
  transform-origin: left center;
  transition: transform .24s cubic-bezier(.4, 0, .2, 1);
}

.task.done .task-title::after { content: ""; transform: scaleX(1) rotate(-.35deg); }
.task.done .task-title { color: var(--ink-faint); }

.task-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--ink-faint); }

.meta-due.late { color: var(--amber); }

.task-notes {
  font-size: 13px;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 52ch;
}

.sub-progress {
  font-size: 12.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.repeat-badge {
  display: inline-flex;
  align-items: center;
  color: var(--ink-faint);
}
.repeat-badge svg { width: 14px; height: 14px; stroke-width: 1.9; }

.task-substeps {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  color: var(--ink-soft);
}

.task-substeps li { display: flex; align-items: center; gap: 7px; }
.task-substeps .box {
  width: 13px;
  height: 13px;
  border: 1.3px solid var(--ink-faint);
  border-radius: 3px;
  flex: none;
  cursor: pointer;
  background: transparent;
  padding: 0;
}
.task-substeps .done .box { background: var(--accent); border-color: var(--accent); }
.task-substeps .done span { color: var(--ink-faint); text-decoration: line-through; }

.task-side { display: flex; align-items: center; gap: 8px; flex: none; padding-top: 2px; }

.prio {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.prio[data-p="high"] { background: var(--amber); }
.prio[data-p="mid"] { background: var(--ink-faint); }

.tag-pill {
  font-size: 12px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tag-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c, var(--accent));
  flex: none;
}

.tag-pill:hover { color: var(--ink); }

.row-btn {
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  border-radius: var(--r-xs);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
}

.task:hover .row-btn, .row-btn:focus-visible { opacity: 1; }
.row-btn:hover { color: var(--danger); background: var(--rule-soft); }
.row-btn svg { width: 16px; height: 16px; }

.task-editor {
  width: 100%;
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--paper);
  padding: 8px 10px;
  font-size: 15px;
}

.task-title-wrap { cursor: text; }
.task-title-wrap:focus-visible { outline-offset: 3px; }

.task-compact { padding: 9px 2px; gap: 9px; align-items: center; }
.task-compact .task-title-wrap { flex: 1; min-width: 0; }
.task-compact .task-title { font-size: 14px; }
.task-compact .task-main { gap: 2px; }
.task-compact .row-btn { opacity: 0; }
.task-compact:hover .row-btn { opacity: 1; }

/* ---------- 空状态 ---------- */

.empty {
  padding: 54px 4px;
  color: var(--ink-faint);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.empty strong { color: var(--ink-soft); font-weight: 560; }

/* ---------- 移动端底部栏 ---------- */

.tabbar { display: none; }

.compose-fab { display: none !important; }

.compose-close {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  border-radius: 50%;
  place-items: center;
}

.compose-close svg { width: 16px; height: 16px; }

/* ---------- 面板 ---------- */

.panel {
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--paper);
  color: var(--ink);
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  box-shadow: var(--shadow-panel);
}

.panel::backdrop { background: rgba(18, 21, 24, .38); }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--rule);
}

.panel-head h3 { margin: 0; font-size: 16px; font-weight: 600; }

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--r-xs);
  display: grid;
  place-items: center;
}

.icon-btn:hover { color: var(--ink); }

.panel-body { padding: 18px; display: flex; flex-direction: column; gap: 16px; }

.status {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
  background: var(--paper-sunk);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}

.status[data-state="error"] { color: var(--danger); }
.status[data-state="ok"] { color: var(--accent-ink); }

.setup { border-top: 1px solid var(--rule-soft); padding-top: 14px; }
.setup summary { cursor: pointer; font-size: 13.5px; color: var(--accent-ink); }

.steps {
  margin: 10px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-soft);
}

code {
  background: var(--paper-sunk);
  border-radius: var(--r-xs);
  padding: 1px 5px;
  font-size: 12.5px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; color: var(--ink-soft); }

.field input {
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--paper-sunk);
  padding: 9px 11px;
  font-size: 14px;
}

.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.data-row { display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--rule-soft); padding-top: 14px; }

.fineprint { margin: 0; font-size: 12px; color: var(--ink-faint); }

/* ---------- 任务详情 ---------- */

.title-input {
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  font-size: 18px;
  font-weight: 560;
  padding: 4px 0 8px;
  width: 100%;
}

.title-input:focus { outline: none; border-color: var(--accent); }

#tpNotes {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--paper-sunk);
  padding: 9px 11px;
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
}

.row-block {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.row-block.column { align-items: stretch; flex-direction: column; gap: 8px; }

.row-label { font-size: 13px; color: var(--ink-soft); flex: none; min-width: 52px; }
.row-label em { font-style: normal; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.row-block input[type="date"],
.row-block input[type="time"],
#tpRepeat,
.inline-add input {
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--paper-sunk);
  padding: 7px 10px;
  font-size: 13.5px;
}

#tpRepeat { min-width: 130px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  border: 1px solid var(--rule);
  background: var(--paper-sunk);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 13px;
  cursor: pointer;
}

.chip:hover { border-color: var(--ink-faint); color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-ink); }

.chip .x { margin-left: 6px; color: var(--ink-faint); }

.inline-add { display: flex; }
.inline-add input { flex: 1; }

.subtasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.subtasks li { display: flex; align-items: center; gap: 9px; font-size: 14px; }

.subtasks .box {
  width: 16px;
  height: 16px;
  border: 1.4px solid var(--ink-faint);
  border-radius: 4px;
  flex: none;
  cursor: pointer;
  background: transparent;
  padding: 0;
}

.subtasks li.done .box { background: var(--accent); border-color: var(--accent); }
.subtasks li.done .sub-title { color: var(--ink-faint); text-decoration: line-through; }
.subtasks .sub-title { flex: 1; }
.subtasks .row-btn { opacity: 0; }
.subtasks li:hover .row-btn { opacity: 1; }

/* 小按钮跟分段控件保持同一套尺寸，放在一行里才不打架 */
.ghost-btn.tiny {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
}

.toolbar-actions { gap: 6px; }
.ghost-btn.danger { color: var(--danger); }
.ghost-btn.danger:hover { border-color: var(--danger); }

/* ---------- 日历 ---------- */

.cal-panel,
.day-panel,
.upcoming,
.quadrant {
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
}

.cal-panel { padding: 14px 16px 16px; }
.day-panel { padding: 14px 2px 16px; }
.upcoming { padding: 12px 2px 14px; }

.cal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.cal-title {
  font-size: 16px;
  font-weight: 580;
  font-variant-numeric: tabular-nums;
  margin-right: auto;
  padding-left: 4px;
}

.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.cal-weekdays {
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--ink-faint);
  text-align: center;
}

.cal-cell {
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--paper);
  min-height: 56px;
  padding: 6px 5px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: var(--ink);
}

.cal-cell:hover { background: var(--rule-soft); }
.cal-cell.is-out { color: var(--ink-faint); }
.cal-cell.is-weekend .cal-num { color: var(--amber); }
.cal-cell.is-today { border-color: var(--accent); }
.cal-cell.is-selected { background: var(--accent-wash); border-color: var(--accent); }
.cal-cell.is-selected .cal-num { color: var(--accent-ink); font-weight: 620; }

.cal-num { font-size: 13.5px; font-variant-numeric: tabular-nums; }

.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.cal-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--c, var(--accent));
  display: block;
}

.cal-count { font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.cal-cell.is-selected .cal-count { color: var(--accent-ink); }

.day-panel { margin-top: 12px; padding: 14px 16px 16px; }

.day-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.day-head h3 { margin: 0; font-size: 15px; font-weight: 580; }
.day-head .muted { color: var(--ink-faint); font-size: 12.5px; font-variant-numeric: tabular-nums; margin-right: auto; }

.day-group { margin-top: 12px; }
.day-group > h5 {
  margin: 0 0 4px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 6px;
}
.day-group > h5 i { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--accent)); display: block; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 54px; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 44px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--rule);
}

.timeline li { position: relative; padding: 6px 0; display: flex; align-items: flex-start; gap: 10px; }
.timeline .t-time {
  position: absolute;
  left: -54px;
  width: 40px;
  text-align: right;
  font-size: 12.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}
.timeline .t-dot {
  position: absolute;
  left: -11px;
  top: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c, var(--accent));
  box-shadow: 0 0 0 3px var(--paper);
}

.upcoming { margin-top: 12px; padding: 12px 16px 14px; }
.upcoming h4 { margin: 0 0 8px; font-size: 13px; font-weight: 520; color: var(--ink-soft); }
.upcoming ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.upcoming li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--rule-soft);
  font-size: 13.5px;
}
.upcoming li:first-child { border-top: 0; }
.upcoming .u-date { width: 88px; flex: none; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.upcoming .u-titles { color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.upcoming .u-count { margin-left: auto; color: var(--ink-faint); font-variant-numeric: tabular-nums; flex: none; }

/* ---------- 四象限 ---------- */

.quadrant-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; grid-auto-rows: 1fr; }

.quadrant { padding: 14px 14px 8px; border-top: 3px solid var(--q, var(--accent)); }
.quadrant h4 {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 580;
  display: flex;
  align-items: center;
  gap: 8px;
}
.quadrant h4 span { color: var(--ink-faint); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.quadrant p.q-hint { margin: 0 0 8px; font-size: 12px; color: var(--ink-faint); }
.quadrant .list .task { padding: 9px 2px; gap: 9px; }
.quadrant .list .task:first-child { border-top: 0; }
.quadrant .task-title { font-size: 14px; }
.quadrant[data-q="1"] { --q: var(--danger); }
.quadrant[data-q="2"] { --q: var(--accent); }
.quadrant[data-q="3"] { --q: var(--amber); }
.quadrant[data-q="4"] { --q: var(--rule-strong); }

/* ---------- 近四周点阵 ---------- */

.dotgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dotgrid i {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--rule);
  display: block;
}
.dotgrid i[data-n="1"] { background: color-mix(in srgb, var(--accent) 34%, var(--rule)); }
.dotgrid i[data-n="2"] { background: color-mix(in srgb, var(--accent) 64%, var(--rule)); }
.dotgrid i[data-n="3"] { background: var(--accent); }
.dotgrid i.is-today { box-shadow: 0 0 0 1.5px var(--ink-faint); }

/* ---------- 提示条 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(6px);
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-sm);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13.5px;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 40;
}

.toast[data-show="true"] { opacity: 1; transform: translateX(-50%) translateY(0); }

.toast-action {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-weight: 560;
}

/* ---------- 移动端 ---------- */

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }

  .rail {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding: 11px 16px;
    gap: 10px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .rail-nav { display: none; }
  .rail-lower { display: none; }
  .rail-top { display: block; }
  .rail-foot { gap: 6px; flex: 0 1 auto; }
  .rail-foot .ghost-btn { flex: 0 1 auto; padding: 5px 10px; font-size: 12.5px; }

  .sheet {
    padding: 18px 16px calc(84px + env(safe-area-inset-bottom));
    gap: 16px;
    max-width: none;
  }

  .head-title { font-size: 24px; }
  .head-band { padding: 14px 15px; gap: 12px; border-radius: var(--r-md); }
  .ring, .ring svg { width: 52px; height: 52px; }

  .capture { position: sticky; top: 0; z-index: 10; }
  .capture-hint { padding-left: 0; }
  .hint-text { display: none; }
  .capture-submit { display: none; }

  .toolbar { gap: 8px; }
  .search { flex: 1 1 100%; }
  .seg { width: 100%; flex: 1 1 100%; }
  .seg-btn { flex: 1; padding: 7px 4px; text-align: center; }
  .toolbar-actions { margin-left: 0; flex: 0 1 auto; }
  .toolbar-actions .ghost-btn { flex: 0 1 auto; }
  .toolbar-actions:empty { display: none; }

  .grip { display: none; }
  .row-btn { opacity: 1; }
  .task-compact .row-btn { opacity: 1; }
  .task-notes { max-width: none; }

  .cal-panel { padding: 12px 10px 12px; }
  .cal-weekdays, .cal-grid { gap: 2px; }
  .cal-cell { min-height: 52px; padding: 5px 2px 4px; gap: 4px; }
  .cal-dots i { width: 4px; height: 4px; }

  .quadrant-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .quadrant { padding: 10px 10px 6px; }
  .quadrant h4 { font-size: 13px; }
  .quadrant p.q-hint { display: none; }
  .day-panel, .upcoming { padding: 12px 12px 14px; }
  .upcoming .u-date { width: 74px; }

  .tabbar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--rule);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 20;
  }

  .tab {
    border: 0;
    background: transparent;
    color: var(--ink-faint);
    padding: 11px 4px 12px;
    font-size: 12.5px;
    cursor: pointer;
  }

  .tab[aria-current="page"] { color: var(--accent-ink); font-weight: 580; }

  .panel {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    position: fixed;
    inset: auto 0 0 0;
  }

  .toast { bottom: calc(72px + env(safe-area-inset-bottom)); width: calc(100% - 32px); justify-content: space-between; }

  /* 手机端只留一个添加入口：右下角加号，点开才是输入卡片 */
  .compose-fab {
    display: grid;
    place-items: center;
    position: fixed;
    right: 16px;
    bottom: calc(70px + env(safe-area-inset-bottom));
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    z-index: 25;
    box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent);
  }

  .compose-fab svg { width: 22px; height: 22px; stroke-width: 2.1; }

  .capture { display: none; }
  body[data-view="today"] .capture { display: flex; }

  body[data-compose="open"] .capture {
    display: flex;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 26;
    border-radius: 16px;
    box-shadow: 0 22px 60px -24px rgba(0, 0, 0, .5);
  }

  body[data-compose="open"] .compose-fab { display: none; }

  /* 优先级竖条别贴着勾选圈 */
  .task { padding-left: 12px; }
  .task[data-priority="2"]::before,
  .task[data-priority="1"]::before { left: 2px; top: 14px; height: 16px; transform: none; }

  .compose { position: relative; }
  .compose-close { display: grid; }
  .picker {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
