/* ==========================================================================
   资产簿 v2.0 · 样式系统
   设计基调沿用「个人资产手账」：米色纸张底 + 赭红主色 + 宋体标题，
   视觉上像一本摊开的纸质账本，而不是一块冷冰冰的数据看板。

   响应式策略（断点 900px）：
     < 900px  手机形态：底部 Tab 栏 + 悬浮「+」，内容单列，卡片满宽
     ≥ 900px  桌面形态：左侧固定侧边栏导航，内容区双列网格，隐藏 Tab 与悬浮按钮
   ========================================================================== */

:root {
  --brand: #9d4238;
  --brand-deep: #7c3129;
  --brand-bg: #9d423812;
  --terracotta: #b5654d;
  --gold: #c8a45c;
  --olive: #7a8450;
  --red: #a63d2f;
  --red-bg: #a63d2f12;
  --text: #4a3728;
  --sub: #7a6a58;
  --muted: #a4907a;
  --bg: #f4ecdf;
  --card: #fdf8ef;
  --line: #e4d7c2;
  --radius: 14px;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "STZhongsong", "SimSun", serif;
  --sidebar-w: 220px;
  --tabbar-h: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
  overscroll-behavior-y: none;
  /* 禁止手指双指缩放页面（配合 viewport meta + JS 手势拦截，三者缺一不可）：
     - pan-x / pan-y 保留单指滚动与横向滑动
     - 不含 pinch-zoom ⇒ 双指捏合不再缩放视口
     表单控件单独放开，避免影响输入与选择操作 */
  touch-action: pan-x pan-y;
}
input, select, textarea, button, a, label {
  touch-action: manipulation; /* 允许点按，但禁用双击缩放与双指缩放 */
}
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ---------- 应用骨架 ---------- */
.shell { display: flex; height: 100vh; height: 100dvh; background: var(--bg); }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* ---------- 顶部栏 ---------- */
.topbar {
  padding: 14px 16px 12px;
  background: linear-gradient(180deg, #faf3e7, #f4ecdf);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex: 0 0 auto;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .brand-ic {
  width: 38px; height: 38px; border-radius: 12px; background: var(--brand-bg);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 20px;
  flex: 0 0 auto;
}
.topbar .brand > div { min-width: 0; }
.topbar .title { font-family: var(--serif); font-size: 20px; font-weight: 700; color: var(--brand); letter-spacing: 2px; white-space: nowrap; }
.topbar .sub { font-size: 11px; color: var(--muted); font-style: italic; font-family: var(--serif); letter-spacing: .5px; }
.topbar .month { font-size: 12px; color: var(--sub); font-family: var(--serif); flex: 0 0 auto; }
.menu-btn {
  display: flex; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); align-items: center; justify-content: center; font-size: 17px; cursor: pointer; padding: 0;
}

/* ---------- 内容区 ---------- */
.content { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.content-inner { max-width: 1120px; margin: 0 auto; padding: 14px 14px 96px; }
.section { display: none; }
.section.active { display: block; }

/* PC 双列网格 */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
.grid-2 > * { min-width: 0; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: 0 2px 6px rgba(122, 90, 50, .05);
}
.card-title {
  font-size: 13px; font-weight: 600; color: var(--sub); margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: center; letter-spacing: 1px; flex-wrap: wrap; gap: 6px 10px;
}
.card-title .act { font-weight: 400; font-size: 12px; color: var(--brand); cursor: pointer; }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }
.para { font-size: 12.5px; color: var(--sub); line-height: 1.75; margin: 6px 0; }
.muted { color: var(--muted); }
.fs-11 { font-size: 11px; } .fs-11_5 { font-size: 11.5px; } .fs-12 { font-size: 12px; } .fs-12_5 { font-size: 12.5px; }
.empty { text-align: center; color: var(--muted); padding: 36px 0; font-size: 14px; }

/* ---------- 概览 Hero ---------- */
.hero {
  position: relative; background: linear-gradient(135deg, #f3e7d3, #e8d6bb);
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px;
  box-shadow: 0 2px 6px rgba(122, 90, 50, .05); overflow: hidden;
}
.hero .hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; display: none; }
.hero .hero-scrim {
  position: absolute; inset: 0; z-index: 1; display: none;
  background: linear-gradient(180deg, rgba(46, 28, 18, .45), rgba(46, 28, 18, .15) 50%, rgba(46, 28, 18, .32));
}
.hero.has-bg .hero-bg, .hero.has-bg .hero-scrim { display: block; }
.hero .hero-body { position: relative; z-index: 2; padding: 24px 18px; min-height: 200px; display: flex; flex-direction: column; justify-content: center; }
.hero:before { content: '✦'; position: absolute; top: 12px; right: 16px; color: var(--gold); font-size: 14px; z-index: 3; }
.hero:after { content: '✦'; position: absolute; top: 14px; right: 32px; color: rgba(157, 66, 56, .4); font-size: 10px; z-index: 3; }
.hero.has-bg:before, .hero.has-bg:after { display: none; }
.hero .label { font-size: 13px; color: var(--sub); letter-spacing: 1px; }
.hero .value { font-family: var(--serif); font-size: 32px; font-weight: 700; color: var(--brand); margin: 6px 0 14px; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.hero .stats { display: flex; gap: 10px; }
.hero .stat { flex: 1; background: rgba(253, 248, 239, .7); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
/* 金额固定单行显示：16px 下「¥999,999,999」这类 12 字符金额（约 60px）仍能放进 83px，
   无需缩字号；仅当极端超长时才由浏览器裁切，避免换行把卡片撑成两行。
   不换行 + 不缩字号，保证常规金额视觉大小与设计一致。 */
.hero .stat .n { font-family: var(--serif); font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.hero .stat .l { font-size: 11px; color: var(--sub); }
.hero.has-bg .label { color: rgba(255, 255, 255, .95); }
.hero.has-bg .value { color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.hero.has-bg .stat { background: rgba(255, 255, 255, .22); border-color: rgba(255, 255, 255, .35); }
.hero.has-bg .stat .n { color: #fff; }
.hero.has-bg .stat .l { color: rgba(255, 255, 255, .9); }
.hero .cam-btn {
  position: absolute; top: 12px; right: 12px; z-index: 4; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(253, 248, 239, .85); border: 1px solid var(--line); font-size: 16px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); padding: 0;
}
.hero .cam-btn:active { transform: scale(.94); }
.hero-tip { position: absolute; right: 14px; bottom: 12px; z-index: 4; font-size: 11px; color: var(--sub); background: rgba(253, 248, 239, .8); border-radius: 999px; padding: 2px 9px; }

/* ---------- 按钮 ---------- */
.btn {
  border: none; border-radius: 999px; padding: 9px 16px; font-size: 14px; background: var(--brand-bg);
  color: var(--brand); cursor: pointer; white-space: nowrap; transition: transform .1s ease, opacity .15s ease;
}
.btn.primary { background: var(--brand); color: #fdf8ef; }
.btn.ghost { background: var(--card); border: 1px solid var(--line); color: var(--sub); }
.btn.danger { background: var(--red-bg); color: var(--red); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; max-width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 16px; background: #fffdf8; color: var(--text); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }
.field input[type=month] { -webkit-appearance: none; appearance: none; }

/* 分段选择器 */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg .opt {
  flex: 1; min-width: 64px; text-align: center; padding: 9px 0; border: 1px solid var(--line);
  border-radius: 999px; font-size: 13px; color: var(--sub); cursor: pointer; background: #fffdf8;
  transition: background .15s ease, color .15s ease;
}
.seg .opt.active { background: var(--brand-bg); color: var(--brand); border-color: var(--brand); font-weight: 600; }

/* 药丸标签（分类切换） */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; touch-action: pan-x; }
.tabs::-webkit-scrollbar { display: none; }
.tabs.wrap { flex-wrap: wrap; overflow-x: visible; padding-bottom: 0; }
.tab {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; background: var(--card); color: var(--sub);
  font-size: 13px; border: 1px solid var(--line); cursor: pointer; white-space: nowrap;
}
.tab.active { background: var(--brand); color: #fdf8ef; border-color: var(--brand); }

/* 月份选择行 */
.month-pick { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: nowrap; }
.month-pick input[type=month] {
  flex: 1 1 0; min-width: 0; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; font-size: 14px; background: var(--card); color: var(--text);
}

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px; box-shadow: 0 2px 6px rgba(122, 90, 50, .05);
  cursor: pointer; transition: background .12s ease, transform .12s ease;
}
.item:active { background: #f7efe1; transform: scale(.995); }
.item .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.item .info { flex: 1; min-width: 0; }
.item .name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .amt { text-align: right; font-family: var(--serif); font-size: 16px; font-weight: 700; white-space: nowrap; }
.item .amt.neg { color: var(--red); }
.item .profit { font-size: 11px; color: var(--olive); }
.item .profit.loss { color: var(--red); }
.item .ops { display: flex; gap: 8px; flex: 0 0 auto; }
.item .ops button { background: none; border: none; padding: 2px 4px; font-size: 12px; color: var(--terracotta); cursor: pointer; }
/* 本月增减：涨红跌绿（国内习惯） */
.d-up { font-size: 11px; color: #a63d2f; }
.d-down { font-size: 11px; color: #6b8450; }
.d-flat { font-size: 11px; color: var(--muted); }

.group-title {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--sub);
  margin: 14px 0 8px; font-weight: 600; letter-spacing: 1px;
}
.group-title .dot { width: 9px; height: 9px; border-radius: 50%; }
.group-title .sum { margin-left: auto; font-family: var(--serif); font-weight: 700; color: var(--text); }

/* ---------- 图表 ---------- */
canvas { width: 100%; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.legend .li { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--sub); }
.legend .li .d { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.bar { margin: 8px 0; }
.bar .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; color: var(--sub); gap: 10px; }
.bar .top .r { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { height: 10px; background: #ede2cf; border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; transition: width .3s ease; }
.chart-pane { display: none; }
.chart-pane.active { display: block; }

/* ---------- 资产变化（两月对比） ---------- */
.diff-hero { text-align: center; padding: 6px 0 14px; }
.diff-hero .big { font-family: var(--serif); font-size: 30px; font-weight: 700; letter-spacing: .5px; word-break: break-all; }
.diff-hero .big.up { color: var(--red); }
.diff-hero .big.down { color: var(--olive); }
.diff-hero .big.flat { color: var(--muted); }
.diff-hero .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.diff-stats { display: flex; gap: 10px; }
.diff-stats .stat { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.diff-stats .stat .n { font-family: var(--serif); font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.diff-stats .stat .l { font-size: 11px; color: var(--sub); }
.diff-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.diff-row:last-child { border-bottom: none; }
.diff-row .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.diff-row .dn { font-size: 14px; font-weight: 600; min-width: 56px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diff-row .dm { flex: 1; min-width: 0; text-align: right; }
.diff-row .dm .flow { font-size: 11px; color: var(--muted); }
.diff-row .dm .delta { font-family: var(--serif); font-size: 14px; font-weight: 700; }
.diff-row .dm .delta.up { color: var(--red); }
.diff-row .dm .delta.down { color: var(--olive); }
.diff-row .dm .delta.flat { color: var(--muted); }

/* ---------- 规划 ---------- */
.plan-base { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px dashed var(--line); margin-bottom: 10px; }
.plan-base .lb { font-size: 12.5px; color: var(--sub); }
.plan-base .vl { font-family: var(--serif); font-size: 18px; font-weight: 700; color: var(--brand); }
.plan-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.plan-row:last-child { border-bottom: none; }
.plan-row .pn { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-row .pv { text-align: right; font-size: 12px; color: var(--sub); white-space: nowrap; }
.plan-row .pv .gap { font-family: var(--serif); font-weight: 700; }
.plan-row .pv .gap.over { color: var(--red); }
.plan-row .pv .gap.under { color: var(--olive); }
/* 关联明细：父级 .pn 是单行省略，这里要放开才能显示完整的分类/小类列表 */
.plan-row .pn .pn-sub {
  margin-top: 2px; font-size: 11px; font-weight: 400; color: var(--muted);
  white-space: normal; overflow: visible; line-height: 1.5;
}
/* 达标状态标签：跟着差额的正负配色，一眼看得出超配还是偏低 */
.st-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px;
  font-size: 10px; font-weight: 600; font-family: inherit; vertical-align: 1px;
  background: var(--line); color: var(--sub);
}
.st-tag.ok { background: #e6ecd4; color: #55663a; }
.st-tag.over { background: var(--red-bg); color: var(--red); }
.st-tag.under { background: #dfe6d8; color: #4c5c3a; }

/* 方案编辑器里「细选小类」的展开面板 */
.rec-box {
  margin-top: 8px; max-height: 190px; overflow-y: auto;
  border: 1px dashed var(--line); border-radius: 9px; padding: 8px 10px; background: #fffdf8;
}
.tip { display: flex; gap: 8px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; line-height: 1.7; }
.tip:last-child { border-bottom: none; }
.tip .ic { flex: 0 0 auto; }
.tip.warn { color: #8a6d3b; } .tip.danger { color: var(--red); } .tip.ok { color: var(--olive); }
.disclaimer { background: #f7efdd; border: 1px dashed #d8c49a; color: #8a6d3b; border-radius: 10px; padding: 10px 12px; font-size: 12px; line-height: 1.6; }
.warn-box { background: var(--red-bg); border: 1px solid #f0c3bd; color: var(--red); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.7; margin-bottom: 12px; }
.rk-src { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 6px; }
.rk-badge { font-size: 10.5px; color: var(--brand); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; background: var(--brand-bg); }
.rank-num { font-family: var(--serif); font-size: 42px; font-weight: 800; color: var(--brand); text-align: center; }
.rank-desc { text-align: center; color: var(--sub); margin: 6px 0 16px; font-size: 14px; }

/* ---------- 设置行 ---------- */
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.row:last-child { border-bottom: none; }
.row .k { font-size: 14px; color: var(--text); }
.row .v { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- 弹层 ---------- */
.mask { position: fixed; inset: 0; background: rgba(74, 55, 40, .45); display: none; align-items: center; justify-content: center; z-index: 90; padding: 16px; }
.mask.show { display: flex; }
.sheet {
  background: var(--card); width: 100%; max-width: 480px; border-radius: 18px; padding: 18px 16px 20px;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 12px 32px rgba(60, 40, 20, .24);
}
.mask.show .sheet { animation: sheetUp .22s cubic-bezier(.25, .9, .3, 1); }
@keyframes sheetUp { from { transform: translateY(14px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
/* 手机端弹层贴底，符合原生手感 */
@media (max-width: 560px) {
  .mask { align-items: flex-end; padding: 0; }
  .sheet { border-radius: 18px 18px 0 0; max-height: 92vh; }
}
.sheet h3 { margin: 0 0 14px; font-family: var(--serif); font-size: 18px; color: var(--brand); letter-spacing: 1px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet h3 .x { font-size: 20px; color: var(--muted); cursor: pointer; font-family: sans-serif; font-weight: 400; }
.sheet .actions { display: flex; gap: 10px; margin-top: 6px; }
.sheet .actions .btn { flex: 1; padding: 12px; }
.dlg-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.dlg-msg { font-size: 14px; color: var(--text); line-height: 1.8; white-space: pre-line; word-break: break-word; }
.dlg-err { min-height: 18px; font-size: 12px; color: var(--red); margin: 8px 0 0; line-height: 1.6; }
#dlgMask { z-index: 95; }

/* ---------- 变动记录弹层 ---------- */
.ent-form { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.ent-form .ent-row { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.ent-form input { border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font-size: 16px; background: var(--card); color: var(--text); outline: none; }
.ent-form input[type=number] { flex: 1 1 auto; min-width: 96px; width: auto; }
.ent-form input[type=month] { flex: 0 1 134px; min-width: 100px; width: auto; }
.ent-form input.ent-note { flex: 1 1 auto; min-width: 0; }
.ent-form .seg { flex: 0 0 auto; }
.ent-form .seg .opt { flex: 0 0 auto; min-width: 58px; padding: 9px 12px; }
.ent-row-item { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.ent-row-item .e-m { font-size: 11px; color: var(--muted); flex: 0 0 auto; }
.ent-row-item .e-d { flex: 0 0 auto; font-weight: 600; font-family: var(--serif); }
.ent-row-item .e-d.up { color: #a63d2f; }
.ent-row-item .e-d.down { color: #6b8450; }
.ent-row-item .e-n { flex: 1; min-width: 0; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ent-row-item .e-b { flex: 0 0 auto; font-size: 11px; color: var(--muted); font-family: var(--serif); }
.ent-row-item .e-ops { display: flex; gap: 8px; flex: 0 0 auto; }
.ent-row-item .e-ops button { background: none; border: none; font-size: 12px; color: var(--terracotta); cursor: pointer; padding: 2px 2px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 0 4px; font-size: 12px; color: var(--sub); }
.pager button { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 12px; color: var(--sub); cursor: pointer; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- 分类 / 方案管理 ---------- */
.mgr-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.mgr-row .m-sw { width: 16px; height: 16px; border-radius: 4px; flex: 0 0 auto; border: 1px solid rgba(0, 0, 0, .12); }
.mgr-row .m-name { font-size: 14px; font-weight: 500; flex: 1; min-width: 0; }
.mgr-row .m-cur { font-size: 10.5px; color: var(--brand); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; flex: 0 0 auto; background: var(--brand-bg); }
.mgr-row .m-extra { font-size: 11px; color: var(--muted); flex: 0 0 auto; }
.mgr-row .m-ops { display: flex; gap: 10px; flex: 0 0 auto; }
.mgr-row .m-ops button { background: none; border: none; font-size: 12px; color: var(--terracotta); cursor: pointer; padding: 0; }
.cc-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cc-row input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf8; cursor: pointer; }
.cc-hex { font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.cc-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.cc-quick span { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 1px solid rgba(0, 0, 0, .1); }
.cat-item { margin-bottom: 10px; }
.cat-item .ci-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ci-name { font-size: 13px; font-weight: 600; }
.ci-note { font-size: 11px; color: var(--muted); font-weight: 400; }
.cat-item .ci-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.chk-list { display: flex; flex-direction: column; gap: 8px; }
.chk-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.chk-row input { width: 16px; height: 16px; accent-color: var(--brand); }
.chk-name { flex: 1; }
.chk-extra { font-size: 11px; color: var(--muted); }
.chk-line { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--sub); line-height: 1.6; cursor: pointer; margin-bottom: 12px; }
.chk-line input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--brand); flex: 0 0 auto; }
.help-q {
  display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
  border-radius: 50%; background: var(--brand-bg); color: var(--brand); font-size: 11px;
  cursor: pointer; margin-left: 6px; flex: 0 0 auto; font-weight: 700; font-family: sans-serif;
}

/* ---------- 手机：底部 Tab + 悬浮按钮 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); z-index: 60; box-shadow: 0 -2px 12px rgba(90, 60, 30, .10);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .t {
  flex: 1; text-align: center; padding: 7px 0 9px; font-size: 12px; letter-spacing: .3px;
  color: var(--muted); cursor: pointer;
}
.tabbar .t .ic { font-size: 22px; line-height: 1.1; display: block; margin-bottom: 2px; filter: grayscale(.4); opacity: .85; }
.tabbar .t.active { color: var(--brand); font-weight: 600; }
.tabbar .t.active .ic { filter: none; opacity: 1; }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 50%; background: var(--brand); color: #fdf8ef; font-size: 24px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(157, 66, 56, .35);
  cursor: pointer; z-index: 59; border: none; line-height: 1; padding: 0 0 3px;
}
.fab:active { transform: scale(.94); }

/* ---------- 桌面：侧边栏 ---------- */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--card);
  border-right: 1px solid var(--line); display: none; flex-direction: column; padding: 18px 12px;
  box-shadow: 2px 0 12px rgba(90, 60, 30, .05);
}
.sidebar .sb-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 16px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.sidebar .sb-ic { width: 36px; height: 36px; border-radius: 11px; background: var(--brand-bg); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 19px; }
.sidebar .sb-title { font-family: var(--serif); font-size: 17px; font-weight: 700; color: var(--brand); letter-spacing: 1.5px; }
.sidebar .sb-sub { font-size: 10px; color: var(--muted); font-style: italic; font-family: var(--serif); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--sub); cursor: pointer; font-size: 14px; margin-bottom: 2px; transition: background .15s ease;
}
.nav-item:hover { background: var(--brand-bg); }
.nav-item.active { background: var(--brand); color: #fdf8ef; font-weight: 600; }
.nav-item .ic { font-size: 17px; width: 22px; text-align: center; }
.sidebar .sb-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.sidebar .sb-user { display: flex; align-items: center; gap: 8px; padding: 8px 6px 10px; }
.sidebar .sb-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-bg); color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.sidebar .sb-mail { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 登录页 ---------- */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg, #f4ecdf, #e8d6bb); }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px 24px 24px; box-shadow: 0 8px 28px rgba(90, 60, 30, .16); }
.auth-card .auth-ic { font-size: 34px; text-align: center; }
.auth-card .auth-title { font-family: var(--serif); font-size: 21px; font-weight: 700; color: var(--brand); letter-spacing: 2px; text-align: center; margin-top: 4px; }
.auth-card .auth-sub { font-size: 11.5px; color: var(--muted); text-align: center; margin-bottom: 20px; font-family: var(--serif); font-style: italic; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.auth-tabs .t { flex: 1; text-align: center; padding: 9px 0; border-radius: 999px; font-size: 13.5px; color: var(--sub); border: 1px solid var(--line); cursor: pointer; background: #fffdf8; }
.auth-tabs .t.active { background: var(--brand); color: #fdf8ef; border-color: var(--brand); font-weight: 600; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; left: 0; right: 0; top: 16px; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  background: rgba(74, 55, 40, .94); color: #fdf8ef; padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); animation: toastIn .2s ease;
  max-width: 100%; text-align: center;
}
.toast.err { background: rgba(166, 61, 47, .95); }
.toast.ok { background: rgba(122, 132, 80, .95); }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------- 加载态 ---------- */
.loading { position: fixed; inset: 0; background: rgba(244, 236, 223, .7); z-index: 150; display: none; align-items: center; justify-content: center; }
.loading.show { display: flex; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   形态切换：≥900px 走桌面侧边栏，<900px 走手机底部 Tab
   ========================================================================== */
@media (min-width: 900px) {
  .sidebar { display: flex; }
  .tabbar, .fab { display: none !important; }
  .topbar .menu-btn { display: none; }
  .content-inner { padding: 20px 24px 40px; }
  .grid-2 { grid-template-columns: 1fr 1fr; gap: 0 16px; align-items: start; }
  .grid-2.full-first > *:first-child { grid-column: 1 / -1; }
  .hero .hero-body { min-height: 210px; }
  .item:hover { background: #f9f2e5; }
  .toast-host { top: 20px; }
}
@media (max-width: 899px) {
  .sidebar { display: none; }

  /* iOS Safari 在 input 字号 <16px 时聚焦会自动放大页面，且失焦不回弹。
     这里强制移动端所有输入类元素字号 ≥16px，从根上消除聚焦缩放。
     !important 用于压过「全局字号缩放」按档位改写的 font-size。 */
  input, select, textarea {
    font-size: 16px !important;
  }
  /* 年月选择器保持紧凑，但同样不低于 16px */
  .month-pick input[type=month],
  .field input[type=month],
  .ent-form input[type=month] {
    font-size: 16px !important;
  }
}
/* 手机端顶栏在侧边栏隐藏时需要菜单按钮（用于退出登录等入口） */
@media (min-width: 900px) { .topbar .menu-btn { display: none; } }

/* 窄屏微调：iPhone 16 系列 393/402/430px */
@media (max-width: 445px) {
  .topbar { padding: 11px 12px 9px; }
  .topbar .title { font-size: 17px; letter-spacing: 1px; }
  .topbar .brand-ic { width: 34px; height: 34px; font-size: 18px; }
  .content-inner { padding: 12px 12px 90px; }
  .hero .hero-body { padding: 20px 14px; min-height: 178px; }
  .hero .value { font-size: 27px; }
  .card { padding: 14px; }
  .tabbar .t { font-size: 11px; }
  .tabbar .t .ic { font-size: 20px; }
}

/* 尊重系统「减弱动效」 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   应用锁
   ========================================================================== */
.lock-mask {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.lock-card {
  width: 100%; max-width: 380px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 22px;
  box-shadow: 0 12px 40px rgba(74, 55, 40, .14);
  text-align: center;
}
.lock-ic { font-size: 34px; margin-bottom: 6px; }
.lock-title { font-family: var(--serif); font-size: 19px; font-weight: 700; color: var(--text); }
.lock-sub { font-size: 12px; color: var(--muted); margin: 4px 0 18px; }
.lock-card .field { text-align: left; }

/* ==========================================================================
   AI 相关
   ========================================================================== */
/* 排位：AI 估算时徽章换成高亮色，让数据来源一眼可辨 */
.rk-badge.ai {
  color: #fff; background: var(--olive); border-color: var(--olive);
}
.rk-guide-ai {
  background: #f2f5e9; border: 1px dashed #b9c48f; color: #5d6b3a;
  border-radius: 10px; padding: 10px 12px; font-size: 12px; line-height: 1.7; margin-bottom: 8px;
}
/* 规划页 AI 建议正文：等宽感 + 保留换行 */
.ai-answer {
  background: #f7efdd; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 13px; line-height: 1.85; color: var(--text);
  white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow-y: auto;
}
.ai-ask { display: flex; gap: 8px; margin-top: 10px; }
.ai-ask input {
  flex: 1; min-width: 0; padding: 9px 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text);
}
.ai-state { font-size: 12px; line-height: 1.7; }
.ai-state.ok { color: var(--olive); }
.ai-state.bad { color: var(--red); }

/* 说明文字过长时折叠成「?」，点开再展开（长文案不刷屏） */
.help-q {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin-left: 5px; vertical-align: -2px;
  font-size: 10px; line-height: 1; border-radius: 50%;
  background: var(--line); color: var(--sub); cursor: pointer; user-select: none;
}
.help-q:hover { background: var(--brand); color: #fff; }
.para.collapsed > .help-body { display: none; }

/* 弹窗打开时锁住底层滚动，避免手机上滑动"穿透" */
.scroll-locked { overflow: hidden !important; }
