/* 知己 · 私人助手 · 视觉系统 */
:root {
  --bg: #f6f4ef;
  --bg-soft: #efece4;
  --surface: #fffdf9;
  --surface-2: #faf8f3;
  --ink: #24221e;
  --ink-2: #4d4a43;
  --muted: #8b867b;
  --line: #e5dfd2;
  --line-strong: #d6cdbb;
  --accent: #2f6f5e;
  --accent-ink: #ffffff;
  --accent-soft: #e3efe9;
  --work: #2f6f5e;
  --life: #b5623c;
  --finance: #9a7a24;
  --think: #4c5b8a;
  --assistant: #6b4e71;
  --danger: #b34a3f;
  --danger-soft: #f7e7e4;
  --warn: #a8701e;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(36, 34, 30, .04), 0 8px 24px rgba(36, 34, 30, .04);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "SimSun", serif;
}

html[data-theme="dark"] {
  --bg: #121513;
  --bg-soft: #171b18;
  --surface: #1a1f1c;
  --surface-2: #202622;
  --ink: #ece9e1;
  --ink-2: #c2beb4;
  --muted: #8e948c;
  --line: #2b322c;
  --line-strong: #3a423b;
  --accent: #74c1a7;
  --accent-ink: #10201a;
  --accent-soft: #1f322b;
  --work: #74c1a7;
  --life: #d98763;
  --finance: #d2b35c;
  --think: #94a3d4;
  --assistant: #b798bf;
  --danger: #e08074;
  --danger-soft: #3a2422;
  --warn: #d8a454;
  --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 10px 30px rgba(0, 0, 0, .18);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body.no-scroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 6px 0; padding-left: 22px; }
.ic { width: 20px; height: 20px; flex: 0 0 auto; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 26px; height: 26px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; line-height: 1.5; }
.tiny { font-size: 11px; }
.bold { font-weight: 600; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 12px; }
.mt-lg { margin-top: 20px; }
.mb { margin-bottom: 12px; }
.number { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); }

/* 启动与鉴权 */
.boot {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  color: var(--muted);
}
.boot-mark {
  width: 62px; height: 62px; border-radius: 20px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 30px; font-weight: 600;
  animation: breathe 2.2s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: .92; } 50% { transform: scale(1.05); opacity: 1; } }

.auth-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 20% 0%, var(--accent-soft), transparent 55%);
}
.auth-card {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 24px; padding: 30px; box-shadow: var(--shadow);
}
.auth-card .brand-mark { margin-bottom: 18px; }
.auth-card h1 { font-family: var(--serif); font-size: 26px; margin-bottom: 6px; }
.auth-card p { color: var(--muted); font-size: 13.5px; }
.auth-card form { margin-top: 20px; display: grid; gap: 12px; }

/* 布局 */
.shell { min-height: 100vh; display: flex; }
.sidebar {
  display: none;
  width: 236px; flex: 0 0 236px;
  padding: 26px 18px 18px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 55%, var(--bg));
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 13px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 20px; font-weight: 600;
}
.brand-name { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: .06em; }
.brand-sub { font-size: 10.5px; color: var(--muted); letter-spacing: .16em; text-transform: uppercase; }
.nav { display: grid; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--ink-2); background: none; border: 0; text-align: left; width: 100%;
  font-size: 14px; transition: background .18s, color .18s;
}
.nav-item:hover { background: var(--bg-soft); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .ic { width: 19px; height: 19px; }
.sidebar-foot { margin-top: auto; padding-top: 18px; display: grid; gap: 8px; }
.sidebar-card {
  padding: 12px; border-radius: 14px; background: var(--surface-2);
  border: 1px solid var(--line); font-size: 12px; color: var(--muted);
}
.sidebar-note { display: flex; gap: 8px; align-items: flex-start; }
.sidebar-note .ic { width: 15px; height: 15px; margin-top: 2px; color: var(--accent); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-title { display: flex; flex-direction: column; line-height: 1.25; }
.topbar-title strong { font-size: 16px; font-weight: 600; }
.topbar-title span { font-size: 11px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.view { padding: 6px 16px 110px; width: 100%; max-width: 1120px; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(7, 1fr);
  padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.tab {
  border: 0; background: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 0; font-size: 10.5px; border-radius: 10px;
}
.tab .ic { width: 21px; height: 21px; }
.tab.active { color: var(--accent); }
.tab.active .ic { transform: translateY(-1px); }
.tab.active::after {
  content: ''; width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent); margin-top: 1px;
}

/* 通用组件 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 12px;
  padding: 9px 15px; font-size: 13.5px; font-weight: 500;
  background: var(--bg-soft); color: var(--ink);
  transition: transform .12s, background .18s, opacity .18s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.04); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon {
  width: 38px; height: 38px; border-radius: 12px; border: 0;
  display: inline-grid; place-items: center;
  background: transparent; color: var(--ink-2);
}
.btn-icon:hover { background: var(--bg-soft); }
.btn-icon .ic { width: 19px; height: 19px; }
.link-btn { border: 0; background: none; color: var(--accent); font-size: 12.5px; padding: 2px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow);
}
.card.tight { padding: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font-size: 14.5px; font-weight: 600; letter-spacing: .01em; }
.card-head .sub { font-size: 11.5px; color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  background: var(--bg-soft); color: var(--ink-2);
  font-size: 11px; line-height: 1.7;
}
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: #f6ead4; color: var(--warn); }
html[data-theme="dark"] .badge.warn { background: #3a2f1c; }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.chips { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: transparent;
  color: var(--ink-2); border-radius: 999px; padding: 5px 12px; font-size: 12.5px;
}
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
html[data-theme="dark"] .chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.flag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.flag.overdue { color: var(--danger); }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }

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

.page-head { padding: 12px 2px 16px; }
.eyebrow { font-size: 11.5px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.page-head h1 { font-family: var(--serif); font-size: 27px; font-weight: 600; margin-top: 5px; letter-spacing: .01em; }
.page-head .lead { margin-top: 6px; color: var(--muted); font-size: 13.5px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 10px; }
.section-title h2 { font-size: 15px; font-weight: 600; }
.section-title span { font-size: 12px; color: var(--muted); }

.empty { text-align: center; padding: 26px 12px; color: var(--muted); }
.empty-icon {
  width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 15px;
  display: grid; place-items: center; background: var(--bg-soft); color: var(--muted);
}
.empty-title { font-size: 13.5px; color: var(--ink-2); margin-bottom: 3px; }

/* 今日 */
.hero-grid { display: grid; gap: 14px; }
.focus-card { position: relative; overflow: hidden; }
.focus-card::after {
  content: ''; position: absolute; right: -40px; top: -60px; width: 150px; height: 150px;
  border-radius: 50%; background: var(--accent-soft); opacity: .7; pointer-events: none;
}
.focus-list { display: grid; gap: 2px; position: relative; z-index: 1; }
.task-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.task-row:last-child { border-bottom: 0; }
.task-row .check {
  width: 22px; height: 22px; margin-top: 1px; border-radius: 7px;
  border: 1.5px solid var(--line-strong); background: transparent;
  display: grid; place-items: center; color: transparent; flex: 0 0 auto;
}
.task-row .check .ic { width: 14px; height: 14px; }
.task-row.done .check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 13.8px; line-height: 1.45; color: var(--ink); }
.task-row.done .task-title { color: var(--muted); text-decoration: line-through; }
.task-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 3px; font-size: 11px; color: var(--muted); }
.task-meta .ic { width: 12px; height: 12px; }
.priority-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.priority-dot.p2 { background: var(--finance); }
.priority-dot.p3 { background: var(--danger); }
.ai-card {
  background: linear-gradient(145deg, var(--assistant), color-mix(in srgb, var(--assistant) 70%, #1c1620));
  color: #f7f2f8; border: 0;
}
.ai-card h2 { color: #fff; }
.ai-card p { color: rgba(255, 255, 255, .82); font-size: 13px; margin-top: 8px; line-height: 1.65; }
.ai-card .btn { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .18); margin-top: 14px; }
.ai-card .btn:hover { background: rgba(255, 255, 255, .22); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 11px 12px; }
.stat-value { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 1px; }
.stat-value.pos { color: var(--accent); }
.stat-value.neg { color: var(--danger); }

.habit-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.habit-strip::-webkit-scrollbar { display: none; }
.habit-pill {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 14px; padding: 9px 12px; min-width: 82px; text-align: left;
}
.habit-pill.done { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.habit-pill strong { display: block; font-size: 12.5px; font-weight: 500; }
.habit-pill span { font-size: 10.5px; color: var(--muted); }
.habit-pill.done strong { color: var(--accent); }

/* 工作 */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.search-box { position: relative; flex: 1; }
.search-box .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search-box input { width: 100%; padding-left: 36px; }
.project-grid { display: grid; gap: 10px; }
.project-card { display: flex; align-items: center; gap: 12px; padding: 13px 14px; }
.project-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.project-card h3 { font-size: 13.5px; font-weight: 600; }
.project-card p { font-size: 11.5px; color: var(--muted); }
.day-group { margin-bottom: 16px; }
.day-label { font-size: 11.5px; color: var(--muted); letter-spacing: .06em; margin: 0 2px 7px; display: flex; justify-content: space-between; }

/* 生活 */
.habit-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
.habit-card { padding: 13px; display: flex; flex-direction: column; gap: 9px; }
.habit-top { display: flex; align-items: center; justify-content: space-between; }
.habit-name { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500; }
.habit-icon { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; }
.habit-icon .ic { width: 14px; height: 14px; }
.habit-dots { display: flex; gap: 4px; }
.dot { flex: 1; height: 7px; border-radius: 4px; background: var(--bg-soft); }
.dot.on { background: var(--accent); }
.habit-foot { display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; color: var(--muted); }
.habit-check {
  width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line-strong);
  background: transparent; display: grid; place-items: center; color: transparent;
}
.habit-check.done { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.habit-check .ic { width: 15px; height: 15px; }
.goal-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.goal-row:last-child { border-bottom: 0; }
.goal-ring {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 600;
  background: conic-gradient(var(--accent) var(--p, 0%), var(--bg-soft) 0);
}
.goal-ring i {
  width: 31px; height: 31px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; font-style: normal;
}
.goal-row h3 { font-size: 13px; font-weight: 500; }

/* 理财 */
.month-switch { display: inline-flex; align-items: center; gap: 4px; background: var(--bg-soft); border-radius: 10px; padding: 2px; }
.month-switch button { border: 0; background: none; padding: 5px 9px; border-radius: 8px; color: var(--ink-2); }
.month-switch button:hover { background: var(--surface); }
.month-switch strong { font-size: 13px; font-weight: 600; min-width: 76px; text-align: center; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.money-card { padding: 14px; }
.money-card .label { font-size: 11px; color: var(--muted); }
.money-card .value { font-size: 20px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.money-card .value.income { color: var(--accent); }
.money-card .value.expense { color: var(--life); }
.bar-row { margin-bottom: 11px; }
.bar-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px; }
.bar-head span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { height: 7px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .4s; }
.bar-fill.warn { background: var(--warn); }
.bar-fill.over { background: var(--danger); }
.tx-list { display: grid; }
.tx-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tx-row:last-child { border-bottom: 0; }
.tx-icon {
  width: 34px; height: 34px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--bg-soft); color: var(--ink-2);
  font-size: 11px; font-weight: 600;
}
.tx-icon.income { background: var(--accent-soft); color: var(--accent); }
.tx-main { flex: 1; min-width: 0; }
.tx-main strong { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-main span { font-size: 11px; color: var(--muted); }
.tx-amount { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tx-amount.income { color: var(--accent); }
.chart { height: 116px; display: flex; align-items: flex-end; gap: 3px; padding-top: 8px; }
.chart-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; }
.chart-bar { width: 100%; max-width: 26px; border-radius: 4px 4px 2px 2px; opacity: .9; min-height: 3px; }
.chart-col span { font-size: 9px; color: var(--muted); white-space: nowrap; }

/* 思考 */
.note-card { padding: 15px; display: block; }
.note-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.note-excerpt { font-size: 12.5px; color: var(--ink-2); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-meta { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 11px; color: var(--muted); }
.decision-card h3 { font-size: 14px; font-weight: 600; }
.decision-card .score-line { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.score-pill { font-size: 11px; padding: 3px 9px; border-radius: 8px; background: var(--bg-soft); color: var(--ink-2); }
.score-pill.top { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.matrix { width: 100%; border-collapse: collapse; font-size: 12px; }
.matrix th, .matrix td { padding: 8px 7px; text-align: center; border-bottom: 1px solid var(--line); }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix thead th { font-size: 11px; color: var(--muted); font-weight: 500; }
.matrix td.best { color: var(--accent); font-weight: 700; }
.review-body { font-size: 13.5px; line-height: 1.75; }
.review-body h3, .chat-md h3 { font-size: 14.5px; margin: 14px 0 6px; }
.review-body h4, .chat-md h4 { font-size: 13.5px; margin: 12px 0 5px; color: var(--ink-2); }
.review-body p, .chat-md p { margin: 6px 0; }
.review-body li, .chat-md li { margin: 3px 0; }
.review-body blockquote, .chat-md blockquote {
  margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--ink-2);
}
.review-body code, .chat-md code { background: var(--bg-soft); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.review-body pre, .chat-md pre { background: var(--bg-soft); padding: 12px; border-radius: 10px; overflow-x: auto; }

/* 助手 */
.chat-page { display: flex; flex-direction: column; height: calc(100vh - 132px); min-height: 420px; }
.chat-toolbar { display: flex; align-items: center; gap: 8px; padding: 4px 0 10px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 4px 2px 12px; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { margin: auto; text-align: center; padding: 24px; max-width: 460px; }
.chat-empty .brand-mark { margin: 0 auto 14px; width: 52px; height: 52px; font-size: 24px; }
.chat-empty h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.chat-empty p { color: var(--muted); font-size: 13px; margin-top: 6px; }
.prompt-grid { display: grid; gap: 8px; margin-top: 18px; text-align: left; }
.prompt-pill { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 13px; font-size: 12.5px; color: var(--ink-2); text-align: left; }
.prompt-pill:hover { border-color: var(--accent); color: var(--accent); }
.bubble { max-width: min(86%, 680px); padding: 11px 14px; border-radius: 16px; font-size: 13.8px; line-height: 1.7; }
.bubble.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 5px; }
.bubble.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; color: var(--ink); }
.bubble.assistant .chat-md > :first-child { margin-top: 0; }
.bubble.assistant .chat-md > :last-child { margin-bottom: 0; }
.bubble.error { background: var(--danger-soft); color: var(--danger); border-color: transparent; font-size: 12.5px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.composer { border: 1px solid var(--line); background: var(--surface); border-radius: 18px; padding: 8px 8px 8px 14px; display: flex; align-items: flex-end; gap: 8px; box-shadow: var(--shadow); }
.composer textarea { flex: 1; border: 0; background: transparent; resize: none; outline: none; padding: 7px 0; max-height: 140px; font-size: 13.8px; line-height: 1.55; }
.composer .send { width: 38px; height: 38px; border-radius: 13px; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.composer .send:disabled { opacity: .4; }
.mode-chips { margin-bottom: 8px; }
.mode-chip { font-size: 11.5px; padding: 4px 10px; }

/* 表单与弹层 */
.field { display: grid; gap: 5px; margin-bottom: 13px; }
.field-label { font-size: 12px; color: var(--muted); }
.field small { color: var(--muted); font-size: 11px; }
input[type="text"], input[type="number"], input[type="date"], input[type="time"], input[type="password"], input[type="search"], input[type="month"], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface-2); color: var(--ink);
  padding: 10px 12px; outline: none; font-size: 13.5px;
  transition: border-color .18s, background .18s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--surface); }
textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .full { grid-column: 1 / -1; }
.segmented { display: grid; grid-auto-flow: column; gap: 3px; background: var(--bg-soft); padding: 3px; border-radius: 12px; }
.segmented button { border: 0; background: none; padding: 8px 6px; border-radius: 9px; font-size: 12.5px; color: var(--muted); }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); font-weight: 500; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 5px 0; }
.check-line input { width: 16px; height: 16px; accent-color: var(--accent); }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(24, 22, 18, .38);
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(3px);
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%; max-height: 92vh; overflow: hidden;
  background: var(--surface); border-radius: 22px 22px 0 0;
  display: flex; flex-direction: column;
  animation: sheetUp .24s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .18);
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.sheet.wide { max-width: 720px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 18px 10px; }
.sheet-head h2 { font-size: 17px; font-weight: 600; }
.sheet-form { display: flex; flex-direction: column; min-height: 0; }
.sheet-body { padding: 6px 18px 14px; overflow-y: auto; }
.sheet-foot { display: flex; gap: 9px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; }
.sheet-foot .btn-ghost { flex: 0 0 88px; }
.confirm {
  width: min(340px, calc(100% - 40px)); background: var(--surface);
  border-radius: 18px; padding: 22px; margin: auto;
  box-shadow: var(--shadow); animation: fade .18s;
}
.confirm p { font-size: 14px; margin-bottom: 18px; }
.confirm-actions { display: flex; gap: 9px; }
.confirm-actions .btn { flex: 1; }
.modal-backdrop:has(.confirm) { align-items: center; }

#toast-root { position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: max-content; max-width: calc(100% - 32px); }
.toast {
  background: var(--ink); color: var(--bg); padding: 9px 15px; border-radius: 11px;
  font-size: 12.5px; opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s; box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--accent); color: var(--accent-ink); }

/* 设置 */
.settings-grid { display: grid; gap: 14px; }
.profile-grid { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row strong { display: block; font-size: 13px; font-weight: 500; }
.setting-row span { font-size: 11.5px; color: var(--muted); }
.memory-item { display: flex; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.memory-item:last-child { border-bottom: 0; }
.memory-text { flex: 1; font-size: 12.8px; line-height: 1.55; }
.memory-cat { font-size: 10px; color: var(--muted); margin-top: 2px; }
.memory-actions { display: flex; gap: 1px; }
.memory-actions button { width: 30px; height: 30px; border: 0; background: none; color: var(--muted); border-radius: 8px; display: grid; place-items: center; }
.memory-actions button:hover { background: var(--bg-soft); color: var(--ink); }
.memory-actions .ic { width: 15px; height: 15px; }
.memory-actions .pinned { color: var(--finance); }

.code-box {
  background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 11px;
  padding: 10px 12px; font-family: ui-monospace, Consolas, monospace; font-size: 11.5px;
  word-break: break-all; color: var(--ink-2);
}
.matrix-editor { display: grid; gap: 8px; }
.matrix-row { display: grid; grid-template-columns: 1fr 74px 30px; gap: 6px; align-items: center; }
.matrix-row input { padding: 7px 9px; font-size: 12.5px; }
.matrix-row .btn-icon { width: 30px; height: 30px; }
.option-block { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 9px; }
.option-head { display: flex; gap: 7px; align-items: center; margin-bottom: 7px; }
.option-head input { flex: 1; }
.score-grid { display: grid; grid-template-columns: 1fr 90px; gap: 5px 8px; align-items: center; font-size: 11.5px; }
.score-grid input { padding: 6px 8px; font-size: 12px; }

/* 响应式 */
@media (min-width: 760px) {
  .view { padding: 10px 26px 60px; }
  .topbar { padding: 16px 26px; }
  .hero-grid { grid-template-columns: 1.35fr 1fr; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .habit-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .profile-grid { grid-template-columns: 1fr 1fr; }
  .profile-grid .full { grid-column: 1 / -1; }
  .modal-backdrop { align-items: center; }
  .sheet { border-radius: 22px; max-height: 86vh; }
  .tabbar { display: none; }
  .view { padding-bottom: 50px; }
  .chat-page { height: calc(100vh - 150px); }
  #toast-root { bottom: 26px; }
}
@media (min-width: 960px) {
  .sidebar { display: flex; flex-direction: column; }
  .topbar { border-bottom-color: var(--line); }
  .chat-page { height: calc(100vh - 150px); }
}
@media (max-width: 380px) {
  .stat-row, .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-grid .money-card:last-child { grid-column: 1 / -1; }
  .habit-grid { grid-template-columns: 1fr; }
}

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

/* 补充：快速记录、聊天换行与设置细节 */
[hidden] { display: none !important; }
.bubble.user { white-space: pre-wrap; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface-2); text-align: left;
}
.quick-item:hover { border-color: var(--accent); }
.quick-item .ic { color: var(--accent); margin-bottom: 5px; }
.quick-item strong { font-size: 13.5px; font-weight: 600; }
.quick-item span { font-size: 11px; color: var(--muted); }
.quick-item:last-child { grid-column: 1 / -1; }
.note-card { cursor: pointer; }
.note-card:hover { border-color: var(--line-strong); }
.memory-candidate { align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.memory-candidate:last-child { border-bottom: 0; }
.memory-candidate input { margin-top: 3px; flex: 0 0 auto; }
.memory-candidate .memory-cat { display: block; }
.topbar-actions .btn-icon { flex: 0 0 auto; color: var(--ink-2); }
.setting-row span { word-break: break-all; }

/* 通知中心 */
.notif-btn { position: relative; }
.notif-dot {
  position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 9.5px; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums;
}
.notif-list { display: grid; gap: 8px; }
.notif-item {
  display: grid; gap: 4px; text-align: left; width: 100%; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 12px; padding: 11px 12px;
}
.notif-item.unread { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.notif-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notif-item-title { font-size: 13.5px; font-weight: 500; }
.notif-item-body { font-size: 12px; color: var(--muted); line-height: 1.5; white-space: pre-wrap; }

/* 经营 */
.biz-tabs { flex: 1; max-width: 380px; }
.milestone-card { display: flex; gap: 14px; align-items: flex-start; border-left: 3px solid var(--line-strong); }
.milestone-card.danger { border-left-color: var(--danger); }
.milestone-card.warn { border-left-color: var(--warn); }
.milestone-card.ok { border-left-color: var(--accent); }
.milestone-card.done { opacity: .68; }
.milestone-when { flex: 0 0 80px; display: flex; flex-direction: column; gap: 2px; }
.milestone-when strong { font-size: 13px; }
.milestone-when span { font-size: 11px; color: var(--muted); }
.milestone-title { font-size: 14px; font-weight: 500; line-height: 1.4; }
.milestone-actions { display: flex; gap: 2px; }
.contact-card { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.contact-card:hover { border-color: var(--line-strong); }
.contact-avatar {
  width: 42px; height: 42px; border-radius: 14px; flex: 0 0 auto;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 600; font-size: 16px;
}
.contact-avatar.lg { width: 52px; height: 52px; border-radius: 17px; font-size: 20px; }
.contact-name { font-size: 14.5px; font-weight: 600; }
.contact-actions { display: flex; align-items: center; gap: 4px; }
.contact-detail-head { display: flex; align-items: center; gap: 12px; }
.contact-detail-head h3 { font-size: 17px; font-weight: 600; }
.interaction-card { padding: 14px 16px; }
.interaction-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.interaction-head strong { font-size: 13px; }
.interaction-summary { font-size: 13.5px; line-height: 1.55; }
.timeline { display: grid; }
.timeline-item { display: flex; gap: 10px; padding: 6px 0 12px; position: relative; }
.timeline-item:not(:last-child)::before {
  content: ''; position: absolute; left: 4px; top: 22px; bottom: 0; width: 1px; background: var(--line);
}
.timeline-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: 0 0 auto; }
.brief-block { font-size: 13px; line-height: 1.7; color: var(--ink-2); }
.brief-block h2, .brief-block h3, .brief-block h4, .brief-block h5, .brief-block h6 {
  font-size: 14px; margin: 10px 0 4px; color: var(--ink);
}
@media (max-width: 560px) {
  .milestone-card { flex-wrap: wrap; }
  .milestone-when { flex-basis: 100%; flex-direction: row; align-items: baseline; gap: 8px; }
}


