:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e9edf2;
  --border-strong: #d8dee6;
  --text: #1f2933;
  --text-muted: #7a8699;
  --text-faint: #a6b0bf;

  --primary: #3b5bdb;
  --primary-soft: #eef2ff;
  --primary-deep: #2f4bc0;

  --green: #0ca678;
  --green-soft: #e6f7f1;
  --red: #e03131;
  --red-soft: #fdeeee;
  --amber: #e8890c;
  --amber-soft: #fff4e0;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 8px 30px rgba(16, 24, 40, 0.10);

  --sidebar-w: 232px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* 所有内联 SVG 图表不超过容器宽度，防止窄屏溢出 */
svg { max-width: 100%; height: auto; }

/* ============================= 布局 ============================= */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; }
.brand-icon {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, #4c6ef5, #3b5bdb);
  color: #fff; font-size: 21px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 91, 219, 0.32);
}
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: 0.5px; }
.brand-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: 10px;
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  cursor: pointer; user-select: none;
  transition: background 0.15s, color 0.15s;
}
.nav-item .ico { font-size: 17px; width: 22px; text-align: center; }
.nav-item:hover { background: #f2f5fa; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.sidebar-foot {
  margin-top: auto; padding: 14px 10px 2px;
  font-size: 11px; color: var(--text-faint); line-height: 1.6;
}
.sidebar-foot b { color: var(--text-muted); font-weight: 600; }

/* 账本切换器 */
.ledger-switch {
  padding: 10px 8px 12px; margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
}
.ledger-switch-label { display: block; font-size: 11px; font-weight: 700; color: var(--text-faint); margin-bottom: 6px; letter-spacing: 0.5px; }
.ledger-switch-row { display: flex; gap: 6px; align-items: center; }
.ledger-switch-row select {
  flex: 1; min-width: 0; width: 100%;
  padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 9px;
  font-size: 13px; font-weight: 600; color: var(--text); background: #fff;
  outline: none; cursor: pointer;
}
.ledger-switch-row select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,91,219,0.12); }
.ledger-switch-row .icon-btn { flex-shrink: 0; width: 34px; height: 34px; border: 1px solid var(--border-strong); background: #fff; }

/* 币种标签 */
.cur-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  background: var(--amber-soft); color: #b06a06; border-radius: 5px;
  font-size: 10.5px; font-weight: 700; vertical-align: 1px;
}

/* 账本管理 / 汇率 / 同步面板内的行 */
.ledger-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.ledger-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px;
}
.ledger-row.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ledger-row .lg-info { flex: 1; min-width: 0; }
.ledger-row .lg-name { font-weight: 700; font-size: 13.5px; }
.ledger-row .lg-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.ledger-row .btn { flex-shrink: 0; }
.ledger-row .btn[disabled],
.ledger-row .btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 账本管理 modal：内联提示 / 错误行 / 离线模式提示 */
.lg-offline-tip {
  font-size: 12.5px; line-height: 1.6; padding: 9px 12px;
  background: var(--amber-soft, #fff7e6); color: #8a5a00;
  border: 1px dashed #f0c98a; border-radius: 8px; margin-bottom: 12px;
}
.lg-status {
  font-size: 12.5px; color: var(--text-muted); line-height: 1.6;
  min-height: 20px; margin-bottom: 8px;
}
.lg-status.ok { color: var(--green); }
.lg-status.err { color: var(--red); }
.lg-inline-err {
  font-size: 12px; color: var(--red); line-height: 1.5;
  margin-top: 4px; display: none;
}

.fx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.fx-row { display: flex; align-items: center; gap: 8px; }
.fx-row .fx-cur { width: 72px; font-weight: 700; font-size: 13px; }
.fx-row input { flex: 1; }
.fx-hint { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-bottom: 14px; }
.fx-update { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--soft, #f5f7fb); border: 1px dashed var(--border, #d7dee8); border-radius: 8px; margin-bottom: 14px; }
.fx-updated { font-size: 12px; color: var(--text-muted); }
.fx-update .btn { flex-shrink: 0; }
.fx-update .btn[disabled],
.fx-update .btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* 汇率 modal：独立模式（无后端）提示 */
.fx-offline-tip {
  font-size: 12.5px; line-height: 1.6; padding: 9px 12px;
  background: #fff7e6; color: #8a5a00;
  border: 1px dashed #f0c98a; border-radius: 8px; margin-bottom: 12px;
}
.fx-offline-tip a { color: #8a5a00; text-decoration: underline; }

/* 新闻列表：独立模式 fallback */
.news-offline {
  padding: 28px 16px; text-align: center; color: var(--text-muted);
  background: #fff7e6; border: 1px dashed #f0c98a; border-radius: 8px;
  line-height: 1.7;
}
.news-offline .big { font-size: 32px; margin-bottom: 8px; }
.news-offline p { margin: 6px 0; }
.news-offline a { color: #8a5a00; text-decoration: underline; }
.news-offline a:hover { color: #6b4500; }

/* 示例数据提示条（首次打开自动载入示例时出现，明确告知这不是真实账本） */
.demo-banner {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; margin-bottom: 12px;
  background: #fff7e6; color: #8a5a00;
  border: 1px solid #f0c98a; border-radius: 8px;
  font-size: 13px; line-height: 1.6;
}
.demo-banner b { color: #6b4500; }
.demo-banner .btn { flex-shrink: 0; }

.sync-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.sync-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sync-status { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; min-height: 20px; }
.sync-status.ok { color: var(--green); }
.sync-status.err { color: var(--red); }


.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.btn-menu {
  display: none;
  align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: #fff;
  color: var(--text); font-size: 18px; cursor: pointer;
  flex-shrink: 0;
}
.btn-menu:hover { background: #f7f9fb; }

.sidebar-mask {
  display: none;
  position: fixed; inset: 0; z-index: 20;
  background: rgba(16, 24, 40, 0.4);
}

.content { flex: 1; overflow-y: auto; padding: 24px 26px 48px; }
.view { display: none; max-width: 1080px; margin: 0 auto; }
.view.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============================= 通用组件 ============================= */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: none; cursor: pointer;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600;
  transition: transform 0.05s, box-shadow 0.15s, background 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(59,91,219,0.28); }
.btn-primary:hover { background: var(--primary-deep); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: #f7f9fb; }
.btn-danger-ghost { background: #fff; color: var(--red); border: 1px solid #f3caca; }
.btn-danger-ghost:hover { background: var(--red-soft); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px;
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.card-desc { font-size: 12.5px; color: var(--text-muted); margin: 0 0 18px; }

/* 首次使用引导 */
.onboarding {
  background: linear-gradient(135deg, #eef2ff 0%, #f8faff 55%, #ffffff 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  margin-bottom: 16px;
}
.ob-head { text-align: center; max-width: 620px; margin: 0 auto 20px; }
.ob-badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 700;
  letter-spacing: 1px; margin-bottom: 12px;
}
.ob-head h2 { margin: 0 0 8px; font-size: 20px; }
.ob-head p { margin: 0; color: var(--text-muted); font-size: 13.5px; line-height: 1.7; }
.ob-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.ob-step {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px;
  display: flex; gap: 12px; align-items: flex-start;
}
.ob-num {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.ob-body { display: flex; flex-direction: column; gap: 4px; }
.ob-body b { font-size: 14px; }
.ob-body span { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }
.ob-actions { display: flex; gap: 10px; justify-content: center; }
@media (max-width: 900px) {
  .ob-steps { grid-template-columns: 1fr; }
}

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px;
}
.stat-label { font-size: 12.5px; color: var(--text-muted); }
.stat-value { font-size: 24px; font-weight: 800; margin-top: 7px; letter-spacing: -0.5px; }
.stat-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-value.blue { color: var(--primary); }
.stat-value.amber { color: var(--amber); }

/* 徽章 */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.5;
}
.badge.asset { background: var(--green-soft); color: var(--green); }
.badge.liability { background: var(--red-soft); color: var(--red); }
.badge.neutral { background: #f1f3f5; color: var(--text-muted); }

/* ============================= 表格 ============================= */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-weight: 600; color: var(--text-muted);
  font-size: 12px; padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td {
  padding: 13px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #fafbfd; }
.cell-name { font-weight: 600; }
.cell-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.money-pos { color: var(--green); font-weight: 700; }
.money-neg { color: var(--red); font-weight: 700; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn {
  border: none; background: transparent; cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px;
  font-size: 14px; color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: #f1f3f5; color: var(--text); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }

/* 空状态 */
.empty {
  text-align: center; padding: 46px 20px; color: var(--text-muted);
}
.empty .big { font-size: 40px; margin-bottom: 12px; }
.empty p { margin: 6px 0; }

/* ============================= 表单 ============================= */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); background: #fff;
  outline: none; transition: border 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,91,219,0.12);
}
.field .unit { position: relative; }
.field .unit input { padding-left: 28px; }
.field .unit::before { content: "¥"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }

.live-verdict {
  margin-top: 16px; padding: 14px 16px; border-radius: 10px;
  font-size: 13px; line-height: 1.6; display: flex; gap: 11px; align-items: center;
}
.live-verdict .ico { font-size: 22px; }
.live-verdict.asset { background: var(--green-soft); color: #0b7a57; }
.live-verdict.liability { background: var(--red-soft); color: #b32828; }
.live-verdict.neutral { background: #f1f3f5; color: var(--text-muted); }

/* ============================= 仓鼠跑轮 ============================= */
.wheel-layout { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.wheel-visual {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; text-align: center;
}
.wheel-visual svg { max-width: 100%; height: auto; }
.wheel-status {
  margin-top: 14px; padding: 12px 14px; border-radius: 10px;
  font-weight: 700; font-size: 14.5px;
}
.wheel-status.in { background: var(--amber-soft); color: #b06a06; }
.wheel-status.free { background: var(--green-soft); color: #0b7a57; }

.progress-track { height: 10px; background: #eef1f5; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; transition: width 0.4s ease; }

.metric-list { display: flex; flex-direction: column; gap: 13px; }
.metric-row { display: flex; align-items: center; justify-content: space-between; }
.metric-label { font-size: 13.5px; color: var(--text-muted); }
.metric-value { font-size: 15px; font-weight: 700; }
.metric-bar { display: flex; gap: 10px; align-items: center; }
.metric-bar .progress-track { flex: 1; }

/* ============================= 新闻 ============================= */
.news-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.news-toolbar .hint { font-size: 12.5px; color: var(--text-muted); }
.toolbar-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.news-list { display: flex; flex-direction: column; gap: 10px; }
.news-item {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 15px 18px;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.05s;
}
.news-item:hover { border-color: #c7d4f5; box-shadow: var(--shadow); transform: translateY(-1px); }
.news-idx {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 8px; background: #f1f4f8; color: var(--text-muted);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.news-body { flex: 1; min-width: 0; }
.news-title { font-size: 14.5px; font-weight: 600; line-height: 1.45; }
.news-item:hover .news-title { color: var(--primary); }
.news-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-meta { display: flex; gap: 12px; margin-top: 7px; font-size: 11.5px; color: var(--text-faint); }
.news-meta .src { color: var(--primary); font-weight: 600; }
.news-ext { flex-shrink: 0; color: var(--text-faint); font-size: 17px; margin-top: 2px; }

/* ============================= 计算器 ============================= */
.calc-result {
  background: linear-gradient(135deg, #eef2ff, #f4f7ff);
  border: 1px solid #dfe6ff; border-radius: var(--radius);
  padding: 24px; text-align: center; margin-top: 18px;
}
.calc-result .big { font-size: 40px; font-weight: 800; color: var(--primary); letter-spacing: -1px; }
.calc-result .unit { font-size: 15px; color: var(--text-muted); margin-top: 6px; }
.calc-result .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 10px; line-height: 1.6; }

/* 提示信息条 */
.note {
  background: var(--primary-soft); border: 1px solid #dfe6ff;
  color: #374a9c; border-radius: 10px;
  padding: 11px 14px; font-size: 12.5px; line-height: 1.6;
  display: flex; gap: 9px;
}

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(17,24,39,0.42);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: 20px; animation: fadeIn 0.15s ease;
}
.modal {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 520px; max-width: 100%; max-height: 90vh; overflow-y: auto;
  padding: 24px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { border: none; background: #f1f3f5; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 15px; color: var(--text-muted); }
.modal-close:hover { background: #e9ecf0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 图表导出选择器 */
.chart-select-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; padding: 2px; }
.chart-select-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card, #fff); border: 1px solid var(--border, #d7dee8); border-radius: 10px; cursor: pointer; transition: border-color 0.12s ease, background 0.12s ease; }
.chart-select-item:hover { border-color: var(--primary, #3b5bdb); background: #f7f9ff; }
.chart-select-item input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--primary, #3b5bdb); cursor: pointer; }
.chart-select-name { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-select-size { flex-shrink: 0; font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* 还债计划 */
.debt-control { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; background: var(--soft, #f5f7fb); border: 1px dashed var(--border, #d7dee8); border-radius: 10px; margin-bottom: 18px; }
.debt-control label { font-size: 13.5px; font-weight: 600; }
.debt-control .unit { width: 160px; }
.debt-hint { flex-basis: 100%; font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.debt-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.debt-card { border: 1px solid var(--border, #d7dee8); border-radius: 12px; padding: 16px; background: #fff; }
.debt-card-head { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.debt-card-months { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }
.debt-card-months span { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; margin-top: 3px; }
.debt-card-interest { font-size: 13px; color: var(--text-muted); margin-top: 10px; }
.debt-card-interest b { color: var(--red, #e03131); }
.debt-card-order { font-size: 12px; color: var(--text-muted); margin-top: 8px; line-height: 1.6; word-break: break-all; }
.debt-note { margin-top: 14px; padding: 11px 14px; background: #eef2ff; border: 1px solid #dfe6ff; color: #374a9c; border-radius: 10px; font-size: 13px; line-height: 1.7; }
.debt-title { font-size: 14px; font-weight: 700; margin-top: 20px; margin-bottom: 6px; }

/* 帮助弹窗 */
.help-intro { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin-bottom: 16px; }
.help-points { display: flex; flex-direction: column; gap: 10px; }
.help-point { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.help-point-title { font-weight: 700; font-size: 13.5px; margin-bottom: 3px; }
.help-point-desc { color: var(--text-muted); font-size: 13px; line-height: 1.6; }

/* ============================= 现金流象限 ============================= */
.quadrant-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.quadrant-svg { text-align: center; }
.quadrant-svg svg { max-width: 100%; height: auto; }
.quadrant-side { display: flex; flex-direction: column; }
.verdict-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.verdict-card h4 { margin: 0 0 6px; font-size: 15px; }
.verdict-card .pos { font-size: 26px; font-weight: 800; margin: 8px 0; letter-spacing: -0.5px; }
.verdict-card p { margin: 6px 0; font-size: 13px; color: var(--text-muted); line-height: 1.7; }
.ratio-track { height: 14px; background: #eef1f5; border-radius: 999px; overflow: hidden; margin-top: 12px; }
.ratio-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #4c6ef5, #0ca678); transition: width 0.4s ease; }
.ratio-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-faint); margin-top: 5px; }

/* ============================= 趋势图 ============================= */
.trend-empty { text-align: center; padding: 32px 16px; color: var(--text-muted); }
.trend-empty .big { font-size: 34px; margin-bottom: 8px; }
.trend-empty p { margin: 5px 0; }

/* ============================= 现金流游戏 ============================= */
.settle-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.settle-table td { padding: 11px 6px; border-bottom: 1px solid var(--border); }
.settle-table .cat { color: var(--text-muted); font-size: 12px; padding-top: 16px; font-weight: 700; letter-spacing: 1px; }
.settle-table .amt { text-align: right; font-weight: 700; }
.settle-table .total td { font-size: 15px; font-weight: 800; padding-top: 14px; border-top: 2px solid var(--border); }
.settle-table .total td:last-child { border-bottom: none; }
.project-summary { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
.project-summary .stat-card { flex: 1; min-width: 180px; }
.project-empty { text-align: center; padding: 28px 16px; color: var(--text-muted); }

/* ============================= 环形图 ============================= */
.donut-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.donut-card { border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.donut-card h4 { margin: 0 0 14px; font-size: 14px; }
.donut-flex { display: flex; align-items: center; gap: 16px; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.donut-legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.donut-legend-row .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.donut-legend-row .lg-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend-row .lg-val { margin-left: auto; color: var(--text-muted); font-weight: 600; white-space: nowrap; }

/* ============================= 财务自由目标 ============================= */
.freedom-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: center; }
.freedom-ring { text-align: center; }
.freedom-ring svg { max-width: 100%; height: auto; }
.freedom-dur { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; color: var(--primary); margin: 8px 0 4px; }
.freedom-dur-sub { font-size: 12.5px; color: var(--text-muted); }
.health-grade { font-size: 17px; font-weight: 800; margin-top: -2px; }

/* 财务自由里程碑 */
.milestones { margin-top: 22px; }
.milestones-title { font-size: 13.5px; font-weight: 700; margin-bottom: 10px; color: var(--text); }
.ms-track { position: relative; height: 12px; background: #eef1f5; border-radius: 8px; margin: 4px 0 22px; }
.ms-fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--green), var(--primary)); transition: width .4s ease; }
.ms-dot { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid #d7dde6; z-index: 1; }
.ms-dot.done { border-color: var(--green); background: var(--green); }
.ms-dot.current { border-color: var(--primary); background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.ms-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.ms-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 8px; text-align: center; }
.ms-card.done { border-color: var(--green); }
.ms-card.current { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ms-name { font-size: 12px; color: var(--text-muted); font-weight: 700; }
.ms-amt { font-size: 16px; font-weight: 800; margin: 6px 0 2px; letter-spacing: -0.3px; }
.ms-amt.done { color: var(--green); }
.ms-amt.current { color: var(--primary); }
.ms-cap { font-size: 11px; color: var(--text-faint); line-height: 1.5; }
.ms-flag { font-size: 11px; margin-top: 6px; font-weight: 700; }
.ms-flag.done { color: var(--green); }
.ms-flag.current { color: var(--primary); }
.ms-flag.upcoming { color: var(--text-faint); }

/* ============================= 先支付自己 ============================= */
.unit-pct { position: relative; }
.unit-pct input { padding-right: 30px; }
.unit-pct::after {
  content: "%"; position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%); color: var(--text-faint); font-weight: 700;
}

.pay-layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: stretch; }
.pay-pool-visual {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; text-align: center; display: flex; align-items: center; justify-content: center;
}
.pay-pool-visual svg { max-width: 100%; height: auto; }
.pay-pool-side { display: flex; flex-direction: column; }

.pay-legend { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 4px; }
.pay-legend .lg { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-muted); }
.pay-legend .lg i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

@media (max-width: 900px) {
  .pay-layout { grid-template-columns: 1fr; }
}

/* ============================= 终生学习者书架 ============================= */
.books-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.book-tab {
  border: 1px solid var(--border-strong); background: #fff; color: var(--text-muted);
  padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.book-tab .cnt { color: var(--text-faint); font-weight: 600; }
.book-tab:hover { background: #f7f9fb; color: var(--text); }
.book-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.book-tab.active .cnt { color: rgba(255,255,255,0.75); }

.books-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.book-card {
  display: flex; gap: 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
  transition: box-shadow 0.15s, transform 0.05s, border-color 0.15s;
}
.book-card:hover { border-color: #c7d4f5; box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.bk-cover {
  width: 72px; height: 104px; flex-shrink: 0; border-radius: 9px;
  color: #fff; font-size: 30px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px rgba(16,24,40,0.18);
  user-select: none;
}
.bk-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bk-title { font-size: 15.5px; font-weight: 700; line-height: 1.4; }
.bk-author { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.bk-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
.bk-stars { font-size: 13px; letter-spacing: 1px; color: #e8890c; }
.bk-stars .star { color: #d9dee7; }
.bk-stars .star.on { color: #e8890c; }
.bk-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.bk-tag {
  background: #f1f4f8; color: var(--text-muted); border-radius: 6px;
  font-size: 11px; padding: 2px 8px;
}
.bk-review {
  margin-top: 10px; font-size: 12.5px; color: var(--text-muted); line-height: 1.6;
  border-left: 3px solid var(--border-strong); padding-left: 10px;
}
.bk-review.empty { color: var(--text-faint); font-style: italic; }
.bk-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 12px; }
.bk-foot-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bk-foot-right { display: flex; gap: 2px; }
.bk-ebook {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; color: var(--text-muted);
  background: var(--primary-soft); border-radius: 8px; padding: 4px 8px;
  max-width: 100%;
}
.bk-ebook span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.bk-ebook .icon-btn { width: 24px; height: 24px; font-size: 12px; }

.bk-detail { display: flex; flex-direction: column; gap: 10px; }
.bk-detail-row { display: flex; gap: 14px; font-size: 13.5px; }
.bk-detail-row .l { width: 66px; flex-shrink: 0; color: var(--text-muted); }
.bk-review-block {
  margin-top: 8px; padding: 14px 16px; background: #f8fafc;
  border: 1px solid var(--border); border-radius: 10px;
}
.bk-review-block h4 { margin: 0 0 8px; font-size: 13px; }
.bk-review-block p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--text); }
.bk-review-block p.muted { color: var(--text-faint); }

/* 响应式 */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .wheel-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .quadrant-wrap { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 1fr; }
  .books-grid { grid-template-columns: 1fr; }
  .freedom-layout { grid-template-columns: 1fr; }
  .ms-cards { grid-template-columns: repeat(3, 1fr); }
}

/* 移动端：侧边栏抽屉 + 汉堡菜单 */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 30; width: 260px; max-width: 82vw;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(16, 24, 40, 0.25); }

  .sidebar-mask {
    display: block; opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .sidebar-mask.show { opacity: 1; pointer-events: auto; }

  .btn-menu { display: inline-flex; }

  .topbar {
    flex-direction: column; align-items: stretch;
    height: auto; gap: 10px; padding: 12px 14px;
  }
  .topbar-left { justify-content: flex-start; }
  .topbar-right { flex-wrap: nowrap; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .topbar-right .btn { flex-shrink: 0; white-space: nowrap; padding: 6px 10px; font-size: 12px; }
  .topbar-right .badge { flex-shrink: 0; font-size: 11px; }

  .content { padding: 16px 14px 40px; }

  .stat-grid { gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 20px; }

  .modal { width: calc(100vw - 28px); max-height: 88vh; }
  .form-grid { gap: 12px; }
  .fx-grid { grid-template-columns: 1fr; }
  .fx-update { flex-direction: column; align-items: stretch; }

  .chart-select-list { max-height: 44vh; }
  .chart-select-item { padding: 9px 10px; }
  .chart-select-size { display: none; }

  .debt-cards { grid-template-columns: 1fr; }
  .debt-control .unit { width: 100%; }
}

