/* ==========================================================
   个人管理中心 · 设计系统
   ========================================================== */
:root {
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-soft: #eef2ff;
  --success: #10b981;
  --success-soft: #ecfdf5;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --info: #0ea5e9;
  --info-soft: #f0f9ff;

  --income: #16a34a;
  --expense: #e5484d;

  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --border: #e8eaf0;
  --border-strong: #d8dbe5;
  --text: #171a22;
  --text-2: #5b6478;
  --text-3: #949cb0;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-xs: 0 1px 2px rgba(19, 22, 34, .05);
  --shadow-sm: 0 2px 8px rgba(19, 22, 34, .06);
  --shadow: 0 8px 24px rgba(19, 22, 34, .08);
  --shadow-lg: 0 20px 48px rgba(19, 22, 34, .14);

  --sidebar-w: 244px;
  --topbar-h: 66px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d5d9e3; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 登录 / 安装 ---------- */
.auth-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(135deg, #eef2ff 0%, #f5f6fa 45%, #ecfeff 100%);
  padding: 24px 16px;
}
.auth-wrap { width: 100%; max-width: 420px; }
.install-card { max-width: 100%; }
.auth-card {
  background: var(--surface); border-radius: var(--radius-lg); padding: 32px 28px;
  box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.7);
}
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.brand-logo {
  width: 48px; height: 48px; border-radius: 14px; flex: none;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff; font-weight: 700; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(79,70,229,.35);
}
.brand-logo.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
.auth-brand h1 { font-size: 19px; font-weight: 700; }
.auth-brand p { font-size: 12.5px; color: var(--text-3); }
.auth-form .field, .install-form .field { margin-bottom: 16px; }
.auth-tips { margin-top: 18px; text-align: center; font-size: 12px; color: var(--text-3); }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--text-3); }
.form-section { margin-bottom: 22px; }
.form-section h3 { font-size: 13px; color: var(--text-2); margin-bottom: 12px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-2 .span2 { grid-column: span 2; }
.seg { display: flex; gap: 8px; margin-bottom: 14px; }
.seg-item {
  flex: 1; text-align: center; padding: 9px 8px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--border); font-size: 13px; color: var(--text-2); background: var(--surface-2);
}
.seg-item.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-600); font-weight: 600; }
.seg-item input { display: none; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.field .check { display: flex; margin-bottom: 0; padding: 9px 0 0; }
.field .check .check-text { font-size: 13px; color: var(--text-2); }
/* iOS 风格开关：全局替换原生复选框 */
.field input[type="checkbox"], .input[type="checkbox"], input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  width: 40px; height: 23px; flex: none; margin: 0; padding: 0;
  border: none; border-radius: 999px; background: #d4d7e3;
  position: relative; cursor: pointer; transition: background .18s; box-shadow: none;
}
.field input[type="checkbox"]:focus, .input[type="checkbox"]:focus, input[type="checkbox"]:focus {
  border: none; box-shadow: none;
}
input[type="checkbox"]::after {
  content: ''; position: absolute; top: 2.5px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.28); transition: transform .18s cubic-bezier(.2,.9,.3,1);
}
input[type="checkbox"]:checked { background: var(--primary); }
input[type="checkbox"]:checked::after { transform: translateX(16px); }
input[type="checkbox"]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
input[type="checkbox"]:active::after { width: 21px; }
input[type="checkbox"]:checked:active::after { transform: translateX(13px); }
.install-done { text-align: center; padding: 12px 0; }
.done-icon {
  width: 60px; height: 60px; border-radius: 50%; background: var(--success-soft); color: var(--success);
  font-size: 30px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.install-done h2 { font-size: 18px; margin-bottom: 8px; }
.install-done p { color: var(--text-2); font-size: 13px; margin-bottom: 20px; }
code { background: #f1f2f6; padding: 2px 6px; border-radius: 6px; font-size: 12.5px; }

.alert { padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: var(--danger-soft); color: #b42318; border: 1px solid #fecaca; }
.alert-ok { background: var(--success-soft); color: #047857; border: 1px solid #a7f3d0; }
.alert-warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* 安装向导：步骤条 + 环境检测 */
.install-steps { display: flex; gap: 6px; margin: 4px 0 18px; flex-wrap: wrap; }
.install-steps .step {
  flex: 1; min-width: 64px; text-align: center; font-size: 11.5px; color: var(--text-3);
  padding: 6px 4px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border);
}
.install-steps .step.active { color: var(--primary-600); background: var(--primary-soft); border-color: var(--primary); font-weight: 600; }
.env-check { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 20px; }
.env-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 13px; border-bottom: 1px solid var(--border); }
.env-row:last-child { border-bottom: none; }
.env-ic { width: 20px; height: 20px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; }
.env-row.ok .env-ic { background: var(--success); }
.env-row.bad .env-ic { background: var(--danger); }
.env-name { font-weight: 600; flex: none; }
.env-msg { color: var(--text-3); font-size: 12px; margin-left: auto; }
.env-row.bad .env-name { color: var(--danger-600, #b42318); }
.install-form h3 { font-size: 13.5px; color: var(--text-1); margin: 18px 0 12px; font-weight: 700; }
.install-form h3:first-of-type { margin-top: 4px; }

/* ---------- 表单元素 ---------- */
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field small { display: block; margin-top: 5px; color: var(--text-3); font-size: 11.5px; }
.field input, .field select, .field textarea, .input {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); outline: none; transition: .15s;
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.65; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.field input[type="color"] { padding: 4px; height: 42px; cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-weight: 500;
  transition: .15s; white-space: nowrap; user-select: none;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.28); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #eef0f5; }
.btn-block { width: 100%; padding: 12px; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; }
.icon-btn {
  border: none; background: transparent; cursor: pointer; color: var(--text-2);
  width: 34px; height: 34px; border-radius: 9px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 15px; transition: .15s;
}
.icon-btn:hover { background: #eef0f5; color: var(--text); }

/* ---------- 布局 ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 60;
}
.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.2px; }
.sidebar-close { display: none; margin-left: auto; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.nav-group { margin-top: 14px; }
.nav-group-title { font-size: 11px; color: var(--text-3); padding: 0 10px 6px; letter-spacing: .6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px;
  color: var(--text-2); cursor: pointer; margin-bottom: 2px; transition: .15s; font-weight: 500;
}
.nav-item:hover { background: #f2f4f9; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-600); font-weight: 600; }
.nav-item .ni { width: 20px; text-align: center; font-size: 15px; }
.nav-item .badge { margin-left: auto; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 10px; color: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.user-meta { min-width: 0; flex: 1; }
.user-meta strong { display: block; font-size: 13px; line-height: 1.3; }
.user-meta small { color: var(--text-3); font-size: 11.5px; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40;
}
.menu-btn { display: none; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h2 { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.topbar-title p { font-size: 12px; color: var(--text-3); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.content { padding: 22px 24px 40px; flex: 1; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(15,18,28,.45); z-index: 55; }
.tabbar { display: none; }

/* ---------- 卡片 / 通用块 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.card-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 14.5px; font-weight: 650; flex: 1; }
.card-head .sub { font-size: 12px; color: var(--text-3); font-weight: 400; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 8px 10px; }

.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }

/* 统计卡 */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; position: relative; overflow: hidden; box-shadow: var(--shadow-xs);
  transition: .18s;
}
.stat:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.priv-eye {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 28px; height: 28px; border-radius: 9px; border: none; cursor: pointer;
  background: rgba(0,0,0,.055); font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: .15s;
}
.priv-eye:hover { background: rgba(0,0,0,.1); transform: scale(1.08); }
.stat .lab { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat .val { font-size: 25px; font-weight: 700; letter-spacing: -.6px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.stat .deco {
  position: absolute; right: -12px; top: -12px; width: 76px; height: 76px; border-radius: 50%;
  opacity: .1;
}

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: #f0f2f7; color: var(--text-2); white-space: nowrap;
}
.badge.b-primary { background: var(--primary-soft); color: var(--primary-600); }
.badge.b-success { background: var(--success-soft); color: #047857; }
.badge.b-danger { background: var(--danger-soft); color: #b42318; }
.badge.b-warning { background: var(--warning-soft); color: #b45309; }
.badge.b-info { background: var(--info-soft); color: #0369a1; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

.money { font-variant-numeric: tabular-nums; font-weight: 650; }
.money.in { color: var(--income); }
.money.out { color: var(--expense); }
.muted { color: var(--text-3); }
.tiny { font-size: 12px; }
.strike { text-decoration: line-through; opacity: .5; }

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
}
.toolbar .spacer { flex: 1; }
.search-box { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.search-box input { padding-left: 34px; }
.search-box::before {
  content: "🔍"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  font-size: 12px; opacity: .5; pointer-events: none;
}
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 6px 13px; border-radius: 999px; border: 1.5px solid var(--border); cursor: pointer;
  font-size: 12.5px; color: var(--text-2); background: var(--surface); transition: .15s; white-space: nowrap;
}
.chip:hover { border-color: var(--border-strong); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; padding: 11px 14px; color: var(--text-2); font-weight: 600; font-size: 12.5px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid #f1f2f6; vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: .12s; }
table.tbl tbody tr:hover { background: #fafbff; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: .35; transition: .15s; }
tr:hover .row-actions { opacity: 1; }

.empty { text-align: center; padding: 46px 20px; color: var(--text-3); }
.empty .ico { font-size: 38px; opacity: .45; margin-bottom: 10px; }
.empty p { font-size: 13px; }
.loading { text-align: center; padding: 40px; color: var(--text-3); font-size: 13px; }
.spinner {
  width: 22px; height: 22px; border: 2.5px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 待办 ---------- */
.todo-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px;
  border-bottom: 1px solid #f1f2f6; transition: .12s;
}
.todo-item:last-child { border-bottom: none; }
.todo-item:hover { background: #fafbff; }
.todo-item.done .todo-title { text-decoration: line-through; color: var(--text-3); }
.tick {
  width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border-strong);
  cursor: pointer; flex: none; margin-top: 2px; transition: .15s; display: flex;
  align-items: center; justify-content: center; color: transparent; font-size: 12px; background: var(--surface);
}
.tick:hover { border-color: var(--primary); }
.tick.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.todo-main { flex: 1; min-width: 0; }
.todo-title { font-weight: 500; word-break: break-word; }
.todo-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px; font-size: 11.5px; color: var(--text-3); }
.pri { width: 3px; align-self: stretch; border-radius: 3px; flex: none; }
.pri-0 { background: #cbd5e1; } .pri-1 { background: #60a5fa; }
.pri-2 { background: #fb923c; } .pri-3 { background: #ef4444; }

.kanban { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.kb-col { background: #f0f2f7; border-radius: var(--radius); padding: 12px; min-height: 120px; }
.kb-col.drag-over { background: #e5e9f5; outline: 2px dashed var(--primary); outline-offset: -4px; }
.kb-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 0 4px; font-weight: 600; font-size: 13px; }
.kb-card {
  background: var(--surface); border-radius: 11px; padding: 11px 13px; margin-bottom: 9px;
  box-shadow: var(--shadow-xs); cursor: grab; border: 1px solid var(--border); transition: .15s;
}
.kb-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.kb-card.dragging { opacity: .45; }
.kb-card .t { font-weight: 550; font-size: 13.5px; margin-bottom: 6px; word-break: break-word; }

/* ---------- 日历 ---------- */
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-head div { text-align: center; font-size: 12px; color: var(--text-3); font-weight: 600; padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  min-height: 96px; padding: 6px; cursor: pointer; transition: .15s; overflow: hidden;
}
.cal-cell:hover { border-color: var(--primary); background: #fff; }
.cal-cell.out { opacity: .42; }
.cal-cell.today { border-color: var(--primary); background: var(--primary-soft); }
.cal-cell.sel { box-shadow: 0 0 0 2px var(--primary); }
.cal-date { font-size: 12.5px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 4px; }
.cal-date .lunar { font-size: 10px; color: var(--text-3); font-weight: 400; }
.cal-ev {
  font-size: 11px; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-more { font-size: 10.5px; color: var(--text-3); padding-left: 4px; }
.day-list { display: flex; flex-direction: column; gap: 8px; }
.day-ev {
  display: flex; gap: 10px; padding: 11px 13px; border-radius: 11px; background: var(--surface-2);
  border: 1px solid var(--border); cursor: pointer; transition: .15s;
}
.day-ev:hover { background: #fff; box-shadow: var(--shadow-xs); }
.day-ev .bar { width: 3px; border-radius: 3px; flex: none; }
.day-ev .tm { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- 财务 ---------- */
.acct-card {
  border-radius: var(--radius); padding: 16px 18px; color: #fff; position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm); cursor: pointer; transition: .18s; min-height: 106px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.acct-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.acct-card .n { font-size: 13px; opacity: .92; display: flex; align-items: center; gap: 6px; }
.acct-card .b { font-size: 22px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.acct-card .t { font-size: 11px; opacity: .75; }
.acct-card .ring {
  position: absolute; right: -26px; bottom: -30px; width: 108px; height: 108px;
  border-radius: 50%; background: rgba(255,255,255,.14);
}
.acct-hide {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 26px; height: 26px;
  border: none; border-radius: 8px; background: rgba(255,255,255,.22); color: #fff;
  font-size: 14px; line-height: 1; cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: .15s; backdrop-filter: blur(2px);
}
.acct-hide:hover { background: rgba(255,255,255,.4); transform: scale(1.08); }
.acct-card.acct-hidden { opacity: .55; filter: grayscale(.35); }
.memo-dash { cursor: pointer; }
.memo-dash .tx-main { min-width: 0; }
.memo-dash .memo-sum { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.memo-dash .memo-time { margin-left: auto; flex: none; font-size: 11.5px; color: var(--text-3); }
.tx-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid #f1f2f6;
  transition: .12s;
}
.tx-item:last-child { border-bottom: none; }
.tx-item:hover { background: #fafbff; }
.tx-ico {
  width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center;
  justify-content: center; font-size: 16px; flex: none;
}
.tx-main { flex: 1; min-width: 0; }
.tx-main .t { font-weight: 550; font-size: 13.5px; }
.tx-main .s { font-size: 11.5px; color: var(--text-3); }
.bar-row { margin-bottom: 13px; }
.bar-row .lb { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.bar-track { height: 7px; background: #eef0f5; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width .5s cubic-bezier(.2,.8,.2,1); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before {
  content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary-soft);
}
.tl-item .h { font-size: 12px; color: var(--text-3); }
.tl-item .c { font-size: 13.5px; margin-top: 3px; }

/* ---------- 笔记 / 习惯 ---------- */
.note-grid { columns: 3; column-gap: 16px; }
.note-card {
  break-inside: avoid; margin-bottom: 16px; border-radius: var(--radius); padding: 14px 16px;
  border: 1px solid var(--border); border-left: 4px solid var(--note, #e2e8f0); background: color-mix(in srgb, var(--note, #fff) 14%, #fff);
  cursor: default; transition: .18s; box-shadow: var(--shadow-xs); position: relative;
}
.note-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.note-pin { position: absolute; top: 10px; right: 12px; font-size: 11px; color: var(--warning-600); font-weight: 600; }
.note-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding-right: 44px; }
.note-title { font-size: 14.5px; font-weight: 600; line-height: 1.4; word-break: break-word; }
.note-body { font-size: 13px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; max-height: 160px; overflow: hidden; margin: 8px 0; line-height: 1.6; }
.note-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.note-foot { font-size: 11.5px; color: var(--text-3); }

.habit-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f2f6; }
.habit-row:last-child { border-bottom: none; }
.habit-ico { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex: none; }

/* 习惯热力图 */
.heatmap { overflow-x: auto; padding-bottom: 4px; }
.hm-months { position: relative; height: 16px; margin-left: 132px; font-size: 11px; color: var(--text-3); }
.hm-month { position: absolute; transform: translateX(-50%); }
.hm-body { min-width: 520px; }
.hm-row { display: grid; gap: 3px; align-items: center; margin-bottom: 3px; }
.hm-label { font-size: 12.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; }
.hm-cell { width: 16px; height: 16px; border-radius: 4px; background: #eef0f5; cursor: pointer; transition: .12s; border: 1px solid transparent; }
.hm-cell:hover { transform: scale(1.18); }
.hm-cell.on { box-shadow: 0 0 0 1px rgba(0,0,0,.04); }
.hm-legend { margin-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.hm-legend .hm-cell { cursor: default; }
.hm-legend .hm-cell.on { background: var(--success); }

.heat { display: flex; gap: 3px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.heat i {
  width: 13px; height: 13px; border-radius: 3.5px; background: #eef0f5; flex: none; cursor: pointer;
  transition: .15s;
}
.heat i:hover { transform: scale(1.25); }

/* ---------- 模态框 ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.modal-mask {
  position: absolute; inset: 0; background: rgba(15,18,28,.42); pointer-events: auto;
  animation: fadeIn .18s ease; backdrop-filter: blur(2px);
}
.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 60px);
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  pointer-events: auto; display: flex; flex-direction: column; animation: pop .2s cubic-bezier(.2,.9,.3,1.2);
}
.modal.wide { width: min(860px, calc(100vw - 32px)); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%,-46%) scale(.96); } }
.modal-head { display: flex; align-items: center; padding: 17px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { flex: 1; font-size: 15.5px; font-weight: 650; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: span 2; }

/* ---------- Toast ---------- */
.toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 10px 18px; border-radius: 11px; background: rgba(23,26,34,.92); color: #fff;
  font-size: 13px; box-shadow: var(--shadow); animation: slideDown .22s ease; max-width: 88vw;
}
.toast.ok { background: #0f9f6e; }
.toast.err { background: #dc2626; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-12px); } }

/* ---------- 响应式 ---------- */
@media (max-width: 1240px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .pipeline { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .note-grid { columns: 2; }
}
@media (max-width: 1024px) {
  .g-3 { grid-template-columns: repeat(2, 1fr); }
  .g-2-1, .g-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --topbar-h: 58px; }
  .sidebar {
    transform: translateX(-100%); transition: transform .24s cubic-bezier(.2,.8,.2,1);
    box-shadow: var(--shadow-lg); width: 268px;
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; }
  .sidebar-close { display: inline-flex; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px 14px 92px; }
  .topbar { padding: 0 14px; }
  .topbar-title h2 { font-size: 16px; }
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr 1fr; }
  .grid { gap: 12px; }
  .kanban { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: 1fr; }
  .note-grid { columns: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: span 1; }
  .modal { width: 100%; max-width: 100%; left: 0; top: auto; bottom: 0; transform: none;
    border-radius: 20px 20px 0 0; max-height: 92vh; animation: slideUp .24s cubic-bezier(.2,.9,.3,1); }
  @keyframes slideUp { from { transform: translateY(100%); } }
  .modal.wide { width: 100%; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(255,255,255,.94); backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 5px 2px; color: var(--text-3); font-size: 10.5px; cursor: pointer; border-radius: 10px;
  }
  .tab-item .ti { font-size: 18px; line-height: 1.1; }
  .tab-item.active { color: var(--primary); font-weight: 600; }
  .cal-cell { min-height: 62px; padding: 4px; border-radius: 8px; }
  .cal-grid, .cal-head { gap: 4px; }
  .cal-ev { font-size: 9.5px; padding: 1px 4px; }
  .stat .val { font-size: 21px; }
  table.tbl th, table.tbl td { padding: 10px 10px; }
  .search-box { max-width: none; }
}
@media (max-width: 560px) {
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
  .hide-xs { display: none !important; }
  .stat { padding: 14px; }
  .auth-card { padding: 26px 20px; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2 .span2 { grid-column: span 1; }
}

/* 打印 */
@media print {
  .sidebar, .topbar, .tabbar, .toolbar, .row-actions { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- 每日记录 / Memos ---------- */
.memo-composer {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow-xs);
}
.memo-input {
  border: none; background: transparent; padding: 4px 2px; resize: vertical; font-size: 14.5px;
  line-height: 1.6; min-height: 52px; box-shadow: none;
}
.memo-input:focus { box-shadow: none; outline: none; }
.memo-composer-bar { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.memo-pin-opt { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.memo-composer-bar .btn-primary { margin-left: auto; }

.memo-list { display: flex; flex-direction: column; gap: 18px; }
.memo-group-h {
  font-size: 13px; font-weight: 600; color: var(--text-2); margin: 2px 0 10px;
  display: flex; align-items: center; gap: 6px;
}
.memo-group { display: flex; flex-direction: column; gap: 12px; }

.memo-card {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 14px 16px; box-shadow: var(--shadow-xs);
  transition: .18s; border-left: 3px solid var(--primary-soft);
}
.memo-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.memo-card.pinned { border-left-color: var(--primary); background: color-mix(in srgb, var(--primary-soft) 22%, var(--surface)); }
.memo-pin { position: absolute; top: 10px; right: 12px; font-size: 11px; color: var(--primary-600); font-weight: 600; }
.memo-content {
  font-size: 14px; line-height: 1.65; color: var(--text); white-space: pre-wrap; word-break: break-word;
  padding-right: 48px;
}
.memo-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.memo-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.memo-time { font-size: 11.5px; color: var(--text-3); }

.tag {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--primary-soft); color: var(--primary-600);
  white-space: nowrap; line-height: 1.5;
}
.tag-inline { background: var(--primary-soft); color: var(--primary-600); }

.memo-card:hover .row-actions { opacity: 1; }
