/* ============================================================
   个人工作台 · 全局样式
   主题：light（浅色侧栏）/ dark（深色侧栏），由 <html data-theme> 切换
   分层顺序：令牌 → 重置 → 骨架 → 通用组件 → 各业务视图 → 响应式
   ============================================================ */

/* ---------- 1. 令牌：与主题无关的部分 ---------- */
:root {
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 999px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  --sidebar-w: 244px;
  --ease: cubic-bezier(.2, .7, .3, 1);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  color-scheme: light;
}

/* ---------- 2. 令牌：浅色主题（默认） ---------- */
:root,
[data-theme="light"] {
  color-scheme: light;

  /* 内容区与层级 */
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fcfcfe;
  --sunken: #f5f6fa;
  --row-hover: #fafbff;
  --field-bg: #ffffff;
  --seg-bg: #eceef4;
  --track: #eef0f6;
  --cal-out: #fbfbfe;

  --line: #e9ebf2;
  --line-strong: #dcdfe9;
  --line-hover: #cfd4e0;

  --ink: #14161d;
  --ink-2: #4b5162;
  --ink-3: #8a90a2;
  --ink-4: #aab0c0;

  /* 品牌与语义色 */
  --brand: #5b5bd6;
  --brand-2: #7c6cf5;
  --brand-ink: #4a48c4;
  --brand-soft: #f0f0fe;
  --brand-ring: rgba(91, 91, 214, .16);
  --brand-line: #e2dfff;

  --ok: #16a34a;
  --ok-ink: #15803d;
  --ok-soft: #e9f8ef;
  --warn: #d97706;
  --warn-ink: #a35a07;
  --warn-soft: #fdf4e6;
  --danger: #dc2626;
  --danger-ink: #be123c;
  --danger-soft: #fdeff0;

  /* 侧栏：浅色 */
  --sb-bg: #ffffff;
  --sb-bg-2: #fbfcff;
  --sb-ink: #14161d;
  --sb-ink-2: #4b5162;
  --sb-ink-3: #9298a8;
  --sb-line: #ecEEF4;
  --sb-hover: #f4f6fa;
  --sb-card: #f8f9fd;
  --sb-card-line: #eaeaF3;
  --sb-track: #e8eaf2;
  --sb-active-bg: linear-gradient(100deg, #efefff, #f6f5ff);
  --sb-active-ink: #4543bf;
  --sb-active-ring: #e0ddff;
  --sb-active-icon: #5b5bd6;
  --sb-count-bg: #f0f2f8;
  --sb-count-ink: #6c7387;
  --sb-border: 1px solid var(--line);
  --sb-shadow: none;
  --sb-glow: radial-gradient(circle, rgba(124, 108, 245, .10), transparent 68%);

  /* 其他 */
  --topbar-bg: rgba(246, 247, 251, .8);
  --nav-bg: rgba(255, 255, 255, .94);
  --scroll: #d6dae4;
  --scroll-hover: #bcc2d0;
  --selection-bg: #ded9ff;
  --selection-ink: #241f5c;
  --modal-mask: rgba(22, 24, 38, .4);

  --shadow-xs: 0 1px 2px rgba(19, 22, 38, .05);
  --shadow-sm: 0 1px 2px rgba(19, 22, 38, .05), 0 4px 12px -8px rgba(19, 22, 38, .16);
  --shadow-md: 0 2px 4px rgba(19, 22, 38, .04), 0 16px 32px -20px rgba(19, 22, 38, .28);
  --shadow-lg: 0 32px 72px -28px rgba(19, 22, 38, .38);
}

/* ---------- 3. 令牌：深色主题 ---------- */
[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0d0f15;
  --surface: #161923;
  --surface-2: #1a1e29;
  --sunken: #1d212c;
  --row-hover: #1b1f2a;
  --field-bg: #1b202a;
  --seg-bg: #1c212c;
  --track: #262b38;
  --cal-out: #12141b;

  --line: #2a3040;
  --line-strong: #363d4d;
  --line-hover: #454d5f;

  --ink: #eceff7;
  --ink-2: #a8afc0;
  --ink-3: #838d9e;
  --ink-4: #616a7b;

  --brand: #6f6ce8;
  --brand-2: #8b7cfa;
  --brand-ink: #b3b0ff;
  --brand-soft: rgba(124, 108, 245, .16);
  --brand-ring: rgba(124, 108, 245, .3);
  --brand-line: #3b3680;

  --ok: #34d399;
  --ok-ink: #6ee7b7;
  --ok-soft: rgba(52, 211, 153, .14);
  --warn: #fbbf24;
  --warn-ink: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .14);
  --danger: #f87171;
  --danger-ink: #fda4af;
  --danger-soft: rgba(248, 113, 113, .14);

  /* 侧栏：深色 */
  --sb-bg: #14161f;
  --sb-bg-2: #0d0f15;
  --sb-ink: #f2f4fb;
  --sb-ink-2: #a9b0c2;
  --sb-ink-3: #6d7688;
  --sb-line: rgba(255, 255, 255, .07);
  --sb-hover: rgba(255, 255, 255, .06);
  --sb-card: rgba(255, 255, 255, .045);
  --sb-card-line: rgba(255, 255, 255, .07);
  --sb-track: rgba(255, 255, 255, .1);
  --sb-active-bg: linear-gradient(100deg, rgba(124, 108, 245, .28), rgba(124, 108, 245, .1));
  --sb-active-ink: #ffffff;
  --sb-active-ring: rgba(146, 132, 255, .22);
  --sb-active-icon: #cdc6ff;
  --sb-count-bg: rgba(255, 255, 255, .09);
  --sb-count-ink: #b7bad0;
  --sb-border: 1px solid transparent;
  --sb-shadow: none;
  --sb-glow: radial-gradient(circle, rgba(110, 96, 240, .3), transparent 68%);

  --topbar-bg: rgba(13, 15, 21, .78);
  --nav-bg: rgba(20, 23, 32, .94);
  --scroll: #333a49;
  --scroll-hover: #454d5f;
  --selection-bg: #3b3373;
  --selection-ink: #e7e4ff;
  --modal-mask: rgba(4, 5, 9, .62);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .28), 0 6px 16px -10px rgba(0, 0, 0, .6);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .3), 0 18px 36px -22px rgba(0, 0, 0, .75);
  --shadow-lg: 0 36px 80px -30px rgba(0, 0, 0, .85);
}

/* ---------- 4. 重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .24s var(--ease), color .24s var(--ease);
}

h1, h2, h3, h4, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--brand-ink); text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

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

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb {
  background: var(--scroll);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 5. 布局骨架 ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100dvh;
}

/* 侧栏：主题由 --sb-* 一组令牌决定 */
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 14px;
  background: linear-gradient(178deg, var(--sb-bg) 0%, var(--sb-bg-2) 100%);
  color: var(--sb-ink-2);
  border-right: var(--sb-border);
  overflow: hidden;
  transition: background-color .24s var(--ease), border-color .24s var(--ease);
}
/* 顶部一抹品牌光：深色下是氛围，浅色下只是极淡的层次 */
.sidebar::before {
  content: "";
  position: absolute;
  top: -120px; left: -60px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: var(--sb-glow);
  pointer-events: none;
}
.sidebar > * { position: relative; }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 22px;
}
.brand__mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, #8b7cff, #5b5bd6 55%, #4340c0);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 6px 18px -6px rgba(110, 96, 240, .75), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__name { font-weight: 640; font-size: 14px; letter-spacing: -.01em; color: var(--sb-ink); }
.brand__sub {
  font-size: 10px;
  color: var(--sb-ink-3);
  letter-spacing: .16em;
  text-transform: uppercase;
  margin-top: 1px;
}

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav__label {
  padding: 0 10px 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--sb-ink-3);
}
.nav__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--sb-ink-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .16s var(--ease), color .16s var(--ease);
  width: 100%;
  text-align: left;
}
.nav__item:hover { background: var(--sb-hover); color: var(--sb-ink); }
.nav__item.is-active {
  background: var(--sb-active-bg);
  color: var(--sb-active-ink);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--sb-active-ring);
}
.nav__item.is-active::before {
  content: "";
  position: absolute;
  left: -14px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #a89bff, #6e60f0);
}
.nav__item svg { flex: none; stroke: currentColor; opacity: .9; }
.nav__item.is-active svg { opacity: 1; stroke: var(--sb-active-icon); }
.nav__count {
  margin-left: auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--sb-count-ink);
  background: var(--sb-count-bg);
  border-radius: var(--r-full);
  padding: 1px 7px;
  min-width: 21px;
  text-align: center;
  font-weight: 600;
}
.nav__item.is-active .nav__count { background: var(--sb-active-ring); color: var(--sb-active-ink); }

/* 侧栏「今日进度」 */
.side-focus {
  margin-top: auto;
  margin-bottom: 14px;
  padding: 13px 13px 12px;
  border-radius: 13px;
  background: var(--sb-card);
  border: 1px solid var(--sb-card-line);
}
.side-focus__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.side-focus__label { font-size: 11.5px; color: var(--sb-ink-3); letter-spacing: .02em; }
.side-focus__num {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--sb-ink);
  font-variant-numeric: tabular-nums;
}
.side-focus__track {
  height: 5px;
  margin: 9px 0 8px;
  border-radius: 99px;
  background: var(--sb-track);
  overflow: hidden;
}
.side-focus__track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #7c6cf5, #a89bff);
  transition: width .5s var(--ease);
}
.side-focus__track i.is-full { background: linear-gradient(90deg, #22c55e, #6ee7a0); }
.side-focus__foot { font-size: 11px; color: var(--sb-ink-3); }

.sidebar__foot {
  padding-top: 12px;
  border-top: 1px solid var(--sb-line);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.save-state {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 4px;
  font-size: 11px;
  color: var(--sb-ink-3);
  font-variant-numeric: tabular-nums;
}
.save-state__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, .9);
  transition: background .2s;
}
.save-state.is-saving .save-state__dot { background: #fbbf24; box-shadow: 0 0 8px rgba(251, 191, 36, .9); }

.side-tools { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.ghost-btn {
  display: grid;
  place-items: center;
  height: 32px;
  border-radius: 9px;
  color: var(--sb-ink-3);
  transition: background .16s, color .16s;
}
.ghost-btn:hover { background: var(--sb-hover); color: var(--sb-ink); }
.ghost-btn.is-danger:hover { background: rgba(248, 113, 113, .16); color: #e8615f; }

/* 主区域 */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 18px var(--sp-8) 16px;
  background: var(--topbar-bg);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}
.topbar.is-stuck {
  border-bottom-color: var(--line);
  box-shadow: 0 12px 24px -24px rgba(19, 22, 38, .5);
}

.topbar__titles { min-width: 0; }
.topbar__title {
  font-size: 21px;
  font-weight: 680;
  letter-spacing: -.025em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__sub {
  font-size: 12.5px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
}
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.topbar__primary { display: flex; align-items: center; gap: var(--sp-2); }

.content {
  padding: 10px var(--sp-8) var(--sp-8);
  max-width: 1340px;
  width: 100%;
}

/* 切页入场，只在外壳挂载新视图时播放一次 */
.view-enter > * { animation: rise .32s var(--ease) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 6. 通用组件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 560;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background .16s var(--ease), border-color .16s, box-shadow .16s, transform .08s;
}
.btn:active { transform: translateY(.5px) scale(.995); }
.btn svg { stroke: currentColor; flex: none; }

.btn--primary {
  background: linear-gradient(160deg, #6a68e0, #5b5bd6 55%, #4a48c4);
  color: #fff;
  box-shadow: 0 1px 2px rgba(74, 72, 196, .35), 0 8px 18px -10px rgba(91, 91, 214, .9),
              inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn--primary:hover {
  background: linear-gradient(160deg, #7a78e8, #5f5ddc 55%, #4a48c4);
  box-shadow: 0 2px 4px rgba(74, 72, 196, .35), 0 12px 24px -10px rgba(91, 91, 214, .95),
              inset 0 1px 0 rgba(255, 255, 255, .2);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-2);
  box-shadow: var(--shadow-xs);
}
.btn--ghost:hover { background: var(--sunken); color: var(--ink); border-color: var(--line-hover); }

.btn--quiet { background: transparent; color: var(--ink-3); padding: 0 10px; }
.btn--quiet:hover { background: var(--sunken); color: var(--ink); }

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

/* 破坏性确认按钮：两套主题共用实心红底，保证白字对比度 */
.btn--danger-solid {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 1px 2px rgba(150, 20, 20, .35), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.btn--danger-solid:hover { background: #c11f1f; }

.btn--sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn--icon { width: 34px; height: 34px; padding: 0; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: background-color .24s var(--ease), border-color .24s var(--ease);
}
.card__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 15px var(--sp-5);
}
.card__title {
  font-size: 13.5px;
  font-weight: 620;
  letter-spacing: -.005em;
  display: flex;
  align-items: center;
  gap: 7px;
}
.card__hint { font-size: 12px; color: var(--ink-3); margin-left: auto; }
.card__body { padding: 4px var(--sp-5) var(--sp-5); }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .01em;
}
.field__hint { font-size: 11.5px; color: var(--ink-3); }
.field__row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }

.input, .select, .textarea {
  width: 100%;
  background: var(--field-bg);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 13.5px;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px var(--brand-ring);
}
.textarea { resize: vertical; min-height: 84px; line-height: 1.65; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a90a2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}
.select:hover { border-color: var(--line-hover); }

/* 原生日期/时间控件的图标在深色下是黑的，需要反色 */
input[type="date"], input[type="time"] { color-scheme: light; }
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"] { color-scheme: dark; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .5; }
input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="time"]:hover::-webkit-calendar-picker-indicator { opacity: .85; }

/* 带前置图标的下拉（工具栏用） */
.pick { position: relative; display: inline-flex; align-items: center; }
.pick__ico {
  position: absolute;
  left: 10px;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  pointer-events: none;
  transition: color .16s;
}
.pick:hover .pick__ico { color: var(--ink-2); }
.pick .select {
  height: 34px;
  min-width: 98px;
  padding: 0 28px 0 30px;
  font-size: 12.5px;
  color: var(--ink-2);
  border-radius: 9px;
}

/* 分段控制器 */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--seg-bg);
  border-radius: 10px;
}
.segmented__item {
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-3);
  transition: background .16s, color .16s, box-shadow .16s;
  white-space: nowrap;
}
.segmented__item:hover { color: var(--ink-2); }
.segmented__item.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.segmented__count {
  font-size: 11px;
  color: var(--ink-3);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}
.segmented__item.is-active .segmented__count { color: var(--ink-2); }

/* 概览趋势卡里的时间段切换：小一号，不抢标题 */
.segmented.trend-seg { flex: none; }
.segmented.trend-seg .segmented__item { padding: 4px 10px; font-size: 11.5px; border-radius: 7px; }

/* 标签 / 徽章 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: var(--r-full);
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.7;
  background: var(--sunken);
  color: var(--ink-2);
  white-space: nowrap;
}
.tag__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 620;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
}
.badge--high { background: var(--danger-soft); color: var(--danger-ink); }
.badge--mid { background: var(--warn-soft); color: var(--warn-ink); }
.badge--low { background: var(--sunken); color: var(--ink-3); }
.badge--overdue { background: var(--danger-soft); color: var(--danger-ink); }
.badge--today { background: var(--brand-soft); color: var(--brand-ink); }

/* 复选框 */
.cb {
  appearance: none;
  width: 18px; height: 18px;
  flex: none;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .16s, border-color .16s, box-shadow .16s;
}
.cb:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.cb:checked {
  background: linear-gradient(160deg, #22c55e, #16a34a);
  border-color: #16a34a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px;
  box-shadow: 0 2px 6px -2px rgba(22, 163, 74, .7);
}

/* 色板选择 */
.swatch {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}
.swatch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.swatch__dot {
  display: block;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 1px rgba(19, 22, 38, .12);
  transition: box-shadow .15s var(--ease), transform .15s;
}
.swatch:hover .swatch__dot { transform: scale(1.08); }
.swatch input:checked + .swatch__dot {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px currentColor;
}

/* 空状态 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
  color: var(--ink-3);
}
.empty__icon {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: var(--sunken);
  border: 1px solid var(--line);
  color: var(--ink-3);
  margin-bottom: 5px;
}
.empty__title { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.empty__text { font-size: 12.5px; max-width: 30ch; }

/* ---------- 7. 概览面板 ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 16px 18px 15px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background-color .24s var(--ease);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.kpi::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--tone), transparent 78%);
}
.kpi::after {
  content: "";
  position: absolute;
  top: -46px; right: -34px;
  width: 132px; height: 132px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--tone-soft), transparent 70%);
  opacity: .72;
  pointer-events: none;
}

.kpi--rose   { --tone: #e11d48; --tone-soft: rgba(225, 29, 72, .13); }
.kpi--violet { --tone: #5b5bd6; --tone-soft: rgba(91, 91, 214, .13); }
.kpi--teal   { --tone: #0d9488; --tone-soft: rgba(13, 148, 136, .13); }
.kpi--amber  { --tone: #d97706; --tone-soft: rgba(217, 119, 6, .13); }

[data-theme="dark"] .kpi--rose   { --tone: #fb7185; --tone-soft: rgba(251, 113, 133, .16); }
[data-theme="dark"] .kpi--violet { --tone: #8b7cfa; --tone-soft: rgba(139, 124, 250, .16); }
[data-theme="dark"] .kpi--teal   { --tone: #2dd4bf; --tone-soft: rgba(45, 212, 191, .14); }
[data-theme="dark"] .kpi--amber  { --tone: #fbbf24; --tone-soft: rgba(251, 191, 36, .14); }
[data-theme="dark"] .kpi::after { opacity: .55; }

.kpi__top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.kpi__label {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 550;
  letter-spacing: .01em;
}
.kpi__ico {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 9px;
  background: var(--tone-soft);
  color: var(--tone);
  flex: none;
}
.kpi__value {
  position: relative;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  margin-top: 6px;
  color: var(--ink);
}
.kpi__value small { font-size: 12.5px; font-weight: 500; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.kpi__foot {
  position: relative;
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.kpi__foot b { color: var(--ok-ink); font-weight: 650; }
.kpi__foot b.is-down { color: var(--danger); }
.kpi__alert { color: var(--danger-ink); font-weight: 620; }
.kpi__meter {
  position: relative;
  height: 4px;
  margin-top: 11px;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
}
.kpi__meter i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #f0a13a, var(--tone));
  transition: width .6s var(--ease);
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(0, 1fr);
  gap: var(--sp-3);
  align-items: start;
}
.dash-col { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }

.chart-wrap { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-empty {
  display: grid;
  place-items: center;
  min-height: 150px;
  font-size: 12.5px;
  color: var(--ink-3);
}

/* 折线默认只留末端高亮点，悬停时露出每个数据点 */
.chart-dots circle { opacity: 0; transition: opacity .18s var(--ease); }
.chart-svg:hover .chart-dots circle { opacity: 1; }

.donut-card { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.donut-card__ring { width: 168px; max-width: 100%; }
[data-theme="light"] .chart-svg.donut { filter: drop-shadow(0 6px 12px rgba(19, 22, 38, .06)); }

.legend { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-4); margin-top: var(--sp-3); }
.legend__item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.legend__dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.legend__val { margin-left: auto; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.donut-legend { display: flex; flex-direction: column; gap: 2px; margin-top: var(--sp-3); width: 100%; }
.donut-legend__row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 5px 8px;
  border-radius: 8px;
  transition: background .14s;
}
.donut-legend__row:hover { background: var(--sunken); }
.donut-legend__name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend__num {
  margin-left: auto;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 12px;
}

/* 今日日程：时间 + 竖线 + 内容，圆点落在线上 */
.mini-list { display: flex; flex-direction: column; }
.mini-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 0;
}
.mini-row__time {
  width: 40px;
  flex: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  font-weight: 620;
  padding-top: 1px;
}
.mini-row__mark {
  position: relative;
  width: 11px;
  flex: none;
  align-self: stretch;
}
.mini-row__mark::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-50%);
  background: var(--line-strong);
}
.mini-row:first-child .mini-row__mark::before { top: 8px; }
.mini-row:last-child .mini-row__mark::before { bottom: auto; height: 15px; }
.mini-row:only-child .mini-row__mark::before { display: none; }
.mini-row__mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 5px;
  width: 7px; height: 7px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 2px solid var(--brand);
  z-index: 1;
}
.mini-row__main { min-width: 0; flex: 1; padding-top: 1px; }
.mini-row__title {
  font-size: 13px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-row__meta { font-size: 11.5px; color: var(--ink-3); }

.bar-line { display: flex; align-items: center; gap: 11px; padding: 7px 0; }
.bar-line__label { width: 72px; flex: none; font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-line__track { flex: 1; height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; display: block; }
.bar-line__fill { display: block; height: 100%; border-radius: 99px; transition: width .5s var(--ease); }
.bar-line__num { width: 22px; text-align: right; font-size: 12px; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- 8. 任务视图 ---------- */
/* 工具栏：搜索独占左侧，筛选控件收在右端，全部同高 34px */
.task-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  flex-wrap: wrap;
}
.task-toolbar__group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 460px;
}
.search-box svg {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  stroke: var(--ink-3);
  pointer-events: none;
}
.search-box .input {
  padding-left: 33px;
  height: 34px;
  border-radius: 9px;
  font-size: 13px;
}

/* 卡片头部：状态 tab 与结果计数 */
.task-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 12px var(--sp-4);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.task-head .segmented { background: transparent; padding: 0; gap: 4px; }
.task-head .segmented__item {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.task-head .segmented__item:hover { background: var(--sunken); }
.task-head .segmented__item.is-active {
  background: var(--brand-soft);
  color: var(--brand-ink);
  box-shadow: none;
  border-color: var(--brand-line);
}
.task-head .segmented__item.is-active .segmented__count { color: var(--brand-ink); opacity: .8; }
.task-head__count {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.task-list { display: flex; flex-direction: column; }
/* 组与组之间补一条分隔：组内最后一行已无下边框 */
.task-group + .task-group { border-top: 1px solid var(--line); }

/* 分组标题：小标签 + 计数 chip + 一条收尾细线 */
.task-group__title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px var(--sp-5) 8px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.task-group__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.task-group__count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--sunken);
  color: var(--ink-2);
  font-size: 10.5px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

/* 任务行：左侧优先级竖条 + 主区（标题行 / meta 行 / 备注）。状态由右侧胶囊统一切换 */
.task {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--sp-5) 12px 18px;
  border-bottom: 1px solid var(--line);
  transition: background .14s;
}
.task:last-child { border-bottom: 0; }
.task:hover { background: var(--row-hover); }

.task__prio {
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 26px;
  border-radius: 0 3px 3px 0;
  background: var(--p, #94a3b8);
  opacity: .6;
  transition: opacity .14s, height .2s var(--ease);
}
.task__prio[data-p="3"] { --p: #e11d48; }
.task__prio[data-p="2"] { --p: #f59e0b; }
.task__prio[data-p="1"] { --p: #94a3b8; }
.task:hover .task__prio { opacity: 1; height: 34px; }

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

/* 标题与操作同一行：状态胶囊始终右对齐，形成一条视觉纵列 */
.task__row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 22px;
}
.task__title {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.5;
  letter-spacing: -.005em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* meta：统一「彩点 + 小字」，不再混用胶囊 / 徽章三种权重 */
.task__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
}
.task__meta:empty { display: none; }
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 190px;
}
.meta-item > span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.meta-item__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--c, var(--ink-3));
  flex: none;
}
.meta-item svg { flex: none; stroke: currentColor; opacity: .85; }
.meta-item--due { font-variant-numeric: tabular-nums; }
.task__due {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.task__due.is-overdue { color: var(--danger); font-weight: 620; }
.task__due.is-overdue svg { opacity: 1; }

.task__note {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 状态胶囊常显（核心信息），编辑/删除悬停浮现（保留占位，避免布局跳动） */
.task__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}
.task__actions .icon-btn { opacity: 0; }
.task:hover .task__actions .icon-btn,
.task:focus-within .task__actions .icon-btn { opacity: 1; }
@media (hover: none) { .task__actions .icon-btn { opacity: 1; } }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-full);
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  transition: background .16s, border-color .16s, box-shadow .16s;
}
.status-pill:hover { background: var(--sunken); border-color: var(--line-strong); }
.status-pill__dot { width: 6px; height: 6px; border-radius: 50%; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  color: var(--ink-3);
  transition: background .14s, color .14s, opacity .14s;
}
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.icon-btn.is-danger:hover { background: var(--danger-soft); color: var(--danger); }

/* 概览里的紧凑行（复用 .task 但去掉优先级条与操作区） */
.task--mini { padding: 10px var(--sp-5) 10px 18px; }
.task--mini .task__title { font-size: 13px; -webkit-line-clamp: 1; cursor: default; }
.task--mini .task__title:hover { color: inherit; }
.task--mini .task__meta { margin-top: 4px; }

/* ---------- 9. 日程视图 ---------- */
.cal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.72fr) minmax(250px, .68fr);
  gap: var(--sp-3);
  align-items: stretch;
}
.cal-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 13px var(--sp-4);
}
.cal-month { font-size: 15px; font-weight: 680; letter-spacing: -.02em; min-width: 96px; }
.cal-month small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 5px; letter-spacing: 0; }

.cal-grid { padding: 0 var(--sp-3) var(--sp-3); }
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 4px 0 8px;
  gap: 0;
}
.cal-weekdays span {
  text-align: center;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--ink-3);
  letter-spacing: .1em;
}
/* 表格化网格：容器画上/左边线，单元格画右/下边线 */
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 86px;
  gap: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  padding: 6px 7px 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
  transition: background .14s;
  overflow: hidden;
  cursor: pointer;
}
.cal-day:hover { background: var(--row-hover); }
.cal-day.is-out { background: var(--cal-out); color: var(--ink-4); }
.cal-day.is-out .cal-day__num { opacity: .55; }
.cal-day.is-today {
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1.5px var(--brand-line);
}
.cal-day.is-today .cal-day__num {
  background: linear-gradient(160deg, #6e6ae0, #5b5bd6);
  color: #fff;
  font-weight: 680;
  box-shadow: 0 4px 10px -4px rgba(91, 91, 214, .8);
}
.cal-day.is-selected { background: var(--brand-soft); }
.cal-day__num {
  display: grid;
  place-items: center;
  width: 23px; height: 23px;
  border-radius: 50%;
  font-variant-numeric: tabular-nums;
  font-weight: 550;
  align-self: center;
  flex: none;
  font-size: 12px;
  transition: background .16s, color .16s;
}
.cal-day__list { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-day__evt {
  position: relative;
  font-size: 10.5px;
  line-height: 1.6;
  padding: 0 5px 0 9px;
  border-radius: 5px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 550;
}
.cal-day__evt::before {
  content: "";
  position: absolute;
  left: 3.5px; top: 50%;
  transform: translateY(-50%);
  width: 2.5px; height: 9px;
  border-radius: 2px;
  background: currentColor;
  opacity: .85;
}
.cal-day__dots { display: none; gap: 3px; flex-wrap: wrap; justify-content: center; max-width: 100%; }
.cal-day__dot { width: 5px; height: 5px; border-radius: 50%; }
.cal-day__more { font-size: 9.5px; color: var(--ink-3); line-height: 1.3; padding-left: 5px; }

.agenda { display: flex; flex-direction: column; }
.agenda__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: var(--sp-4) var(--sp-5) var(--sp-2);
}
.agenda__date { font-size: 14.5px; font-weight: 680; letter-spacing: -.01em; }
.agenda__weekday { font-size: 12px; color: var(--ink-3); }

.event-item {
  position: relative;
  display: flex;
  gap: 11px;
  padding: 12px var(--sp-5);
  transition: background .14s;
}
.event-item + .event-item { border-top: 1px solid var(--line); }
.event-item:hover { background: var(--sunken); }

.agenda__foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px var(--sp-5);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-3);
}
.agenda__foot .btn { margin-left: auto; }
.event-item__time {
  width: 46px;
  flex: none;
  padding-top: 1px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.event-item__bar {
  width: 3px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  flex: none;
}
.event-item__main { flex: 1; min-width: 0; }
.event-item__title { font-size: 13px; font-weight: 550; word-break: break-word; }
.event-item__meta { font-size: 11.5px; color: var(--ink-3); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }

/* ---------- 10. 笔记视图 ---------- */
.notes-layout {
  display: grid;
  grid-template-columns: 306px minmax(0, 1fr);
  gap: var(--sp-3);
  align-items: start;
}
.notes-list { display: flex; flex-direction: column; max-height: calc(100dvh - 172px); overflow: auto; padding: 4px; }
.note-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 13px;
  border-radius: 11px;
  cursor: pointer;
  transition: background .14s;
  text-align: left;
  width: 100%;
  margin-bottom: 2px;
}
.note-card:hover { background: var(--sunken); }
.note-card.is-active {
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand-line);
}
.note-card.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 12px; bottom: 12px;
  width: 3px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
}
.note-card.is-active .note-card__title { color: var(--brand-ink); }
.note-card__title {
  font-size: 13px;
  font-weight: 620;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: -.005em;
}
.note-card__excerpt {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-card__foot { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.note-card__date { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pin-mark { color: var(--brand); }

.editor { display: flex; flex-direction: column; min-height: calc(100dvh - 172px); overflow: hidden; }
.editor__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px var(--sp-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.editor__title {
  width: 100%;
  border: 0;
  background: none;
  padding: var(--sp-5) var(--sp-6) var(--sp-2);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -.03em;
  outline: none;
  line-height: 1.35;
}
.editor__title::placeholder { color: var(--ink-4); }
.editor__body {
  flex: 1;
  width: 100%;
  border: 0;
  background: none;
  padding: var(--sp-2) var(--sp-6) var(--sp-5);
  font-size: 14.5px;
  line-height: 1.9;
  resize: none;
  outline: none;
  min-height: 320px;
  color: var(--ink-2);
  font-family: var(--font);
}
.editor__body::placeholder { color: var(--ink-4); }
.editor__foot {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-6);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--ink-3);
  flex-wrap: wrap;
}
.editor__tags { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.tag-input {
  border: 0;
  background: transparent;
  font-size: 11.5px;
  color: var(--ink-2);
  width: 78px;
  outline: none;
  padding: 2px 0;
}
.tag-input::placeholder { color: var(--ink-4); }
.icon-btn.is-pinned { color: var(--brand); background: var(--brand-soft); }
.editor__back { display: none; }

/* ---------- 11. 模态框 / 提示 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  background: var(--modal-mask);
  backdrop-filter: blur(4px);
  animation: fade .18s var(--ease);
}
.modal {
  width: min(520px, 100%);
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: pop .22s var(--ease);
  overflow: hidden;
}
.modal__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
}
.modal__title { font-size: 16px; font-weight: 680; letter-spacing: -.02em; }
.modal__body {
  padding: 0 var(--sp-5) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  overflow: auto;
}
.modal__foot {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}
.modal__foot .spacer { flex: 1; }

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

.toast-root {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px;
  border-radius: 11px;
  background: rgba(24, 26, 40, .95);
  border: 1px solid rgba(255, 255, 255, .08);
  color: #f2f3fa;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 16px 36px -18px rgba(15, 17, 30, .8);
  backdrop-filter: blur(8px);
  animation: toast-in .22s var(--ease);
  pointer-events: auto;
  max-width: 420px;
}
[data-theme="dark"] .toast { background: rgba(38, 43, 58, .96); border-color: rgba(255, 255, 255, .12); }
.toast--ok svg { stroke: #4ade80; }
.toast--warn svg { stroke: #fbbf24; }
.toast.is-out { animation: toast-out .2s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------- 12. 主题切换按钮 ---------- */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow-xs);
  transition: background .16s, color .16s, border-color .16s, transform .2s var(--ease);
}
.theme-toggle:hover { background: var(--sunken); color: var(--ink); border-color: var(--line-hover); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle svg { transition: transform .35s var(--ease), opacity .2s; }
.theme-toggle:hover svg { transform: rotate(-18deg); }

/* ---------- 13. 响应式 ---------- */
.mobile-nav { display: none; }

@media (max-width: 1180px) {
  .content { padding-left: var(--sp-6); padding-right: var(--sp-6); }
  .topbar { padding-left: var(--sp-6); padding-right: var(--sp-6); }
}

@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .cal-layout { grid-template-columns: minmax(0, 1fr); }
  .notes-layout { grid-template-columns: 252px minmax(0, 1fr); }
}

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

  .topbar {
    padding: 12px var(--sp-4);
    gap: var(--sp-2);
  }
  .topbar__title { font-size: 18px; }
  .content { padding: 2px var(--sp-4) 96px; }

  .mobile-nav {
    position: fixed;
    z-index: 60;
    left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 2px;
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    background: var(--nav-bg);
    backdrop-filter: blur(18px) saturate(180%);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px -18px rgba(19, 22, 38, .5);
  }
  .mobile-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 2px;
    border-radius: 11px;
    font-size: 10px;
    font-weight: 550;
    color: var(--ink-3);
    transition: background .16s, color .16s;
  }
  .mobile-nav__item.is-active {
    color: var(--brand-ink);
    background: var(--brand-soft);
  }
  .mobile-nav__item svg { stroke: currentColor; }

  /* 移动端提示上移，避免压住底部导航 */
  .toast-root { bottom: calc(78px + env(safe-area-inset-bottom)); }

  /* 笔记：列表/详情单栏切换 */
  .notes-layout { grid-template-columns: minmax(0, 1fr); }
  .notes-list { max-height: none; }
  .notes-layout[data-mode="list"] .editor-pane { display: none; }
  .notes-layout[data-mode="editor"] .notes-list-pane { display: none; }
  .editor, .notes-list { min-height: auto; }
  .editor__back { display: grid; }

  /* 日历单元格压缩：宽屏显示事件摘要，窄屏退化为圆点 */
  .cal-days { grid-auto-rows: 60px; gap: 0; }
  .cal-day { min-height: 56px; padding: 5px 1px; font-size: 12px; gap: 2px; }
  .cal-day__num { width: 22px; height: 22px; }
  .cal-day__list { display: none; }
  .cal-day__dots { display: flex; }
  .cal-month { min-width: 0; }
  .cal-weekdays { gap: 0; }
  .task-head { padding: 10px var(--sp-3); gap: var(--sp-2); }
  .task-head .segmented { overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .task-head .segmented::-webkit-scrollbar { display: none; }
}

@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .kpi { padding: 13px 13px 12px; }
  .kpi__value { font-size: 23px; }
  .kpi__ico { width: 24px; height: 24px; border-radius: 8px; }
  .kpi__ico svg { width: 13px; height: 13px; }
  .kpi__foot { font-size: 11px; }
  .card__head, .card__body { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .field__row { grid-template-columns: 1fr; }
  .search-box { max-width: none; flex-basis: 100%; order: -1; }
  .task-toolbar__group { margin-left: 0; width: 100%; }
  .task-toolbar__group .pick { flex: 1; }
  .task-toolbar__group .pick .select { width: 100%; }
  .task { padding: 11px var(--sp-4) 11px 18px; gap: 10px; }
  .task-group__title { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  /* 窄屏空间有限：标题、编辑、状态胶囊、删除保持一行 */
  .task__row { flex-wrap: nowrap; }
  .task__actions { width: auto; gap: 0; }
  .status-pill { height: 22px; padding: 0 9px; font-size: 11px; }
  .task__actions .icon-btn { opacity: 1; width: 26px; height: 26px; }
  /* 趋势卡头部：窄屏藏掉合计，标题与时间段切换同行 */
  .trend-card .card__hint { display: none; }
  .trend-card .card__title { flex: 1; min-width: 0; white-space: nowrap; }
  .modal { max-height: calc(100dvh - 16px); }
  .modal-mask { padding: 8px; align-items: end; }
  .modal { border-radius: 20px 20px 14px 14px; }
  .editor__title { padding: var(--sp-4) var(--sp-4) var(--sp-2); font-size: 20px; }
  .editor__body { padding: var(--sp-2) var(--sp-4) var(--sp-4); }
  .editor__foot { padding: 10px var(--sp-4); }
}

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

/* ---------- 云同步状态条 ---------- */
.sync-state {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 9px;
  background: var(--sunken);
  font-size: 11px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .14s;
  white-space: nowrap;
  overflow: hidden;
}
.sync-state:hover { background: var(--brand-soft); }
.sync-state span:last-child { overflow: hidden; text-overflow: ellipsis; }
.sync-state__dot {
  flex: none;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
  transition: background .2s;
}
.sync-state__dot[data-s="synced"],
.sync-state__dot[data-s="pushed"],
.sync-state__dot[data-s="pulled"] { background: var(--ok, #15a34a); }
.sync-state__dot[data-s="syncing"] { background: var(--brand); animation: sync-pulse 1s infinite alternate; }
.sync-state__dot[data-s="auth"],
.sync-state__dot[data-s="error"] { background: var(--danger); }
@keyframes sync-pulse {
  from { opacity: .4; }
  to { opacity: 1; }
}

/* ---------- 回收站 ---------- */
.trash-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.trash-note {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--sunken);
  font-size: 12px;
  color: var(--ink-2);
}
.trash-note svg { flex: none; stroke: var(--ink-3); }
.trash-list { display: flex; flex-direction: column; }
.trash-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 12px var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.trash-row:last-child { border-bottom: 0; }
.trash-row__main { flex: 1; min-width: 0; }
.trash-row__title {
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trash-row__meta {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trash-row__sep { margin: 0 4px; }
.trash-row__actions { display: flex; align-items: center; gap: 6px; flex: none; }

/* ---------- 任务子步骤 ---------- */
.task__actions .icon-btn[data-expand] svg { transition: transform .16s var(--ease); }
.task__actions .icon-btn[data-expand].is-open svg { transform: rotate(180deg); }

.subs {
  margin-top: 9px;
  padding: 9px 11px 11px;
  border-radius: 11px;
  background: var(--sunken);
  border: 1px solid var(--line);
}
.sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.sub-row__title {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sub-row__title.is-done { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-hover); }
.sub-row .icon-btn { opacity: 0; width: 22px; height: 22px; }
.sub-row:hover .icon-btn, .sub-row:focus-within .icon-btn { opacity: 1; }
@media (hover: none) { .sub-row .icon-btn { opacity: .7; } }
.subs__empty { font-size: 12px; color: var(--ink-3); padding: 2px 0 6px; }
.subs__add .input { height: 32px; font-size: 12.5px; background: var(--surface); }
.cb--sm { width: 15px; height: 15px; border-radius: 4px; }

/* ---------- 日历：月/周切换与周视图 ---------- */
.cal-mode { margin-left: 6px; }
.cal-mode .segmented__item { padding: 4px 11px; font-size: 12px; }

.cal-grid--week { padding: var(--sp-3) var(--sp-3) var(--sp-3); }
.cal-week__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  padding: 2px 2px 10px;
  font-variant-numeric: tabular-nums;
}
.cal-week__cols {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  align-items: stretch;
}
.cal-wcol {
  display: flex;
  flex-direction: column;
  min-height: 260px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .14s, box-shadow .14s;
}
.cal-wcol:hover { border-color: var(--line-hover); }
.cal-wcol.is-selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.cal-wcol__head {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--sunken);
}
.cal-wcol__wd { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.cal-wcol__num { font-size: 15px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.cal-wcol.is-today .cal-wcol__num { color: var(--brand-ink); }
.cal-wcol.is-today .cal-wcol__wd { color: var(--brand-ink); }
.cal-wcol__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px;
  overflow-y: auto;
}
.cal-wcol__none { font-size: 11px; color: var(--ink-3); text-align: center; padding: 10px 0; }
.cal-evt {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 7px;
  border-radius: 7px;
  background: var(--brand-soft);
  border-left: 2.5px solid var(--brand);
  font-size: 11.5px;
  line-height: 1.35;
}
.cal-evt__time { flex: none; font-size: 10px; color: var(--brand-ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.cal-evt__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
  font-weight: 550;
}

@media (max-width: 1080px) {
  .cal-week__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-wcol { min-height: 120px; }
}
@media (max-width: 560px) {
  .cal-week__cols { grid-template-columns: minmax(0, 1fr); }
  .cal-head { flex-wrap: wrap; row-gap: 8px; }
  .cal-mode { margin-left: 0; }
}

/* ---------- 数据统计页 ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr);
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  align-items: start;
}
.stats-col { display: flex; flex-direction: column; gap: var(--sp-3); }
.stat-kpi { padding: 16px 18px; }
.stat-kpi__label { font-size: 12px; color: var(--ink-3); font-weight: 550; }
.stat-kpi__value { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin-top: 5px; font-variant-numeric: tabular-nums; }
.stat-kpi__value small { font-size: 12px; font-weight: 550; color: var(--ink-3); margin-left: 3px; letter-spacing: 0; }
.stat-kpi__foot { margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }

.stat-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 190px;
  padding-top: 6px;
}
.stat-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  min-width: 0;
}
.stat-bar__track {
  flex: 1;
  width: 100%;
  max-width: 34px;
  display: flex;
  align-items: flex-end;
  border-radius: 8px;
  background: var(--sunken);
  overflow: hidden;
}
.stat-bar__fill {
  width: 100%;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--brand), color-mix(in srgb, var(--brand) 55%, transparent));
  min-height: 3px;
  transition: height .4s var(--ease);
}
.stat-bar__label { font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

@media (max-width: 1080px) {
  .stats-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .stat-bars { gap: 4px; height: 150px; }
  .stat-bar__label { font-size: 9px; }
}

/* ---------- 全局搜索（Ctrl+K） ---------- */
.gsearch-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 17, 28, .42);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
  animation: gsearch-in .14s var(--ease);
}
@keyframes gsearch-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.gsearch {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 64px -16px rgba(10, 12, 24, .45);
  overflow: hidden;
}
.gsearch__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
}
.gsearch__input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  color: var(--ink);
}
.gsearch__input::placeholder { color: var(--ink-3); }
.gsearch__kbd {
  font-size: 10.5px;
  font-family: inherit;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  background: var(--sunken);
}
.gsearch__results {
  max-height: 46vh;
  overflow-y: auto;
  padding: 6px;
}
.gsearch__group {
  font-size: 10.5px;
  font-weight: 650;
  color: var(--ink-3);
  letter-spacing: .08em;
  padding: 8px 10px 4px;
}
.gsearch__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  text-align: left;
  color: var(--ink-2);
  transition: background .12s;
}
.gsearch__item svg { flex: none; stroke: var(--ink-3); }
.gsearch__item.is-active { background: var(--brand-soft); color: var(--ink); }
.gsearch__item.is-active svg { stroke: var(--brand-ink); }
.gsearch__title {
  flex: none;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 550;
}
.gsearch__meta {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--ink-3);
}
.gsearch__empty { padding: 36px 16px; text-align: center; font-size: 12.5px; color: var(--ink-3); }

/* ---------- Markdown 预览 ---------- */
.md-toggle .segmented__item { padding: 4px 10px; font-size: 11.5px; border-radius: 7px; }
.md-preview {
  flex: 1;
  min-height: 320px;
  padding: 2px 4px 12px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-2);
  overflow-y: auto;
  word-break: break-word;
}
.md-preview h1, .md-preview h2, .md-preview h3 {
  color: var(--ink);
  letter-spacing: -.01em;
  margin: 14px 0 6px;
  line-height: 1.4;
}
.md-preview h1 { font-size: 19px; font-weight: 700; }
.md-preview h2 { font-size: 16px; font-weight: 650; }
.md-preview h3 { font-size: 14px; font-weight: 650; }
.md-preview p { margin: 6px 0; }
.md-preview ul, .md-preview ol { margin: 6px 0; padding-left: 22px; }
.md-preview ul { list-style: disc; }
.md-preview ol { list-style: decimal; }
.md-preview li { margin: 3px 0; list-style: inherit; }
.md-preview a { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 2px; }
.md-preview code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--ink);
}
.md-preview pre {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 8px 0;
}
.md-preview pre code { background: transparent; border: 0; padding: 0; }
.md-preview blockquote {
  margin: 8px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  background: var(--brand-soft);
  color: var(--ink-2);
}
.md-preview blockquote p { margin: 2px 0; }
.md-preview hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.md-preview strong { color: var(--ink); }

/* ---------- 拖拽排序 ---------- */
.task.is-draggable { cursor: grab; }
.task.is-dragging { opacity: .45; }
.task.is-drop-before { box-shadow: inset 0 2px 0 var(--brand); }

/* 打印：仅输出内容 */
@media print {
  .sidebar, .topbar__actions, .mobile-nav, .view-toolbar, .side-focus { display: none !important; }
  .shell { grid-template-columns: 1fr; }
}
