/* 个人工作台 · 深空深色设计系统
   设计方向:参考「制片台/控制台」深色界面,个人生产力仪表盘(桌面为主,手机可用)
   拨盘:VARIANCE 4(布局克制) · MOTION 3(动效低调) · DENSITY 5(信息适中)
   规则:
   - 单一强调色:电光蓝 #4D9FFF,全站锁定,不混入其他强调色
   - 形状:卡片 14px / 控件 10px / 状态标签全胶囊,整套统一
   - 深色为主题底色(参考图风格),浅色为系统跟随主题(变量覆盖)
   - 数字一律 tabular-nums,时钟用大号字重 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* 深空 · 深色令牌(默认) */
  --bg: #0b101b;
  --surface: #151d2f;
  --surface-2: #1d2942;
  --surface-3: #27345a;
  --border: rgba(150, 168, 200, 0.12);
  --border-strong: rgba(150, 168, 200, 0.28);
  --text: #e8edf6;
  --text-2: #b9c3d6;
  --muted: #98a3b8;
  --accent: #4d9fff;
  --accent-strong: #7cc0ff;
  --accent-soft: rgba(77, 159, 255, 0.13);
  --accent-btn: #6fb4ff;
  --accent-btn-text: #08101c;
  --green: #3ecf8e;
  --green-soft: rgba(62, 207, 142, 0.14);
  --red: #ff6b6b;
  --red-soft: rgba(255, 107, 107, 0.14);
  --amber: #ffb454;
  --amber-soft: rgba(255, 180, 84, 0.14);
  --cyan: #4dd8e6;
  --cyan-soft: rgba(77, 216, 230, 0.14);
  --festival: #ffd666;
  --festival-soft: rgba(255, 214, 102, 0.16);
  --term: #c99bff;
  --term-soft: rgba(201, 155, 255, 0.16);
  --important: #ff8fb3;
  --important-soft: rgba(255, 143, 179, 0.18);
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(3, 7, 20, 0.42);
  --shadow-lift: 0 16px 38px rgba(3, 7, 20, 0.52);
}

/* 浅色主题(变量覆盖,保持同一套形状与强调色) */
:root[data-theme="light"] {
  --bg: #edf1f7;
  --surface: #ffffff;
  --surface-2: #f5f8fc;
  --surface-3: #e7edf6;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.24);
  --text: #101828;
  --text-2: #344054;
  --muted: #5f6b81;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --accent-btn: #2563eb;
  --accent-btn-text: #ffffff;
  --green: #0e9f6e;
  --green-soft: rgba(14, 159, 110, 0.12);
  --red: #d92d2d;
  --red-soft: rgba(217, 45, 45, 0.1);
  --amber: #b45309;
  --amber-soft: rgba(180, 83, 9, 0.12);
  --cyan: #0e7490;
  --cyan-soft: rgba(14, 116, 144, 0.12);
  --festival: #a16207;
  --festival-soft: rgba(161, 98, 7, 0.12);
  --term: #7c3aed;
  --term-soft: rgba(124, 58, 237, 0.12);
  --important: #db2777;
  --important-soft: rgba(219, 39, 119, 0.12);
  --shadow: 0 6px 18px rgba(16, 24, 40, 0.08);
  --shadow-lift: 0 10px 26px rgba(16, 24, 40, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0a0d16;
    --surface: #121826;
    --surface-2: #1a2234;
    --surface-3: #232e46;
    --border: rgba(150, 168, 200, 0.14);
    --border-strong: rgba(150, 168, 200, 0.32);
    --text: #e8edf6;
    --text-2: #b9c3d6;
    --muted: #98a3b8;
    --accent: #4d9fff;
    --accent-strong: #7cc0ff;
    --accent-soft: rgba(77, 159, 255, 0.13);
    --accent-btn: #6fb4ff;
    --accent-btn-text: #08101c;
    --green: #3ecf8e;
    --green-soft: rgba(62, 207, 142, 0.14);
    --red: #ff6b6b;
    --red-soft: rgba(255, 107, 107, 0.14);
    --amber: #ffb454;
    --amber-soft: rgba(255, 180, 84, 0.14);
    --cyan: #4dd8e6;
    --cyan-soft: rgba(77, 216, 230, 0.14);
    --festival: #ffd666;
    --festival-soft: rgba(255, 214, 102, 0.16);
    --term: #c99bff;
    --term-soft: rgba(201, 155, 255, 0.16);
    --important: #ff8fb3;
    --important-soft: rgba(255, 143, 179, 0.18);
    --shadow: 0 8px 24px rgba(3, 7, 18, 0.5);
    --shadow-lift: 0 14px 34px rgba(3, 7, 18, 0.62);
  }
}

/* 浅色系统的无 JS 默认(避免跟随系统时先闪一下深色;JS 启动后会写入 data-theme) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #edf1f7;
    --surface: #ffffff;
    --surface-2: #f5f8fc;
    --surface-3: #e7edf6;
    --border: rgba(15, 23, 42, 0.1);
    --border-strong: rgba(15, 23, 42, 0.24);
    --text: #101828;
    --text-2: #344054;
    --muted: #5f6b81;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --accent-soft: rgba(37, 99, 235, 0.1);
    --accent-btn: #2563eb;
    --accent-btn-text: #ffffff;
    --green: #0e9f6e;
    --green-soft: rgba(14, 159, 110, 0.12);
    --red: #d92d2d;
    --red-soft: rgba(217, 45, 45, 0.1);
    --amber: #b45309;
    --amber-soft: rgba(180, 83, 9, 0.12);
    --cyan: #0e7490;
    --cyan-soft: rgba(14, 116, 144, 0.12);
    --festival: #a16207;
    --festival-soft: rgba(161, 98, 7, 0.12);
    --term: #7c3aed;
    --term-soft: rgba(124, 58, 237, 0.12);
    --important: #db2777;
    --important-soft: rgba(219, 39, 119, 0.12);
    --shadow: 0 6px 18px rgba(16, 24, 40, 0.08);
    --shadow-lift: 0 10px 26px rgba(16, 24, 40, 0.14);
  }
}

html {
  font-size: 16px;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(1200px 520px at 12% -8%, rgba(77, 159, 255, 0.12), transparent 60%),
    radial-gradient(1000px 480px at 108% 0%, rgba(62, 207, 142, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-size: 16px;
  min-height: 44px;
  font-family: inherit;
  border-radius: var(--radius-sm);
}

button {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  padding: 0 16px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

button:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

button:active {
  transform: scale(0.98);
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  padding: 9px 12px;
  background: var(--surface-2);
  color: var(--text);
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
}

input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

label {
  display: block;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 14px;
}

label input, label select {
  margin-top: 6px;
}

.hidden {
  display: none !important;
}

.view {
  width: 100%;
  max-width: none;
  padding: 14px 14px 96px;
}

/* 登录(开发期隐藏,正式上线启用) */
.login-box {
  max-width: 380px;
  margin: 10vh auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 26px;
  box-shadow: var(--shadow);
}

.login-box h1 {
  text-align: center;
  margin-bottom: 6px;
  font-size: 22px;
  letter-spacing: 0.5px;
}

.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-btn), #2f7bd9);
  border-color: transparent;
  color: var(--accent-btn-text);
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(77, 159, 255, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 8px 22px rgba(77, 159, 255, 0.36);
  color: var(--accent-btn-text);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  min-height: 40px;
  padding: 0 12px;
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.form-msg {
  text-align: center;
  color: var(--red);
  margin-top: 10px;
  min-height: 18px;
  font-size: 14px;
}

.hint-line {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 14px;
}

/* 顶栏 */
#app-view.view {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.main-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  flex: 1;
}

.topbar {
  position: relative;
  z-index: 20;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  display: none;   /* 按用户要求:上方不再显示「个人工作台」和圆角方块 */
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #2f7bd9);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 4px 12px rgba(77, 159, 255, 0.35);
  flex: none;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.clock-box {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.clock-date {
  color: var(--text-2);
  font-size: 17px;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
}

.clock-date:hover {
  color: var(--accent-strong);
}

.clock-time {
  font-size: 30px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.clock-week {
  color: var(--muted);
  font-size: 16px;
  padding: 3px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-search {
  position: relative;
  min-width: 0;
}

.top-search input {
  min-height: 28px;
  width: 180px;
  max-width: 28vw;
  border-radius: 999px;
  padding: 4px 16px;
}

.top-search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 340px;
  max-width: 92vw;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  max-height: 55vh;
  overflow-y: auto;
  z-index: 50;
  padding: 6px;
}

.coin-chip {
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.coin-chip .chip-up {
  color: var(--green);
}

.coin-chip .chip-down {
  color: var(--red);
}

.topbar-add {
  min-height: 40px;
  padding: 0 14px;
  white-space: nowrap;
}

@media (max-width: 639px) {
  .brand-name {
    display: none;
  }
  .clock-date {
    font-size: 14px;
  }
  .clock-time {
    font-size: 24px;
  }
  .clock-week {
    font-size: 13px;
    padding: 2px 9px;
  }
  .topbar {
    gap: 8px;
  }
  .topbar-actions {
    gap: 6px;
  }
  .top-search {
    flex: 1;
    min-width: 0;
  }
  .top-search input {
    width: 100%;
    max-width: none;
  }
  .topbar-actions button,
  .topbar-add {
    min-height: 36px;
    padding: 0 10px;
    font-size: 13px;
  }
  .weather-chip {
    font-size: 12px;
    padding: 5px 10px;
  }
}

.weather-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  cursor: pointer;
  min-width: 120px;
}

.weather-chip {
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.weather-wrap.weather-loading .weather-chip {
  opacity: 0.55;
  pointer-events: none;
}

/* 三栏布局骨架(整页铺满 + 可拖拽分栏) */
.app-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.side-nav {
  display: none;
}

.right-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.panel-card {
  background: var(--surface);
  border: 1px solid rgba(150, 168, 200, 0.08);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 4px 18px rgba(3, 7, 20, 0.28);
}

.panel-card .sub-title {
  font-size: 16px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.quick-actions .btn-ghost {
  min-height: 38px;
  padding: 0 8px;
  font-size: 13px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.splitter {
  display: none;
  position: relative;
  cursor: col-resize;
}

.splitter::after {
  content: "";
  position: absolute;
  inset: 6px 2px;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.splitter:hover::after {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(77, 159, 255, 0.45);
}

/* 导航按钮 */
.side-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0 4px;
  margin-bottom: 20px;   /* 工作台与导航之间留出空间 */
  min-width: 0;
}

.side-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #2f7bd9);
  box-shadow: 0 4px 12px rgba(77, 159, 255, 0.35);
}

.side-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.side-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 100%;
  line-height: 1.3;
}

.side-sub {
  font-size: 15px;       /* 与名称同字号同字重 */
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  position: relative;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-btn:hover {
  background: var(--surface-2);
  color: var(--text-2);
}

.nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.nav-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

/* 主区 */
.main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

/* 今日待办浓缩 */
.panel-today {
  font-size: 14px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.panel-today-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
}

.panel-today-item:last-child {
  border-bottom: none;
}

.panel-today-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.panel-today-count {
  color: var(--muted);
  white-space: nowrap;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.panel-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.panel-dot.important {
  background: #f0a3a3;
}

.panel-dot.urgent {
  background: #e8c287;
}

.panel-today-empty {
  color: var(--muted);
  font-size: 13px;
}

.panel-cal {
  margin-top: 6px;
}

.side-cal-head {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
}

.side-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.side-cal-w {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}

.side-cal-day {
  min-height: 26px;
  padding: 0;
  font-size: 12px;
  text-align: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  border-radius: 8px;
  cursor: pointer;
}

.side-cal-day:hover {
  background: var(--surface-3);
}

.side-cal-day.today {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  border-color: rgba(77, 159, 255, 0.4);
}

.greeting {
  color: var(--text);
  font-size: 19px;
  font-weight: 700;
  white-space: nowrap;
}

.side-overview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-ov-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

#side-coin {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

#side-coin .coin-mini-card {
  width: 100%;
}

#side-rate .coin-mini-card {
  flex: 1 1 100%;
}
  color: var(--muted);
  padding: 8px 0;
}

/* 预算进度(右侧面板:只显示百分比进度条) */
.panel-budget {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.budget-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.budget-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.budget-name {
  color: var(--text-2);
}

.budget-pct {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.pb-ok {
  background: var(--green);
}

.pb-warn {
  background: var(--amber);
}

.pb-over {
  background: var(--red);
}

/* 移动端底部导航 */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}

.bottom-tab {
  flex: 1;
  min-height: 46px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  border-radius: 9px;
}

.bottom-tab.active {
  color: var(--accent-strong);
  font-weight: 600;
  background: var(--accent-soft);
}

/* 更多抽屉 */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 16, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.sheet-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 70vh;
  overflow-y: auto;
}

/* 浮层(搜索 / 快速新建) */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(5, 8, 16, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
}

.search-box {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 16vh - 32px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-lift);
}

.search-results {
  margin-top: 10px;
  max-height: 55vh;
  overflow-y: auto;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 4px;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
  cursor: pointer;
}

.search-item:hover {
  color: var(--accent-strong);
}

.search-empty {
  color: var(--muted);
  text-align: center;
  padding: 16px 0;
  font-size: 14px;
}

/* 轻提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 90;
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow-lift);
}

.pane-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}

.pane-head .pane-title {
  margin-bottom: 0;
}

#new-todo-btn {
  min-height: 40px;
  padding: 0 14px;
  white-space: nowrap;
}

.card {
  background: var(--surface-2);
  border: 1px solid rgba(150, 168, 200, 0.08);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 12px;
}

.form-row {
  display: flex;
  gap: 18px;
  margin: 4px 0 14px;
  flex-wrap: wrap;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  margin-bottom: 0;
  font-size: 15px;
}

.check-label input {
  width: auto;
  min-height: auto;
  margin: 0;
  accent-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 10px;
}

.form-actions .btn-primary {
  padding: 0 24px;
}

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-bar select {
  min-width: 0;
  flex: 1;
}

.filter-bar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

/* 财务:收支左右两栏明细 */
.tx-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.tx-col {
  min-width: 0;
}

.tx-col-total {
  margin-top: 10px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.tx-col-total span {
  margin-left: 4px;
}

.tx-total-expense {
  color: var(--red);
}

.tx-total-income {
  color: var(--green);
}

/* 驾驶舱指标卡(参考 5.jpg:图标 + 数字 + 说明) */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  flex: none;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.stat-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.stat-hint {
  color: var(--muted);
  font-size: 11px;
}

.stat-overdue .stat-value { color: var(--red); }
.stat-today .stat-value { color: var(--accent-strong); }
.stat-upcoming .stat-value { color: var(--text); }
.stat-habits .stat-value { color: var(--amber); }
.stat-finance .stat-value { color: var(--red); }
.stat-overdue .stat-icon { color: var(--red); background: var(--red-soft); }
.stat-today .stat-icon { color: var(--accent-strong); background: var(--accent-soft); }
.stat-upcoming .stat-icon { color: var(--text-2); background: var(--surface-3); }
.stat-habits .stat-icon { color: var(--amber); background: var(--amber-soft); }
.stat-finance .stat-icon { color: var(--green); background: var(--green-soft); }

/* 驾驶舱模块卡片网格 */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.dash-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.dash-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.dash-more {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.dash-mini-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}

.dash-mini-item:last-child {
  border-bottom: none;
}

/* 首页待办里的「完成」按钮:紧凑小胶囊 */
.dash-mini-item .btn-small-primary {
  min-height: 26px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 999px;
  flex: none;
}

.dash-mini-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-overdue {
  border-left: 3px solid var(--red);
  background: linear-gradient(90deg, var(--red-soft), transparent 60%);
  padding-left: 10px;
}

/* 待办列表 */
.todo-list {
  list-style: none;
}

/* 待办页:按领域分左右两栏 */
.todo-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

@media (min-width: 900px) {
  .dash-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .dash-card-wide {
    grid-column: span 2;
  }
  .todo-cols {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .tx-cols {
    grid-template-columns: 1fr 1fr;
  }
}

.todo-col {
  min-width: 0;
}

.todo-subgroup {
  margin-bottom: 12px;
}

.todo-subgroup .sub-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.todo-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.todo-item:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}

.todo-item.overdue {
  border-left: 3px solid var(--red);
  background:
    linear-gradient(90deg, var(--red-soft), transparent 55%),
    var(--surface-2);
}

.todo-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.todo-done {
  color: var(--muted);
  text-decoration: line-through;
}

.todo-title {
  font-size: 15px;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  justify-content: flex-end;
}

.tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
}

.tag-important {
  color: #f0a3a3;
  border-color: transparent;
  background: var(--surface-3);
  font-weight: 600;
}

.tag-urgent {
  color: #e8c287;
  border-color: transparent;
  background: var(--surface-3);
  font-weight: 600;
}

.tag-exclusive {
  color: #f2afc8;
  border-color: transparent;
  background: var(--surface-3);
  font-weight: 600;
}

.tag-overdue {
  color: #fff;
  font-weight: 600;
  background: #d97676;
  border-color: #d97676;
}

.tag-done, .tag-income {
  color: #8fcfb4;
  border-color: transparent;
  background: var(--surface-3);
}

.tag-holiday, .tag-expense {
  color: #f0a3a3;
  border-color: transparent;
  background: var(--surface-3);
}

.tag-workday {
  color: #e8c287;
  border-color: transparent;
  background: var(--surface-3);
}

.todo-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

.todo-actions button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
  white-space: nowrap;
}

.todo-view-body {
  margin-top: 6px;
  max-height: 60vh;
  overflow-y: auto;
}

.todo-view-chiprow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tv-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
}

.todo-view-row {
  display: flex;
  gap: 14px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.todo-view-row .tv-k {
  flex: 0 0 96px;
  color: var(--muted);
}

.todo-view-row .tv-v {
  color: var(--text);
  word-break: break-word;
}

.btn-small-primary {
  background: var(--accent-btn);
  border-color: var(--accent-btn);
  color: var(--accent-btn-text);
  font-weight: 600;
}

.btn-small-primary:hover {
  filter: brightness(1.08);
  border-color: var(--accent-btn);
  color: var(--accent-btn-text);
}

.tag-ended {
  color: var(--muted);
  border-color: var(--border);
  background: var(--surface-2);
  font-weight: 600;
}

/* 打卡:矩形卡片网格 */
.card-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.card-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.card-grid-4 .mind-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.card-grid-3 .mind-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.card-grid-3 .mind-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}

.card-grid-4 .mind-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}

.mind-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.mind-card-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.mind-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mind-card-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
}

.mind-card-actions button {
  flex: 1;
  min-height: 36px;
  padding: 0 8px;
  font-size: 13px;
}

.mind-card-actions button[data-act="view"] {
  color: var(--green);
  border-color: rgba(62, 207, 142, 0.4);
  background: var(--green-soft);
}

.mind-card-actions button[data-act="edit"] {
  color: var(--accent);
  border-color: rgba(77, 159, 255, 0.4);
  background: var(--accent-soft);
}

.mind-card-actions button[data-act="del"] {
  color: var(--red);
  border-color: rgba(255, 107, 107, 0.4);
  background: var(--red-soft);
}

.mind-view-body {
  margin-top: 10px;
  height: calc(100vh - 24vh - 90px);
  min-height: 320px;
  overflow: auto;
  cursor: grab;
  position: relative;
  background:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
  user-select: none;
}

.mind-view-body:active {
  cursor: grabbing;
}

.mind-pan {
  transform: translate(var(--pan-x, 0px), var(--pan-y, 0px));
  width: max-content;
}

.mind-zoom-wrap {
  zoom: var(--zoom, 1);
  transform-origin: 0 0;
}

#mind-view-overlay .search-box {
  max-width: 67.5vw;
  width: 67.5vw;
  max-height: calc(100vh - 8vh - 24px);
}

.mind-view-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.mind-view-toolbar button {
  min-height: 30px;
  padding: 0 12px;
  font-size: 14px;
}

.mind-zoom-label {
  min-width: 48px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.habit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.habit-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.habit-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}

.habit-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.habit-card-head-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.habit-card-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.habit-more-dots {
  width: 34px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
}

.habit-more-dots:hover {
  color: var(--accent);
  background: var(--surface-3);
  border-color: var(--border);
}

.habit-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.habit-card-note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-3);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  word-break: break-word;
}

.checkin-input-wrap {
  margin-top: 10px;
}

.checkin-text-input {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  font-size: 15px;
  line-height: 1.6;
  padding: 10px 12px;
}

.habit-record-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
}

.habit-record-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.habit-checks {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 40px;
}

.habit-logs-list {
  margin-top: 10px;
  max-height: 55vh;
  overflow-y: auto;
}

.habit-logs-search {
  width: 100%;
  margin-top: 10px;
  min-height: 36px;
  padding: 0 12px;
}

.habit-log-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}

.habit-log-date {
  flex-shrink: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.habit-log-note {
  word-break: break-word;
  color: var(--text);
}

.habit-stat {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
}

.habit-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.habit-card-actions button {
  min-height: 38px;
}

.habit-card-actions .habit-btn-main {
  width: 100%;
  min-height: 42px;
  font-size: 15px;
  font-weight: 600;
  background: var(--accent-btn);
  border-color: var(--accent-btn);
  color: var(--accent-btn-text);
}

.habit-card-actions .habit-btn-main:hover {
  filter: brightness(1.08);
  border-color: var(--accent-btn);
  color: var(--accent-btn-text);
}

.habit-card-links {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.habit-card-link {
  min-height: 28px !important;
  padding: 0 4px;
  font-size: 13px;
  color: var(--accent);
  background: transparent;
  border: none;
}

.habit-card-link:hover {
  color: var(--accent-strong);
  background: transparent;
  text-decoration: underline;
}

.habit-more-menu {
  position: fixed;
  z-index: 95;
  min-width: 132px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.habit-more-menu button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 14px;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 8px;
}

.habit-more-menu button:hover {
  background: var(--surface-3);
}

.habit-more-menu #habit-more-del {
  color: var(--red);
}

.habit-more-scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
}

.habit-stats-body {
  margin-top: 12px;
}

.habit-stats-period {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 12px;
}

.habit-stats-period button {
  min-height: 30px;
  padding: 0 14px;
  font-size: 13px;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.habit-stats-period button.active {
  color: var(--accent-btn-text);
  background: var(--accent-btn);
  font-weight: 600;
}

.habit-stats-range {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.habit-stats-range label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.habit-stats-range input {
  min-height: 34px;
  padding: 0 8px;
}

.habit-stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.habit-stats-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.habit-stats-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.habit-stats-label {
  font-size: 12px;
  color: var(--muted);
}

.habit-stats-strip {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 4px;
  margin-top: 14px;
}

.habit-stats-day {
  height: 10px;
  border-radius: 2px;
  background: var(--surface-3);
  border: 1px solid var(--border);
}

.habit-stats-day.on {
  background: var(--accent);
  border-color: var(--accent);
}

.habit-stats-day:not(.on) {
  color: transparent;
}

.habit-stats-day[title*="-"]:has(span) {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
}

.habit-stats-day span {
  font-size: 12px;
  color: var(--muted);
}

.habit-stats-day.on span {
  color: var(--accent-btn-text);
  font-weight: 600;
}

/* 财务统计弹窗 */
.finance-stats-body {
  margin-top: 12px;
}

.fin-stats-divider {
  border-top: 1px solid var(--border);
  margin: 18px 0 12px;
}

.fin-budget-section {
  margin-top: 4px;
}

.budget-stats-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.fin-budget-month-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.fin-budget-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.fin-budget-month {
  flex: 0 0 64px;
  color: var(--text);
  font-weight: 600;
}

.fin-budget-none {
  color: var(--muted);
}

.fin-budget-spent {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.fin-budget-cats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.fin-budget-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.fin-stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.fin-stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--muted);
}

.fin-stat-num {
  font-size: 20px;
  font-weight: 700;
}

.fin-stat-num.expense {
  color: var(--red);
}

.fin-stat-num.income {
  color: var(--green);
}

.fin-stats-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.fin-stats-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.fin-cat-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 6px;
}

.fin-cat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.fin-cat-name {
  flex: 0 0 64px;
  color: var(--text);
}

.fin-cat-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.fin-cat-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.fin-cat-val {
  flex: 0 0 auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.fin-budget-exec {
  margin-top: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.fin-budget-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.fin-budget-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.fin-budget-month {
  flex: 0 0 64px;
  color: var(--text);
}

.fin-budget-val {
  flex: 0 0 auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.fin-budget-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.fin-budget-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.fin-budget-bar i.over {
  background: var(--red);
}

.fin-budget-pct {
  flex: 0 0 auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.fin-budget-pct.over {
  color: var(--red);
  font-weight: 600;
}

@media (max-width: 639px) {
  .fin-stats-cols {
    grid-template-columns: 1fr;
  }
}

.habit-ended {
  opacity: 0.72;
}

.habit-ended .habit-card-name {
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}

.habit-group-title {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  padding: 10px 4px 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  border-top: 1px solid var(--border);
  list-style: none;
}

@media (max-width: 639px) {
  .habit-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .habit-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .card-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .card-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 639px) {
  .card-grid-4 {
    grid-template-columns: 1fr;
  }
  .card-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* 状态选择(胶囊;普通待办不含「进行中」,项目待办保留) */
.status-select {
  min-height: 34px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  width: auto;
  border: 1px solid;
  cursor: pointer;
}

.status-pill {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}

.status-pill.status-todo {
  color: #9ab8e8;
  background: var(--surface-3);
  border-color: transparent;
}

.status-pill.status-doing {
  color: #e8c287;
  background: var(--surface-3);
  border-color: transparent;
}

.status-pill.status-done {
  color: #8fcfb4;
  background: var(--surface-3);
  border-color: transparent;
}

.status-pill.status-unfinished {
  color: #f0a3a3;
  background: var(--surface-3);
  border-color: transparent;
}

.status-todo {
  color: #9ab8e8;
  background: var(--surface-3);
  border-color: transparent;
}

.status-doing {
  color: #e8c287;
  background: var(--surface-3);
  border-color: transparent;
}

.status-done {
  color: #8fcfb4;
  background: var(--surface-3);
  border-color: transparent;
}

.status-unfinished {
  color: #f0a3a3;
  background: var(--surface-3);
  border-color: transparent;
}

.empty-tip {
  color: var(--muted);
  text-align: center;
  padding: 24px 0;
}

.dash-group {
  margin-bottom: 16px;
}

.dash-group h3 {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.dash-group h3 .count {
  color: var(--red);
}

/* 记账 */
.sub-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}

.sum-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  align-items: center;
}

.sum-main {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
}

.sum-main > div {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
}

.sum-budget {
  margin-left: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  max-width: 300px;
}

.sum-budget .progress {
  height: 10px;
  flex: 1;
  min-width: 80px;
}

.sum-budget-pct {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sum-budget-pct.pct-ok { color: var(--green); }
.sum-budget-pct.pct-warn { color: var(--amber); }
.sum-budget-pct.pct-over { color: var(--red); }

.sum-label {
  color: var(--muted);
  font-size: 13px;
}

.sum-expense {
  color: var(--red);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 10ch;
}

.sum-income {
  color: var(--green);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 10ch;
}

.tx-expense {
  color: var(--red);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tx-income {
  color: var(--green);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.budget-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 12px;
}

.budget-form {
  max-height: 55vh;
  overflow-y: auto;
  margin-bottom: 12px;
}

/* 项目 */
.project-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  transition: border-color 0.15s ease;
}

.project-card:hover {
  border-color: var(--border-strong);
}

.project-name {
  font-size: 16px;
  font-weight: 600;
}

.rework-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.rework-bar label {
  margin-bottom: 0;
  font-size: 13px;
}

.rework-bar select {
  min-height: 38px;
  width: auto;
  font-size: 14px;
  margin-top: 0;
}

.stage-flow {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.stage-card {
  min-width: 230px;
  max-width: 260px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.stage-name {
  font-size: 14px;
  font-weight: 600;
  word-break: break-word;
}

.stage-head .status-select {
  min-height: 30px;
  font-size: 12px;
  padding: 2px 6px;
}

.stage-todos {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stage-todo {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 14px;
}

.stage-todo-check {
  min-height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 50%;
  font-size: 13px;
  color: var(--green);
}

.stage-todo-x {
  min-height: 26px;
  min-width: 26px;
  padding: 0;
  border-radius: 50%;
  font-size: 13px;
  color: var(--muted);
  margin-left: auto;
}

.stage-add {
  display: flex;
  gap: 6px;
}

.stage-add input {
  min-height: 36px;
  font-size: 14px;
  padding: 6px 8px;
}

.stage-add .stage-new-title {
  flex: 1;
}

.stage-add .stage-new-due {
  width: 110px;
}

.stage-add button {
  min-height: 36px;
  padding: 0 10px;
}

.stage-add-card {
  min-width: 150px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  padding: 10px;
}

.stage-add-card input {
  min-height: 36px;
  font-size: 14px;
}

.stage-add-card button {
  min-height: 36px;
}

/* 灵感 */
textarea {
  resize: vertical;
  min-height: 80px;
}

.idea-content {
  white-space: pre-wrap;
  line-height: 1.5;
}

/* 日历 */
.cal-nav {
  display: flex;
  gap: 6px;
}

.cal-nav .btn-ghost {
  padding: 0 10px;
  font-size: 16px;
}

.cal-head {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-holiday { background: var(--red); }
.dot-workday { background: var(--amber); }
.dot-festival { background: var(--festival); }
.dot-important { background: var(--important); }
.dot-term { background: var(--term); }

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

/* 日历页:桌面左右两栏(日历 2/3 + 右侧当天信息 1/3);窄屏自动上下堆叠 */
.cal-layout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.cal-left {
  flex: 2;
  min-width: 0;
}

.cal-right {
  flex: 1;
  min-width: 0;
  max-height: 78vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cal-right .card:last-child {
  margin-bottom: 0;
}

@media (max-width: 767px) {
  .cal-layout {
    flex-direction: column;
  }
  .cal-left,
  .cal-right {
    width: 100%;
  }
  .cal-right {
    max-height: none;
    overflow-y: visible;
  }
}

.cal-weekdays {
  margin-bottom: 6px;
}

.cal-weekdays span {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0;
}

.cal-cell {
  min-height: 62px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  cursor: pointer;
  background: var(--surface-2);
  overflow: hidden;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.cal-cell:hover {
  border-color: var(--accent);
}

.cal-empty {
  border: none;
  cursor: default;
  background: transparent;
}

.cal-daynum {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cal-holiday .cal-daynum {
  color: var(--red);
}

.cal-workday .cal-daynum {
  color: var(--amber);
}

.cal-lunar {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.2;
}

.cal-term {
  font-size: 10px;
  color: var(--term);
  font-weight: 600;
  line-height: 1.2;
}

.cal-holiday-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--red);
  background: var(--red-soft);
  border-radius: 999px;
  padding: 1px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  align-self: flex-start;
  max-width: 100%;
}

.cal-workday .cal-holiday-name {
  color: var(--amber);
  background: var(--amber-soft);
}

.cal-imp {
  font-size: 10px;
  color: var(--important);
  background: var(--important-soft);
  border-radius: 999px;
  padding: 1px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  align-self: flex-start;
}

.cal-festival {
  font-size: 10px;
  font-weight: 600;
  color: var(--festival);
  background: var(--festival-soft);
  border-radius: 999px;
  padding: 1px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  align-self: flex-start;
  max-width: 100%;
}

.tag-festival {
  color: var(--festival);
  border-color: rgba(255, 214, 102, 0.4);
  background: var(--festival-soft);
}

.cal-todo {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.cal-today .cal-daynum {
  color: var(--accent-strong);
}

.cal-selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.cal-detail-title {
  font-size: 17px;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.cal-detail-sub {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.cal-sec {
  margin-bottom: 12px;
}

.cal-sec h4 {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}

/* 资讯 */
.coin-mini-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.coin-mini-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12px;
  text-align: center;
}

.coin-mini-sym {
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
}

.coin-mini-val {
  font-variant-numeric: tabular-nums;
}

.coin-mini-chg {
  font-weight: 600;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.coin-mini-rate .coin-mini-val {
  color: var(--accent-strong);
}

.coin-mini-err {
  color: var(--muted);
}

.coin-mini-empty {
  color: var(--muted);
}

.tag-mind {
  color: var(--term);
  border-color: rgba(201, 155, 255, 0.4);
  background: var(--term-soft);
  font-weight: 600;
}

.mind-preview {
  margin-top: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* 思维导图:横向展开(参考图风格:彩色层级节点 + 深灰连接线) */
.mind-editor {
  overflow: auto;
  max-width: 100%;
  margin-bottom: 12px;
}

.mind-canvas {
  position: relative;
  min-width: 100%;
}

.mind-lines {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  pointer-events: none;
}

.mind-box {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mind-box .mind-input {
  width: 100%;
  height: 100%;
  color: var(--text);
  border: 1px solid var(--text);
  border-radius: 10px;
  background: transparent;
  font-weight: 600;
  text-align: center;
  padding: 0 8px;
  min-height: 0;
}

.mind-box .mind-input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.mind-drag {
  position: absolute;
  left: -18px;
  top: 0;
  cursor: grab;
  color: var(--muted);
  padding: 0 2px;
  user-select: none;
  z-index: 3;
  background: transparent;
  border: none;
  opacity: 0.55;
}

.mind-drag svg {
  width: 8px;
  height: 11px;
}

.mind-drag:hover {
  color: var(--accent-strong);
  opacity: 1;
}

.mind-box.dragging {
  opacity: 0.45;
}

.mind-box.drop-child {
  box-shadow: 0 0 0 2px var(--accent);
}

.mind-box.drop-before::before,
.mind-box.drop-after::after {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  z-index: 2;
}

.mind-box.drop-before::before {
  top: -5px;
}

.mind-box.drop-after::after {
  bottom: -5px;
}

.mind-canvas.drop-root {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}

/* 右键菜单 */
.mind-ctx {
  position: fixed;
  z-index: 200;
  min-width: 128px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 4px;
  box-shadow: var(--shadow-lift);
}

.mind-ctx button {
  display: block;
  width: 100%;
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--text-2);
}

.mind-ctx button:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.mind-ctx button:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* 只读(预览 / 查看脑图) */
.mind-view-box {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  border: 1px solid var(--text);
  border-radius: 10px;
  background: transparent;
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mind-preview {
  overflow: auto;
}

.mind-details {
  margin-top: 8px;
  font-size: 13px;
}

.mind-details summary {
  cursor: pointer;
  color: var(--accent-strong);
  padding: 2px 0;
}

/* 设置 */
.settings-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.settings-row .btn-primary {
  padding: 0 18px;
}

.avatar-preview {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #2f7bd9);
  flex: none;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-file-label {
  margin-bottom: 0;
  font-size: 13px;
}

#import-file {
  margin-top: 6px;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 44px;
}

/* 报表 */
.trend-line {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
}

.weekly-text {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 10px;
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .col-full {
    grid-column: 1 / -1;
  }
  .budget-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .cal-cell {
    min-height: 86px;
    padding: 6px;
  }
  .cal-lunar, .cal-term, .cal-imp {
    font-size: 11px;
  }
}

@media (max-width: 639px) {
  .cal-lunar {
    display: none;
  }
}

/* 桌面:三栏 + 顶栏(整页铺满,分栏可拖拽) */
@media (min-width: 1024px) {
  .view {
    padding-bottom: 14px;
  }

  #app-view.view {
    display: grid;
    grid-template-columns: var(--side-w, 190px) 8px minmax(0, 1fr);
    gap: 0;
    padding: 0;
  }

  button {
    min-height: 40px;
  }

  .main-area {
    padding: 12px 12px 12px 4px;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr) 8px var(--right-w, 360px);
    gap: 0;
    align-items: stretch;
  }

  .splitter {
    display: block;
  }

  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--surface);
    border: none;
    border-right: 1px solid var(--border);
    border-radius: 0;
    padding: 12px 10px;
    overflow-y: auto;
    min-height: 0;
  }

  .nav-settings {
    margin-top: auto;
    border-top: 1px solid var(--border);
    border-radius: 0;
  }

  .main,
  .right-panel {
    overflow-y: auto;
    min-height: 0;
  }

  .main {
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
  }

  .right-panel {
    padding-right: 2px;
  }

  .bottom-nav {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ---- 统计页 ---- */
.stats-range {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

.stats-select,
.stats-date {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
}

.stats-to {
  color: var(--muted);
  font-size: 13px;
}

#stats-refresh {
  white-space: nowrap;
}

.stats-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stats-body .card {
  margin-bottom: 0;
}

.stats-cols {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stats-cols .card {
  margin-bottom: 0;
  height: 100%;
}

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

.stat-card {
  text-align: center;
  padding: 16px 12px;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }

.stat-label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.stats-bar {
  margin-bottom: 10px;
}

.stats-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--text-2);
}

.stats-bar-head span:last-child {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stats-bar .progress {
  height: 10px;
}

.col-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding-top: 12px;
}

.col-chart-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 3px;
}

.col-chart-bar {
  width: 14%;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
  min-height: 2px;
}

.col-chart-duo {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 100%;
  width: 16%;
}

.col-bar-income {
  flex: 1;
  background: var(--green);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}

.col-bar-expense {
  flex: 1;
  background: var(--red);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}

.col-chart-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.col-chart-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.dual-donut {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.donut-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.donut-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.donut-svg {
  width: 130px;
  height: 130px;
  flex-shrink: 0;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
}

.donut-legend-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.budget-pct.over {
  color: var(--red);
  font-weight: 600;
}

.stats-body .budget-pct {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stats-body .budget-pct.over {
  color: var(--red);
}

@media (max-width: 767px) {
  .col-chart {
    height: 150px;
  }
  .donut-wrap {
    flex-direction: column;
    align-items: flex-start;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-cols {
    grid-template-columns: 1fr;
  }
}

/* ---- 长期目标 ---- */
.goal-view-switch {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.goal-switch {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
}

.goal-switch.active {
  background: var(--accent-btn);
  border-color: var(--accent-btn);
  color: var(--accent-btn-text);
  font-weight: 600;
}

.goal-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.goal-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 14px;
}

.goal-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.goal-progress-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(var(--green) calc(var(--p) * 1%), var(--surface-3) 0);
  position: relative;
}

.goal-progress-circle::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--surface-2);
}

.goal-progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  z-index: 1;
}

.goal-head-main {
  flex: 1;
  min-width: 0;
}

.goal-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.goal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.goal-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}

.goal-status-active { background: var(--accent-soft); color: var(--accent-strong); }
.goal-status-done { background: var(--green-soft); color: var(--green); }
.goal-status-giveup { background: var(--red-soft); color: var(--red); }
.goal-status-archive { background: var(--surface-3); color: var(--muted); }

.goal-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.goal-progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.goal-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.goal-actions .btn-ghost {
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.goal-body {
  margin-top: 10px;
}

.goal-tree {
  display: flex;
  flex-direction: column;
}

.goal-node {
  position: relative;
  margin-left: 14px;
  padding-left: 16px;
  margin-top: 4px;
}

.goal-node::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--muted);
  opacity: 0.25;
}

.goal-node::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 50%;
  width: 12px;
  height: 2px;
  background: var(--muted);
  opacity: 0.25;
}

.goal-node:first-child {
  margin-top: 0;
}

.node-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.node-row:hover {
  background: var(--surface-3);
  border-color: var(--border);
}

.node-row.node-done {
  opacity: 0.75;
}

.node-toggle {
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.node-toggle:hover {
  color: var(--accent-strong);
}

.node-toggle:active {
  transform: none;
}

.node-toggle-spacer {
  width: 16px;
  flex-shrink: 0;
}

.node-children {
  margin-left: 0;
}

.node-check {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border-radius: 4px;
  border: 2px solid var(--text-2);
  background: var(--surface-2);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.18s ease, background 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.node-check:hover {
  border-color: var(--red);
  background: var(--red-soft);
}

.node-check:active {
  transform: none;
}

.node-check.done {
  border-color: var(--red);
  background: var(--red-soft);
}

.node-check.done::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 11px;
  border: solid var(--red);
  border-width: 0 3px 3px 0;
  transform: translate(-50%, -50%) rotate(45deg);
  transform-origin: center;
}

.node-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  padding: 0 6px;
}

.node-badge-group {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.node-title {
  font-size: 14px;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-types {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.node-type {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  white-space: nowrap;
}

.node-type.accum {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.node-type.habit {
  background: var(--green-soft);
  color: var(--green);
}

.node-type.effort {
  background: var(--amber-soft);
  color: var(--amber);
}

.node-pct {
  font-size: 12px;
  color: var(--muted);
  width: 40px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.node-actions {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.node-btn {
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
  white-space: nowrap;
}

.node-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.inline-child {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 4px 20px;
}

.inline-child-input {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 6px 10px;
  font-size: 13px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.inline-child-input:focus {
  outline: none;
  border-color: var(--accent);
}

.inline-child-cancel {
  min-height: 0;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.inline-child-cancel:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.node-menu {
  position: fixed;
  z-index: 999;
  min-width: 150px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  padding: 4px;
}

/* 全局居中提示(替代浏览器原生 alert/confirm) */
.app-toast {
  position: fixed;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  max-width: 78vw;
  padding: 14px 26px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  white-space: pre-wrap;
}

.app-toast.show {
  opacity: 1;
}

.app-toast.error {
  border-color: var(--red);
  color: var(--red);
}

.app-toast.success {
  border-color: var(--green);
  color: var(--green);
}

.app-confirm {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(4, 8, 18, 0.55);
}

.app-confirm.hidden {
  display: none;
}

.app-confirm-box {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  min-width: 300px;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 22px 24px;
}

.app-confirm-text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
  white-space: pre-wrap;
}

.app-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.app-confirm-no,
.app-confirm-yes {
  min-height: 36px;
  padding: 0 16px;
}

.app-input-field {
  width: 100%;
  min-height: 0;
  margin-top: 18px;
  padding: 9px 12px;
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.app-input-field:focus {
  outline: none;
  border-color: var(--accent);
}

/* 时长相关 */
.checkin-duration-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 10px;
}

.checkin-duration-row label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.checkin-duration-row input {
  flex: 0 0 150px;
  min-height: 0;
  padding: 8px 12px;
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.checkin-duration-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.effort-add #effort-duration {
  flex: 0 0 88px;
  min-height: 36px;
}

.habit-log-dur {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.effort-total {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.effort-dur {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.effort-period-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.effort-period-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.effort-period-btns button {
  min-height: 28px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.effort-period-btns button:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.effort-period-btns button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.effort-period-total {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.cat-kinds {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.cat-kinds button {
  min-height: 28px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}

.cat-kinds button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.cat-list {
  max-height: 46vh;
  overflow-y: auto;
  margin-bottom: 12px;
}

.cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.cat-name {
  color: var(--text);
  font-size: 14px;
}

.cat-ops {
  display: flex;
  gap: 6px;
}

.cat-op {
  min-height: 0;
  padding: 3px 10px;
  font-size: 12px;
}

.cat-add {
  display: flex;
  gap: 8px;
}

.cat-add input {
  flex: 1;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
}

.cat-add .btn-primary {
  min-height: 36px;
  padding: 0 16px;
}

.node-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.node-menu button:hover {
  background: var(--surface-3);
  color: var(--accent-strong);
}

@media (max-width: 767px) {
  .goal-actions {
    flex-wrap: wrap;
  }
  .node-title {
    white-space: normal;
  }
}

.effort-list {
  max-height: 40vh;
  overflow-y: auto;
  margin-bottom: 12px;
}

.effort-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.effort-note {
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.effort-from {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
  margin-right: 2px;
}

.effort-time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.effort-add {
  display: flex;
  gap: 8px;
}

.effort-add input {
  flex: 1;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
}

/* 视图切换淡入 */
.view-pane:not(.hidden) {
  animation: fadeInUp 0.22s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* 卡片精致 hover */
.card,
.panel-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.panel-card:hover {
  border-color: var(--border-strong);
}

/* 统一滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
