* {
  box-sizing: border-box;
}

:root {
  --font-display: "Outfit", "Noto Sans SC", sans-serif;
  /** 顶栏产品名：拉丁用 Syne，中文回退 Noto Sans SC */
  --font-brand-title: "Syne", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Noto Sans SC", "Outfit", "PingFang SC", "Microsoft YaHei", sans-serif;
  --color-page: #e4e8ef;
  --color-elevated: #ffffff;
  /* 筛选工具条的底：比页面底色亮，但不是纯白，免得和白色的任务卡片混在一起 */
  --toolbar-surface: #f7f9fc;
  --color-text: #14171f;
  --color-text-secondary: #5c6578;
  --color-border: rgba(15, 23, 42, 0.09);
  --color-border-strong: rgba(15, 23, 42, 0.14);
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --repeat-bg: #ccfbf1;
  --repeat-fg: #0f766e;
  --radius-sm: 8px;
  --radius-md: 12px;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-2: 0 8px 24px rgba(15, 23, 42, 0.1);
  /* 任务卡片专用：比 --shadow-1 重一档，卡片才能从页面底色里立出来 */
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.07), 0 4px 12px rgba(15, 23, 42, 0.07);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  /** 侧栏：与主区灰底 + 白卡片区分，冷色通道 + 微弱氛围光（与顶栏蓝/青呼应） */
  --sidebar-bg: linear-gradient(165deg, #f2f5fb 0%, #e9eef8 42%, #e4eaf4 100%);
  --sidebar-accent-glow: rgba(37, 99, 235, 0.07);
  --sidebar-teal-glow: rgba(15, 118, 110, 0.045);
  --sidebar-border-outer: rgba(15, 23, 42, 0.11);
  --sidebar-header-surface: rgba(255, 255, 255, 0.42);
  --sidebar-footer-surface: rgba(15, 23, 42, 0.035);
  --sidebar-item-hover: rgba(37, 99, 235, 0.07);
  /* ----- 以下和 App 的规范一一对应（packages/ios-app/lib/theme.ts），由 scripts/web-parity-check.mjs 核对 ----- */
  /* 主色写成小字时用更深的一档，底色、描边、图标仍用 --accent */
  --accent-text: #2056e0;
  --accent-pressed: #1d4ed8;
  --accent-ring: rgba(37, 99, 235, 0.24);
  --danger: #dc2626;
  --danger-text: #d52424;
  --danger-pressed: #b91c1c;
  --danger-soft: #fef0f0;
  --color-text-tertiary: #737c8c;
  --color-separator: rgba(60, 60, 67, 0.22);
  --color-sunken: #f5f6f9;
  --fill-neutral: rgba(15, 23, 42, 0.06);
  --warning: #8a5a0a;
  --warning-soft: #fff6e0;
  --success: #047857;
  /* 任务状态：标签底 / 标签字 / 标签边 / 卡片底 / 卡片边。卡片边四种状态都是同一条中性细线 */
  --status-todo-bg: #fef0f0;
  --status-todo-fg: #c53030;
  --status-todo-border: rgba(197, 48, 48, 0.2);
  --status-todo-card-bg: #ffffff;
  --status-todo-card-border: rgba(15, 23, 42, 0.13);
  --status-in-progress-bg: #e6eeff;
  --status-in-progress-fg: #1d4ed8;
  --status-in-progress-border: rgba(37, 99, 235, 0.18);
  --status-in-progress-card-bg: #f3f7ff;
  --status-in-progress-card-border: rgba(15, 23, 42, 0.13);
  --status-paused-bg: #fdf8ec;
  --status-paused-fg: #7a4f0a;
  --status-paused-border: rgba(138, 90, 10, 0.22);
  --status-paused-card-bg: #f3ecdf;
  --status-paused-card-border: rgba(15, 23, 42, 0.13);
  --status-done-bg: #e4f5ee;
  --status-done-fg: #0b5c45;
  --status-done-border: rgba(4, 120, 87, 0.2);
  --status-done-card-bg: #f0faf5;
  --status-done-card-border: rgba(15, 23, 42, 0.13);
  --priority-high: #c53030;
  --priority-medium: #a35208;
  --priority-low: #0b6e63;
  --milestone-border: rgba(217, 119, 6, 0.35);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0.01em;
  background-color: var(--color-page);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

html,
body {
  height: 100%;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.app-header {
  display: flex;
  align-items: center;
  padding: 14px 22px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: linear-gradient(118deg, #0f172a 0%, #1e3a8a 46%, #0f766e 112%);
  color: #f8fafc;
  gap: 16px;
  position: relative;
  z-index: 2;
}

.sidebar-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -6px 0 -6px -8px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-menu-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar-menu-bars,
.sidebar-menu-bars::before,
.sidebar-menu-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  position: relative;
}

.sidebar-menu-bars::before,
.sidebar-menu-bars::after {
  content: '';
  position: absolute;
  left: 0;
}

.sidebar-menu-bars::before {
  top: -6px;
}

.sidebar-menu-bars::after {
  top: 6px;
}

.sidebar-menu-btn.open .sidebar-menu-bars {
  background: transparent;
}

.sidebar-menu-btn.open .sidebar-menu-bars::before {
  top: 0;
  transform: rotate(45deg);
}

.sidebar-menu-btn.open .sidebar-menu-bars::after {
  top: 0;
  transform: rotate(-45deg);
}

.sidebar-backdrop {
  display: none;
}

.sidebar-drawer-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--color-text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}

.brand-mark {
  display: block;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.28));
}

.brand-name {
  font-family: var(--font-brand-title);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.045em;
  color: #f6f1e8;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.header-spacer {
  flex: 1;
}

.header-search-row {
  flex: 0 1 320px;
  display: flex;
  align-items: center;
  min-width: 0;
}

.search-container {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.search-container input {
  width: 100%;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.14);
  color: #f8fafc;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.search-container input::placeholder {
  color: rgba(248, 250, 252, 0.55);
}

.search-container input:focus {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

.view-switch {
  display: flex;
  gap: 4px;
}

.view-button {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(248, 250, 252, 0.92);
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 500;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out), border-color 0.2s var(--ease-out), transform 0.15s ease;
}

.view-button:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

.view-button.active {
  background: #f8fafc;
  color: #0f172a;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.app-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.sidebar {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 130% 90% at 0% 0%, var(--sidebar-accent-glow) 0%, transparent 58%),
    radial-gradient(ellipse 100% 70% at 100% 100%, var(--sidebar-teal-glow) 0%, transparent 50%),
    var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border-outer);
  box-shadow:
    inset -1px 0 0 rgba(255, 255, 255, 0.55),
    8px 0 36px rgba(15, 23, 42, 0.055);
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.sidebar-header {
  padding: 10px 12px 10px 16px;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--color-border);
  background: var(--sidebar-header-surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-header > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.list-container {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.sidebar-archive {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 4px 12px 10px;
}

.sidebar-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--sidebar-footer-surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.settings-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text-secondary);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.settings-btn:hover {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--color-text);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.settings-btn-icon {
  display: flex;
  align-items: center;
  font-size: 16px;
  line-height: 1;
  opacity: 0.85;
}

.sync-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  width: auto;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(15, 23, 42, 0.08);
  white-space: nowrap;
}

.sidebar-footer .account-card {
  flex-wrap: wrap;
  padding: 10px;
  gap: 8px 10px;
}

.sidebar-footer .account-avatar {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

.sidebar-footer .account-signout-btn {
  width: auto;
}

.sidebar-footer .account-form {
  width: 100%;
}

.sidebar-footer .account-form .settings-hint {
  margin-bottom: 8px;
  font-size: 11px;
}

.sidebar-footer .settings-field {
  margin-bottom: 8px;
  font-size: 12px;
}

.sidebar-footer .settings-field input {
  padding: 7px 9px;
  font-size: 12px;
}

.sync-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.sync-indicator[data-state='syncing'] .sync-indicator-dot {
  background: #2563eb;
  animation: sync-pulse 1s ease-in-out infinite;
}

.sync-indicator[data-state='synced'] .sync-indicator-dot {
  background: #16a34a;
}

.sync-indicator[data-state='error'] .sync-indicator-dot {
  background: var(--danger);
}

.sync-indicator[data-state='offline'] .sync-indicator-dot {
  background: #94a3b8;
}

@keyframes sync-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.settings-section + .settings-divider {
  margin: 22px 0;
}

.settings-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.settings-section-title svg {
  flex-shrink: 0;
  opacity: 0.75;
}

.settings-divider {
  height: 1px;
  background: var(--color-border);
}

.settings-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ---- 已登录账号卡片 ---- */
.account-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06) 0%, rgba(59, 130, 246, 0.03) 55%, rgba(255, 255, 255, 0) 100%);
}

.account-card.hidden {
  display: none;
}

.account-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--accent-pressed) 0%, #3b82f6 60%, #60a5fa 100%);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
  user-select: none;
}

.account-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.account-email-display {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-signout-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.3;
  cursor: pointer;
  transition: color 0.15s ease;
}

.account-signout-btn:hover {
  color: var(--danger-text);
}

/* ---- 未登录表单 ---- */
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 13px;
}

.settings-field input {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 23, 42, 0.12);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.settings-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.account-social {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 2px 0 10px;
}

.account-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.account-social-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.account-social-btn:hover {
  filter: brightness(1.06);
}

.account-social-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.account-social-apple {
  background: #111111;
  color: #ffffff;
  border: 1px solid #111111;
}

.account-social-wechat {
  background: #07c160;
  color: #ffffff;
  border: 1px solid #07c160;
}

.account-social-google {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid rgba(15, 23, 42, 0.14);
}

.account-or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 11px;
  color: var(--color-text-secondary);
}

.account-or::before,
.account-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.account-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.account-signup-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #ffffff;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.account-signup-btn:hover {
  border-color: rgba(15, 23, 42, 0.28);
}

.account-signin-btn {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.account-signin-btn:hover {
  background: #1e40af;
  border-color: #1e40af;
}

.account-magiclink-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--accent-text);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}

.account-magiclink-btn:hover {
  text-decoration: underline;
}

.account-form.hidden {
  display: none;
}

/* ---- 语言分段选择器 ---- */
.locale-segment {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.06);
}

.locale-segment-btn {
  padding: 7px 22px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.locale-segment-btn:hover {
  color: var(--color-text);
}

.locale-segment-btn.active {
  background: var(--color-elevated);
  color: var(--color-text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}

.detail-body label .detail-label-text {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: #6b7280;
}

.list-item {
  position: relative;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.list-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 16px;
  margin-right: 4px;
  margin-left: -8px;
  color: var(--color-text-secondary);
  opacity: 0;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.list-drag-handle svg {
  width: 10px;
  height: 16px;
  fill: currentColor;
  display: block;
}

.list-item:hover .list-drag-handle {
  opacity: 0.5;
}

.list-item .list-drag-handle:hover {
  opacity: 1;
  color: var(--color-text);
}

.list-item.dragging {
  opacity: 0.45;
}

.list-item.dragging .list-drag-handle {
  cursor: grabbing;
}

.list-item.drag-over-before::before,
.list-item.drag-over-after::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(37, 99, 235, 0.4);
}

.list-item.drag-over-before::before {
  top: -1px;
}

.list-item.drag-over-after::after {
  bottom: -1px;
}

.list-item:hover {
  background-color: var(--sidebar-item-hover);
}

.list-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.14) 0%, rgba(37, 99, 235, 0.06) 100%);
  box-shadow: inset 3px 0 0 var(--accent);
}

.list-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item-all {
  margin-bottom: 4px;
}

.list-item-name-all {
  font-weight: 700;
  font-size: 15px;
  font-family: var(--font-display);
  color: var(--accent-text);
}

.list-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.list-item:hover .list-item-actions {
  opacity: 1;
}

.icon-button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  color: #6b7280;
}

.icon-button.small {
  font-size: 14px;
}

.icon-button:hover {
  color: #111827;
}

.main-content {
  position: relative;
  padding: 10px 0 16px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  background:
    radial-gradient(ellipse 95% 48% at 50% -18%, rgba(37, 99, 235, 0.07), transparent 62%),
    var(--color-page);
}

.settings-view {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 95% 48% at 50% -18%, rgba(37, 99, 235, 0.07), transparent 62%),
    var(--color-page);
}

.settings-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.settings-view-header h1 {
  margin: 0;
  font-size: 22px;
  font-family: var(--font-brand-title);
  letter-spacing: -0.03em;
}

.settings-view-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-view-body {
  flex: 1;
  overflow: auto;
  padding: 20px 28px 48px;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
}

.settings-tab {
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-secondary);
}

.settings-tab.on {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.settings-view .settings-section {
  max-width: 880px;
}

.settings-btn.active {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--accent-text);
  font-weight: 600;
}

body.settings-open .list-item.active,
body.auth-open .list-item.active {
  background: transparent;
  box-shadow: none;
}

body.settings-open .list-item.active:hover,
body.auth-open .list-item.active:hover {
  background-color: var(--sidebar-item-hover);
}

body.settings-open .list-item-name-all,
body.auth-open .list-item-name-all {
  color: var(--color-text);
}

body.settings-open .archive-view-btn.active,
body.auth-open .archive-view-btn.active {
  background: transparent;
  box-shadow: none;
  color: var(--color-text-secondary);
  font-weight: inherit;
}

body.settings-open .ai-fab,
body.auth-open .ai-fab {
  display: none;
}

body.settings-open .detail-panel,
body.auth-open .detail-panel {
  transform: translateX(100%) !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

.auth-view .settings-view-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-panel {
  width: 100%;
  max-width: 420px;
  margin: 0;
  padding: 28px;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.auth-panel .account-social-btn {
  padding: 10px 12px;
}

body.auth-required .app-body {
  grid-template-columns: 1fr;
}

body.auth-required .sidebar,
body.auth-required .sidebar-backdrop,
body.auth-required .quick-add,
body.auth-required #taskListSection,
body.auth-required .detail-panel,
body.auth-required .ai-fab,
body.auth-required .ai-panel,
body.auth-required .search-container,
body.auth-required .view-switch,
body.auth-required .sidebar-menu-btn {
  display: none !important;
}

body.auth-required .main-content {
  padding: 0;
}

body.auth-required .auth-view {
  z-index: 30;
}

body.auth-required #authViewClose,
body.auth-required .auth-view .settings-view-header {
  display: none !important;
}

.mcp-urlbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--color-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
}

.mcp-urlbar-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.mcp-urlbar code {
  flex: 1;
  font-size: 13px;
  word-break: break-all;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  transform: translate(-50%, 12px);
  padding: 10px 16px;
  border-radius: 999px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.app-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.app-toast.error {
  background: #991b1b;
}

.mcp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 16px;
}

.mcp-tab {
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  cursor: pointer;
  color: var(--color-text-secondary);
}

.mcp-tab small {
  display: block;
  font-size: 11px;
  opacity: 0.8;
}

.mcp-tab.on {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.mcp-step-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.mcp-step-card {
  background: var(--color-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
  min-height: 132px;
}

.mcp-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.mcp-step-card h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.mcp-step-card p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.mcp-pane h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.mcp-pane ol {
  margin: 0;
  padding-left: 20px;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.75;
}

.settings-mcp-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff8e8;
  color: #7a5b14;
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 860px) {
  .mcp-step-cards {
    grid-template-columns: 1fr 1fr;
  }
  .mcp-urlbar {
    flex-wrap: wrap;
  }
}

.quick-add {
  position: relative;
  margin-bottom: 14px;
  margin-right: 20px;
  padding: 14px 16px;
  background: var(--accent);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.24);
  overflow: hidden;
}

.quick-add.is-collapsed {
  margin-bottom: 0;
  margin-right: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  max-height: 0;
}

.quick-add.is-morphing {
  z-index: 12;
  will-change: transform;
  pointer-events: none;
}

.quick-add.is-morphing::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
}

.quick-add.is-morphing-expand::after {
  animation: quick-add-tint-out 0.36s var(--ease-out) forwards;
}

.quick-add.is-morphing-collapse::after {
  animation: quick-add-tint-in 0.32s var(--ease-out) forwards;
}

@keyframes quick-add-tint-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes quick-add-tint-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.quick-add-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 0;
  flex-shrink: 0;
  padding: 7px 14px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.24);
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), background 0.15s ease;
}

.quick-add-toggle:hover {
  background: #1e40af;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.34);
}

.quick-add-toggle-plus {
  font-size: 18px;
  line-height: 1;
  font-weight: 500;
}

.quick-add-form {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
}

.quick-add.is-collapsed .quick-add-form {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
}

.quick-add.is-morphing .quick-add-form {
  grid-template-rows: 1fr;
}

.quick-add.is-morphing-expand .quick-add-form {
  opacity: 0;
  animation: quick-add-form-in 0.22s ease 0.14s forwards;
}

.quick-add.is-morphing-collapse .quick-add-form {
  opacity: 1;
  animation: quick-add-form-out 0.14s ease forwards;
}

@keyframes quick-add-form-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes quick-add-form-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .quick-add.is-morphing-expand::after,
  .quick-add.is-morphing-collapse::after,
  .quick-add.is-morphing-expand .quick-add-form,
  .quick-add.is-morphing-collapse .quick-add-form {
    animation: none;
  }

  .quick-add.is-morphing-expand::after {
    opacity: 0;
  }

  .quick-add.is-morphing-collapse::after {
    opacity: 1;
  }

  .quick-add.is-morphing-expand .quick-add-form,
  .quick-add.is-morphing-collapse .quick-add-form {
    opacity: 1;
  }
}

.quick-add-form-inner {
  overflow: hidden;
  min-height: 0;
}

.main-content > #taskListSection {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  /* 把内容区的上、左内边距挪到自己身上：位置不变，但工具条的底色可以一直铺到边 */
  margin: -10px 0 0 -20px;
  padding: 10px 0 0 20px;
}

/* 新增任务的蓝色面板展开时，任务区从它下面开始，不往上顶 */
.main-content > .quick-add:not(.is-collapsed) + #taskListSection {
  margin-top: 0;
  padding-top: 0;
}

/* 工具条：视图切换 + 筛选。一条比页面底色更亮的底，下沿一道细线，和任务区分开 */
.task-toolbar {
  margin: -10px 0 12px -20px;
  padding: 10px 0 2px 20px;
  background: var(--toolbar-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.main-content > .quick-add:not(.is-collapsed) + #taskListSection .task-toolbar {
  margin-top: 0;
  border-top: 1px solid var(--color-border);
}

/* 工具条里什么都不显示时（今天 / 本周，且新增任务的面板开着），整条不画，免得留一道空条 */
.task-toolbar:has(> .board-switch.hidden):has(.task-filter-group[style*="display: none"]):has(.quick-add-toggle.hidden) {
  display: none;
}

/* 工具条里只剩筛选一行时（今天 / 本周没有视图切换），上下留白对称 */
.task-toolbar > .board-switch.hidden + .filters {
  margin-top: 0;
}

.quick-add-row {
  display: flex;
  gap: 10px;
  margin-bottom: 0;
}

.quick-add-row input {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: #fafbfc;
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.quick-add-row input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.quick-add-row select {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: var(--color-elevated);
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.quick-add-row select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filters {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  margin-right: 20px;
}

.board-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 20px 8px 0;
}

.board-switch-label {
  margin-right: 4px;
  font-size: 13px;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.board-switch-btn {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-elevated);
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.board-switch-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.task-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filters-spacer {
  flex: 1;
}

.filters-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.archive-view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text-secondary);
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.archive-view-icon {
  flex-shrink: 0;
}

.archive-view-btn:hover {
  background-color: var(--sidebar-item-hover);
  color: var(--color-text);
}

.archive-view-btn.active {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent-text);
  font-weight: 600;
}

.archive-view-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 12px;
  margin: 0 20px 8px 0;
  font-size: 13px;
  color: #4338ca;
  background: #eef2ff;
  border-radius: 6px;
  border: 1px solid #c7d2fe;
}

.archive-view-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #4338ca;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.archive-view-close:hover {
  background: #e0e7ff;
  color: #312e81;
}

.toggle-done-btn {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: var(--color-elevated);
  font-size: 12px;
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.toggle-done-btn:hover {
  background: #f1f5f9;
  color: #374151;
}

.filters select {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: var(--color-elevated);
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text);
  cursor: pointer;
}

.filters select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.task-sort-hidden-select {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.sort-menu-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.sort-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: #4b5563;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sort-icon-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.sort-icon-btn[aria-expanded="true"] {
  background: #e5e7eb;
  color: #111827;
}

.sort-icon-svg {
  flex-shrink: 0;
}

.sort-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  padding: 4px 0;
  margin: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  z-index: 30;
}

.sort-menu.hidden {
  display: none;
}

.sort-menu-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  text-align: left;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.35;
  white-space: normal;
}

.sort-menu-item:hover {
  background: #f3f4f6;
}

.sort-menu-item.active {
  color: #4f46e5;
  font-weight: 600;
  background: #eef2ff;
}

.task-list {
  list-style: none;
  margin: 0;
  /* 右侧与原先 main 的 padding-right 对齐，任务卡片宽度与改前一致；列表区贴主区域右缘滚动 */
  padding: 0 20px 8px 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kanban-board {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 20px 12px 0;
}

.kanban-pager {
  display: none;
}

.kanban-mobile-status {
  display: none;
}

.kanban-column {
  flex: 1 1 220px;
  min-width: 220px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.035);
  border: 1px solid var(--color-border);
  border-radius: 16px;
}

.kanban-column.drop-active {
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(37, 99, 235, 0.06);
}

.kanban-column.drop-invalid {
  border-color: rgba(185, 28, 28, 0.4);
  background: rgba(185, 28, 28, 0.05);
}

.kanban-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.kanban-column-head::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #94a3b8;
  flex-shrink: 0;
}

.kanban-column-todo .kanban-column-head::before { background: #e05252; }
.kanban-column-in_progress .kanban-column-head::before { background: var(--accent-pressed); }
.kanban-column-paused .kanban-column-head::before { background: #d97706; }
.kanban-column-done .kanban-column-head::before { background: #166534; }
.kanban-column-milestone .kanban-column-head::before { background: #ca8a04; }

.kanban-column-head span:first-of-type {
  flex: 1;
}

.kanban-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 1px 8px;
}

.kanban-column-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 8px 10px;
}

.kanban-empty {
  margin: 8px 4px;
  color: var(--color-text-secondary);
  font-size: 12px;
  text-align: center;
}

.kanban-card {
  background: var(--color-elevated);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow-card);
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}

.kanban-card-selected {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.kanban-card.is-dragging { opacity: 0.35; }

.kanban-subs {
  list-style: none;
  margin: 10px 0 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kanban-subs .task-item {
  min-height: 0;
  padding: 8px 10px;
  box-shadow: none;
  background: var(--color-page);
}

.kanban-subs .task-item::before {
  display: none;
}

.kanban-subs .add-subtask-row {
  margin: 0;
}

.kanban-card-title {
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.kanban-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.kanban-list-name,
.kanban-sub-count,
.kanban-due {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.kanban-repeat {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  background-color: var(--repeat-bg);
  color: var(--repeat-fg);
  white-space: nowrap;
}

.kanban-repeat-milestone {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 1px solid rgba(217, 119, 6, 0.35);
}

.kanban-due-overdue { color: #b91c1c; font-weight: 600; }
.kanban-due-soon { color: #c2410c; font-weight: 600; }

body.kanban-dragging,
body.kanban-dragging .kanban-card { cursor: grabbing; }

.kanban-ghost {
  position: fixed;
  z-index: 80;
  margin: 0;
  pointer-events: none;
  transform: rotate(1.5deg);
  box-shadow: var(--shadow-2);
  opacity: 0.96;
}

.task-section-header {
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--color-text-secondary);
  padding: 12px 4px 6px;
  flex-shrink: 0;
}

.task-section-header.collapsible {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  padding: 14px 8px 8px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.task-section-header.collapsible:hover {
  color: var(--color-text-primary);
  background: rgba(99, 102, 241, 0.06);
}

.task-section-header.collapsible .section-caret {
  display: inline-block;
  font-size: 10px;
  color: var(--color-text-secondary);
  transition: transform 0.2s ease;
  transform: rotate(0deg);
  width: 12px;
  text-align: center;
}

.task-section-header.collapsible.collapsed .section-caret {
  transform: rotate(-90deg);
}

.task-section-header.collapsible .section-count {
  font-weight: 500;
  color: var(--color-text-secondary);
  opacity: 0.8;
}

.today-pending-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.today-add-onetime-btn {
  flex-shrink: 0;
  border: 1px solid rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent-text);
  border-radius: 999px;
  padding: 4px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.today-add-onetime-btn:hover {
  background: rgba(37, 99, 235, 0.14);
}

.today-add-panel {
  list-style: none;
  padding: 8px 8px 12px;
  margin: 0 20px 8px 0;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
}

.today-add-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
}

.today-add-input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
}

.today-add-hint {
  margin: 10px 2px 6px;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.today-add-pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 180px;
  overflow: auto;
}

.today-add-pick-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  color: var(--color-text);
}

.today-add-pick-item:hover {
  background: var(--sidebar-item-hover);
}

.today-unpin-btn {
  margin-left: auto;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
}

.today-unpin-btn:hover {
  color: var(--accent-text);
}

.task-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 12px 14px;
  min-height: 64px;
  flex-shrink: 0;
  background: var(--color-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out),
    border-color 0.18s var(--ease-out), background 0.18s var(--ease-out);
  box-shadow: var(--shadow-card);
}

.task-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
  transition: background 0.18s var(--ease-out);
}

/* ----- Status-tinted card backgrounds ----- */
/* todo 保持默认白底，避免一打开全是红 */
.task-item.card-in-progress {
  background: #eff6ff;
  border-color: rgba(59, 130, 246, 0.24);
}
.task-item.card-in-progress::before {
  background: #3b82f6;
}

.task-item.card-done {
  background: #f0fdf4;
  border-color: rgba(22, 163, 74, 0.22);
}
.task-item.card-done::before {
  background: #22c55e;
}

.task-item.card-done.card-milestone {
  background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 40%, #fffdf5 70%, #ffffff 100%);
  border-color: rgba(217, 119, 6, 0.35);
}
.task-item.card-done.card-milestone::before {
  background: linear-gradient(180deg, #f59e0b 0%, #fbbf24 100%);
}

.task-item.subtask {
  margin-left: 32px;
}
.task-item.subtask::before {
  width: 3px;
}

.subtask-branch {
  list-style: none;
  margin: 0 0 8px;
  /* 竖线对齐主任务左侧的展开箭头 */
  padding: 0 0 0 24px;
}

.subtask-branch-list {
  list-style: none;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 8px 0 2px 36px;
}

.subtask-branch-list::before {
  content: '';
  position: absolute;
  left: 0;
  /* 只接到主任务卡片底边，不再伸进卡片里 */
  top: -7px;
  bottom: 4px;
  width: 1px;
  background: #c5cedb;
}

.subtask-branch-list > .task-item.subtask,
.subtask-branch-list > .add-subtask-row {
  position: relative;
  margin-left: 0;
  overflow: visible;
}

.subtask-branch-list > .task-item.subtask::after,
.subtask-branch-list > .add-subtask-row::after {
  content: '';
  position: absolute;
  left: -36px;
  top: 50%;
  width: 36px;
  height: 1px;
  background: #c5cedb;
  pointer-events: none;
}

.subtask-branch-list > :last-child::before {
  content: '';
  position: absolute;
  left: -38px;
  top: calc(50% + 1px);
  bottom: -8px;
  width: 6px;
  background: var(--color-page);
  pointer-events: none;
}

.kanban-subs.subtask-branch-list {
  margin: 10px 0 0 8px;
  padding: 8px 0 0 36px;
  border-top: 1px solid var(--color-border);
}

.kanban-subs.subtask-branch-list::before {
  top: 0;
}

.kanban-subs.subtask-branch-list > :last-child::before {
  background: var(--color-elevated);
}

.kanban-subs .task-item.subtask {
  margin-left: 0;
}
.kanban-subs .task-item.card-in-progress,
.kanban-subs .task-item.card-done,
.kanban-subs .task-item.card-done.card-milestone {
  background: var(--color-page);
  border-color: var(--color-border);
}
.kanban-subs .task-item::before,
.kanban-subs .task-item.card-in-progress::before,
.kanban-subs .task-item.card-done::before,
.kanban-subs .task-item.card-done.card-milestone::before {
  display: none;
}

.kanban-subs .task-item > .task-content {
  border-left: none;
  margin-left: 8px;
  padding-left: 0;
}

.kanban-subs .status-tag:focus,
.kanban-subs .status-tag:focus-visible {
  outline: none;
}

.kanban-subs .task-item.kanban-sub-selected,
.kanban-subs .task-item.kanban-sub-selected:hover,
.kanban-subs .task-item.card-todo.kanban-sub-selected,
.kanban-subs .task-item.card-todo.kanban-sub-selected:hover,
.kanban-subs .task-item.card-paused.kanban-sub-selected,
.kanban-subs .task-item.card-paused.kanban-sub-selected:hover,
.kanban-subs .task-item.card-in-progress.kanban-sub-selected,
.kanban-subs .task-item.card-in-progress.kanban-sub-selected:hover,
.kanban-subs .task-item.card-done.kanban-sub-selected,
.kanban-subs .task-item.card-done.kanban-sub-selected:hover,
.kanban-subs .task-item.card-done.card-milestone.kanban-sub-selected,
.kanban-subs .task-item.card-done.card-milestone.kanban-sub-selected:hover {
  border-color: var(--color-border);
  background: var(--color-page);
  box-shadow: inset 0 0 0 2px var(--accent-pressed);
}

.expand-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  color: #6b7280;
  width: 20px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  margin-right: 4px;
  transition: background 0.1s ease, color 0.1s ease;
}

.expand-btn:hover {
  background: #e5e7eb;
  color: #111827;
}

.expand-btn.no-children {
  color: #d1d5db;
}

.add-subtask-row {
  margin-left: 32px;
  padding: 4px 0;
  flex-shrink: 0;
}

.add-subtask-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px dashed #c7d2fe;
  border-radius: 6px;
  background: #fafbff;
  font-size: 13px;
  color: #374151;
  outline: none;
  font-family: inherit;
}

.add-subtask-input::placeholder {
  color: #9ca3af;
}

.add-subtask-input:focus {
  border-color: #818cf8;
  background: #fff;
}

.task-item > .status-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex-shrink: 0;
}

.task-item > .status-col > .status-tag {
  margin: 0;
}

.task-item > .task-content {
  flex: 1;
  padding-left: 12px;
  border-left: 1px solid var(--color-border);
  margin-left: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-item > .task-content > .task-cover {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
}

.task-item > .task-content > .task-text {
  flex: 1;
}

.task-item:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-2);
}

.task-item.card-in-progress:hover {
  background: #dbeafe;
  border-color: rgba(59, 130, 246, 0.4);
}
.task-item.card-done:hover {
  background: #dcfce7;
  border-color: rgba(22, 163, 74, 0.35);
}
.task-item.card-done.card-milestone:hover {
  background: linear-gradient(135deg, #fde68a 0%, #fef3c7 40%, #fffdf5 75%, #ffffff 100%);
  border-color: rgba(217, 119, 6, 0.5);
}

.task-item .title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.task-item.done .task-title-row span,
.task-item.done .title {
  text-decoration: line-through;
  text-decoration-color: rgba(156, 163, 175, 0.55);
  text-decoration-thickness: 1.5px;
  color: #9ca3af;
}

.firework-container {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
}

.firework-particle {
  position: absolute;
  border-radius: 50%;
}

.firework-particle.burst {
  animation: firework-burst 0.9s cubic-bezier(0.22, 0.6, 0.36, 1) forwards;
}

.firework-particle.sparkle {
  animation: firework-sparkle 1.1s ease-out forwards;
}

@keyframes firework-burst {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  60% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0.2);
  }
}

@keyframes firework-sparkle {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(calc(var(--tx) * 0.3), calc(var(--ty) * 0.3)) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0);
  }
}

.task-item .meta {
  font-size: 12px;
  color: #6b7280;
}

.task-due-date {
  margin-left: auto;
  font-size: 12px;
  color: #9ca3af;
  white-space: nowrap;
  flex-shrink: 0;
}

.completion-history-btn {
  margin-left: auto;
  padding: 3px 8px;
  border: 1px solid #c7d2fe;
  border-radius: 4px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}

.completion-history-btn:hover {
  background: #e0e7ff;
}

.completion-history-modal {
  width: 540px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.completion-history-modal .modal-body {
  flex: 1;
  min-height: 0;
  max-height: 60vh;
  overflow-y: auto;
}

.completion-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}

.completion-nav-arrow {
  width: 28px;
  height: 28px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  transition: background .15s;
}
.completion-nav-arrow:hover {
  background: #f3f4f6;
}

.completion-nav-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: #374151;
}

.completion-nav-input {
  width: 64px;
  height: 28px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  -moz-appearance: textfield;
}
.completion-nav-input::-webkit-inner-spin-button,
.completion-nav-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.completion-month-input {
  width: 48px;
}

.completion-weekday-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}
.completion-weekday-header.hidden {
  display: none;
}
.completion-weekday-cell {
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  padding: 2px 0;
  font-weight: 500;
}

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

.completion-grid.grid-4col {
  grid-template-columns: repeat(4, 1fr);
}

.completion-grid.grid-weekly {
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.completion-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 4px;
  background: #f9fafb;
  min-height: 56px;
}

.completion-cell.completed {
  background: #dcfce7;
  border-color: #86efac;
}

.completion-cell.current {
  border-color: #818cf8;
  box-shadow: 0 0 0 1px #818cf8;
}

.completion-cell-mark {
  font-size: 18px;
  font-weight: 700;
  color: #16a34a;
  height: 22px;
}

.completion-cell-label {
  font-size: 10px;
  color: #6b7280;
  margin-top: 2px;
  white-space: nowrap;
}

.completion-cell.created {
  border-color: #f59e0b;
  background: #fffbeb;
}
.completion-cell.created.completed {
  background: #dcfce7;
  border-color: #f59e0b;
}

.completion-created-tag {
  font-size: 9px;
  color: #d97706;
  background: #fef3c7;
  border-radius: 3px;
  padding: 0 3px;
  margin-top: 1px;
  line-height: 14px;
  white-space: nowrap;
}

.completion-note-modal {
  width: 420px;
}

.completion-note-hint {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 8px 0;
}

.completion-note-modal textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}
.completion-note-modal textarea:focus {
  border-color: #818cf8;
}

.completion-timeline {
  margin-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.completion-timeline.timeline-only {
  margin-top: 0;
  border-top: none;
}

.timeline-heading {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  padding: 12px 0 8px;
}

.timeline-item {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  position: relative;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #818cf8;
  margin-top: 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 20px;
  bottom: -6px;
  width: 2px;
  background: #e5e7eb;
}

.timeline-body {
  flex: 1;
  min-width: 0;
}

.timeline-date {
  font-size: 11px;
  color: #9ca3af;
  margin-bottom: 2px;
}

.timeline-note {
  font-size: 13px;
  color: #374151;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.timeline-source {
  display: inline-block;
  font-size: 11px;
  color: #6366f1;
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  border-radius: 10px;
  padding: 1px 8px;
  margin: 2px 0 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-item.from-subtask .timeline-dot {
  background: #6366f1;
  border-color: #e0e7ff;
}

.timeline-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.timeline-followup-btn {
  flex-shrink: 0;
  opacity: 0;
  border: none;
  background: transparent;
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.timeline-item.is-completion:hover .timeline-followup-btn {
  opacity: 1;
}

.timeline-item.is-completion.is-composing .timeline-followup-btn {
  display: none;
}

.timeline-followup-btn:hover {
  background: var(--accent-soft);
}

.timeline-followup-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 1px 8px;
  margin-right: 6px;
  vertical-align: middle;
}

.timeline-followups {
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid #fde68a;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-followup-item {
  padding: 6px 0 2px;
}

.timeline-followup-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.timeline-followup-time {
  font-size: 11px;
  color: #9ca3af;
}

.timeline-followup-text {
  font-size: 13px;
  color: #374151;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.timeline-followup-composer {
  margin-top: 0;
}

.timeline-followup-composer textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-border-strong);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  resize: vertical;
  outline: none;
}

.timeline-followup-composer textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.completion-cell.empty-cell {
  border: none;
  background: transparent;
}

.completion-cell.day-cell {
  min-height: 40px;
  padding: 4px;
  border-radius: 6px;
  position: relative;
}

.completion-cell.can-makeup .completion-makeup-btn {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  border: none;
  border-radius: 4px;
  padding: 2px 6px;
  background: #818cf8;
  color: #fff;
  font-size: 10px;
  cursor: pointer;
  transition: opacity 0.15s;
  z-index: 1;
  white-space: nowrap;
}

.completion-cell.can-makeup:hover .completion-makeup-btn {
  opacity: 1;
}

.completion-cell.month-cell,
.completion-cell.week-cell {
  min-height: 52px;
  padding: 6px;
  position: relative;
}

.priority-tag {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  color: #fff;
}

.priority-high {
  background-color: #ef4444;
}

.priority-medium {
  background-color: #f97316;
}

.priority-low {
  background-color: #10b981;
}

.due-tag {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.due-soon {
  background-color: #fef3c7;
  color: #b45309;
}

.due-overdue {
  background-color: #fee2e2;
  color: var(--danger-text);
}

.repeat-tag {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background-color: var(--repeat-bg);
  color: var(--repeat-fg);
  white-space: nowrap;
  text-align: center;
  box-sizing: border-box;
}

.status-tag {
  border: none;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  text-align: center;
  box-sizing: border-box;
  max-width: 100%;
}

.status-todo {
  background: #fee2e2;
  color: #e05252;
}

.status-in-progress {
  background: #dbeafe;
  color: var(--accent-text);
}

.status-done {
  background: #dcfce7;
  color: #166534;
}

.status-tag.status-milestone.status-done {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: #92400e;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 2px 6px rgba(217, 119, 6, 0.25);
  border: 1px solid rgba(217, 119, 6, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
}

.status-tag .status-trophy {
  font-size: 13px;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(217, 119, 6, 0.35));
}

.repeat-tag.repeat-milestone {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 1px solid rgba(217, 119, 6, 0.35);
}

.status-tag:hover {
  filter: brightness(0.97);
}

.task-title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.task-title-side {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.detail-field-label {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 4px;
}

.detail-cover-section {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.cover-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.detail-cover-preview {
  position: relative;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  display: none;
  overflow: hidden;
  width: 80px;
  height: 80px;
  min-width: 80px;
}

.detail-cover-preview.has-image {
  display: block;
}

.detail-cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-remove-x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}

/* 头图小方图可以点开看大图 */
.detail-cover-preview img {
  cursor: zoom-in;
}

/* 全屏看头图大图：深色遮罩，图片居中、按原比例尽量放大，点任意位置关闭 */
.cover-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 14, 24, 0.86);
  cursor: zoom-out;
  animation: cover-lightbox-in 0.16s ease-out;
}

.cover-lightbox img {
  /* 头图存下来最大 800 像素，小图也放大到撑满短边，不然在大屏上只有一小块 */
  width: min(100%, 100vh - 48px, 800px);
  height: auto;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.cover-lightbox-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.cover-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

@keyframes cover-lightbox-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.detail-cover-preview:hover .cover-remove-x {
  opacity: 1;
}

.cover-remove-x:hover {
  background: rgba(0, 0, 0, 0.7);
}

.cover-upload-label {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: var(--color-elevated);
  cursor: pointer;
  font-size: 12px;
  text-align: center;
  margin-top: 0;
}

.cover-ai-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 118, 110, 0.35);
  background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
  color: #0f766e;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition:
    filter 0.15s ease,
    opacity 0.15s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.cover-ai-btn:hover:not(:disabled) {
  filter: brightness(0.97);
}

/* 生成中与默认「AI 生成/重新生图」区分：靛蓝系，非红 */
.cover-ai-btn:disabled {
  opacity: 1;
  cursor: wait;
  border-color: rgba(79, 70, 229, 0.4);
  background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
  color: #4338ca;
  filter: none;
}

.cover-upload-label:hover {
  background: #f1f5f9;
}

.cover-upload-label.hidden {
  display: none;
}

.detail-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 328px;
  border-left: 1px solid var(--color-border);
  background: var(--color-elevated);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s var(--ease-out), box-shadow 0.28s var(--ease-out);
  box-shadow: none;
  pointer-events: none;
}

.detail-panel.open {
  transform: translateX(0);
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.12);
  pointer-events: auto;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #fafbfc 0%, var(--color-elevated) 100%);
}

.detail-header button {
  border: none;
  background: rgba(15, 23, 42, 0.06);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text);
  transition: background 0.15s ease;
}

.detail-header button:hover {
  background: rgba(15, 23, 42, 0.1);
}

.detail-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.detail-body label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: #6b7280;
  gap: 4px;
}

.detail-desc-label .detail-desc-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.detail-desc-preview {
  min-height: 88px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: #fafbfc;
  color: var(--color-text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-word;
  cursor: text;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.detail-desc-preview:hover {
  border-color: #c7cbd4;
}

.detail-desc-preview:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.detail-desc-preview.detail-desc-preview--empty {
  color: #9ca3af;
}

.detail-desc-link {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.detail-desc-link:hover {
  color: #1e40af;
}

.detail-body input,
.detail-body textarea,
.detail-body select {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.detail-body input:focus,
.detail-body textarea:focus,
.detail-body select:focus,
.detail-desc-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.detail-parent-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-parent-name {
  font-size: 13px;
  color: #4f46e5;
  font-weight: 500;
}

.detail-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-actions #detailCompletionHistoryBtn,
.detail-actions #deleteTaskBtn {
  margin-left: auto;
}

.detail-actions #detailCompletionHistoryBtn:not(.hidden) + #deleteTaskBtn {
  margin-left: 0;
}

.secondary {
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.secondary:hover {
  background-color: #e5e7eb;
}

.danger {
  background-color: #ef4444;
  color: #fff;
  border: none;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.primary {
  background-color: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.15s ease, transform 0.12s ease;
}

.primary:hover {
  background-color: #1e40af;
}

.danger:hover {
  background-color: #b91c1c;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

#completionNoteModal {
  z-index: 50;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  width: 360px;
  background: var(--color-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.modal-body {
  padding: 12px 14px;
}

.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.modal-body input {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  font-family: inherit;
}

.modal-body input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.modal-footer {
  padding: 10px 16px 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-footer button {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: var(--color-elevated);
  cursor: pointer;
  font-family: inherit;
}

.modal-footer button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.modal-footer button.primary:hover {
  background: #1e40af;
  border-color: #1e40af;
}

/* ===== Milestone celebration overlay ===== */
.milestone-celebration {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 260ms ease;
}

.milestone-celebration.hidden {
  display: none;
}

.milestone-celebration.active {
  opacity: 1;
}

.milestone-celebration.closing {
  opacity: 0;
}

.milestone-celebration-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1200px 800px at 50% 45%, rgba(255, 247, 214, 0.88) 0%, rgba(255, 234, 177, 0.55) 28%, rgba(30, 41, 59, 0.45) 70%, rgba(15, 23, 42, 0.6) 100%);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.milestone-celebration-rays {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 140vmax;
  height: 140vmax;
  margin-left: -70vmax;
  margin-top: -70vmax;
  background:
    conic-gradient(
      from 0deg,
      rgba(255, 214, 102, 0.55) 0deg 8deg,
      transparent 8deg 24deg,
      rgba(255, 214, 102, 0.4) 24deg 30deg,
      transparent 30deg 48deg,
      rgba(255, 214, 102, 0.55) 48deg 56deg,
      transparent 56deg 72deg,
      rgba(255, 214, 102, 0.4) 72deg 80deg,
      transparent 80deg 96deg,
      rgba(255, 214, 102, 0.55) 96deg 104deg,
      transparent 104deg 120deg,
      rgba(255, 214, 102, 0.4) 120deg 128deg,
      transparent 128deg 144deg,
      rgba(255, 214, 102, 0.55) 144deg 152deg,
      transparent 152deg 168deg,
      rgba(255, 214, 102, 0.4) 168deg 176deg,
      transparent 176deg 360deg
    );
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 20%, #000 48%, rgba(0, 0, 0, 0.4) 78%, transparent 100%);
  -webkit-mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 20%, #000 48%, rgba(0, 0, 0, 0.4) 78%, transparent 100%);
  opacity: 0;
  transform: rotate(0deg);
}

.milestone-celebration.active .milestone-celebration-rays {
  animation: milestone-rays-spin 3s linear forwards;
}

@keyframes milestone-rays-spin {
  0% { opacity: 0; transform: rotate(0deg); }
  15% { opacity: 0.85; }
  80% { opacity: 0.7; }
  100% { opacity: 0; transform: rotate(90deg); }
}

.milestone-celebration-content {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 24px;
  text-align: center;
  pointer-events: none;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}

.milestone-celebration-trophy {
  font-size: clamp(140px, 24vw, 260px);
  line-height: 1;
  transform: scale(0.3) translateY(20px);
  opacity: 0;
  filter: drop-shadow(0 8px 24px rgba(251, 191, 36, 0.55));
}

.milestone-celebration.active .milestone-celebration-trophy {
  animation: milestone-trophy-pop 1400ms cubic-bezier(0.22, 1.2, 0.36, 1) forwards;
}

@keyframes milestone-trophy-pop {
  0% { transform: scale(0.3) translateY(20px) rotate(-12deg); opacity: 0; }
  55% { transform: scale(1.15) translateY(-4px) rotate(4deg); opacity: 1; }
  70% { transform: scale(0.98) translateY(0) rotate(-2deg); }
  85% { transform: scale(1.04) translateY(0) rotate(1deg); }
  100% { transform: scale(1) translateY(0) rotate(0deg); opacity: 1; }
}

.milestone-celebration-title {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff8e1;
  text-shadow:
    0 2px 0 rgba(146, 64, 14, 0.55),
    0 8px 24px rgba(217, 119, 6, 0.55),
    0 0 36px rgba(252, 211, 77, 0.75);
  opacity: 0;
  transform: translateY(12px);
}

.milestone-celebration-subtitle {
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 500;
  color: rgba(255, 249, 230, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(10px);
}

.milestone-celebration.active .milestone-celebration-title {
  animation: milestone-text-in 900ms 260ms ease-out forwards;
}

.milestone-celebration.active .milestone-celebration-subtitle {
  animation: milestone-text-in 900ms 460ms ease-out forwards;
}

@keyframes milestone-text-in {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

.milestone-celebration-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.milestone-confetti-piece {
  position: absolute;
  top: -24px;
  left: var(--cfx-start);
  display: block;
  opacity: 0;
  transform: translate(0, 0) rotate(0deg);
  animation-name: milestone-confetti-fall;
  animation-timing-function: cubic-bezier(0.25, 0.7, 0.4, 1);
  animation-fill-mode: forwards;
}

@keyframes milestone-confetti-fall {
  0% {
    opacity: 0;
    transform: translate(0, -10vh) rotate(0deg);
  }
  8% { opacity: 1; }
  100% {
    opacity: 0;
    left: var(--cfx-end);
    transform: translate(0, 110vh) rotate(var(--cfx-rotate));
  }
}

/* ========================= AI 助手 ========================= */

/* 悬浮入口按钮（FAB）：可拖拽，渐变星球 + 呼吸光晕 */
.ai-fab {
  position: fixed;
  right: 26px;
  bottom: 96px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(140deg, #6366f1 0%, #2563eb 46%, #0d9488 100%);
  box-shadow:
    0 6px 20px rgba(37, 99, 235, 0.42),
    0 2px 6px rgba(15, 23, 42, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  animation: aiFabBreath 3.2s ease-in-out infinite;
}

@keyframes aiFabBreath {
  0%, 100% {
    box-shadow:
      0 6px 20px rgba(37, 99, 235, 0.42),
      0 2px 6px rgba(15, 23, 42, 0.25),
      0 0 0 0 rgba(99, 102, 241, 0.32),
      inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }
  50% {
    box-shadow:
      0 6px 22px rgba(37, 99, 235, 0.5),
      0 2px 6px rgba(15, 23, 42, 0.25),
      0 0 0 9px rgba(99, 102, 241, 0),
      inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }
}

.ai-fab:hover {
  transform: scale(1.08);
}

.ai-fab.dragging {
  transition: none;
  animation: none;
  cursor: grabbing;
  transform: scale(1.04);
  box-shadow:
    0 12px 32px rgba(37, 99, 235, 0.5),
    0 4px 10px rgba(15, 23, 42, 0.3);
}

.ai-fab.active {
  background: linear-gradient(140deg, #4f46e5 0%, var(--accent-pressed) 46%, #0f766e 100%);
  box-shadow:
    0 6px 22px rgba(37, 99, 235, 0.55),
    0 0 0 3px rgba(129, 140, 248, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  animation: none;
}

.ai-fab-logo {
  pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(15, 23, 42, 0.3));
}

/* 浮动聊天面板：右下角 */
.ai-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 400px;
  height: min(620px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--color-border-strong);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22), 0 4px 12px rgba(15, 23, 42, 0.1);
  z-index: 60;
  overflow: hidden;
}

.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(118deg, #0f172a 0%, #1e3a8a 60%, #155e75 120%);
  color: #eef2ff;
  flex-shrink: 0;
}

.ai-panel-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

.ai-panel-title svg {
  color: #a5b4fc;
}

.ai-panel-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(224, 231, 255, 0.75);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.ai-icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

/* 上下文提示条 */
.ai-context-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  font-size: 12px;
  background: rgba(37, 99, 235, 0.06);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  flex-shrink: 0;
}

.ai-context-chip .ai-context-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
}

.ai-context-chip.no-task {
  color: var(--color-text-secondary);
  background: rgba(15, 23, 42, 0.03);
}

.ai-context-chip.no-task .ai-context-dot {
  background: #cbd5e1;
}

#aiContextChipLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 消息区 */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f6f8fc;
}

.ai-empty-state {
  margin: auto;
  text-align: center;
  padding: 0 24px;
  color: var(--color-text-secondary);
}

.ai-empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}

.ai-empty-hint {
  font-size: 12.5px;
  line-height: 1.7;
}

.ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

.ai-msg-user {
  align-self: flex-end;
  align-items: flex-end;
}

.ai-msg-assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.ai-msg-content {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-msg-user .ai-msg-content {
  background: var(--accent);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.ai-msg-assistant .ai-msg-content {
  background: #ffffff;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-1);
}

.ai-msg-error .ai-msg-content {
  background: #fef2f2;
  border-color: rgba(220, 38, 38, 0.25);
  color: #b91c1c;
}

.ai-msg-content.ai-thinking {
  color: var(--color-text-secondary);
  font-style: italic;
  animation: aiThinkingPulse 1.2s ease-in-out infinite;
}

@keyframes aiThinkingPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.ai-msg-note {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* 子任务建议卡片 */
.ai-suggestion-card {
  margin-top: 8px;
  width: 100%;
  background: #ffffff;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.ai-suggestion-head {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-text);
  background: rgba(37, 99, 235, 0.07);
  border-bottom: 1px solid rgba(37, 99, 235, 0.12);
}

.ai-suggestion-target {
  padding: 6px 12px;
  font-size: 11.5px;
  color: var(--color-text-secondary);
  border-bottom: 1px dashed var(--color-border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-suggestion-list {
  max-height: 240px;
  overflow-y: auto;
}

.ai-suggestion-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  cursor: pointer;
  transition: background 0.12s ease;
}

.ai-suggestion-item:hover {
  background: rgba(37, 99, 235, 0.04);
}

.ai-suggestion-item:last-child {
  border-bottom: none;
}

.ai-suggestion-item input[type='checkbox'] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.ai-suggestion-item-body {
  min-width: 0;
}

.ai-suggestion-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text);
}

.ai-suggestion-item-desc {
  margin-top: 3px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--color-text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 88px;
  overflow-y: auto;
}

.ai-suggestion-foot {
  padding: 9px 12px;
  background: rgba(15, 23, 42, 0.02);
  display: flex;
  justify-content: flex-end;
}

.ai-suggestion-apply-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.ai-suggestion-apply-btn:hover {
  background: #1e40af;
  transform: translateY(-1px);
}

.ai-suggestion-applied {
  font-size: 12.5px;
  font-weight: 600;
  color: #047857;
}

/* 输入区 */
.ai-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--color-border);
  background: #ffffff;
  flex-shrink: 0;
}

.ai-input-row textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--color-border-strong);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 13px;
  font-family: var(--font-body);
  line-height: 1.5;
  max-height: 96px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-input-row textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ai-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.ai-send-btn:hover {
  background: #1e40af;
}

.ai-send-btn.streaming {
  background: var(--danger);
}

.ai-send-btn.streaming:hover {
  background: #b91c1c;
}

/* 设置弹窗里的 AI Key 状态提示 */
.ai-key-status {
  color: #047857;
}

/* ========================= 手机端 H5 ========================= */
@media (max-width: 768px) {
  body {
    font-size: 15px;
  }

  .sidebar-menu-btn {
    display: flex;
  }

  .app-header {
    flex-wrap: wrap;
    gap: 10px 8px;
    padding: 10px 12px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .brand-name {
    font-size: 16px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-spacer {
    display: none;
  }

  .header-search-row {
    flex: 1 1 100%;
    order: 4;
    gap: 8px;
  }

  .search-container {
    flex: 1 1 auto;
    order: 0;
    min-width: 0;
  }

  .header-search-row .search-container input {
    height: 40px;
    padding: 0 14px;
  }

  .view-switch {
    margin-left: auto;
    flex-shrink: 0;
  }

  .view-button {
    padding: 8px 12px;
    min-height: 40px;
  }

  .board-switch {
    flex-wrap: nowrap;
    margin: 0;
    gap: 6px;
    min-width: 0;
  }

  .board-switch-label {
    width: auto;
    margin-right: 0;
    font-size: 12px;
  }

  .board-switch-btn {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 4px 12px;
    font-size: 13px;
  }

  .filters select,
  .toggle-done-btn {
    min-height: 32px;
    padding: 4px 8px;
  }

  .toggle-done-btn {
    font-size: 13px;
  }

  .task-filter-group > select {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }

  .toggle-done-btn {
    flex: 1 1 auto;
    min-width: 0;
  }

  .sort-icon-btn {
    width: 32px;
    height: 32px;
  }

  .sort-menu {
    left: auto;
    right: 0;
  }

  .sort-menu-item {
    min-height: 44px;
    font-size: 15px;
    display: flex;
    align-items: center;
  }

  .quick-add-toggle {
    width: auto;
    min-height: 32px;
    padding: 4px 12px;
    justify-content: center;
    font-size: 13px;
  }

  .expand-btn {
    display: none;
  }

  .task-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-top: 4px;
  }

  .task-meta-row .status-tag,
  .task-meta-row .priority-tag {
    min-height: 0;
    padding: 2px 8px;
    font-size: 12px;
  }

  /* 手机标签：状态是淡底圆点，优先级是细环，临期只留描边 */
  .task-meta-row .status-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px 3px 7px;
    border: 1px solid transparent;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.2;
    box-shadow: none;
  }

  .task-meta-row .status-tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
  }

  .task-meta-row .status-tag.status-paused::before,
  .task-meta-row .status-tag.status-milestone::before {
    display: none;
  }

  .task-meta-row .status-tag.status-in-progress::before {
    content: '▶';
    width: auto;
    height: auto;
    border-radius: 0;
    background: none;
    font-size: 8px;
    line-height: 1;
  }

  .task-meta-row .status-tag.status-done::before {
    content: '✓';
    width: auto;
    height: auto;
    border-radius: 0;
    background: none;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
  }

  .task-meta-row .status-tag.status-milestone.status-done::before {
    display: none;
  }

  .task-meta-row .status-tag.status-todo {
    background: #f2f4f7;
    color: #3e4858;
    border-color: rgba(15, 23, 42, 0.08);
  }

  .task-meta-row .status-tag.status-in-progress {
    background: #eef3ff;
    color: #1e3a8a;
    border-color: rgba(37, 99, 235, 0.16);
  }

  .task-meta-row .status-tag.status-paused {
    background: #f8f3ea;
    color: #8a5a18;
    border-color: rgba(146, 96, 16, 0.18);
  }

  .task-meta-row .status-tag.status-done {
    background: #eef6f4;
    color: #115e59;
    border-color: rgba(15, 118, 110, 0.16);
  }

  .task-meta-row .status-tag.status-milestone.status-done {
    background: #fbf6ea;
    color: #8a5a12;
    border-color: rgba(146, 96, 16, 0.22);
    box-shadow: none;
  }

  .task-meta-row .status-tag:hover {
    filter: none;
  }

  .task-meta-row .priority-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #fff;
    border: 1.5px solid currentColor;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
  }

  .task-meta-row .priority-high {
    color: var(--priority-high);
  }

  .task-meta-row .priority-medium {
    color: #b45309;
  }

  .task-meta-row .priority-low {
    color: #0f766e;
  }

  .task-meta-row .task-due-line,
  .kanban-card-meta .task-due-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1 0 calc(100% + 44px);
    width: calc(100% + 44px);
    margin-right: -44px;
    gap: 8px;
    min-width: 0;
  }

  .kanban-card-meta .task-due-line {
    flex-basis: calc(100% + 40px);
    width: calc(100% + 40px);
    margin-right: -40px;
  }

  .task-meta-row .task-due-line .task-due-date,
  .kanban-card-meta .task-due-line .task-due-date {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 0;
  }

  .task-meta-row .task-due-line .due-tag,
  .kanban-card-meta .task-due-line .due-tag {
    flex: 0 0 auto;
    margin-left: auto;
    padding: 2px 7px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid transparent;
    font-weight: 600;
    box-shadow: none;
  }

  .task-meta-row .task-due-line .due-tag.due-soon,
  .kanban-card-meta .task-due-line .due-tag.due-soon {
    color: #9a6700;
    border-color: rgba(154, 103, 0, 0.28);
  }

  .task-meta-row .task-due-line .due-tag.due-overdue,
  .kanban-card-meta .task-due-line .due-tag.due-overdue {
    color: var(--priority-high);
    border-color: rgba(180, 35, 24, 0.28);
  }

  .task-meta-row .repeat-tag {
    padding: 2px 8px;
    font-size: 12px;
    background: #f3fbf9;
    color: #0f766e;
    border: 1px solid rgba(15, 118, 110, 0.18);
  }

  .task-meta-row .subtask-meta-toggle {
    padding: 0;
    font-size: 12px;
    color: #6b7280;
  }

  .task-meta-row .task-due-date,
  .kanban-card-meta .task-due-date {
    flex: 0 1 auto;
    margin-left: 0;
  }

  .task-title-side .task-detail-btn,
  .kanban-card .task-detail-btn {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 999px;
    padding: 0 8px;
    min-height: 22px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1;
  }

  .brand-mark {
    width: 24px;
    height: 24px;
  }

  .app-body {
    grid-template-columns: 1fr;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(15, 23, 42, 0.42);
    border: 0;
    padding: 0;
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 320px);
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.28s var(--ease-out);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: none;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(15, 23, 42, 0.22);
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .list-drag-handle {
    display: none;
  }

  .list-item {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }

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

  .sidebar-drawer-close {
    display: flex;
  }

  .main-content {
    padding: 10px 0 16px 12px;
  }

  .settings-view-header {
    padding: 12px 16px 10px;
  }

  .settings-view-body {
    padding: 16px 16px 40px;
  }

  .filters {
    flex-wrap: wrap;
    margin-right: 12px;
    gap: 8px;
  }

  .task-filter-group {
    flex-wrap: wrap;
    width: 100%;
  }

  .filters-spacer {
    display: none;
  }

  .filters-end {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    width: auto;
  }

  .filters select,
  .quick-add-row input,
  .quick-add-row select,
  .search-container input,
  .sidebar-footer input,
  .detail-body input,
  .detail-body select,
  .detail-body textarea,
  .modal-body input,
  .ai-input-row textarea {
    font-size: 16px;
  }

  .task-filter-group > select {
    height: 32px;
    min-height: 32px;
    padding: 0 26px 0 10px;
    font-size: 13px;
    line-height: 30px;
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--color-elevated);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%2364748b' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
  }

  .quick-add {
    margin-right: 12px;
  }

  .quick-add-row {
    flex-direction: column;
  }

  .task-list {
    padding: 0 12px max(16px, env(safe-area-inset-bottom)) 0;
  }

  .kanban-pager {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: 0 12px 8px 0;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .kanban-pager::-webkit-scrollbar {
    display: none;
  }

  .kanban-pager-btn {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border-strong);
    background: var(--color-elevated);
    color: var(--color-text-secondary);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
  }

  .kanban-pager-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }

  .kanban-board {
    margin-right: 12px;
    padding: 0;
    gap: 0;
    height: 100%;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .kanban-board::-webkit-scrollbar {
    display: none;
  }

  .kanban-column {
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: auto;
    align-self: stretch;
    background: var(--color-elevated);
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .kanban-column-body {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .kanban-card {
    padding: 14px;
    cursor: pointer;
    touch-action: pan-x pan-y;
  }

  .kanban-card .priority-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #fff;
    border: 1.5px solid currentColor;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
  }

  .kanban-card .priority-high { color: var(--priority-high); }
  .kanban-card .priority-medium { color: #b45309; }
  .kanban-card .priority-low { color: #0f766e; }

  .kanban-card .kanban-due-soon { color: #9a6700; }
  .kanban-card .kanban-due-overdue { color: var(--priority-high); }

  .kanban-card-head {
    position: relative;
  }

  .kanban-card-head:has(> .task-detail-btn) {
    padding-right: 40px;
  }

  .kanban-card-head > .task-detail-btn {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
  }

  .kanban-move-btn {
    margin-left: auto;
    border: none;
    background: transparent;
    color: var(--accent-text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 2px 0;
    min-height: 32px;
  }

  .phone-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: flex-end;
    background: rgba(15, 23, 42, 0.42);
  }

  .phone-sheet-backdrop.hidden {
    display: none;
  }

  .phone-sheet {
    width: 100%;
    background: var(--color-elevated);
    border-radius: 16px 16px 0 0;
    padding: 8px 16px max(12px, env(safe-area-inset-bottom));
  }

  .phone-sheet-handle {
    width: 36px;
    height: 4px;
    margin: 4px auto 12px;
    border-radius: 999px;
    background: #d1d5db;
  }

  .phone-sheet-title {
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 700;
  }

  .phone-sheet-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .phone-sheet-action,
  .phone-sheet-cancel {
    width: 100%;
    min-height: 48px;
    border-radius: 12px;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
  }

  .phone-sheet-action {
    border: 1px solid var(--color-border);
    background: var(--color-page);
    color: var(--color-text);
  }

  .phone-sheet-action.is-current {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-text);
  }

  .phone-sheet-action.is-danger {
    color: var(--danger-text);
    border-color: #fecaca;
  }

  .phone-sheet > .phone-sheet-cancel {
    margin-top: 4px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
  }

  .phone-sheet-footer {
    display: flex;
    gap: 8px;
    margin-top: 12px;
  }

  .phone-sheet-footer .phone-sheet-cancel,
  .phone-sheet-footer .phone-sheet-confirm {
    flex: 1;
    width: auto;
    margin-top: 0;
  }

  .phone-sheet-footer .phone-sheet-cancel {
    border: 1px solid var(--color-border);
    background: var(--color-page);
    color: var(--color-text);
  }

  .phone-sheet-confirm {
    border: none;
    background: var(--accent);
    color: #fff;
  }

  @keyframes phone-sheet-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  #addListModal,
  #renameListModal,
  #confirmModal,
  #completionNoteModal {
    z-index: 85;
    align-items: flex-end;
    background: rgba(15, 23, 42, 0.42);
  }

  #addListModal > .modal,
  #renameListModal > .modal,
  #confirmModal > .modal,
  #completionNoteModal > .modal {
    width: 100%;
    max-width: none;
    border: none;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.16);
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    animation: phone-sheet-up 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    touch-action: pan-x;
  }

  #addListModal > .modal::before,
  #renameListModal > .modal::before,
  #confirmModal > .modal::before,
  #completionNoteModal > .modal::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    margin: 8px auto 0;
    border-radius: 999px;
    background: #d1d5db;
  }

  #addListModal .modal-header,
  #renameListModal .modal-header,
  #confirmModal .modal-header,
  #completionNoteModal .modal-header {
    padding: 10px 16px 6px;
    border-bottom: none;
    font-size: 16px;
  }

  #addListModal .modal-header .icon-button,
  #renameListModal .modal-header .icon-button,
  #completionNoteModal .modal-header .icon-button {
    display: none;
  }

  #addListModal .modal-body,
  #renameListModal .modal-body,
  #confirmModal .modal-body,
  #completionNoteModal .modal-body {
    padding: 4px 16px 8px;
  }

  #addListModal .modal-body input,
  #renameListModal .modal-body input {
    height: 44px;
    border-radius: 12px;
  }

  #completionNoteModal textarea {
    border-radius: 12px;
  }

  #addListModal .modal-footer,
  #renameListModal .modal-footer,
  #confirmModal .modal-footer,
  #completionNoteModal .modal-footer {
    padding: 8px 16px 4px;
  }

  #addListModal .modal-footer button,
  #renameListModal .modal-footer button,
  #confirmModal .modal-footer button,
  #completionNoteModal .modal-footer button {
    flex: 1;
    min-height: 48px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
  }

  #addListModal .modal-footer button:not(.primary),
  #renameListModal .modal-footer button:not(.primary),
  #confirmModal .modal-footer button:not(.primary),
  #completionNoteModal .modal-footer button:not(.primary) {
    border-color: var(--color-border);
    background: var(--color-page);
    color: var(--color-text);
  }

  #confirmModal .modal-footer button.primary {
    background: var(--danger);
    border-color: var(--danger);
  }

  .phone-quick-add-slot .quick-add-form,
  .phone-quick-add-slot .quick-add-form-inner {
    display: block;
    overflow: visible;
    opacity: 1;
    pointer-events: auto;
    min-height: auto;
  }

  .phone-quick-add-slot .quick-add-row {
    flex-direction: column;
  }

  .phone-quick-add-slot .quick-add-row input,
  .phone-quick-add-slot .quick-add-row select {
    width: 100%;
    height: 44px;
    font-size: 16px;
  }

  .kanban-mobile-status {
    display: none;
  }

  .task-item {
    padding: 10px 10px;
    min-height: 56px;
    align-items: center;
  }

  /* 优先级跟在状态后面；详情和临期仍贴在卡片右侧 */
  .task-item .task-title-row {
    display: flex;
    align-items: flex-start;
    width: 100%;
    gap: 8px;
  }

  .task-item .task-title-row > span {
    flex: 1 1 auto;
    min-width: 0;
  }

  .task-item:has(.task-title-side) > .task-content {
    padding-right: 44px;
  }

  .task-item .task-title-side {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    margin-left: 0;
  }

  .task-item.subtask,
  .add-subtask-row {
    margin-left: 16px;
  }

  .add-subtask-input {
    font-size: 16px;
    min-height: 40px;
  }

  .task-item > .task-content {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .task-item > .task-content > .task-cover {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .task-item > .task-content > .task-due-date,
  .task-item > .task-content > .today-unpin-btn {
    flex: 1 0 100%;
    margin-left: 0;
  }

  /* 列表卡片上的完成详情只在电脑版保留，手机上改从任务详情里看 */
  .task-item .completion-history-btn {
    display: none;
  }

  .detail-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    z-index: 32;
    border-left: none;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .detail-panel.open {
    box-shadow: none;
  }

  .settings-view,
  .auth-view {
    z-index: 26;
  }

  .mcp-step-cards {
    grid-template-columns: 1fr;
  }

  .mcp-urlbar {
    flex-wrap: wrap;
  }

  .mcp-tabs {
    gap: 6px;
  }

  .modal {
    width: calc(100vw - 24px);
    max-width: 400px;
  }

  .completion-history-modal {
    width: calc(100vw - 24px);
    max-width: 540px;
    max-height: 86vh;
  }

  .ai-fab {
    position: static;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    animation: none;
    touch-action: manipulation;
    box-shadow:
      0 2px 8px rgba(37, 99, 235, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }

  .ai-fab-logo {
    width: 22px;
    height: 22px;
  }

  .ai-panel {
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
    height: min(86dvh, calc(100dvh - 72px));
    max-width: none;
    border-radius: 14px;
  }

  .account-actions {
    flex-direction: column;
  }

  .account-signin-btn,
  .account-magiclink-btn {
    width: 100%;
  }

  /* 视图、筛选、新建收成两行，给任务列表留出高度 */
  .main-content > #taskListSection {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    align-items: stretch;
    column-gap: 8px;
    row-gap: 6px;
  }

  .main-content > #taskListSection {
    margin: -10px 0 0 -12px;
    padding: 10px 0 0 12px;
  }

  #taskListSection > .task-toolbar,
  #taskListSection .task-toolbar > .filters {
    display: contents;
  }

  /* 垫在第 1、2 行（视图切换 + 筛选）后面的底色，铺到屏幕两边 */
  .main-content > #taskListSection::before {
    content: '';
    grid-column: 1 / -1;
    grid-row: 1 / 3;
    margin: -10px 0 -6px -12px;
    background: var(--toolbar-surface);
    border-bottom: 1px solid var(--color-border);
    pointer-events: none;
  }

  #taskListSection.toolbar-collapsed::before {
    display: none;
  }

  #taskListSection .task-toolbar > .board-switch {
    grid-column: 1;
    grid-row: 1;
  }

  #taskListSection .task-filter-group {
    grid-column: 1 / -1;
    grid-row: 2;
    width: auto;
    margin-right: 12px;
  }

  #taskListSection .filters-end {
    grid-column: 2;
    grid-row: 1;
    margin-right: 12px;
  }

  #archiveViewBanner {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-right: 12px;
  }

  #kanbanPager {
    grid-column: 1 / -1;
    grid-row: 4;
  }

  #taskList,
  #kanbanBoard {
    grid-column: 1 / -1;
    grid-row: 5;
    min-height: 0;
  }

  #taskList,
  .kanban-column-body {
    overflow-anchor: none;
  }

  #taskListSection.toolbar-collapsed .board-switch,
  #taskListSection.toolbar-collapsed .task-filter-group,
  #taskListSection.toolbar-collapsed .filters-end,
  #taskListSection.toolbar-collapsed #kanbanPager {
    display: none;
  }
}


/* ===== 对齐 App 规范（docs/WEB_PARITY_GOAL.md）===== */
/* 这一段在文件最后，覆盖上面按「宽屏 / 窄屏」分别写的旧卡片样式。
   卡片结构由 renderer.js 的 buildCardRows 产出：.task-card-top（标题 + 项目 + 头图）和 .task-meta-row。 */

/* ----- 卡片本体：列表卡片和看板卡片 ----- */
.task-item.pg-card,
.kanban-card.pg-card {
  position: relative;
  display: block;
  min-height: 0;
  padding: 10px;
  background: var(--status-todo-card-bg);
  border: 1px solid var(--status-todo-card-border);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.09);
  outline: none;
}
/* 旧样式里卡片左侧有一条 4px 的状态色条，App 上已经去掉 */
.task-item.pg-card::before,
.kanban-card.pg-card::before {
  content: none;
}
.pg-card.card-in-progress {
  background: var(--status-in-progress-card-bg);
  border-color: var(--status-in-progress-card-border);
}
.pg-card.card-paused {
  background: var(--status-paused-card-bg);
  border-color: var(--status-paused-card-border);
}
.pg-card.card-done {
  background: var(--status-done-card-bg);
  border-color: var(--status-done-card-border);
}
/* 里程碑（已达成）：金色渐变底和金色描边，庆祝效果的一部分，保留 */
.pg-card.card-done.card-milestone {
  background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 40%, #fffdf5 70%, #ffffff 100%);
  border-color: var(--milestone-border);
}
@media (hover: hover) {
  .task-item.pg-card:hover,
  .kanban-card.pg-card:hover {
    background: var(--status-todo-card-bg);
    border-color: var(--color-border-strong);
    transform: none;
  }
  .pg-card.card-in-progress:hover { background: var(--status-in-progress-card-bg); }
  .pg-card.card-paused:hover { background: var(--status-paused-card-bg); }
  .pg-card.card-done:hover { background: var(--status-done-card-bg); }
  .pg-card.card-done.card-milestone:hover {
    background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 40%, #fffdf5 70%, #ffffff 100%);
    border-color: var(--milestone-border);
  }
}
/* 选中、键盘聚焦：主色描边 + 外环 */
.pg-card.is-selected,
.pg-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

/* ----- 第一、二行：标题（固定两行高）和所属项目，右边是头图 ----- */
.pg-card .task-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.pg-card .task-card-text {
  flex: 1 1 auto;
  min-width: 0;
}
.pg-card .task-title {
  height: 40px;
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
/* 电脑宽屏的列表：一行足够放下标题，不再预留第二行，放不下的用省略号。
   手机窄屏和看板的窄卡片还是两行 */
@media (min-width: 769px) {
  .task-item.pg-card .task-title {
    height: 20px;
    -webkit-line-clamp: 1;
  }
}
/* 已完成：字变浅、常规字重；划线细一点、比字再浅一档 */
.pg-card.done .task-title {
  color: var(--color-text-tertiary);
  font-weight: 400;
  text-decoration: line-through;
  text-decoration-color: var(--color-separator);
  text-decoration-thickness: 1px;
}
.pg-card .task-project {
  height: 18px;
  margin-top: 4px;
  font-size: 12px;
  line-height: 18px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pg-card .task-cover {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin: 0;
  border-radius: 6px;
  object-fit: cover;
  background: var(--color-sunken);
}
/* 有项目行时，头图占「标题两行 + 项目一行」的高度 */
.pg-card .task-cover.task-cover-tall {
  width: 62px;
  height: 62px;
}
.pg-card .expand-btn {
  flex: 0 0 auto;
  align-self: flex-start;
  margin: 0 -4px 0 -4px;
  height: 20px;
}

/* ----- 第三行：标签靠左，日期靠右 ----- */
.pg-card .task-meta-row {
  display: flex;
  align-items: center;
  height: 24px;
  margin: 6px 0 0;
  padding: 0;
  gap: 0;
  flex-wrap: nowrap;
}
.pg-card .task-meta-tags {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}
.pg-card .task-meta-tags > * {
  flex: 0 0 auto;
}
.pg-card .task-due {
  flex: 0 0 auto;
  margin-left: 8px;
  font-size: 12px;
  line-height: 16px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
}
.pg-card .task-due-overdue {
  color: var(--danger-text);
  font-weight: 600;
}
.pg-card .task-due-soon {
  color: var(--warning);
  font-weight: 600;
}

/* ----- 标签：状态、优先级、周期、子任务进度 ----- */
.pg-card .status-tag,
.pg-card .task-meta-row .status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px 0 7px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  box-shadow: none;
  filter: none;
  cursor: pointer;
}
.pg-card .status-tag::before,
.pg-card .task-meta-row .status-tag::before {
  content: none;
  display: none;
}
.pg-card .status-tag.status-todo,
.pg-card .task-meta-row .status-tag.status-todo {
  background: var(--status-todo-bg);
  color: var(--status-todo-fg);
  border-color: var(--status-todo-border);
}
.pg-card .status-tag.status-in-progress,
.pg-card .task-meta-row .status-tag.status-in-progress {
  background: var(--status-in-progress-bg);
  color: var(--status-in-progress-fg);
  border-color: var(--status-in-progress-border);
}
.pg-card .status-tag.status-paused,
.pg-card .task-meta-row .status-tag.status-paused {
  background: var(--status-paused-bg);
  color: var(--status-paused-fg);
  border-color: var(--status-paused-border);
}
.pg-card .status-tag.status-done,
.pg-card .task-meta-row .status-tag.status-done {
  background: var(--status-done-bg);
  color: var(--status-done-fg);
  border-color: var(--status-done-border);
}
.pg-card .status-tag.status-milestone.status-done,
.pg-card .task-meta-row .status-tag.status-milestone.status-done {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(138, 90, 10, 0.3);
  padding: 0 9px 0 7px;
}
.pg-card .status-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.pg-card .status-glyph-todo {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: currentColor;
}
.pg-card .status-glyph-in-progress {
  font-size: 8px;
  font-weight: 700;
}
.pg-card .status-glyph-done {
  font-size: 12px;
  font-weight: 700;
}
.pg-card .status-glyph-milestone {
  font-size: 12px;
}
.pg-card .status-glyph-paused {
  gap: 2.5px;
}
.pg-card .status-glyph-paused i {
  width: 2.5px;
  height: 9px;
  border-radius: 1px;
  background: currentColor;
}
.pg-card .priority-tag,
.pg-card .task-meta-row .priority-tag,
.kanban-card.pg-card .priority-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  background: var(--color-elevated);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}
.pg-card .priority-tag.priority-high { color: var(--priority-high); background: var(--color-elevated); }
.pg-card .priority-tag.priority-medium { color: var(--priority-medium); background: var(--color-elevated); }
.pg-card .priority-tag.priority-low { color: var(--priority-low); background: var(--color-elevated); }
.pg-card .repeat-tag {
  height: 22px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid rgba(11, 110, 99, 0.2);
  border-radius: 999px;
  background: #eaf6f3;
  color: #0b6e63;
  font-size: 12px;
  font-weight: 500;
}
.pg-card .subtask-progress {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--color-text-secondary);
}
.pg-card .completion-history-btn {
  position: static;
  margin: 0;
  height: 22px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.pg-card .today-unpin-btn {
  margin-top: 6px;
}

/* ----- 窄屏右上角的「…」；宽屏不显示（宽屏点卡片就开详情，悬停有快捷按钮） ----- */
.pg-card .task-detail-btn {
  display: none;
}

/* ----- 宽屏：改状态、右键卡片弹出的小菜单 ----- */
.floating-menu {
  position: fixed;
  z-index: 1000;
  min-width: 132px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--color-elevated);
  border: 1px solid var(--color-border);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}
.floating-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
  cursor: pointer;
}
.floating-menu-item:hover,
.floating-menu-item:focus-visible {
  background: var(--fill-neutral);
  outline: none;
}
.floating-menu-item.is-current {
  color: var(--accent-text);
  font-weight: 600;
  background: var(--accent-soft);
}
.floating-menu-item.is-danger { color: var(--danger-text); }
.phone-sheet-action.is-danger { color: var(--danger-text); }

/* ----- 子任务：缩进 + 连线，最上面一条进度 ----- */
.subtask-progress-bar {
  margin: 2px 0 8px 32px;
  padding: 0 4px;
}
.subtask-progress-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}
.subtask-progress-track {
  height: 6px;
  border-radius: 3px;
  background: var(--fill-neutral);
  overflow: hidden;
}
.subtask-progress-fill {
  height: 6px;
  border-radius: 3px;
  background: var(--success);
}
.kanban-card .subtask-progress-bar {
  margin: 10px 0 6px;
}
/* 连线用主色的浅一档，一眼看出是挂在主任务下面的 */
.subtask-branch-list::before,
.subtask-branch-list > .task-item.subtask::after,
.subtask-branch-list > .add-subtask-row::after {
  background: var(--accent-ring);
}
.subtask-branch-list > .task-item.subtask.pg-card {
  margin-left: 0;
}

/* ----- 看板卡片的补充 ----- */
.kanban-card.pg-card {
  margin: 0;
}
.kanban-card.pg-card.kanban-card-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

/* ----- 窄屏 ----- */
@media (max-width: 768px) {
  .task-item.pg-card,
  .kanban-card.pg-card {
    padding: 10px;
    margin: 0;
  }
  .pg-card .task-card-top {
    padding-right: 34px;
  }
  .pg-card .task-detail-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 8px;
    right: 8px;
    min-height: 22px;
    padding: 0 8px;
    border: 1px solid var(--color-border-strong);
    border-radius: 999px;
    background: var(--color-elevated);
    color: var(--color-text);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 20px;
  }
  .pg-card .expand-btn {
    display: none;
  }
  .subtask-progress-bar {
    margin-left: 20px;
  }
}

/* ===== 详情面板（对齐 App）===== */
.detail-panel .detail-body {
  gap: 12px;
  padding: 12px;
  background: var(--color-page);
}
/* 一块白色圆角卡片 */
.detail-block {
  border-radius: var(--radius-md);
  background: var(--color-elevated);
}
/* 第一块：头图小方图在左，标题和头图按钮在右 */
.detail-head-block {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
}
.detail-head-block .detail-cover-preview {
  position: relative;
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  min-width: 88px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-sunken);
}
.detail-head-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-body textarea.detail-title-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  resize: none;
  overflow: hidden;
  font-family: inherit;
  font-size: 20px;
  line-height: 26px;
  font-weight: 600;
  color: var(--color-text);
}
.detail-body textarea.detail-title-input:focus {
  box-shadow: none;
  outline: none;
}
.detail-head-block .cover-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}
.detail-head-block .cover-upload-label,
.detail-head-block .cover-ai-btn {
  display: inline-flex;
  /* 「上传头图」是个 label，会被 .detail-body label 排成上下一列，文字就贴到按钮顶上去了；这里改回横排并居中 */
  flex-direction: row;
  justify-content: center;
  gap: 0;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
}
.detail-head-block .cover-upload-label {
  background: var(--fill-neutral);
  color: var(--color-text);
}
.detail-head-block .cover-upload-label.hidden {
  display: none;
}
.detail-head-block .cover-ai-btn {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.detail-head-block .cover-ai-btn:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.18);
}

/* 第二块：描述 */
.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  margin-bottom: 6px;
  padding: 0 6px 0 14px;
}
.detail-section-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text);
}
.detail-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--accent);
  cursor: pointer;
}
.detail-icon-btn:hover {
  background: var(--accent-soft);
}
.detail-icon-btn.hidden,
.detail-desc-edit-actions.hidden {
  display: none;
}
.detail-desc-edit-actions {
  display: inline-flex;
  gap: 4px;
}
.detail-text-btn {
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-text);
  cursor: pointer;
}
.detail-text-btn:hover {
  background: var(--accent-soft);
}
.detail-text-btn.is-muted {
  color: var(--color-text-secondary);
  font-weight: 500;
}
.detail-text-btn.is-muted:hover {
  background: var(--fill-neutral);
}
.detail-text-btn.is-danger {
  color: var(--danger-text);
}
.detail-text-btn.is-danger:hover {
  background: var(--danger-soft);
}
.detail-text-btn.hidden {
  display: none;
}
.detail-desc-block {
  overflow: hidden;
}
.detail-desc-block .detail-desc-preview {
  min-height: 48px;
  padding: 12px 14px 14px;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 16px;
  line-height: 24px;
  cursor: default;
}
.detail-desc-block .detail-desc-preview.is-collapsed {
  max-height: 192px;
  overflow: hidden;
}
.detail-desc-block .detail-desc-preview.detail-desc-preview--empty {
  color: var(--color-text-tertiary);
}
.detail-body .detail-desc-block textarea.detail-desc-textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 96px;
  padding: 12px 14px 14px;
  border: 0;
  border-radius: 0;
  background: none;
  resize: none;
  font-size: 16px;
  line-height: 24px;
}
.detail-body .detail-desc-block textarea.detail-desc-textarea.hidden {
  display: none;
}
.detail-body .detail-desc-block textarea.detail-desc-textarea:focus {
  box-shadow: inset 0 0 0 2px var(--accent-ring);
}
.detail-desc-toggle {
  display: block;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-top: 1px solid var(--color-border);
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-text);
  cursor: pointer;
}
.detail-desc-toggle:hover {
  background: var(--fill-neutral);
}
.detail-desc-toggle.hidden {
  display: none;
}

/* 第三块：属性。每行左边名称、右边控件，行间细线 */
.detail-props {
  overflow: hidden;
}
.detail-body .detail-prop-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 6px 10px 6px 14px;
  font-size: 16px;
  color: var(--color-text);
}
.detail-body .detail-prop-row + .detail-prop-row {
  border-top: 1px solid var(--color-border);
}
.detail-body .detail-prop-row .detail-label-text {
  flex: 0 0 auto;
  margin: 0;
  font-size: 16px;
  color: var(--color-text);
}
.detail-body .detail-prop-row select,
.detail-body .detail-prop-row input {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 62%;
  margin-left: auto;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background-color: transparent;
  font-size: 16px;
  color: var(--color-text-secondary);
  text-align: right;
  text-align-last: right;
  cursor: pointer;
}
.detail-body .detail-prop-row select:hover,
.detail-body .detail-prop-row input:hover {
  background-color: var(--fill-neutral);
}
.detail-body .detail-prop-row .detail-parent-name {
  margin-left: auto;
  padding-right: 8px;
  font-size: 16px;
  color: var(--color-text-secondary);
  text-align: right;
}
/* 状态和优先级的当前值带对应的颜色 */
#detailStatus[data-status="todo"] { color: var(--status-todo-fg); font-weight: 500; }
#detailStatus[data-status="in_progress"] { color: var(--status-in-progress-fg); font-weight: 500; }
#detailStatus[data-status="paused"] { color: var(--status-paused-fg); font-weight: 500; }
#detailStatus[data-status="done"] { color: var(--status-done-fg); font-weight: 500; }
#detailStatus[data-status="milestone"] { color: var(--warning); font-weight: 500; }
#detailPriority[data-priority="high"] { color: var(--priority-high); font-weight: 500; }
#detailPriority[data-priority="medium"] { color: var(--priority-medium); font-weight: 500; }
#detailPriority[data-priority="low"] { color: var(--priority-low); font-weight: 500; }
#detailStatus option,
#detailPriority option {
  color: var(--color-text);
  font-weight: 400;
}

/* 第四块：动作。完成详情、归档在左，删除在右 */
.detail-panel .detail-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 2px 6px;
  border-radius: var(--radius-md);
  background: var(--color-elevated);
}
.detail-actions-gap {
  flex: 1 1 auto;
}
.detail-panel .detail-meta {
  margin-top: 0;
  text-align: center;
  font-size: 13px;
  line-height: 20px;
  color: var(--color-text-secondary);
}

/* 头图裁剪弹窗 */
.cover-crop-backdrop {
  z-index: 1200;
}
.cover-crop-modal {
  width: 328px;
  max-width: calc(100vw - 32px);
  border-radius: 16px;
}
.cover-crop-view {
  position: relative;
  width: 280px;
  height: 280px;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--color-sunken);
  touch-action: none;
  cursor: grab;
}
.cover-crop-view:active {
  cursor: grabbing;
}
.cover-crop-img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  transform-origin: 0 0;
  user-select: none;
  pointer-events: none;
}
.cover-crop-hint {
  margin: 10px 0 8px;
  font-size: 13px;
  line-height: 18px;
  color: var(--color-text-secondary);
}
.cover-crop-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--color-text-secondary);
}
.cover-crop-zoom input {
  flex: 1 1 auto;
  accent-color: var(--accent);
}
@media (max-width: 768px) {
  .cover-crop-backdrop {
    align-items: center;
    justify-content: center;
  }
}

/* ===== 新建（对齐 App）===== */
/* 新增任务：「创建并打开详情」是文字链接，不和主操作抢 */
.quick-add-open-detail {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0.92;
}
.quick-add-open-detail:hover {
  background: rgba(255, 255, 255, 0.14);
  opacity: 1;
}
/* 还没选的下拉框，字用占位的颜色 */
#quickList:has(option[value='']:checked),
#quickRepeat:has(option[value='']:checked) {
  color: var(--color-text-tertiary);
}
#quickList option,
#quickRepeat option {
  color: var(--color-text);
}

/* 新建项目、重命名项目：两种宽度都是屏幕中间的小弹窗 */
#addListModal .modal,
#renameListModal .modal {
  width: 360px;
  max-width: calc(100vw - 48px);
  border-radius: 16px;
}

@media (max-width: 768px) {
  .phone-quick-add-slot .quick-add-open-detail {
    align-self: center;
    color: var(--accent-text);
  }
  .phone-quick-add-slot .quick-add-open-detail:hover {
    background: var(--accent-soft);
  }
  /* 窄屏原来是从底部弹出的面板，改成居中 */
  #addListModal.modal-backdrop,
  #renameListModal.modal-backdrop {
    align-items: center;
    justify-content: center;
    padding: 0 24px;
  }
  #addListModal .modal,
  #renameListModal .modal {
    position: static;
    width: 100%;
    max-width: 360px;
    margin: 0;
    border-radius: 16px;
    transform: none;
    animation: none;
    padding-bottom: 12px;
  }
  #addListModal .modal::before,
  #renameListModal .modal::before {
    content: none;
    display: none;
  }
}

/* ===== 设置页：AI 模型与密钥、MCP（对齐 App）===== */
.settings-group-title {
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}
.settings-group-title:first-child {
  margin-top: 0;
}
.settings-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 520px;
  padding: 14px;
  border-radius: 14px;
  background: var(--color-elevated);
  border: 1px solid var(--color-border);
}
.ai-key-card .ai-key-status {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--success);
}
.ai-key-card .ai-key-status.hidden {
  display: none;
}
.ai-key-row {
  display: flex;
  gap: 8px;
}
.ai-key-row input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: var(--color-sunken);
  font: inherit;
  font-size: 16px;
  color: var(--color-text);
}
.ai-key-row input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-ring);
}
.ai-key-paste {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--fill-neutral);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
}
.ai-key-paste:hover {
  background: rgba(15, 23, 42, 0.12);
}
.ai-key-save {
  min-height: 44px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
}
.ai-key-save:disabled {
  background: var(--fill-neutral);
  border-color: transparent;
  color: var(--color-text-tertiary);
  cursor: default;
  box-shadow: none;
}
.ai-key-card .settings-hint {
  margin: 0;
}
.ai-model-select {
  display: block;
  width: 100%;
  max-width: 520px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-elevated);
  font: inherit;
  font-size: 15px;
  color: var(--color-text);
}
.ai-model-select.hidden,
.ai-model-note.hidden {
  display: none;
}
/* 没有 Key 时模型区只是一句说明，不是输入框 */
.ai-model-note {
  max-width: 520px;
  box-sizing: border-box;
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--fill-neutral);
  font-size: 13px;
  line-height: 18px;
  color: var(--color-text-secondary);
}

/* MCP：地址不许被折成两截；四步合成一张卡片；应用选项只留名字 */
.settings-mcp .mcp-urlbar code {
  flex: 1 1 240px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--color-sunken);
  font-size: 13px;
  line-height: 19px;
  white-space: nowrap;
  overflow-x: auto;
}
.settings-mcp .mcp-step-cards {
  display: block;
  margin-top: 12px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-elevated);
}
.settings-mcp .mcp-step-card {
  display: grid;
  grid-template-columns: 22px 1fr;
  column-gap: 12px;
  align-items: start;
  min-height: 0;
  padding: 12px 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.settings-mcp .mcp-step-card + .mcp-step-card {
  border-top: 1px solid var(--color-border);
}
.settings-mcp .mcp-step-num {
  grid-row: 1 / span 2;
  width: 22px;
  height: 22px;
  margin: 0;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
  line-height: 22px;
  text-align: center;
}
.settings-mcp .mcp-step-card h4 {
  margin: 0;
  font-size: 15px;
  line-height: 22px;
  font-weight: 600;
}
.settings-mcp .mcp-step-card p {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--color-text-secondary);
}
.settings-mcp .mcp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
}
.settings-mcp .mcp-tab {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--fill-neutral);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}
.settings-mcp .mcp-tab.on {
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
}
.settings-mcp .mcp-pane {
  margin-top: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-elevated);
}
.settings-mcp .mcp-pane.hidden {
  display: none;
}
.settings-mcp .mcp-pane ol {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 20px;
  color: var(--color-text);
}
.settings-mcp .mcp-pane li + li {
  margin-top: 8px;
}
.settings-mcp .mcp-pane .settings-mcp-note {
  margin: 12px 0 0;
}
@media (max-width: 768px) {
  /* 窄屏：标题和复制按钮一行，地址单独一行 */
  .settings-mcp .mcp-urlbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: center;
  }
  .settings-mcp .mcp-urlbar code {
    grid-column: 1 / -1;
    grid-row: 2;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* ===== 完成详情：选中态（对齐 App）===== */
.completion-cell:not(.empty-cell) {
  cursor: pointer;
}
.completion-cell.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
}
/* 只有选中的那一格才显示「补打卡」 */
.completion-cell .completion-makeup-btn {
  display: none;
}
.completion-cell.is-selected .completion-makeup-btn {
  display: inline-flex;
}
.timeline-item.is-completion {
  cursor: pointer;
  border-radius: 8px;
}
.timeline-item.is-completion.is-selected {
  background: var(--accent-soft);
}
/* 只有选中的那条记录才显示「+ 后续」；宽屏鼠标悬停时也显示 */
.timeline-item .timeline-followup-btn {
  visibility: hidden;
}
.timeline-item.is-selected .timeline-followup-btn {
  visibility: visible;
}
@media (hover: hover) {
  .timeline-item:hover .timeline-followup-btn {
    visibility: visible;
  }
}

/* ===== 看板卡片不被压扁（修正）===== */
/* 看板的一列是纵向的弹性容器。卡片一多，弹性布局会把每张卡片的高度往下压，
   标签行被裁掉、卡片叠在一起。卡片不许收缩，列自己出滚动条 */
.kanban-card.pg-card {
  flex: 0 0 auto;
  min-height: auto;
}
/* 展开的子任务同理：子任务卡片和进度条都不许被压 */
.kanban-card.pg-card .kanban-subs > .task-item.pg-card,
.kanban-card.pg-card .subtask-progress-bar,
.kanban-card.pg-card .kanban-subs > .add-subtask-row {
  flex: 0 0 auto;
}
/* 标签放不下时整个整个地收起，不把某个标签从中间切开（比如「14/19」只剩「14/」）。
   做法：允许换行，但行高只留一行，换到第二行的标签被整体藏起来 */
.pg-card .task-meta-tags {
  flex-wrap: wrap;
  height: 22px;
  row-gap: 4px;
  align-content: flex-start;
}

/* ===== 宽屏看板：日期单独一行（修正）===== */
/* 宽屏看板一行并排五列，每列只有两百多像素宽。加了「截止」之后日期最长是
   「2026-11-23截止 还有1天到期」，和标签挤在同一行会把标签挤得只剩十几像素。
   所以宽屏看板的卡片把日期放到标签下面单独一行；没有日期的卡片这一行留空，同一列的卡片仍然一样高。
   窄屏看板一次只显示一列，宽度够，仍然是标签和日期同一行。 */
@media (min-width: 769px) {
  .kanban-card.pg-card .task-meta-row {
    flex-direction: column;
    align-items: stretch;
    height: auto;
    min-height: 44px;
  }
  .kanban-card.pg-card .task-meta-tags {
    flex: 0 0 auto;
  }
  .kanban-card.pg-card .task-due {
    margin: 6px 0 0;
    height: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ===== 看板一屏四列（用户要求）===== */
/* 宽屏原来五列平分一屏，每列太窄。改成一屏正好四列，第五列横向滚动过去，
   底部的滚动条一直显示，可以直接拖。 */
@media (min-width: 769px) {
  .kanban-board {
    overflow-x: scroll;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 23, 42, 0.28) rgba(15, 23, 42, 0.06);
  }
  .kanban-board::-webkit-scrollbar {
    height: 10px;
  }
  .kanban-board::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.06);
    border-radius: 5px;
  }
  .kanban-board::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.28);
    border-radius: 5px;
  }
  .kanban-board::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.42);
  }
  /* 四列之间有三条 12px 的间隔 */
  .kanban-board > .kanban-column {
    flex: 0 0 calc((100% - 36px) / 4);
    min-width: 200px;
    /* 让卡片能按自己这一列的宽度决定排法 */
    container-type: inline-size;
    container-name: kanban-col;
  }
}
/* 列够宽（宽屏显示器上）时，标签和日期放得下同一行，回到和列表卡片一样的三行 */
@container kanban-col (min-width: 400px) {
  .kanban-card.pg-card .task-meta-row {
    flex-direction: row;
    align-items: center;
    height: 24px;
    min-height: 0;
  }
  .kanban-card.pg-card .task-meta-tags {
    flex: 1 1 auto;
  }
  .kanban-card.pg-card .task-due {
    margin: 0 0 0 8px;
    height: auto;
    overflow: visible;
  }
}

/* ===== 详情面板：宽屏字号收小，下拉框摆正（修正）===== */
/* 属性行里的下拉框和日期输入：之前做成了没有边框、文字靠右的样子，
   点开后选项列表跟着靠右、宽度也和文字对不上，看着是歪的。
   改回正常的带边框控件：固定占右边一块，文字靠左，点开的列表和它等宽对齐。 */
.detail-body .detail-prop-row select,
.detail-body .detail-prop-row input {
  flex: 0 0 58%;
  width: 58%;
  max-width: 58%;
  box-sizing: border-box;
  margin-left: auto;
  padding: 6px 8px;
  border: 1px solid var(--color-border-strong);
  border-radius: 8px;
  background-color: var(--color-elevated);
  text-align: left;
  text-align-last: left;
}
.detail-body .detail-prop-row select:hover,
.detail-body .detail-prop-row input:hover {
  background-color: var(--color-elevated);
  border-color: var(--accent-ring);
}
.detail-body .detail-prop-row .detail-parent-name {
  flex: 0 0 58%;
  box-sizing: border-box;
  padding: 0 8px;
  text-align: left;
}

/* 宽屏的详情是一个三百多像素宽的侧边面板，周围的界面是 13、14 号字。
   之前照搬了 App 整页详情的字号（标题 20、小节标题 17、正文 16），在面板里显得太大。
   宽屏收到和周围一致；窄屏是整屏的详情，保持 App 的字号。 */
@media (min-width: 769px) {
  .detail-panel .detail-body {
    gap: 10px;
    padding: 10px;
  }
  .detail-head-block {
    gap: 10px;
    padding: 12px;
  }
  .detail-head-block .detail-cover-preview {
    width: 64px;
    height: 64px;
    min-width: 64px;
  }
  .detail-head-main {
    gap: 8px;
  }
  .detail-body textarea.detail-title-input {
    font-size: 16px;
    line-height: 22px;
  }
  .detail-head-block .cover-upload-label,
  .detail-head-block .cover-ai-btn {
    height: 26px;
    padding: 0 10px;
    font-size: 12px;
  }
  .detail-section-head {
    min-height: 26px;
    margin-bottom: 4px;
    padding: 0 4px 0 12px;
  }
  .detail-section-title {
    font-size: 13px;
    color: var(--color-text-secondary);
  }
  .detail-icon-btn {
    width: 26px;
    height: 26px;
  }
  .detail-icon-btn svg {
    width: 15px;
    height: 15px;
  }
  .detail-text-btn {
    min-height: 26px;
    font-size: 13px;
  }
  .detail-desc-block .detail-desc-preview,
  .detail-body .detail-desc-block textarea.detail-desc-textarea {
    padding: 10px 12px 12px;
    font-size: 14px;
    line-height: 21px;
  }
  .detail-desc-toggle {
    min-height: 32px;
    font-size: 12px;
  }
  .detail-body .detail-prop-row {
    min-height: 40px;
    padding: 5px 10px 5px 12px;
    font-size: 14px;
  }
  .detail-body .detail-prop-row .detail-label-text {
    font-size: 14px;
    color: var(--color-text-secondary);
  }
  .detail-body .detail-prop-row select,
  .detail-body .detail-prop-row input,
  .detail-body .detail-prop-row .detail-parent-name {
    padding: 5px 8px;
    font-size: 14px;
  }
  .detail-panel .detail-actions {
    padding: 2px 4px;
  }
  .detail-panel .detail-meta {
    font-size: 12px;
    line-height: 18px;
  }
}

/* ===== 详情面板里的各块不许被压矮（修正）===== */
/* 详情面板是一个纵向的弹性容器，内容超出时靠自己滚动。
   里面带 overflow: hidden 的块（描述、属性）会被弹性布局压矮，最后一行被裁掉。
   和看板卡片是同一类问题：各块不许收缩，面板自己滚动。 */
.detail-panel .detail-body > * {
  flex-shrink: 0;
}

/* ===== 删除账号 ===== */
.account-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
}
/* 和「退出登录」一样低调，不抢眼；悬停时变红提示这是危险操作 */
.account-delete-btn:hover {
  color: var(--danger-text);
}
/* 电脑宽度下不显示「删除账号」：这个入口留给手机（App 和手机网页） */
@media (min-width: 769px) {
  .account-delete-btn {
    display: none;
  }
}

/* ===== 详情面板的展开 / 收起 ===== */
.detail-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-header .detail-expand-btn {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.detail-expand-btn .detail-collapse-icon,
.detail-panel.expanded .detail-expand-btn .detail-expand-icon {
  display: none;
}
.detail-panel.expanded .detail-expand-btn .detail-collapse-icon {
  display: block;
}
/* 只在电脑宽度下提供：手机上详情本来就是整屏 */
@media (min-width: 769px) {
  .detail-header .detail-expand-btn {
    display: inline-flex;
  }
  .detail-panel {
    transition: transform 0.28s var(--ease-out), box-shadow 0.28s var(--ease-out), width 0.28s var(--ease-out);
  }
  /* 260px 是左侧项目列表的宽度（.app-body 的第一列） */
  .detail-panel.expanded {
    width: calc(100% - 260px);
  }
}

/* ===== 登录页：同意用户协议和隐私政策 ===== */
.auth-agree {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  cursor: pointer;
}
.auth-agree input[type='checkbox'] {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  margin: 1.5px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.auth-agree .legal-link {
  color: var(--accent-text);
  text-decoration: none;
}
.auth-agree .legal-link:hover {
  text-decoration: underline;
}
.auth-agree.is-nudged {
  animation: auth-agree-nudge 0.36s ease;
  color: var(--danger-text);
}
@keyframes auth-agree-nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
@media (prefers-reduced-motion: reduce) {
  .auth-agree.is-nudged {
    animation: none;
  }
}

/* ===== 设置：关于我们 ===== */
.about-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.about-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #0f172a 0%, #17308f 48%, #17409a 70%, #0f766e 118%);
}
.about-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-text);
}
.about-slogan {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--color-text-secondary);
}
.about-links {
  gap: 0;
  padding: 0;
  overflow: hidden;
}
.about-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  font-size: 13.5px;
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.15s ease;
}
.about-link + .about-link {
  border-top: 1px solid var(--color-border);
}
.about-link:hover {
  background: rgba(15, 23, 42, 0.04);
}
.about-link svg {
  color: var(--color-text-secondary);
  opacity: 0.6;
}
.about-foot {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--color-text-secondary);
  text-align: center;
}

/* 「关于我们」从侧栏单独进入：和设置共用页面容器，但不显示设置的页签 */
.settings-view.about-mode .settings-tabs {
  display: none;
}

/* 「AI 模型与密钥」这一页照搬了 App 的字号和控件高度（15、16 号字，44 高），
   在电脑上比周围 13 号字的界面大了一圈。宽屏收到和其他设置页一致；手机宽度保持 App 的尺寸。 */
@media (min-width: 769px) {
  .ai-key-card .ai-key-status {
    font-size: 13px;
  }
  .ai-key-row input {
    min-height: 36px;
    border-radius: 8px;
    font-size: 13px;
  }
  .ai-key-paste {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 13px;
  }
  .ai-key-save {
    min-height: 36px;
    border-radius: 8px;
    font-size: 13px;
  }
  .ai-model-select {
    min-height: 36px;
    border-radius: 10px;
    font-size: 13px;
  }
}

/* AI 助手的写入确认卡片（改描述 / 改完成详情 / 加后续 / 新建任务）：沿用子任务建议卡片的外框 */
.ai-action-body {
  padding: 10px 12px;
}

.ai-action-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text);
}

.ai-action-meta {
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--color-text-secondary);
}

.ai-action-text {
  font-size: 12px;
  line-height: 1.6;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-action-meta + .ai-action-text {
  margin-top: 6px;
}

/* 登录页里单独的注册流程（填邮箱密码 → 输验证码） */
.auth-pane-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}

.auth-msg {
  min-height: 0;
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--danger-text);
}

.auth-msg:empty {
  display: none;
}

.auth-msg.is-info {
  color: var(--success);
}

.auth-code-input {
  letter-spacing: 4px;
  font-size: 16px;
}

.auth-link-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.auth-link {
  padding: 4px 0;
  border: none;
  background: transparent;
  color: var(--accent-text);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}

.auth-link:hover:not(:disabled) {
  text-decoration: underline;
}

.auth-link:disabled {
  color: var(--color-text-secondary);
  cursor: default;
}

.account-magiclink-btn.hidden,
.auth-agree.hidden {
  display: none;
}
