/* ==========================================================================
   个人工作台 · 原生精装质感样式系统（对标 Things 3 / Apple Reminders）
   特点：清透高级浅灰底 + 纯净瓷白浮卡 + 发丝级分割线 + 细腻双层柔影 + 零廉价装饰
   ========================================================================== */

:root {
  /* 默认色板：静谧雾青（清透冷灰底 + 纯净瓷白卡，告别脏黄发灰） */
  --bg-base: #f2f4f7;
  --bg-sidebar: #e9ecf1;
  --bg-card: #ffffff;
  --bg-sub: #f6f7fa;
  --bg-hover: rgba(15, 23, 42, 0.04);
  --fg-main: #111827;
  --fg-muted: #6b7280;
  --fg-faint: #9ca3af;
  --border-line: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -14px rgba(15, 23, 42, 0.09);
  --shadow-float: 0 10px 28px -8px rgba(15, 23, 42, 0.28);

  --tone-accent: #2c6282;
  --tone-accent-hover: #23506b;
  --tone-accent-soft: rgba(44, 98, 130, 0.10);
  --tone-accent-fg: #245370;
  --tone-inbox: #b57b2c;
  --tone-inbox-soft: rgba(181, 123, 44, 0.11);
  --tone-chore: #526a63;
  --tone-chore-soft: rgba(82, 106, 99, 0.10);
  --tone-done: #2f7a5a;
  --tone-done-soft: rgba(47, 122, 90, 0.10);
  --tone-due: #c24b3d;
  --tone-due-soft: rgba(194, 75, 61, 0.10);
  --tone-report: #495d82;
  --tone-report-soft: rgba(73, 93, 130, 0.10);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* 色板 2：清润松绿（微暖干净底 + 纯白卡） */
[data-palette="sage"] {
  --bg-base: #f4f4f0;
  --bg-sidebar: #ecece6;
  --bg-card: #ffffff;
  --bg-sub: #f6f6f2;
  --tone-accent: #356c54;
  --tone-accent-hover: #295743;
  --tone-accent-soft: rgba(53, 108, 84, 0.10);
  --tone-accent-fg: #2a5945;
  --tone-done: #2e7356;
  --tone-done-soft: rgba(46, 115, 86, 0.10);
}

/* 色板 3：沉稳靛灰 */
[data-palette="slate"] {
  --bg-base: #f3f4f8;
  --bg-sidebar: #eaecf2;
  --bg-card: #ffffff;
  --bg-sub: #f5f6fa;
  --tone-accent: #445a84;
  --tone-accent-hover: #36486b;
  --tone-accent-soft: rgba(68, 90, 132, 0.10);
  --tone-accent-fg: #374a70;
}

/* 深色护眼模式（曜石暗底 + 柔和暗卡 + 极细透光线） */
[data-theme="dark"] {
  --bg-base: #111317;
  --bg-sidebar: #161920;
  --bg-card: #1c2028;
  --bg-sub: #232832;
  --bg-hover: rgba(255, 255, 255, 0.055);
  --fg-main: #f1f3f5;
  --fg-muted: #98a2b3;
  --fg-faint: #667085;
  --border-line: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px -12px rgba(0, 0, 0, 0.55);
  --shadow-float: 0 12px 30px -6px rgba(0, 0, 0, 0.65);

  --tone-accent: #5fa0c4;
  --tone-accent-hover: #73b2d4;
  --tone-accent-soft: rgba(95, 160, 196, 0.16);
  --tone-accent-fg: #8ec3e0;
  --tone-inbox: #dba95e;
  --tone-inbox-soft: rgba(219, 169, 94, 0.16);
  --tone-chore: #8ca89f;
  --tone-chore-soft: rgba(140, 168, 159, 0.16);
  --tone-done: #60b08a;
  --tone-done-soft: rgba(96, 176, 138, 0.16);
  --tone-due: #e07a6d;
  --tone-due-soft: rgba(224, 122, 109, 0.16);
  --tone-report: #8e9fc4;
  --tone-report-soft: rgba(142, 159, 196, 0.16);
}

[data-theme="dark"][data-palette="sage"] {
  --tone-accent: #66a88b;
  --tone-accent-hover: #79ba9e;
  --tone-accent-soft: rgba(102, 168, 139, 0.16);
  --tone-accent-fg: #95ccb3;
}

[data-theme="dark"][data-palette="slate"] {
  --tone-accent: #7b93c2;
  --tone-accent-hover: #8fa5d1;
  --tone-accent-soft: rgba(123, 147, 194, 0.16);
  --tone-accent-fg: #acc0e6;
}

/* 三档字体缩放因子 */
body[data-font-size="compact"] { --font-scale: 0.92; }
body[data-font-size="normal"] { --font-scale: 1; }
body[data-font-size="large"] { --font-scale: 1.1; }

/* 基础重置 */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-base);
  color: var(--fg-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* 主布局骨架 */
.app-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100vh;
}

/* 左侧导航栏（电脑端） */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 8px 12px;
}
.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.015em;
}
.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--tone-accent);
}

.sync-badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--tone-done-soft);
  color: var(--tone-done);
  white-space: nowrap;
}
.sync-badge.warn { background: var(--tone-inbox-soft); color: var(--tone-inbox); }
.sync-badge.err { background: var(--tone-due-soft); color: var(--tone-due); }

.btn-primary-full {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  background: var(--tone-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.14s ease;
}
.btn-primary-full:hover { background: var(--tone-accent-hover); }
.btn-primary-full .kbd { font-size: 11px; opacity: 0.72; font-family: var(--font-mono); }

.nav-section { margin-top: 18px; }
.nav-section-label {
  font-size: 12px;
  color: var(--fg-faint);
  padding: 0 10px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-item {
  width: 100%;
  padding: 8px 10px 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  transition: background 0.14s ease, color 0.14s ease;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--fg-main); }
.nav-item.active {
  background: var(--bg-card);
  color: var(--fg-main);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.nav-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--nav-color, var(--tone-accent)); }
.nav-count {
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.count-accent { background: var(--tone-accent-soft); color: var(--tone-accent-fg); }
.count-inbox { background: var(--tone-inbox-soft); color: var(--tone-inbox); font-weight: 600; }
.count-chore { background: var(--tone-chore-soft); color: var(--tone-chore); }
.count-done { background: var(--tone-done-soft); color: var(--tone-done); }

.cat-sidebar-item {
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cat-sidebar-item:hover { background: var(--bg-hover); color: var(--fg-main); }

.sidebar-footer {
  border-top: 1px solid var(--border-line);
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg-muted);
}
.link-muted { font-size: 12px; color: var(--fg-muted); }
.link-muted:hover { color: var(--fg-main); }

/* 主画布 */
.main-stage {
  padding: 32px 36px 84px;
  overflow-y: auto;
  min-width: 0;
}
.stage-inner {
  max-width: 720px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
}

.demo-banner {
  margin-bottom: 18px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  color: var(--fg-muted);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* 速记框（桌面内联 / 手机底部面板） */
.capture-box {
  margin-bottom: 22px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: 0 0 0 1.5px var(--tone-accent), var(--shadow-card);
}
.capture-textarea {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  min-height: 58px;
  font-size: 15px;
  line-height: 1.6;
  outline: none;
}
.capture-textarea::placeholder { color: var(--fg-faint); }
.capture-hint {
  font-size: 12px;
  color: var(--tone-accent-fg);
  background: var(--tone-accent-soft);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.capture-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-line);
}
.capture-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.field-input {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-line);
  background: var(--bg-sub);
  font-size: 12.5px;
  outline: none;
}
.field-input:focus { border-color: var(--tone-accent); background: var(--bg-card); }

/* 桌面端页面抬头 */
.view-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 16px;
}
.view-title-group { display: flex; align-items: center; gap: 12px; }
.view-badge-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.view-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.view-subtitle { margin: 3px 0 0; font-size: 12.5px; color: var(--fg-muted); }

/* 按钮体系（圆润干净，去硬灰框感） */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.14s ease;
  white-space: nowrap;
}
.btn-solid { background: var(--tone-accent); color: #fff; }
.btn-solid:hover { background: var(--tone-accent-hover); }
.btn-outline {
  background: var(--bg-sub);
  color: var(--fg-main);
}
.btn-outline:hover { background: var(--bg-hover); }
.btn-soft-accent { background: var(--tone-accent-soft); color: var(--tone-accent-fg); }
.btn-soft-inbox { background: var(--tone-inbox-soft); color: var(--tone-inbox); }
.btn-soft-chore { background: var(--tone-chore-soft); color: var(--tone-chore); }
.btn-soft-done { background: var(--tone-done-soft); color: var(--tone-done); }
.btn-danger-soft { background: var(--tone-due-soft); color: var(--tone-due); }
.btn-ghost { color: var(--fg-muted); padding: 5px 8px; }
.btn-ghost:hover { color: var(--fg-main); background: var(--bg-hover); }

/* 分类筛选条（柔和圆润分段，彻底告别廉价灰底线） */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-tab {
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--fg-muted);
  background: transparent;
  white-space: nowrap;
  transition: all 0.14s ease;
}
.filter-tab:hover { background: var(--bg-hover); color: var(--fg-main); }
.filter-tab.active {
  background: var(--fg-main);
  color: var(--bg-card);
  font-weight: 500;
}
.filter-tab.active-done {
  background: var(--tone-done);
  color: #fff;
  font-weight: 500;
}

/* ==================== Inset Grouped 原生分组卡片（核心质感升级） ==================== */
.group-section {
  margin-bottom: 22px;
}
.group-outer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 8px;
}
.group-outer-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: 0.01em;
}
.group-outer-owner {
  font-weight: 400;
  color: var(--fg-faint);
  margin-left: 6px;
}
.group-more-btn {
  width: 28px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-faint);
  transition: background 0.12s ease, color 0.12s ease;
}
.group-more-btn:hover { background: var(--bg-hover); color: var(--fg-main); }

.group-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.group-card.plain-card {
  padding: 0;
}

/* 极净任务行（彻底去按钮化、纯正 Things 3 / iOS 列表观感） */
.task-row {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-line);
  transition: background 0.12s ease;
}
.task-row:last-child { border-bottom: none; }
.task-row.interactive:hover { background: var(--bg-hover); }

.task-main-line {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}
.task-tap-area {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.task-body { flex: 1; min-width: 0; }
.task-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.task-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--fg-main);
  line-height: 1.48;
  word-break: break-word;
}
.task-subline {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--fg-muted);
}
.subline-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.meta-sep { opacity: 0.4; }
.wait-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--tone-inbox);
  font-weight: 500;
}
.wait-inline::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--tone-inbox);
}
.due-inline {
  font-size: 12px;
  color: var(--fg-faint);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.due-inline.urgent {
  color: var(--tone-due);
  font-weight: 500;
}
.step-frac {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--tone-accent-fg);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.step-frac.waiting { color: var(--tone-inbox); }

.chevron-right {
  color: var(--fg-faint);
  opacity: 0.45;
  flex-shrink: 0;
  margin-top: 2px;
}

/* 贯通内容区的 4px 纤细平滑进度线（取代短粗进度棍） */
.micro-track {
  display: block;
  width: 100%;
  height: 4px;
  margin-top: 9px;
  border-radius: 999px;
  background: var(--bg-sub);
  overflow: hidden;
  flex-shrink: 0;
}
.micro-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--tone-accent);
  transition: width 0.22s ease;
}
.micro-fill.waiting { background: var(--tone-inbox); }

/* 精致勾选圆圈 */
.check-circle {
  width: 21px;
  height: 21px;
  margin-top: 1px;
  border-radius: 999px;
  border: 1.6px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.14s ease;
}
.check-circle:hover { border-color: var(--tone-accent); background: var(--tone-accent-soft); }
.check-circle.checked { background: var(--tone-done); border-color: var(--tone-done); color: #fff; }

/* 收件箱纯净卡片动作条（彻底去掉原生 <select> 下拉框） */
.inbox-action-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.inbox-action-btn {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  transition: filter 0.12s ease, transform 0.1s ease;
}
.inbox-action-btn:active { transform: scale(0.98); }

/* 归档卡片内产出说明 */
.archive-result {
  font-size: 13px;
  color: var(--tone-done);
  margin-top: 4px;
  line-height: 1.45;
}
.track-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}

/* ==================== 任务详情面板（底部 Sheet / 居中优雅卡片） ==================== */
.detail-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--fg-main);
  margin: 0 0 8px;
}
.detail-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.meta-chip {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-sub);
  color: var(--fg-muted);
}
.meta-chip.urgent { background: var(--tone-due-soft); color: var(--tone-due); font-weight: 500; }
.meta-chip.wait { background: var(--tone-inbox-soft); color: var(--tone-inbox); font-weight: 500; }

.detail-section {
  background: var(--bg-sub);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}
.detail-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-main);
}
.detail-track {
  display: block;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--border-line);
  overflow: hidden;
  margin-bottom: 12px;
}

.sub-step-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-line);
  font-size: 14px;
}
.sub-step-item:last-child { border-bottom: none; }
.sub-step-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.sub-check {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  transition: all 0.12s ease;
}
.sub-check.done { background: var(--tone-accent); border-color: var(--tone-accent); color: #fff; }
.sub-step-text.done { text-decoration: line-through; color: var(--fg-faint); }
.sub-step-del { font-size: 12px; color: var(--fg-faint); padding: 4px 6px; }
.sub-step-del:hover { color: var(--fg-main); }

.add-step-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-line);
}
.add-step-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  outline: none;
  padding: 4px 0;
}
.add-step-input::placeholder { color: var(--fg-faint); }

.template-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.tpl-chip {
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--fg-muted);
  font-size: 12.5px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.tpl-chip:hover { color: var(--fg-main); }

.detail-footer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.archive-confirm-bar {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--tone-done-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.archive-confirm-input {
  width: 100%;
  border: none;
  background: var(--bg-card);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  outline: none;
}

/* 周报 / 月报文档面 */
.report-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.seg-group {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg-sidebar);
}
.seg-btn {
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--fg-muted);
  transition: all 0.14s ease;
}
.seg-btn.active {
  background: var(--bg-card);
  color: var(--fg-main);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.report-paper {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px 26px;
  white-space: pre-wrap;
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--fg-main);
}

.empty-state {
  padding: 48px 18px;
  text-align: center;
  font-size: 13.5px;
  color: var(--fg-faint);
}

/* 弹窗与底部 Sheet 通用容器 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}
.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg-card);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 20px 50px -15px rgba(15, 23, 42, 0.25);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-line);
}
.modal-title { font-size: 16px; font-weight: 600; margin: 0; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--fg-muted); margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border-line);
  background: var(--bg-sub);
  font-size: 14px;
  outline: none;
}
.form-control:focus { border-color: var(--tone-accent); background: var(--bg-card); }
.form-tip { font-size: 12px; color: var(--fg-faint); margin-top: 5px; line-height: 1.5; }

.palette-row { display: flex; flex-wrap: wrap; gap: 8px; }
.palette-pill {
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--bg-sub);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--fg-muted);
  border: 1.5px solid transparent;
}
.palette-pill.active {
  border-color: var(--tone-accent);
  background: var(--tone-accent-soft);
  color: var(--fg-main);
  font-weight: 500;
}
.swatch { width: 11px; height: 11px; border-radius: 999px; display: inline-block; }

.text-muted { color: var(--fg-muted); }
.text-done { color: var(--tone-done); }
.text-due { color: var(--tone-due); font-weight: 500; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  box-shadow: var(--shadow-float);
  z-index: 90;
  pointer-events: none;
  max-width: 88vw;
  text-align: center;
}

.hidden { display: none !important; }
.mobile-topbar, .mobile-bottom-nav, .mobile-fab, .capture-backdrop, .sheet-handle { display: none; }

@keyframes sheetSlideUp {
  from { transform: translateY(32px); opacity: 0.75; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==================== 手机端高定原生适配（<= 820px） ==================== */
@media (max-width: 820px) {
  * { -webkit-tap-highlight-color: transparent; }
  html, body {
    font-size: calc(16px * var(--font-scale, 1));
    line-height: 1.55;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .app-shell {
    display: block;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .sidebar { display: none; }

  /* 原生大标题毛玻璃顶栏 */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 10px;
    background: color-mix(in srgb, var(--bg-base) 86%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .mobile-top-left { display: flex; align-items: baseline; gap: 10px; }
  .mobile-page-title {
    margin: 0;
    font-size: calc(27px * var(--font-scale, 1));
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--fg-main);
    line-height: 1.15;
  }
  .mobile-sync-dot {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--fg-faint);
    padding: 3px 6px;
  }
  .mobile-sync-dot .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--tone-done); }
  .mobile-sync-dot.warn .dot { background: var(--tone-inbox); }
  .mobile-sync-dot.err .dot { background: var(--tone-due); }
  .mobile-sync-dot.err .sync-txt { color: var(--tone-due); font-weight: 500; }

  .mobile-top-actions { display: flex; align-items: center; gap: 4px; }
  .mobile-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--fg-muted);
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  }
  .mobile-icon-btn:active { transform: scale(0.93); }

  .main-stage { padding: 6px 16px 128px; }

  /* 隐藏冗余页面大头，只留存档/周报的轻量操作条 */
  .view-title-group { display: none; }
  #view-main .view-header,
  #view-inbox .view-header,
  #view-chores .view-header { display: none; }
  #view-archive .view-header,
  #view-report .view-header {
    padding-bottom: 0;
    margin-bottom: 14px;
  }
  #view-archive .view-header > div:last-child {
    width: 100%;
    display: grid !important;
    grid-template-columns: 1fr auto;
    gap: 8px;
  }
  #view-archive #archive-search { width: 100% !important; }
  #view-report .view-header > div:last-child { width: 100%; justify-content: flex-end; }

  .filter-bar { margin-bottom: 16px; max-width: 100%; }
  .filter-tab {
    font-size: calc(13.5px * var(--font-scale, 1));
    padding: 6px 12px;
    background: var(--bg-card);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }
  .filter-tab.active {
    background: var(--fg-main);
    color: var(--bg-card);
    box-shadow: none;
  }
  .filter-tab.active-done {
    background: var(--tone-done);
    color: #fff;
    box-shadow: none;
  }

  .group-section { margin-bottom: 22px; }
  .group-outer-head { padding: 0 6px 8px; }
  .group-outer-title { font-size: calc(13.5px * var(--font-scale, 1)); }

  .task-row { padding: 15px 16px; }
  .task-row.interactive:active { background: var(--bg-sub); }
  .task-text { font-size: calc(16px * var(--font-scale, 1)); }
  .task-subline { font-size: calc(13px * var(--font-scale, 1)); margin-top: 5px; }
  .due-inline, .step-frac { font-size: calc(13px * var(--font-scale, 1)); }
  .check-circle { width: 23px; height: 23px; margin-top: 1px; }
  .check-circle:active { transform: scale(0.9); }
  .micro-track { height: 4.5px; margin-top: 10px; }

  /* 手机端速记 & 详情/编辑弹窗全为贴底原生 Bottom Sheet */
  .capture-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 65;
  }
  .capture-box {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    border-radius: 24px 24px 0 0;
    padding: 10px 18px calc(20px + env(safe-area-inset-bottom, 0px));
    z-index: 70;
    box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.18);
    animation: sheetSlideUp 0.18s ease-out;
  }
  .sheet-handle {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
    margin: 0 auto 14px;
  }
  .capture-textarea { min-height: 84px; }

  .modal-mask { align-items: flex-end; padding: 0; }
  .modal-card {
    max-width: 100%;
    max-height: 88vh;
    border-radius: 24px 24px 0 0;
    padding: 12px 18px calc(24px + env(safe-area-inset-bottom, 0px));
    animation: sheetSlideUp 0.18s ease-out;
  }
  .modal-card::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
    margin: 0 auto 14px;
  }

  /* 强制输入 >=16px 防 iOS 缩放 */
  .capture-textarea,
  .field-input,
  .form-control,
  .add-step-input,
  .archive-confirm-input {
    font-size: max(16px, calc(16px * var(--font-scale, 1)));
  }
  .btn { font-size: calc(14.5px * var(--font-scale, 1)); padding: 10px 14px; border-radius: 11px; }
  .sub-step-item { padding: 11px 0; font-size: calc(15.5px * var(--font-scale, 1)); }
  .sub-check { width: 21px; height: 21px; }
  .detail-title { font-size: calc(19px * var(--font-scale, 1)); }
  .report-paper { padding: 18px 16px; font-size: calc(15.5px * var(--font-scale, 1)); }

  .mobile-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 18px;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    width: 54px;
    height: 54px;
    border-radius: 999px;
    background: var(--tone-accent);
    color: #fff;
    box-shadow: var(--shadow-float);
    z-index: 40;
    transition: transform 0.12s ease;
  }
  .mobile-fab:active { transform: scale(0.92); }

  /* 原生半透明磨砂底栏 */
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: color-mix(in srgb, var(--bg-card) 86%, transparent);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-top: 0.5px solid var(--border-line);
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 40;
  }
  .mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    gap: 3px;
    font-size: 11px;
    color: var(--fg-faint);
    position: relative;
  }
  .mobile-nav-btn.active { color: var(--tone-accent); font-weight: 600; }
  .mobile-nav-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 19px);
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    border-radius: 999px;
    background: var(--tone-due);
    color: #fff;
    padding: 0 4px;
    text-align: center;
    font-weight: 600;
  }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}
