/* ============ 设计系统：macOS 风（明亮 / 暗色） ============ */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;

  --r-xl: 20px;
  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 7px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #eef0f3;
  --bg-deep: #e6e8ec;
  --surface: rgba(255, 255, 255, 0.74);
  --surface-solid: #ffffff;
  --surface-2: #f5f6f8;
  --surface-3: #eceef1;
  --sidebar: rgba(247, 248, 250, 0.78);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #9a9aa0;
  --line: rgba(0, 0, 0, 0.09);
  --line-soft: rgba(0, 0, 0, 0.05);
  --hover: rgba(0, 0, 0, 0.045);
  --accent: #0071e3;
  --accent-2: #0a84ff;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --danger: #d70015;
  --ok: #1a8f4c;
  --warn: #b25000;
  --shadow-1: 0 1px 1px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.06);
  --shadow-2: 0 24px 70px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.06);
  --glass: blur(30px) saturate(180%);
  --scrim: rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141416;
  --bg-deep: #0e0e10;
  --surface: rgba(32, 32, 35, 0.72);
  --surface-solid: #1e1e21;
  --surface-2: #242428;
  --surface-3: #2c2c31;
  --sidebar: rgba(26, 26, 29, 0.74);
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #6e6e73;
  --line: rgba(255, 255, 255, 0.11);
  --line-soft: rgba(255, 255, 255, 0.06);
  --hover: rgba(255, 255, 255, 0.06);
  --accent: #0a84ff;
  --accent-2: #4da3ff;
  --accent-soft: rgba(10, 132, 255, 0.16);
  --danger: #ff453a;
  --ok: #30d158;
  --warn: #ffd60a;
  --shadow-1: 0 1px 1px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 30px 80px rgba(0, 0, 0, 0.65);
  --glass: blur(30px) saturate(160%);
  --scrim: rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* ---------- 背景光斑（毛玻璃的底色来源） ---------- */
.bg-orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-orbs span {
  position: absolute; border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  will-change: transform;
}
.bg-orbs span:nth-child(1) {
  width: 44vw; height: 44vw; left: -12vw; top: -14vw;
  background: radial-gradient(circle at 35% 35%, #7aa8ff, transparent 70%);
  animation: orb-a 30s ease-in-out infinite;
}
.bg-orbs span:nth-child(2) {
  width: 38vw; height: 38vw; right: -10vw; top: 2vh;
  background: radial-gradient(circle at 40% 40%, #c39dff, transparent 70%);
  animation: orb-b 36s ease-in-out infinite;
}
.bg-orbs span:nth-child(3) {
  width: 40vw; height: 40vw; left: 24vw; bottom: -22vw;
  background: radial-gradient(circle at 45% 45%, #7fe3c4, transparent 70%);
  animation: orb-c 42s ease-in-out infinite;
}
[data-theme="dark"] .bg-orbs span { opacity: 0.42; }

@keyframes orb-a {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(6vw, 4vh, 0) scale(1.08); }
}
@keyframes orb-b {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-5vw, 6vh, 0) scale(1.06); }
}
@keyframes orb-c {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(4vw, -5vh, 0) scale(1.1); }
}

/* ---------- 动效 ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

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

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1100px 720px at 6% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 62%),
    radial-gradient(900px 620px at 102% -4%, color-mix(in srgb, #b48cff 10%, transparent), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { transition: background 0.35s var(--ease), color 0.35s var(--ease); }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

/* 滚动条：细一点，跟 macOS 一样浮在上面 */
html { scroll-behavior: smooth; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-3) 45%, transparent);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text-2) 60%, transparent); background-clip: content-box; }

:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 13px;
  border-radius: var(--r-md);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px; font-weight: 500;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
  transition: background 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.975); }
.btn.primary {
  background: var(--accent); border-color: transparent; color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 6px 18px rgba(0, 113, 227, 0.24);
}
.btn.primary:hover { background: var(--accent-2); }
.btn.quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.quiet:hover { background: var(--hover); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }

.icon-btn {
  position: relative;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bell-dot {
  position: absolute;
  top: 5px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ff3b30;
  box-shadow: 0 0 0 2px var(--surface-solid, #fff);
  animation: bellPop 0.3s var(--ease) both;
}
@keyframes bellPop {
  from { transform: scale(0.2); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.field { display: block; }
.field > span { display: block; font-size: 11.5px; color: var(--text-2); margin-bottom: 6px; }
.input, .field input, .field select, .field textarea {
  width: 100%;
  height: 32px; padding: 0 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.field textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.6; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface-solid);
}
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--text-3); }

select.input, .field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 7px;
  border-radius: 999px;
  font-size: 10.5px; font-weight: 500;
  background: var(--surface-3); color: var(--text-2);
}
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pill.err { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* ---------- 分段控件 ---------- */
.segmented {
  display: inline-flex; gap: 2px; padding: 2px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  border: 1px solid var(--line-soft);
}
.seg {
  height: 26px; padding: 0 12px;
  border-radius: 7px;
  font-size: 12px; font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  transition: background 0.18s var(--ease), color 0.18s;
}
.seg:hover { color: var(--text); }
.seg.is-on { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }

.card {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

/* ---------- 主题切换 ---------- */
.theme-toggle {
  position: relative;
  width: 46px; height: 26px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  transition: background 0.25s;
}
.theme-toggle:hover { border-color: var(--text-3); }
.theme-toggle .knob {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--surface-solid);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  display: grid; place-items: center;
  transition: transform 0.28s var(--ease), background 0.25s;
}
.theme-toggle .knob svg { width: 11px; height: 11px; stroke: var(--text-2); fill: none; stroke-width: 1.9; stroke-linecap: round; }
.theme-toggle .knob .moon { display: none; }
[data-theme="dark"] .theme-toggle .knob { transform: translateX(20px); }
[data-theme="dark"] .theme-toggle .knob .sun { display: none; }
[data-theme="dark"] .theme-toggle .knob .moon { display: block; }

/* ---------- 弹窗 ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-items: center;
  padding: 26px;
  background: var(--scrim);
  backdrop-filter: blur(6px);
  animation: fade 0.18s var(--ease);
}
.sheet {
  position: relative;
  width: min(460px, 100%);
  max-height: 86vh; overflow: auto;
  padding: 24px;
  border-radius: var(--r-xl);
  background: color-mix(in srgb, var(--surface-solid) 86%, transparent);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  animation: pop 0.24s var(--ease);
}
.sheet.wide { width: min(820px, 100%); }
.sheet h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; letter-spacing: -0.2px; }
.sheet .sub { margin: 0 0 18px; font-size: 12px; color: var(--text-2); }
.sheet-close {
  position: absolute; top: 14px; right: 14px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-2); background: var(--surface-3);
}
.sheet-close:hover { color: var(--text); }
.sheet-close svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

/* 危险操作提示块（删任务不退款之类） */
.warn-box {
  margin: 2px 0 0;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 11.5px;
  line-height: 1.8;
  color: color-mix(in srgb, var(--danger) 86%, var(--text));
  background: color-mix(in srgb, var(--danger) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 26%, transparent);
}
.warn-box b,
.warn-box strong { color: var(--danger); font-weight: 600; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- Toast ---------- */.toasts {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 300; display: grid; gap: 8px; justify-items: center;
  pointer-events: none;
}
.toast {
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(16px) saturate(170%);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  animation: toastIn 0.22s var(--ease);
}

/* ---------- 空状态 ---------- */
.empty {
  display: grid; place-items: center; gap: 10px;
  padding: 58px 10px;
  color: var(--text-3);
  text-align: center;
}
.empty svg { width: 34px; height: 34px; stroke: currentColor; fill: none; stroke-width: 1.3; opacity: 0.7; }
.empty p { margin: 0; font-size: 12.5px; }

/* ---------- 骨架 ---------- */
.shimmer {
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 48%, var(--surface-2) 66%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -30% 0; } }
