/* =========================================================
   日课 · Daily — 视觉样式
   暖纸质感 / 陶土色强调 / 支持明暗主题
   ========================================================= */

:root {
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;

  --bg: #f3ede2;
  --bg-soft: #eee6d8;
  --surface: #fffbf3;
  --surface-2: #f7f1e5;
  --surface-3: #efe7d8;
  --ink: #2c261e;
  --ink-soft: #6b6155;
  --muted: #9a8d7e;
  --line: #e4d9c7;
  --line-strong: #d6c8b2;
  --accent: #bf5a2f;
  --accent-strong: #a94a22;
  --accent-ink: #fff9f1;
  --accent-soft: rgba(191, 90, 47, 0.1);
  --sage: #5f7f5c;
  --danger: #b4432f;
  --danger-soft: rgba(180, 67, 47, 0.1);
  --amber: #a9761d;
  --info: #4d7590;
  --radius-lg: 22px;
  --radius-md: 15px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(44, 38, 30, 0.05);
  --shadow-md: 0 2px 4px rgba(44, 38, 30, 0.04), 0 10px 28px rgba(44, 38, 30, 0.07);
  --shadow-lg: 0 24px 70px rgba(30, 24, 18, 0.22);
  --ring-track: #e6dbc9;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #16130f;
  --bg-soft: #1b1712;
  --surface: #221e18;
  --surface-2: #2a251e;
  --surface-3: #322b22;
  --ink: #f1e8d9;
  --ink-soft: #c5b8a5;
  --muted: #978a78;
  --line: #362e25;
  --line-strong: #493e31;
  --accent: #e07a4b;
  --accent-strong: #f08a58;
  --accent-ink: #251108;
  --accent-soft: rgba(224, 122, 75, 0.14);
  --sage: #95b289;
  --danger: #e07a63;
  --danger-soft: rgba(224, 122, 99, 0.14);
  --amber: #d8a24b;
  --info: #8fb2cb;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.25), 0 12px 30px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.6);
  --ring-track: #3a3127;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(1100px 620px at 12% -12%, rgba(191, 90, 47, 0.07), transparent 62%),
    radial-gradient(900px 560px at 100% 0%, rgba(95, 127, 92, 0.06), transparent 55%);
  background-attachment: fixed;
}

html[data-theme="dark"] body {
  background-image:
    radial-gradient(1100px 620px at 12% -12%, rgba(224, 122, 75, 0.07), transparent 62%),
    radial-gradient(900px 560px at 100% 0%, rgba(143, 178, 133, 0.05), transparent 55%);
}

::selection { background: var(--accent); color: var(--accent-ink); }

h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
input, select, textarea, button { font-family: inherit; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.hidden, [hidden] { display: none !important; }
.only-mobile { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }

/* ---------------- 布局骨架 ---------------- */

.app-shell {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 26px 20px 18px;
  background: linear-gradient(180deg, var(--bg-soft), color-mix(in srgb, var(--bg-soft) 62%, var(--bg)));
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: thin;
}

.main {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 34px 46px 90px;
  min-width: 0;
}

/* ---------------- 侧栏 ---------------- */

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 4px 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(191, 90, 47, 0.28);
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.brand-text em {
  font-size: 9px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--muted);
  transform: translateY(-2px);
}

.side-date {
  padding: 0 4px;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.progress-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.ring { position: relative; width: 52px; height: 52px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4.5; }
.ring-track { stroke: var(--ring-track); }
.ring-value {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 113.1;
  stroke-dashoffset: 113.1;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.ring-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: -0.02em;
}

.progress-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.progress-meta strong {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.progress-meta span { font-size: 12px; color: var(--muted); }

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s, color 0.18s;
}

.nav-item .icon { width: 17px; height: 17px; color: var(--muted); transition: color 0.18s; }
.nav-item span { flex: 1; }

.nav-item:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--ink); }
.nav-item.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.nav-item.is-active .icon { color: var(--accent); }

.nav-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
}
.nav-item.is-active .nav-count { background: var(--accent-soft); color: var(--accent); }
.nav-count.is-zero { visibility: hidden; }

.side-section { display: flex; flex-direction: column; gap: 7px; margin-top: 2px; }

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.mini-btn {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
}
.mini-btn:hover { background: var(--surface); color: var(--accent); }

.cat-list { display: flex; flex-direction: column; gap: 1px; }

.cat-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
}
.cat-item:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--ink); }
.cat-item.is-active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.cat-item .cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item .cat-count { font-size: 11.5px; color: var(--muted); }
.cat-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.side-foot {
  margin-top: auto;
  display: flex;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.side-foot-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  cursor: pointer;
}
.side-foot-btn:hover { background: var(--surface); color: var(--ink); }
.side-foot-btn .icon { width: 16px; height: 16px; }

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--muted);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted) 18%, transparent);
}
.side-foot-btn[data-state="online"] .sync-dot,
.sync-dot[data-state="online"] { background: var(--sage); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sage) 22%, transparent); }
.side-foot-btn[data-state="pending"] .sync-dot,
.side-foot-btn[data-state="syncing"] .sync-dot,
.sync-dot[data-state="pending"],
.sync-dot[data-state="syncing"] { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 20%, transparent); }
.side-foot-btn[data-state="offline"] .sync-dot,
.side-foot-btn[data-state="error"] .sync-dot,
.sync-dot[data-state="offline"],
.sync-dot[data-state="error"] { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
.side-foot-btn[data-state="auth"] .sync-dot,
.sync-dot[data-state="auth"] { background: var(--info); box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 20%, transparent); }

.scrim { display: none; }

/* ---------------- 顶栏 ---------------- */

.topbar {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.headline { flex: 1; min-width: 0; }

.headline-date {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
}

.headline h1 {
  font-family: var(--font-serif);
  font-size: 34px;
  line-height: 1.24;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 2px 0 3px;
}

.headline-sub { font-size: 13.5px; color: var(--ink-soft); }

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-top: 8px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 250px;
  padding: 0 11px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  color: var(--muted);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.search .icon { width: 15px; height: 15px; }
.search:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0; display: grid; place-items: center; }
.search-clear .icon { width: 13px; height: 13px; }

.icon-btn {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.icon-btn:hover { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s, background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 5px 14px rgba(191, 90, 47, 0.25);
}
.btn-primary:hover { background: var(--accent-strong); }
html[data-theme="dark"] .btn-primary:hover { background: var(--accent-strong); }

.btn-quiet {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-soft);
}
.btn-quiet:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-2); }

.btn-danger-quiet { background: transparent; border-color: transparent; color: var(--danger); }
.btn-danger-quiet:hover { background: var(--danger-soft); }

.btn-danger { background: var(--danger); color: #fff9f1; box-shadow: 0 5px 14px rgba(180, 67, 47, 0.25); }
.btn-danger:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }

.btn-sm { height: 31px; padding: 0 12px; font-size: 12.5px; }

/* ---------------- 手机端头部 ---------------- */

.mobile-head { display: none; }

/* ---------------- 快速添加 ---------------- */

.quick-add {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px 9px 15px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.quick-add:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-sm); }
.quick-icon { color: var(--accent); width: 17px; height: 17px; }
.quick-add input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14.5px;
  padding: 6px 0;
}.quick-add input::placeholder { color: var(--muted); font-size: 13.5px; }
.quick-detail { height: 30px; padding: 0 10px; font-size: 12px; color: var(--muted); background: transparent; border-color: transparent; }
.quick-detail:hover { color: var(--ink); background: var(--surface-2); border-color: transparent; }
.quick-submit { height: 32px; padding: 0 14px; font-size: 12.5px; }
.quick-add.is-error { animation: shake 0.34s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; border-color: var(--danger); }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

/* ---------------- 筛选 ---------------- */

.filterbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

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

.chip {
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
}
.chip:hover { background: var(--surface-2); color: var(--ink-soft); }
.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
html[data-theme="dark"] .chip.is-active { background: var(--ink); color: var(--bg); }

.sort-control {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  flex: none;
}
.sort-control select {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12.5px;
  padding: 5px 9px;
  outline: none;
  cursor: pointer;
}

/* ---------------- 任务分组 ---------------- */

.task-groups { display: flex; flex-direction: column; gap: 26px; }

.group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}
.group-title {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 7px;
}
.group-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.task-group[data-group="overdue"] .group-title { color: var(--danger); }
.task-group[data-group="overdue"] .group-title .dot { background: var(--danger); }
.task-group[data-group="today"] .group-title .dot { background: var(--accent); }
.task-group[data-group="tomorrow"] .group-title .dot { background: var(--info); }
.group-count { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.group-line { flex: 1; height: 1px; background: var(--line); }

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

.task {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 13px;
  padding: 13px 15px 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s, opacity 0.2s;
}

.task.is-new { animation: taskIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both; }

@keyframes taskIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.task:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.task.is-overdue { border-left: 3px solid var(--danger); padding-left: 13px; }
.task.is-completing { opacity: 0.35; transform: translateX(8px) scale(0.99); }

.check {
  width: 21px;
  height: 21px;
  margin-top: 2px;
  flex: none;
  border: 1.6px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.check .icon { width: 12px; height: 12px; stroke-width: 3; }
.check:hover { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.06); }
.check:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

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

.task-title-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.task-title {
  font-size: 15px;
  line-height: 1.45;
  font-weight: 550;
  color: var(--ink);
  word-break: break-word;
}
.task-title .notes-mark { font-size: 11px; color: var(--muted); margin-left: 4px; }

.prio-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
  align-self: center;
  background: var(--muted);
}
.prio-dot.prio-3 { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.prio-dot.prio-2 { background: var(--amber); }
.prio-dot.prio-1 { background: var(--sage); }

.task-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.due-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--ink-soft);
}
.due-chip .icon { width: 11px; height: 11px; stroke-width: 2; }

.due-chip.tone-overdue { background: var(--danger-soft); color: var(--danger); }
.due-chip.tone-soon { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }
.due-chip.tone-today { background: var(--accent-soft); color: var(--accent); }
.due-chip.tone-tomorrow { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }
.due-chip.tone-week { background: var(--surface-2); color: var(--ink-soft); }
.due-chip.tone-later { background: transparent; color: var(--muted); padding-left: 2px; }
.due-chip.tone-none { background: transparent; color: var(--muted); padding-left: 2px; }

button.due-chip { cursor: pointer; border: 0; font-family: inherit; }
button.due-chip:hover { filter: brightness(0.96); }

.cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 11.5px;
  white-space: nowrap;
}
.cat-tag i { width: 6px; height: 6px; border-radius: 50%; display: block; }

.repeat-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  color: var(--muted);
}
.repeat-tag .icon { width: 12px; height: 12px; }

.task-notes {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.6;
  padding: 2px 0 1px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-progress {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 2px;
  max-width: 420px;
}
.bar {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 72%, var(--amber)));
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.progress-text { font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress-text b { color: var(--ink-soft); font-weight: 600; }

.plus-btn {
  height: 23px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.plus-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.task-actions { display: flex; align-items: center; gap: 2px; opacity: 0; transition: opacity 0.16s; }
.task:hover .task-actions, .task:focus-within .task-actions { opacity: 1; }

.act-btn {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.act-btn:hover { background: var(--surface-2); color: var(--ink); }
.act-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.act-btn .icon { width: 15px; height: 15px; }

/* 逾期顺延弹层 */
.due-popover {
  position: fixed;
  z-index: 60;
  min-width: 168px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.14s ease-out both;
}
.due-popover .pop-label {
  padding: 5px 9px 4px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.due-popover button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.due-popover button:hover { background: var(--surface-2); color: var(--ink); }
.due-popover button .icon { width: 14px; height: 14px; }
.due-popover button.is-danger:hover { background: var(--danger-soft); color: var(--danger); }
.due-popover hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }

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

.empty-state {
  margin-top: 18px;
  padding: 48px 28px 42px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.empty-mark { width: 62px; height: 62px; margin: 0 auto 16px; color: var(--accent); opacity: 0.75; }
.empty-mark svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.empty-state h2 { font-family: var(--font-serif); font-size: 20px; font-weight: 700; margin-bottom: 7px; }
.empty-state p { font-size: 13px; color: var(--muted); line-height: 1.8; }
.empty-actions { display: flex; gap: 8px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.empty-small { padding: 40px 24px; }

/* ---------------- 已完成 ---------------- */

.view { animation: viewIn 0.24s ease-out both; }
@keyframes viewIn { from { opacity: 0; } to { opacity: 1; } }

.section-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.section-head h2 { font-family: var(--font-serif); font-size: 21px; font-weight: 700; }
.section-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.done-list { display: flex; flex-direction: column; gap: 7px; }

.done-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.done-check { width: 19px; height: 19px; flex: none; color: var(--sage); }
.done-check .icon { width: 19px; height: 19px; }
.done-main { min-width: 0; flex: 1; }
.done-title { font-size: 14px; color: var(--ink-soft); text-decoration: line-through; text-decoration-thickness: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.done-meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 1px; }
.restore-btn { height: 26px; padding: 0 9px; border: 0; background: transparent; color: var(--muted); font-size: 11.5px; border-radius: 7px; cursor: pointer; }
.restore-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ---------------- 统计 ---------------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
.stat-card {
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.stat-value { font-size: 27px; font-weight: 700; font-family: var(--font-serif); line-height: 1.2; letter-spacing: -0.01em; }
.stat-value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; font-family: var(--font-sans); }
.stat-label { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.sage .stat-value { color: var(--sage); }

.panel {
  padding: 19px 20px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.panel-head h2 { font-size: 14.5px; font-weight: 650; }
.panel-head .muted { margin-left: auto; }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 132px;
  padding-top: 6px;
}
.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
  min-width: 0;
}
.chart-count { font-size: 11px; color: var(--ink-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-bar-wrap { width: 100%; display: flex; align-items: flex-end; justify-content: center; flex: 1; }
.chart-bar {
  width: min(60%, 34px);
  min-height: 4px;
  border-radius: 7px 7px 3px 3px;
  background: color-mix(in srgb, var(--ink) 14%, transparent);
  transition: height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.chart-col.is-today .chart-bar { background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 65%, var(--surface))); }
.chart-col.is-empty .chart-bar { background: var(--surface-3); }
.chart-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.chart-col.is-today .chart-label { color: var(--accent); font-weight: 600; }

.priority-list { display: flex; flex-direction: column; gap: 7px; }
.plist-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.plist-item:hover { background: var(--surface-2); }
.plist-rank {
  width: 21px;
  height: 21px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
}
.plist-title { flex: 1; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.plist-meta.tone-overdue { color: var(--danger); }
.plist-meta.tone-soon { color: var(--amber); }
.plist-meta.tone-today { color: var(--accent); }
.plist-meta.tone-tomorrow { color: var(--info); }

.cat-bars { display: flex; flex-direction: column; gap: 10px; }
.cat-bar-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) 26px; align-items: center; gap: 10px; }
.cat-bar-label { font-size: 12.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-bar-track { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 99px; }
.cat-bar-count { font-size: 11.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- 提醒横幅 ---------------- */

.reminder-banner {
  position: sticky;
  bottom: 16px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 20px;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  animation: bannerIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes bannerIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.reminder-icon {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}
.reminder-body { flex: 1; min-width: 0; }
.reminder-body strong { font-size: 13.5px; display: block; }
.reminder-body p { font-size: 12.5px; color: var(--ink-soft); margin-top: 1px; }

/* ---------------- 底部导航（手机） ---------------- */

.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px) saturate(1.2);
  border-top: 1px solid var(--line);
}
.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  cursor: pointer;
}
.bottom-nav button .icon { width: 19px; height: 19px; }
.bottom-nav button.is-active { color: var(--accent); font-weight: 600; }
.bottom-nav .bottom-add {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  margin: -18px 4px 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 20px rgba(191, 90, 47, 0.38);
  display: grid;
  place-items: center;
}
.bottom-nav .bottom-add .icon { width: 22px; height: 22px; }

/* ---------------- 对话框 ---------------- */

dialog.dialog {
  width: min(580px, calc(100vw - 32px));
  max-height: min(88dvh, 900px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog.dialog[open] { animation: dialogIn 0.24s cubic-bezier(0.22, 1, 0.36, 1); }
dialog.dialog:focus { outline: none; }
dialog.dialog::backdrop {
  background: rgba(28, 22, 16, 0.42);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease-out;
}
html[data-theme="dark"] dialog.dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
@keyframes dialogIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

dialog.dialog-small { width: min(420px, calc(100vw - 32px)); }

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 19px 21px 0;
}
.dialog-head h2 { font-family: var(--font-serif); font-size: 19px; font-weight: 700; }

.dialog-body { padding: 18px 21px 4px; overflow-y: auto; max-height: calc(88dvh - 140px); }
.dialog-body > p { font-size: 13.5px; color: var(--ink-soft); line-height: 1.75; }
#confirmMessage { white-space: pre-line; }
#confirmInput { margin-top: 14px; }

.dialog-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 21px 18px;
  background: linear-gradient(180deg, transparent, var(--surface) 40%);
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; min-width: 0; }
.field-label { font-size: 12px; font-weight: 600; color: var(--ink-soft); letter-spacing: 0.02em; }
.field-label .req { color: var(--accent); font-weight: 700; }
.field-hint { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.field-static { font-size: 13px; color: var(--ink-soft); padding: 8px 0; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }
.field-row > .field.grow-2 { flex: 2; }

.dialog input[type="text"], .dialog input[type="number"], .dialog input[type="date"], .dialog input[type="time"], .dialog textarea, .dialog select {
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
.dialog input:focus, .dialog textarea:focus, .dialog select:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; line-height: 1.65; }

.quick-dates { display: flex; gap: 5px; flex-wrap: wrap; }
.quick-dates button {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11.5px;
  cursor: pointer;
}
.quick-dates button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.date-row { align-items: center; }
.date-row input[type="date"] { flex: 1.4; }
.date-row input[type="time"] { flex: 1; }
.check-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  cursor: pointer;
}
.check-inline input { width: 15px; height: 15px; accent-color: var(--accent); }

.amount-row { align-items: center; gap: 7px; }
.amount-row input[type="number"] { width: 92px; flex: 0 0 auto; }
.amount-row input[type="text"] { flex: 1; }
.amount-row .slash { color: var(--muted); font-size: 13px; }
@media (max-width: 560px) {
  .amount-row input[type="number"] { width: 66px; }
  .amount-row input[type="text"] { min-width: 0; }
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  gap: 2px;
}
.segmented button {
  flex: 1;
  padding: 6px 13px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.segmented button[data-priority="3"].is-active { color: var(--danger); }
.segmented button[data-priority="2"].is-active { color: var(--amber); }
.segmented button[data-priority="1"].is-active { color: var(--sage); }
.segmented-wide { width: 100%; }
.segmented-wide button { flex: 1; }

.form-error {
  margin: 2px 0 10px;
  padding: 8px 11px;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
}

/* ---------------- 设置 ---------------- */

.settings-body { padding-bottom: 8px; }
.settings-section { padding: 16px 0; border-bottom: 1px dashed var(--line); }
.settings-section:first-child { padding-top: 4px; }
.settings-section:last-of-type { border-bottom: 0; }
.settings-section h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 11px;
  color: var(--ink);
}
.settings-section h3 .icon { width: 15px; height: 15px; color: var(--accent); }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-bottom: 12px;
  cursor: pointer;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 42px;
  height: 24px;
  flex: none;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  margin: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

.remind-row { align-items: flex-start; }
.remind-row input[type="time"] { width: 130px; }

.settings-actions { display: flex; flex-wrap: wrap; gap: 7px; margin: 9px 0; }

.settings-section .field-hint { margin: 6px 0; }

.tips { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-soft); line-height: 1.9; }
.tips kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.settings-foot { padding: 12px 0 4px; text-align: center; font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }

/* ---------------- 同步 ---------------- */

.sync-status-line {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 0 15px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.sync-status-line .sync-dot { width: 9px; height: 9px; }

.sync-note { margin-bottom: 12px; }
.sync-note code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

#syncLogin .field { margin-bottom: 12px; }
#syncLogin .btn-primary { width: 100%; margin-top: 2px; }
#syncLogin .auth-fields { margin-bottom: 2px; }
#syncLogin .auth-fields .field { margin-bottom: 12px; }

.auth-edit {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.auth-edit .field { margin-bottom: 12px; }
.auth-edit .field-row .field { margin-bottom: 12px; }
.auth-edit .hint { font-weight: 400; }

.sync-rows {
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  margin-bottom: 12px;
}
.sync-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--line);
}
.sync-row:last-child { border-bottom: 0; }
.sync-row span { color: var(--muted); flex: none; }
.sync-row b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* ---------------- Toast ---------------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
.toast.is-leaving { animation: toastOut 0.22s ease-in forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
.toast-msg { max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-action {
  padding: 4px 11px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 22%, transparent);
  color: color-mix(in srgb, var(--bg) 96%, var(--ink));
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.toast-action:hover { background: color-mix(in srgb, var(--bg) 32%, transparent); }

/* ---------------- 动效偏好 ---------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------- 平板 / 手机 ---------------- */

@media (max-width: 960px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 22px 22px calc(104px + env(safe-area-inset-bottom)); max-width: 720px; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 70;
    width: 278px;
    height: 100dvh;
    transform: translateX(-102%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: none;
  }
  .sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(28, 22, 16, 0.4);
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease-out;
  }
  .only-mobile { display: grid !important; }
  .topbar { gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
  .topbar .headline { order: 1; }
  .topbar-tools { order: 2; width: 100%; padding-top: 0; }
  .search { flex: 1; width: auto; }
  #themeToggle { display: none; }
  .headline h1 { font-size: 29px; }
  .mobile-head { display: block; margin-bottom: 16px; }
  .mini-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
  .mini-bar { flex: 1; height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
  .mini-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--accent); transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
  .mini-progress span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
  .cat-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .cat-chips::-webkit-scrollbar { display: none; }
  .cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 11.5px;
    white-space: nowrap;
    cursor: pointer;
  }
  .cat-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
  .cat-chip.is-active { border-color: var(--ink); background: var(--ink); color: var(--bg); }
  .bottom-nav { display: flex; align-items: flex-end; }
  .task-actions { opacity: 1; }
  .task { padding: 12px 12px 12px 13px; gap: 11px; }
  .task.is-overdue { padding-left: 10px; }
  .task-actions .act-btn { width: 27px; height: 27px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-detail { display: none; }
  .empty-state { padding: 36px 18px 32px; }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .reminder-banner { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .dialog-body { max-height: calc(88dvh - 150px); }
}

@media (max-width: 560px) {
  .main { padding: 18px 15px calc(100px + env(safe-area-inset-bottom)); }
  .headline h1 { font-size: 26px; }
  .headline-sub { font-size: 12.5px; }
  .search { height: 36px; }
  .btn { height: 36px; padding: 0 13px; }
  .btn .icon { width: 15px; height: 15px; }
  .quick-add { padding: 8px 8px 8px 13px; }
  .quick-add input { font-size: 14px; }
  .quick-add input::placeholder { font-size: 12.5px; }
  .sort-control { margin-left: 0; }
  .filterbar { gap: 8px; margin-bottom: 16px; }
  .sort-control { width: 100%; justify-content: flex-end; }
  .field-row { flex-direction: column; gap: 0; }
  .field-row > .field { margin-bottom: 15px; }
  .field-row:last-child > .field:last-child { margin-bottom: 0; }
  .date-row { flex-direction: row; }
  .date-row > .field { margin-bottom: 0; }
  .date-row input[type="date"] { flex: 1.5; }
  .date-row .check-inline { padding-top: 3px; }
  .amount-row { flex-direction: row; gap: 6px; }
  .amount-row input[type="number"] { width: 72px; }
  .chart { gap: 5px; }
  .chart-col { gap: 4px; }
  .panel { padding: 16px 15px; }
  .plist-title { font-size: 13px; }
  .task-title { font-size: 14.5px; }
  .task-meta { font-size: 11.5px; }
  .cat-bar-row { grid-template-columns: 62px minmax(0, 1fr) 22px; }
  .dialog-head { padding: 16px 17px 0; }
  .dialog-body { padding: 15px 17px 2px; max-height: calc(86dvh - 150px); }
  .dialog-foot { padding: 12px 17px 15px; }
  .section-head h2 { font-size: 19px; }
  .bottom-nav button { font-size: 10px; }
  .bottom-nav .bottom-add { width: 44px; height: 44px; margin-top: -16px; }
}

/* 深色下输入框日历图标可见性 */
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
html[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8) sepia(0.2);
}

/* 滚动条（桌面） */
@media (pointer: fine) {
  ::-webkit-scrollbar { width: 9px; height: 9px; }
  ::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink) 18%, transparent); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
  ::-webkit-scrollbar-track { background: transparent; }
}

/* 焦点可见性 */
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }
