:root {
  --bg: #f6f2ea;
  --bg-2: #f1ebe1;
  --card: #ffffff;
  --ink: #221d18;
  --ink-2: #4a433b;
  --muted: #8a8175;
  --line: #eee6d9;
  --line-2: #e4dacb;
  --accent: #2f6b56;
  --accent-soft: #eaf1ec;
  --accent-ink: #24543f;
  --amber: #b9813f;
  --danger: #b0504a;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(40, 31, 20, .035), 0 18px 36px -26px rgba(40, 31, 20, .38);
  --ring: 0 0 0 3px rgba(47, 107, 86, .14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 18px 130px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  box-shadow: 0 8px 16px -14px rgba(40, 31, 20, .55);
}
.brand { display: flex; align-items: center; gap: 11px; }
.logo {
  width: 40px; height: 40px; border-radius: 13px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: 17px; font-weight: 600; letter-spacing: .5px;
  box-shadow: 0 8px 18px -10px rgba(47, 107, 86, .85);
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: .1px; line-height: 1.3; }
.topbar p { margin: 1px 0 0; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.db-status {
  font-size: 10px; line-height: 16px; padding: 0 6px; border-radius: 999px;
  border: 1px solid #d9e6dd; background: #eef4ef; color: var(--accent);
  white-space: nowrap;
}
.db-status.off { background: #f3f0ea; border-color: var(--line-2); color: var(--muted); }
.db-status.warn { background: #fbeede; border-color: #e8c9a2; color: #a2622a; }
.loading { text-align: center; color: var(--muted); padding: 90px 0; font-size: 13px; }

.ghost-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 15px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 20px -12px rgba(47, 107, 86, .9);
  transition: transform .12s ease, background .12s ease;
}
.ghost-btn:hover { background: #2a604d; border-color: #2a604d; color: #fff; }
.ghost-btn:active { transform: scale(.97); }

/* ---------- 通用 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
@media (min-width: 700px) {
  .card { padding: 20px; margin-bottom: 16px; }
}
.card.tight { padding: 4px 6px; }
.card-h {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px; gap: 10px;
}
.card-h h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .2px; scroll-margin-top: 88px; }
.card-h span { font-size: 12px; color: var(--muted); white-space: nowrap; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.stat { padding: 15px 16px; margin: 0; }
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat b {
  display: block; font-size: 22px; font-weight: 600; margin: 4px 0 1px;
  letter-spacing: -.5px; font-variant-numeric: tabular-nums;
}
.stat em { font-style: normal; font-size: 11px; color: #b0a79b; }

.page-h { padding: 6px 2px 16px; }
.page-h h2 { margin: 0 0 3px; font-size: 23px; font-weight: 600; letter-spacing: -.4px; }
.page-h p { margin: 0; font-size: 13px; color: var(--muted); }

.hint { font-size: 12px; color: var(--muted); margin: 12px 2px 0; line-height: 1.6; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 28px 10px; margin: 0; }

.link {
  background: none; border: 0; padding: 12px 0 2px;
  color: var(--accent); font: inherit; font-size: 13px; cursor: pointer;
}
.link:hover { text-decoration: underline; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  border-radius: 26px;
  padding: 24px 22px 20px;
  color: #fff;
  margin-bottom: 14px;
  overflow: hidden;
  background: linear-gradient(148deg, #35745e 0%, #2b5f4c 52%, #244f40 100%);
  box-shadow: 0 18px 36px -22px rgba(36, 79, 64, .95);
}
.hero::after {
  content: "";
  position: absolute; right: -60px; top: -80px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 70%);
}
.hero-k { font-size: 12.5px; opacity: .78; letter-spacing: .4px; }
.hero-num {
  font-size: 52px; font-weight: 600; line-height: 1.05;
  letter-spacing: -2px; margin: 6px 0 8px;
  font-variant-numeric: tabular-nums;
}
.hero-num .cur { font-size: 24px; font-weight: 500; opacity: .8; margin-right: 3px; letter-spacing: 0; }
.hero-sub { font-size: 12.5px; opacity: .82; }
.hero-split {
  display: flex; gap: 14px; margin-top: 18px; padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .16);
}
.hero-split div { flex: 1; }
.hero-split span { display: block; font-size: 11.5px; opacity: .72; }
.hero-split b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- 提醒 ---------- */
.rem { list-style: none; margin: 0; padding: 0; }
.rem li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line);
  cursor: pointer;
}
.rem li:first-child { border-top: 0; padding-top: 0; }
.rem li:last-child { padding-bottom: 0; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.rm-main { flex: 1; min-width: 0; }
.rm-main b { display: block; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-main span { font-size: 11.5px; color: var(--muted); }
.rm-tag { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- 今日在摊 ---------- */
.daily-list { list-style: none; margin: 0; padding: 0; }
.daily-list li {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 0; border-top: 1px solid var(--line); cursor: pointer;
}
.daily-list li:first-child { border-top: 0; padding-top: 0; }
.daily-list li:last-child { padding-bottom: 0; }
.dl-main { flex: 1; min-width: 0; }
.dl-main b { display: block; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-main span { font-size: 11.5px; color: var(--muted); }
.dl-right { text-align: right; white-space: nowrap; }
.dl-right b { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dl-right span { font-size: 11px; color: var(--muted); margin-left: 1px; }

/* ---------- 分类条 ---------- */
.catbars { display: flex; flex-direction: column; gap: 13px; }
.cb-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.cb-name { font-size: 12.5px; display: flex; align-items: center; gap: 7px; }
.cb-name i { width: 8px; height: 8px; border-radius: 2px; }
.cb-val { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cb-val em { font-style: normal; color: var(--muted); margin-left: 6px; font-size: 11px; }
.cb-track { height: 6px; border-radius: 99px; background: #f2ede5; overflow: hidden; }
.cb-fill { height: 100%; border-radius: 99px; }

/* ---------- 明细 ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 2px 14px; }
.chip {
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  font: inherit; font-size: 12.5px; padding: 7px 13px; border-radius: 999px;
  cursor: pointer; white-space: nowrap; transition: all .12s ease;
}
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* 分类 / 日期筛选：清单页与明细页共用，括号里是当前范围的条数 */
.chips.sm { gap: 6px; padding: 0; }
.chip.sm { font-size: 12px; padding: 5px 10px; }
.chip em { font-style: normal; font-size: 10.5px; margin-left: 5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.on em { color: rgba(255, 255, 255, .75); }
.list-filter {
  padding: 13px 14px; margin: -4px 0 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.list-filter-row + .list-filter-row { margin-top: 10px; }
.list-filter-row > span, .tpl-filter-row > span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.list-filter .hint { margin-top: 10px; font-size: 11px; }

/* 明细：记账日期用起止日历选区间（含首含尾） */
.date-range { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.date-range input[type="date"] {
  flex: 1 1 0; min-width: 0; max-width: 168px; box-sizing: border-box;
  padding: 6px 6px; font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums;
  color: var(--ink); background: #fff; border: 1px solid #e6ded1; border-radius: 8px;
}
.date-range input[type="date"]:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(47, 107, 86, .12);
}
.date-range em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.date-range .link-btn { flex: 0 0 auto; margin-left: 0; padding: 4px 2px; white-space: nowrap; }
.date-range-sum {
  margin: 9px 0 0; font-size: 11.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.date-range-sum b { color: var(--ink); font-weight: 600; }
.tpl-filter { padding: 14px; }
.tpl-filter-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 8px; margin-bottom: 10px; }
.tpl-filter-h b { font-size: 13.5px; }
.tpl-filter-h span { font-size: 11.5px; color: var(--muted); }
.tpl-filter-h span b { color: var(--accent); font-size: 12.5px; }
.tpl-filter-row + .tpl-filter-row { margin-top: 10px; }
.tpl-filter .hint { margin-top: 10px; font-size: 11px; }
.tpl-filter-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.tpl-filter-foot > span { font-size: 11.5px; color: var(--muted); }
.tpl-filter-foot .seg { flex: 1; min-width: 210px; }
.seg.sm button { font-size: 12px; padding: 6px 8px; }

.reclist { list-style: none; margin: 0; padding: 0; }
.rec {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 12px; border-top: 1px solid var(--line); cursor: pointer;
  border-radius: 12px; transition: background .12s ease;
}
.rec:first-child { border-top: 0; }
.rec:hover { background: #faf7f2; }
.rec-main { flex: 1; min-width: 0; }
.rec-main b { display: block; font-size: 14px; font-weight: 500; }
.rec-main span { font-size: 11.5px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag {
  font-style: normal; font-size: 11px; border: 1px solid currentColor;
  padding: 0 5px; border-radius: 5px; opacity: .85; margin-right: 2px;
}
.rec-right { text-align: right; white-space: nowrap; }
.rec-right b { font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rec-right span { font-size: 11px; color: var(--muted); }

/* 明细页批量重新分类 */
.rec-check { flex: 0 0 auto; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.list-batch { padding: 14px; margin: 12px 0 0; }
.list-batch-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; }
.list-batch-h span { color: var(--muted); font-size: 11.5px; }
.list-batch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.list-batch-row .btn.primary { flex: 0 0 auto; }
.list-batch-row .btn[disabled] { opacity: .45; cursor: not-allowed; }
.list-batch-row .btn[disabled] { opacity: .45; cursor: not-allowed; }
.list-batch .hint { margin-top: 10px; }
.batch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 2px 0 0; }
.batch-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.batch-field > span { font-size: 11.5px; color: var(--muted); }
.batch-field select {
  width: 100%; box-sizing: border-box; padding: 8px 10px;
  font: inherit; font-size: 12.5px; color: var(--ink);
  background: #fff; border: 1px solid #e6ded1; border-radius: 10px;
}
.batch-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(47, 107, 86, .12); }
.batch-days { margin-top: 10px; }
.batch-days .mini-sel { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.batch-days input {
  width: 76px; padding: 6px 9px; font: inherit; font-size: 12.5px;
  border: 1px solid #e6ded1; border-radius: 8px; text-align: center;
}
.batch-preview { margin: 10px 0 0; font-size: 11.5px; line-height: 1.55; color: var(--muted); }
@media (max-width: 380px) { .batch-grid { grid-template-columns: 1fr; } }

/* 明细清单顶部：一个框管「全选当前范围 / 取消全选」 */
.list-selbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 4px 10px; margin: 2px 0 2px;
  border-bottom: 1px solid var(--line);
}
.list-selall {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; user-select: none;
}
.list-selall input {
  width: 17px; height: 17px; margin: 0; flex: none;
  accent-color: var(--accent); cursor: pointer;
}
.list-seln { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.list-seln b { color: var(--ink); font-weight: 600; }

/* ---------- 分析 ---------- */
.donut-wrap { display: flex; justify-content: center; padding: 2px 0 10px; }
.donut { overflow: visible; }
.donut-top { font-size: 21px; font-weight: 600; fill: var(--ink); font-variant-numeric: tabular-nums; }
.donut-sub { font-size: 10.5px; fill: var(--muted); }
.legend { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.lg { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.lg i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.lg span { flex: 1; }
.lg b { font-weight: 500; font-variant-numeric: tabular-nums; }
.lg em { font-style: normal; color: var(--muted); font-size: 11.5px; width: 34px; text-align: right; }

.bars { width: 100%; height: auto; display: block; }
.ax { font-size: 10.5px; fill: #a79e92; }
.barval { font-size: 10px; fill: #7d7468; }
.avg-label { font-size: 10px; fill: #8c8378; }

.callout {
  margin-top: 14px; padding: 14px 15px;
  background: #faf7f1; border: 1px solid var(--line); border-radius: 14px;
}
.callout p { margin: 0 0 6px; font-size: 13px; }
.callout p:last-child { margin-bottom: 0; }
.callout b { font-weight: 600; }

/* ---------- 说明 ---------- */
.calc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.calc-table th {
  text-align: left; font-weight: 500; color: var(--muted);
  font-size: 11.5px; padding: 0 8px 8px 0; border-bottom: 1px solid var(--line);
}
.calc-table td { padding: 9px 8px 9px 0; border-bottom: 1px solid #f4efe7; vertical-align: top; }
.calc-table tr:last-child td { border-bottom: 0; }
.calc-table td:first-child { font-weight: 500; white-space: nowrap; }
.calc-table td:nth-child(2) { color: var(--accent); }
.calc-table td:nth-child(3) { font-size: 11.5px; }

.ideas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.ideas li { display: flex; gap: 11px; }
.ideas .num {
  flex: none; width: 20px; height: 20px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; display: grid; place-items: center; margin-top: 1px;
}
.ideas b { font-size: 13.5px; font-weight: 600; }
.ideas p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }

.kv { display: flex; flex-direction: column; gap: 9px; }
.kv > div {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12.5px; border-bottom: 1px solid #f4efe7; padding-bottom: 8px;
}
.kv > div:last-child { border-bottom: 0; padding-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  border: 1px solid var(--line-2); background: #fff; color: var(--ink);
  font: inherit; font-size: 13px; padding: 9px 15px; border-radius: 11px; cursor: pointer;
  transition: all .12s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; flex: 1; }
.btn.primary:hover { background: #285c4a; color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- 标签与双计量规格 ---------- */
.tag-sec {
  margin: 4px 0 14px; padding: 14px 13px 2px;
  background: #faf7f2; border: 1px solid var(--line); border-radius: 14px;
}
.sec-title {
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  margin: 0 0 12px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.sec-title em { font-style: normal; font-size: 11px; font-weight: 400; color: var(--muted); }
.tagpick { display: flex; flex-wrap: wrap; gap: 6px; }
.tagchip {
  display: flex; align-items: center; gap: 5px;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  font: inherit; font-size: 11.5px; padding: 6px 10px; border-radius: 999px; cursor: pointer;
}
.tagchip i { width: 6px; height: 6px; border-radius: 50%; opacity: .45; }
.tagchip.on { border-color: var(--ink); color: var(--ink); font-weight: 500; }
.tagchip.on i { opacity: 1; }
.tag-sec .field { margin-bottom: 12px; }
.spec-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spec-row .field { margin-bottom: 10px; }
.unit-preview {
  font-size: 11.5px; color: #2a5c4a; line-height: 1.6;
  background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin: 2px 0 10px;
}
.unit-preview b { font-size: 13px; font-variant-numeric: tabular-nums; }

.tagpills { display: inline-flex; gap: 4px; margin-left: 4px; vertical-align: middle; }
.tagpills i {
  font-style: normal; font-size: 10px; line-height: 16px;
  padding: 0 5px; border: 1px solid; border-radius: 5px;
}
.chips.dims { padding-bottom: 12px; }

.cmp { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.cmp-h { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; margin-bottom: 6px; }
.cmp-h span { font-size: 11px; color: var(--muted); }
.cmp ul { list-style: none; margin: 0; padding: 0; }
.cmp li {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12px; padding: 5px 0; border-top: 1px solid #f4efe7;
}
.cmp li:first-child { border-top: 0; }
.cmp li span { color: var(--ink-2); }
.cmp li b { font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cmp li b.best { color: var(--accent); }

.est-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px 104px; gap: 8px; }
.est-row select, .est-row input {
  font: inherit; font-size: 13px; min-width: 0; color: var(--ink);
  padding: 9px 10px; border: 1px solid var(--line-2); border-radius: 10px;
  background: #fdfbf8; outline: none;
}
.est-out {
  margin-top: 10px; padding: 11px 13px; border-radius: 10px;
  background: var(--accent-soft); color: #2a5c4a; font-size: 12.5px;
}
.est-out b { font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---------- 底部导航 ---------- */
.tabbar {
  /* 居中靠 left:50% + translate，前提是整页不比视口宽：
     一旦有超宽元素把文档撑开，fixed 会按撑开的宽度居中，导航就歪到一边。
     宽表格 / 长代码请放进 .table-scroll，别让页面出现横向溢出。 */
  position: fixed; left: 50%; transform: translateX(-50%);
  width: max-content;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex; gap: 2px; padding: 5px;
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  box-shadow: 0 10px 30px -12px rgba(40, 31, 20, .35);
  z-index: 30;
}
.tabbar button {
  border: 0; background: none; font: inherit; font-size: 13px;
  color: var(--ink-2); padding: 9px 18px; border-radius: 999px; cursor: pointer;
  white-space: nowrap;
  transition: all .14s ease;
}
.tabbar button.active { background: var(--ink); color: #fff; }

/* ---------- 表单弹层 ---------- */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-wrap[hidden] { display: none; }
.sheet-bg { position: absolute; inset: 0; background: rgba(28, 22, 16, .38); backdrop-filter: blur(3px); }
.sheet {
  position: relative;
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  background: #fff;
  border-radius: 26px 26px 0 0;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 50px -20px rgba(28, 22, 16, .5);
  animation: up .26s cubic-bezier(.22, .9, .3, 1);
}
@keyframes up { from { transform: translateY(28px); opacity: .4; } to { transform: none; opacity: 1; } }

.sheet-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-h h3 { margin: 0; font-size: 17px; font-weight: 600; }
.x {
  border: 0; background: #f4efe7; width: 30px; height: 30px; border-radius: 50%;
  color: var(--muted); font-size: 13px; cursor: pointer;
}

.typepick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.tchip {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  font: inherit; font-size: 12px; padding: 9px 3px; border-radius: 11px; cursor: pointer;
  transition: all .12s ease;
}
.tchip i { width: 6px; height: 6px; border-radius: 50%; opacity: .5; }
.tchip.on { border-color: var(--ink); background: #fbf8f3; color: var(--ink); font-weight: 500; }
.tchip.on i { opacity: 1; }
.tdesc { font-size: 12px; color: var(--muted); margin: 9px 2px 16px; }

.field { display: block; margin-bottom: 13px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; font: inherit; font-size: 14.5px; color: var(--ink);
  padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 12px;
  background: #fdfbf8; outline: none; transition: border-color .14s ease, background .14s ease;
}
.field input:focus, .field select:focus { border-color: var(--accent); background: #fff; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2.tight { gap: 8px; }
.row2 .field { margin-bottom: 0; }

.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick button {
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  font: inherit; font-size: 11.5px; padding: 5px 10px; border-radius: 999px; cursor: pointer;
}
.quick button:hover { border-color: var(--accent); color: var(--accent); }

/* 首次记录 · 向前补账（仅「不确定期限」表单出现） */
.backfill-sec { background: #f6f9f8; border-color: #cfe0dc; }
.switch-row {
  display: flex; align-items: flex-start; gap: 9px; margin: 0 0 10px;
  font-size: 12.5px; line-height: 1.55; color: var(--ink-2); cursor: pointer;
}
.switch-row input { width: 17px; height: 17px; margin: 1px 0 0; flex: 0 0 17px; accent-color: var(--accent); }
.switch-row b { font-weight: 600; }
.backfill-fields {
  margin: 2px 0 12px; padding: 10px 11px 2px;
  background: #fff; border: 1px solid var(--line-2); border-radius: 11px;
}
.backfill-fields .field { margin-bottom: 0; }
.backfill-fields .quick button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.backfill-fields .mini-note { margin: 9px 0 8px; line-height: 1.6; }
.mini-note.warn {
  color: #9b5733; background: #fdf1e8; border-radius: 8px;
  padding: 8px 10px; margin: 0 0 10px; font-size: 11.5px; line-height: 1.5;
}

.seg { display: flex; background: #f4efe7; padding: 4px; border-radius: 12px; }
.seg button {
  flex: 1; border: 0; background: none; font: inherit; font-size: 13px;
  padding: 8px; border-radius: 9px; color: var(--ink-2); cursor: pointer;
}
.seg button.on { background: #fff; box-shadow: 0 1px 3px rgba(40, 31, 20, .12); font-weight: 500; }

/* 「确定期限」下的形态选择：按天数 / 按周期 / 只在某些月份 */
.fmode { margin: 0 0 14px; padding: 10px 12px; background: #fbf8f3; border: 1px solid var(--line-2); border-radius: 12px; }
.fmode-k { font-size: 11.5px; color: var(--muted); margin-bottom: 7px; }
.fseg button { font-size: 12px; padding: 7px 4px; }
.fmode .mini-note { margin-top: 7px; }

.mini-note { font-size: 11.5px; color: var(--muted); margin: 6px 0 0; line-height: 1.5; align-self: center; }

.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.mchip {
  border: 1px solid var(--line-2); background: #fff; color: var(--muted);
  font: inherit; font-size: 11px; padding: 7px 0; border-radius: 8px; cursor: pointer;
  transition: all .12s ease;
}
.mchip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.preview {
  margin: 4px 0 16px; padding: 13px 15px;
  background: var(--accent-soft); border-radius: 13px;
  font-size: 12.5px; color: #2a5c4a; line-height: 1.6;
}
.preview b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.preview .muted { color: #6d8b7f; font-size: 11.5px; }

.sheet-foot { display: flex; gap: 9px; }
.sheet-foot .btn { padding: 13px 18px; }

/* ---------- 用完再充：充值记录编辑行 ---------- */
.ev-row {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr) 28px;
  gap: 8px; align-items: end; margin-bottom: 9px;
}
.ev-row .field { margin-bottom: 0; min-width: 0; }
.ev-row .field > span { font-size: 10.5px; margin-bottom: 4px; }
.ev-row .field input { padding: 9px 8px; font-size: 13px; border-radius: 10px; }
.ev-i {
  width: 22px; height: 22px; margin-bottom: 9px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; text-align: center; line-height: 22px; font-weight: 600;
}
.ev-del {
  width: 28px; height: 38px; border: 1px solid var(--line-2);
  background: #fff; color: var(--muted); border-radius: 10px; cursor: pointer; font-size: 12px;
}
.ev-del:hover { border-color: var(--danger); color: var(--danger); }
.add-ev { width: 100%; margin: 2px 0 12px; padding: 9px; font-size: 12.5px; }

/* ---------- 分析：累计周期卡片 ---------- */
.cyc { border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-bottom: 10px; cursor: pointer; }
.cyc.waiting { border-style: dashed; background: #faf7f2; }
.cyc-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; }
.cyc-h span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.cyc-eq {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px;
  margin: 10px 0; padding: 10px 12px; border-radius: 10px;
  background: var(--accent-soft); color: #2a5c4a; font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.cyc-eq em { font-style: normal; color: #6d8b7f; }
.cyc-eq b { font-size: 16px; }
.cyc-eq small { margin-left: auto; font-size: 11px; color: #6d8b7f; }
.cyc-seg { list-style: none; margin: 0 0 8px; padding: 0; }
.cyc-seg li {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px;
  font-size: 11.5px; color: var(--ink-2); padding: 5px 0; border-top: 1px solid #f4efe7;
}
.cyc-seg li span:nth-child(2) { color: var(--muted); }
.cyc-seg b { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cyc-note { margin: 6px 0 0; font-size: 11.5px; line-height: 1.65; color: var(--muted); }
.cyc-note b { color: var(--ink-2); font-weight: 600; }
.lead { margin: 0 0 12px; font-size: 13px; color: var(--ink-2); line-height: 1.7; }

/* ---------- 每个人花多少 ---------- */
.person-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 0 8px; }
.person-hero > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.person-hero span { font-size: 11.5px; color: var(--muted); }
.person-hero b { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.person-hero em { font-size: 11px; font-style: normal; color: var(--muted); }
.person-hero-mid { text-align: right; align-items: flex-end; }
.person-hero-mid b { color: var(--accent); }
.person-list { list-style: none; margin: 4px 0 12px; padding: 0; }
.person-list li { display: flex; align-items: center; gap: 9px; padding: 10px 0; border-top: 1px solid #f4efe7; }
.person-list li:first-child { border-top: 0; }
.person-list > li > i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.person-main b { font-size: 12.5px; font-weight: 500; }
.person-main span { font-size: 11px; color: var(--muted); line-height: 1.4; }
.person-bar { height: 4px; border-radius: 999px; background: #f1ece3; overflow: hidden; margin-top: 2px; }
.person-bar i { display: block; height: 100%; border-radius: 999px; }
.person-num { text-align: right; display: flex; flex-direction: column; gap: 2px; flex: none; }
.person-num b { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.person-num span { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.person-list.compact li { padding: 8px 0; }
.person-list.compact .person-main b { font-size: 12px; }
.person-mini .link { margin-top: 2px; }

/* ---------- 期间支出：逐期加总 → 重新平摊 ---------- */
.rpt-ctrl { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin: 2px 0 4px; }
.rpt-ctrl .field { margin-bottom: 0; min-width: 0; }
.rpt-ctrl select, .rpt-ctrl input { width: 100%; }
.rpt-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; padding: 14px 0 6px; }
.rpt-hero > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rpt-hero span { font-size: 11.5px; color: var(--muted); }
.rpt-hero b { font-size: 25px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.rpt-hero em { font-style: normal; font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.rpt-hero .rpt-to { text-align: right; align-items: flex-end; }
.rpt-hero .rpt-to b { color: var(--accent); }
.rpt-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 10px; }
.rpt-table th {
  text-align: right; font-size: 11px; font-weight: 500; color: var(--muted);
  padding: 0 6px 7px 0; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.rpt-table th:first-child { text-align: left; }
.rpt-table td {
  padding: 8px 6px 8px 0; border-bottom: 1px solid #f4efe7; vertical-align: top;
  text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.rpt-table td:first-child { text-align: left; white-space: normal; }
.rpt-table td:first-child b { font-weight: 500; font-size: 12.5px; }
.rpt-table td:first-child .muted { font-size: 11px; }
.rpt-table tr.sum td {
  border-top: 2px solid var(--line-2); border-bottom: 0;
  font-weight: 600; color: var(--accent); padding-top: 10px;
}
.rpt-table tr.sum td:first-child { color: var(--ink-2); }
.cyc-seg li.now { background: var(--accent-soft); border-radius: 8px; padding-left: 6px; padding-right: 6px; margin: 0 -6px; }
.cyc-eq > span:first-child { font-size: 12px; color: var(--ink-2); }
/* tight2 都是「项 / 说明」型表格，第二列是整句话，必须能换行；
   否则一张长表会把整页撑宽，固定定位的底部导航会跟着歪（比价页、说明页踩过） */
.calc-table.tight2 th:nth-child(2), .calc-table.tight2 td:nth-child(2) { white-space: normal; }
.calc-table.tight2 td { word-break: break-word; }
.calc-table.tight2 code { word-break: break-all; }
/* 库存规则表第二列是整句说明，不能 nowrap，否则会把整页撑出横向滚动 */
.calc-table.stock-rules th:nth-child(2), .calc-table.stock-rules td:nth-child(2) { white-space: normal; }
.calc-table.stock-rules td { word-break: break-word; }
.calc-table.stock-rules code { word-break: break-all; }

@media (min-width: 700px) {
  .sheet-wrap { align-items: center; padding: 24px; }
  .sheet { border-radius: 24px; }
  .app { padding-bottom: 110px; }
}

@media (max-width: 380px) {
  .hero-num { font-size: 44px; }
  .typepick { grid-template-columns: repeat(2, 1fr); }
  .tabbar button { padding: 9px 13px; font-size: 12.5px; }
  .rpt-hero b { font-size: 21px; }
  .rpt-ctrl { grid-template-columns: repeat(2, 1fr); }
  .rpt-ctrl .field:first-child { grid-column: 1 / -1; }
  .rpt-table { font-size: 11px; }
}

/* ---------- 账号：右上角入口与面板 ---------- */
[hidden] { display: none !important; }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.top-actions .ghost-btn { padding: 8px 11px; font-size: 12.5px; white-space: nowrap; }
.account-chip {
  width: 34px; height: 34px; flex: none;
  border-radius: 50%; border: 1px solid var(--line-2);
  background: #fff; color: var(--ink-2);
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: border-color .12s ease, color .12s ease;
}
.account-chip:hover { border-color: var(--accent); }
.acct-pop {
  position: fixed; z-index: 45; top: 84px;
  right: max(18px, calc((100vw - 720px) / 2 + 18px));
  width: min(310px, calc(100vw - 36px));
  background: var(--card); border: 1px solid var(--line-2);
  border-radius: 18px; padding: 16px;
  box-shadow: 0 18px 48px -16px rgba(40, 31, 20, .34);
}
.acct-head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.acct-avatar {
  width: 38px; height: 38px; flex: none; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 600;
}
.acct-head b { display: block; font-size: 14px; }
.acct-head span { display: block; font-size: 11.5px; color: var(--muted); }
.acct-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin: 12px 0 8px; padding: 8px 10px; border-radius: 10px;
  background: var(--bg); font-size: 12px; color: var(--muted);
}
.acct-meta b { color: var(--ink); font-size: 13px; }
.acct-note { font-size: 11.5px; line-height: 1.6; color: var(--muted); margin: 0 0 12px; }
.acct-pop > .btn { width: 100%; justify-content: center; margin-top: 8px; }
.acct-pwd { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.acct-pwd input {
  width: 100%; height: 38px; padding: 0 11px; font: inherit; font-size: 13px;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line-2); border-radius: 10px; outline: none;
}
.acct-pwd input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 107, 86, .1); }
.acct-pwd .btn.primary { flex: none; width: 100%; justify-content: center; }
.acct-err { font-size: 11.5px; color: var(--danger); }
.acct-err.ok { color: var(--accent); }

/* ---------- 登录 / 注册 / 首次设置密码 ---------- */
.auth-gate {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 24px 18px; overflow-y: auto;
  background:
    radial-gradient(900px 420px at 15% -10%, #e9f1ec 0%, rgba(233, 241, 236, 0) 70%),
    radial-gradient(700px 380px at 100% 100%, #f3e9dc 0%, rgba(243, 233, 220, 0) 70%),
    var(--bg);
}
.auth-inner { width: 100%; max-width: 420px; margin: auto; }
.auth-loading { text-align: center; color: var(--muted); font-size: 13px; padding: 60px 0; }
.auth-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 26px 24px 20px;
  box-shadow: 0 2px 3px rgba(40, 31, 20, .04), 0 26px 60px -28px rgba(40, 31, 20, .36);
}
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; }
.auth-logo {
  width: 40px; height: 40px; border-radius: 13px; flex: none;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 18px; font-weight: 600;
  box-shadow: 0 6px 14px -6px rgba(47, 107, 86, .8);
}
.auth-brand b { display: block; font-size: 16px; letter-spacing: .3px; }
.auth-brand span { display: block; font-size: 11.5px; color: var(--muted); }
.auth-head h2 { margin: 0 0 6px; font-size: 21px; font-weight: 600; }
.auth-head p { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.auth-head b { color: var(--accent); }
.auth-tabs { display: flex; gap: 4px; margin: 20px 0 4px; border-bottom: 1px solid var(--line); }
.auth-tabs button {
  flex: 1; padding: 10px 4px; font: inherit; font-size: 13px;
  color: var(--muted); background: none; border: 0;
  border-bottom: 2px solid transparent; cursor: pointer;
}
.auth-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.auth-field span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 5px; }
.auth-field input {
  width: 100%; height: 44px; padding: 0 13px; font: inherit; font-size: 14px;
  color: var(--ink); background: #fdfcf9;
  border: 1px solid var(--line-2); border-radius: 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.auth-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 107, 86, .12); background: #fff; }
.auth-field input::placeholder { color: #b5ada2; }
.auth-err {
  font-size: 12px; color: #9b3f37; background: #fbeceb;
  border: 1px solid #f0d2cf; border-radius: 10px; padding: 8px 11px;
}
.auth-submit {
  height: 46px; margin-top: 2px; font: inherit; font-size: 14px; font-weight: 600;
  color: #fff; background: var(--accent); border: 0; border-radius: 12px;
  cursor: pointer; transition: background .15s, transform .1s;
}
.auth-submit:hover { background: #285c4a; }
.auth-submit:active { transform: scale(.99); }
.auth-submit:disabled { opacity: .6; cursor: default; }
.auth-foot { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.auth-foot p { margin: 8px 0 0; font-size: 11.5px; line-height: 1.65; color: var(--muted); }
.auth-badge {
  display: inline-block; font-size: 10.5px; padding: 2px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid #cfe3d6;
}
.auth-fine { color: #a2622a !important; }
.auth-foot code, .hint code, .callout code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .92em; background: #f3efe8; padding: 1px 5px; border-radius: 5px;
}
@media (max-width: 380px) {
  .auth-panel { padding: 22px 18px 16px; border-radius: 20px; }
  .auth-brand { margin-bottom: 18px; }
}

/* ---------- 记账清单：梳理 / 批量打标签 / 快选 ---------- */
.link-btn { border: 0; background: none; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; padding: 3px 2px; }
.link-btn:hover { text-decoration: underline; }
.cdot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 7px; vertical-align: 1px; }
.tabbar button { padding: 9px 14px; }
@media (max-width: 380px) { .tabbar button { padding: 8px 10px; font-size: 12px; } }

.tpl-onboard { display: flex; align-items: center; gap: 12px; background: var(--accent-soft); border-color: #cfe3d6; }
.tpl-onboard b { display: block; font-size: 13.5px; }
.tpl-onboard p { margin: 3px 0 0; font-size: 12px; color: var(--ink-2); line-height: 1.55; }
.tpl-onboard .btn { flex: none; }
.tpl-tabs { display: flex; gap: 6px; margin: 0 2px 14px; border-bottom: 1px solid var(--line); }
.tpl-tabs button {
  flex: 1; padding: 10px 4px; border: 0; border-bottom: 2px solid transparent;
  background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer;
}
.tpl-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tpl-tabs em { font-style: normal; font-size: 11px; opacity: .75; }
.tpl-notice { font-size: 12.5px; padding: 9px 12px; margin-bottom: 12px; border-radius: 12px;
  background: var(--accent-soft); border: 1px solid #cfe3d6; color: var(--accent); }
.tpl-notice.bad { background: #fbeceb; border-color: #f0d2cf; color: #9b3f37; }
.tpl-search { margin-bottom: 12px; }
.tpl-search input, #pkSearch {
  width: 100%; height: 40px; padding: 0 12px; font: inherit; font-size: 13px;
  color: var(--ink); background: #fff; border: 1px solid var(--line-2);
  border-radius: 12px; outline: none;
}
.tpl-search input:focus, #pkSearch:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 107, 86, .1); }
.tpl-intro { background: linear-gradient(160deg, #fbf7ef, #fff); }
.tpl-intro b { font-size: 14px; }
.tpl-intro p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.65; color: var(--ink-2); }
.tpl-empty { text-align: center; }
.tpl-empty .btn { margin-top: 12px; }

.tpl-batch { border-color: var(--line-2); }
.tpl-batch-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.tpl-batch-h > b { font-size: 14px; }
.tpl-batch-h span { font-size: 11.5px; color: var(--muted); }
.tpl-batch-h b { color: var(--accent); }
.tpl-batch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 10px; }
.tpl-sel span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.tpl-sel select, .tpl-custom-row select {
  width: 100%; height: 36px; padding: 0 8px; font: inherit; font-size: 12.5px;
  color: var(--ink); background: #fdfcf9; border: 1px solid var(--line-2);
  border-radius: 9px; outline: none;
}
.tpl-dim { margin-top: 12px; }
.tpl-dim > span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.tpl-dim em { font-style: normal; opacity: .7; }
.tpl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip.small { font-size: 11.5px; padding: 5px 9px; }
.tchip.small.clear { color: var(--danger); border-style: dashed; }
.tpl-batch-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tpl-batch-foot .btn { white-space: nowrap; }
.tpl-batch-foot .btn.primary { flex: 1; min-width: 130px; }
.tpl-batch .hint { margin-top: 10px; font-size: 11px; }

.tpl-group { margin-bottom: 12px; }
.tpl-list { list-style: none; margin: 0; padding: 0; }
.tpl-row {
  display: grid; grid-template-columns: 20px 1fr; gap: 4px 9px;
  padding: 10px 2px; border-bottom: 1px solid var(--line);
}
.tpl-row:last-child { border-bottom: 0; }
.tpl-row.off { opacity: .5; }
.tpl-check input { width: 16px; height: 16px; accent-color: var(--accent); margin-top: 3px; }
.tpl-main b { display: block; font-size: 13px; font-weight: 600; }
.tpl-main > span { display: block; font-size: 11.5px; color: var(--ink-2); line-height: 1.55; }
.tpl-main .tpl-tags { color: var(--muted); }
.tpl-off { font-style: normal; font-size: 10px; color: var(--danger); border: 1px solid #f0d2cf; border-radius: 999px; padding: 0 6px; }
.tpl-ops { grid-column: 2; display: flex; gap: 6px; justify-content: flex-end; margin-top: 2px; }
.tpl-ops button {
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  font: inherit; font-size: 11px; padding: 4px 9px; border-radius: 999px; cursor: pointer;
}
.tpl-ops button.danger { color: var(--danger); }
.tpl-ops button:hover { border-color: var(--accent); }

.tpl-edit { list-style: none; padding: 14px; margin: 4px 0 10px; background: #fbf8f3; border: 1px solid var(--line-2); border-radius: 14px; }
.tpl-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.tpl-edit-grid.four { grid-template-columns: repeat(4, 1fr); }
.tpl-edit .field { margin-bottom: 10px; }
.tpl-edit .field input, .tpl-edit .field select { height: 36px; font-size: 12.5px; }
.tpl-edit .months { margin-top: 2px; }
.tpl-edit-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tpl-edit-foot .btn.primary { flex: none; }
.tpl-active { font-size: 12px; color: var(--ink-2); margin-right: auto; display: flex; align-items: center; gap: 5px; }
.tpl-active input { accent-color: var(--accent); }

.tpl-custom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tpl-custom-row input {
  width: 100%; height: 36px; padding: 0 9px; font: inherit; font-size: 12.5px;
  color: var(--ink); background: #fdfcf9; border: 1px solid var(--line-2); border-radius: 9px; outline: none;
}
.tpl-custom-row .btn { height: 36px; padding: 0 12px; }
.tpl-suggest-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tpl-suggest-bar > span { font-size: 12.5px; color: var(--muted); margin-right: auto; }
.tpl-suggest-bar b { color: var(--accent); }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 10px; }
.cand {
  display: block; padding: 9px 10px; border: 1px solid var(--line-2);
  border-radius: 11px; background: #fdfcf9; cursor: pointer; min-width: 0;
}
.cand.on { border-color: var(--accent); background: var(--accent-soft); }
.cand input { accent-color: var(--accent); margin-right: 5px; vertical-align: -1px; }
.cand b { font-size: 12.5px; font-weight: 600; }
.cand span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 品牌 / 规格：清单、明细、快选器里统一的小徽标 */
.tpl-brand { font-style: normal; font-weight: 500; color: var(--ink-2); }
.tpl-brand::after { content: '·'; margin: 0 3px; opacity: .45; }
.tpl-spec {
  font-style: normal; font-weight: 400; font-size: .82em; color: var(--muted);
  margin-left: 5px; padding: 0 4px; border-radius: 5px; background: #f1ede6;
  white-space: nowrap;
}

/* 快速录入：一个大框，边打边认 */
.tpl-entry { border: 1px solid #d9e6dd; background: linear-gradient(180deg, #fbfdfb, #fff); }
.tpl-entry textarea {
  display: block; width: 100%; box-sizing: border-box; resize: none; overflow: hidden;
  margin-top: 10px; padding: 12px 13px;
  font: inherit; font-size: 14px; line-height: 1.95;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line-2); border-radius: 12px; outline: none;
}
.tpl-entry textarea::placeholder { color: #c3bbaf; }
.tpl-entry textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tpl-entry-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.tpl-entry-bar > span { font-size: 12.5px; color: var(--muted); margin-right: auto; white-space: nowrap; }
.tpl-entry-bar > span b { color: var(--accent); font-size: 15px; margin: 0 1px; }
.tpl-entry-bar .btn { flex: 1 1 100%; width: 100%; margin-top: 2px; white-space: nowrap; }
.tpl-entry-bar .btn[disabled] { opacity: .4; }
.mini-sel { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.mini-sel select {
  height: 30px; padding: 0 6px; font: inherit; font-size: 11.5px;
  color: var(--ink); background: #fdfcf9; border: 1px solid var(--line-2); border-radius: 8px;
}
.rc-chips {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--line);
}
.rc-chip {
  display: inline-flex; align-items: baseline;
  font-size: 12px; padding: 4px 9px; border-radius: 999px;
  background: #f5f1ea; color: var(--ink-2); border: 1px solid #e8e2d7;
}
.rc-chip .tpl-spec { background: #fff; }
.rc-more { font-size: 11.5px; color: var(--muted); }

.tpl-quick {
  display: block; width: 100%; text-align: left; margin: 0 0 14px;
  padding: 10px 12px; border: 1px solid #cfe3d6; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); font: inherit; cursor: pointer;
}
.tpl-quick b { display: block; font-size: 13px; }
.tpl-quick span { display: block; font-size: 11px; opacity: .8; margin-top: 2px; }
.tpl-from { font-size: 11.5px; color: var(--accent); background: var(--accent-soft);
  border-radius: 10px; padding: 7px 11px; margin-bottom: 12px; }

.tpl-picker-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.tpl-picker-bg { position: absolute; inset: 0; background: rgba(30, 24, 18, .38); }
.tpl-picker {
  position: relative; width: 100%; max-width: 720px; max-height: 82vh;
  display: flex; flex-direction: column;
  background: var(--card); border-radius: 22px 22px 0 0; padding: 18px 16px 0;
  box-shadow: 0 -14px 40px -18px rgba(40, 31, 20, .5);
}
.tpl-picker-h { display: flex; align-items: center; justify-content: space-between; }
.tpl-picker-h h3 { margin: 0; font-size: 16px; font-weight: 600; }
.tpl-picker-h button { border: 0; background: none; font: inherit; font-size: 17px; color: var(--muted); cursor: pointer; }
.pk-tip { margin: 5px 0 10px; font-size: 11.5px; color: var(--muted); }
.tpl-picker-body { overflow-y: auto; padding: 12px 0 24px; }
.pk-group { margin-bottom: 14px; }
.pk-h { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0 2px 7px; }
.pk-h span { float: right; font-weight: 400; color: var(--muted); }
.pk-item {
  display: block; width: 100%; text-align: left; margin-bottom: 6px;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px;
  background: #fdfcf9; font: inherit; cursor: pointer;
}
.pk-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.pk-item b { display: block; font-size: 13px; }
.pk-item span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
@media (min-width: 700px) {
  .tpl-picker-wrap { align-items: center; padding: 24px; }
  .tpl-picker { border-radius: 20px; padding-bottom: 4px; }
}

/* ---------- 自定义物品品类 ---------- */
.cat-wrap { z-index: 60; }
.cat-manage { margin-left: 8px; white-space: nowrap; }
.link-btn.danger { color: #b25b58; }
.cat-field-row { display: flex; align-items: flex-end; gap: 8px; }
.cat-field-row .field { flex: 1; min-width: 0; margin-bottom: 13px; }
.cat-field-add { margin-bottom: 13px; padding: 11px 12px; font-size: 12px; white-space: nowrap; }
.cat-sheet .cat-hint { margin: 0 0 14px; }
.cat-sec-t {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  margin: 16px 0 8px; padding-top: 12px; border-top: 1px solid var(--line);
}
.cat-sec-t:first-of-type { border-top: 0; padding-top: 0; }
.cat-sec-t em { font-style: normal; font-weight: 400; font-size: 11px; color: var(--muted); }
.cat-add-row { display: flex; gap: 8px; }
.cat-add-row input, .cat-edit-row input {
  flex: 1; min-width: 0; font: inherit; font-size: 14px; color: var(--ink);
  padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px;
  background: #fdfbf8; outline: none;
}
.cat-add-row input:focus, .cat-edit-row input:focus { border-color: var(--accent); background: #fff; }
.cat-palette { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cat-palette.sm { margin-top: 8px; }
.cat-color {
  width: 24px; height: 24px; padding: 0; border-radius: 50%;
  border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line-2); cursor: pointer;
}
.cat-color.on { border-color: #fff; box-shadow: 0 0 0 2px var(--ink); }
.cat-err { margin-top: 8px; font-size: 12px; color: #b25b58; }
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-item {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.cat-item > b { font-weight: 600; }
.cat-item.editing { display: block; }
.cat-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.cat-used { flex: 1; min-width: 90px; font-size: 11px; color: var(--muted); }
.cat-edit-row { display: flex; gap: 8px; }
.btn.small { padding: 8px 11px; font-size: 12px; }
.cat-none { font-size: 12px; color: var(--muted); margin: 0; padding: 8px 2px; }
.cat-builtin .chip.static { cursor: default; }
.cat-builtin .cat-dot { margin-right: 5px; vertical-align: 1px; }

/* ---------- 物品库存 ---------- */
/* 多了一个「库存」tab，窄屏把每个按钮收紧一点，六项仍能一行放下 */
.tabbar { max-width: calc(100vw - 16px); }
@media (max-width: 430px) {
  .tabbar button { padding: 8px 11px; font-size: 12px; }
}
@media (max-width: 360px) {
  .tabbar button { padding: 8px 8px; font-size: 11.5px; }
}

.stock-summary .card.stat.warn b { color: var(--amber); }
.stock-form .field { margin-bottom: 10px; }
.stock-form-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stock-form-3 .field { min-width: 0; }
.stock-add .btn.primary { margin-top: 2px; }

/* 库存：新增物品改成弹层，页面上只留一个按钮 */
.card-h-act { display: flex; align-items: center; gap: 8px; }
.card-h-act span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.card-h-act .btn { padding: 5px 11px; font-size: 12px; }
.stock-sheet .cat-hint { margin: -6px 0 12px; }
.stock-sheet .stock-form .field:last-of-type { margin-bottom: 4px; }
.stock-log-sheet .cat-hint { margin: -6px 0 10px; }
.stock-log-sheet .stock-log { margin-top: 2px; }
.stock-log-sheet .stock-log-row:last-child { border-bottom: 0; }
.sheet-actions { display: flex; gap: 8px; margin-top: 14px; }
.sheet-actions .btn { flex: 1 1 0; }
.sheet-actions .btn.ghost { flex: 0 0 auto; padding-left: 18px; padding-right: 18px; }
.stock-filter { margin-bottom: 14px; }
.stock-search {
  width: 100%; padding: 9px 12px; margin: 2px 0 10px;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: #fbf9f5; font: inherit; font-size: 13px; color: var(--ink);
}
.stock-search:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.stock-list, .stock-log { list-style: none; margin: 0; padding: 0; }
.stock-item {
  padding: 12px 2px 13px; border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent; padding-left: 10px;
}
.stock-item:last-child { border-bottom: 0; }
.stock-item.low { border-left-color: var(--amber); }
.stock-item.out { border-left-color: var(--danger); background: #fdf7f5; }
.stock-item.editing { border-left-color: var(--accent); background: var(--accent-soft); }
.stock-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stock-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; min-width: 0; }
.stock-title > b { font-size: 14px; font-weight: 600; }
.stock-spec, .stock-cat { font-size: 11px; color: var(--muted); }
.stock-cat { font-weight: 600; }
.stock-qty { flex: none; text-align: right; white-space: nowrap; }
.stock-qty > b { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stock-qty > span { font-size: 11px; color: var(--muted); margin-left: 3px; }
.stock-qty > em {
  display: block; font-style: normal; font-size: 10.5px;
  color: var(--amber); font-weight: 600;
}
.stock-item.out .stock-qty > em { color: var(--danger); }
.stock-meta { font-size: 11.5px; color: var(--muted); margin: 3px 0 9px; }
.stock-ops { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.stock-n {
  width: 56px; padding: 6px 8px; border: 1px solid var(--line-2);
  border-radius: 8px; background: #fff; font: inherit; font-size: 12.5px; text-align: center;
}
.stock-edit .field { margin-bottom: 8px; }
.stock-edit .stock-ops { margin-top: 4px; }
.stock-edit .hint { margin: 0; font-size: 11px; }
.stock-log-row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.stock-log-row:last-child { border-bottom: 0; }
.stock-log-row > div { flex: 1; min-width: 0; }
.stock-log-row b { font-weight: 600; }
.stock-log-row span { display: block; font-size: 11px; color: var(--muted); }
.stock-log-time { flex: none !important; display: inline !important; font-size: 11px !important; }
.stock-log-d { flex: none; font-variant-numeric: tabular-nums; }
.stock-log-d.up { color: var(--accent); }
.stock-log-d.down { color: var(--amber); }
.stock-alert-card .rem li { cursor: pointer; }
.stock-sec #stockMatchInfo { margin-top: 8px; }

/* ---------- 食材 · 按采购地比价 ---------- */
/* 多了「比价」这一档，窄屏让底栏可横向滑动而不是把按钮挤折行 */
.tabbar { max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; }
.tabbar::-webkit-scrollbar { display: none; }
@media (max-width: 430px) {
  .tabbar { gap: 0; padding: 4px; }
  .tabbar button { padding: 9px 11px; font-size: 12px; }
}
.food-sec .est-out { margin-top: 10px; line-height: 1.6; }
.food-search-form { display: flex; gap: 8px; align-items: stretch; }
.food-search-form input {
  flex: 1; min-width: 0; font: inherit; font-size: 13px;
  padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px;
  background: #fdfbf8; outline: none; color: var(--ink);
}
.food-search-form .btn { flex: none; }
.food-search-opts { margin-top: 10px; align-items: center; }
.food-cands, .food-shops { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.food-cands .chip, .food-shops .chip { cursor: pointer; }
.food-shop-ops { margin-top: 12px; align-items: end; }
.food-summary {
  padding: 10px 12px; border-radius: 10px; margin-bottom: 10px;
  background: var(--accent-soft); color: #2a5c4a; font-size: 13px;
}
.food-summary .muted { margin-left: 8px; font-size: 11.5px; }
.table-scroll { overflow-x: auto; }
.food-table { min-width: 620px; }
.food-table td { vertical-align: middle; }
.food-best { background: rgba(76, 139, 111, .08); }
.food-best-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 10px; vertical-align: 1px;
}
.food-spec { display: block; font-size: 11px; }
.food-bills { list-style: none; margin: 0; padding: 0; }
.food-bills li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 2px; border-bottom: 1px solid var(--line);
}
.food-bills li:last-child { border-bottom: 0; }
.food-bills b { flex: none; }
.food-bills span { flex: 1; min-width: 0; font-size: 11.5px; color: var(--muted); }
.food-bills em { font-style: normal; font-variant-numeric: tabular-nums; }
.food-empty .mini-note { margin-top: 8px; }

/* ---------- 待确认采购单（点餐软件推来的清单） ---------- */
.draft-card .lead b { color: var(--accent); }
.draft-alert .rem li { cursor: pointer; }
.draft { border: 1px solid #ece5d9; border-radius: 12px; padding: 12px; margin: 12px 0; background: #fffdf9; }
.draft:first-of-type { margin-top: 6px; }
.draft-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.draft-h b { font-size: 13.5px; font-weight: 600; }
.draft-h span { flex: 1; min-width: 0; font-size: 11px; color: var(--muted); }
.draft-h em { font-style: normal; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent); }
.draft-table { min-width: 520px; }
.draft-table th { font-size: 11px; }
.draft-table td { padding: 4px 6px; }
.draft-table input {
  width: 100%; min-width: 0; box-sizing: border-box;
  padding: 5px 7px; font-size: 12px; font-variant-numeric: tabular-nums;
  border: 1px solid #e6ded1; border-radius: 7px; background: #fff; color: var(--ink);
}
.draft-table input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(47, 107, 86, .12); }
.draft-ops { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.draft-ops .btn { flex: 0 0 auto; }
.draft .row2.tight { margin-bottom: 6px; }

/* ---------- 个人设置：两个外部联动开关 ---------- */
.acct-set { margin: 2px 0 4px; padding: 10px 0 2px; border-top: 1px solid var(--line); }
.acct-set-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.acct-set-h b { font-size: 12.5px; }
.acct-set-h span { font-size: 10.5px; color: var(--muted); }
.acct-switch { display: flex; gap: 8px; align-items: flex-start; padding: 7px 0; cursor: pointer; }
.acct-switch input { width: 17px; height: 17px; margin: 1px 0 0; flex: 0 0 17px; accent-color: var(--accent); }
.acct-switch span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acct-switch b { font-size: 12px; font-weight: 600; }
.acct-switch em { font-style: normal; font-size: 10.5px; line-height: 1.5; color: var(--muted); }
.acct-set-msg { margin: 6px 0 0; font-size: 11px; min-height: 0; }
.acct-set-msg.ok { color: var(--accent); }
.acct-set-msg.bad { color: var(--danger); }
.draft-off .card-h h3 { color: var(--muted); }

/* ---------- 「待确认记账」卡片（家庭点餐系统推来的预估） ---------- */
.pending-card { border-color: #e2d3bd; background: linear-gradient(180deg, #fffaf2, #fff); }
.pending-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-top: 1px dashed #eee3d4;
}
.pending-row:first-of-type { border-top: none; padding-top: 4px; }
.pending-main { flex: 1; min-width: 0; }
.pending-title { display: flex; align-items: baseline; gap: 8px; }
.pending-title b { font-size: 13.5px; font-weight: 600; }
.pending-amount { color: var(--accent); font-weight: 700; font-size: 14px; }
.pending-meta { font-size: 11.5px; color: var(--muted); line-height: 1.7; margin-top: 2px; }
.pending-ops { display: flex; gap: 6px; flex-shrink: 0; }
@media (max-width: 520px) {
  .pending-row { flex-wrap: wrap; }
  .pending-ops { width: 100%; justify-content: flex-end; }
}

/* ---------- 给谁用了：标签管理 ---------- */
.who-size-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 4px; }
.who-size-row .mini-sel { font-size: 12px; color: var(--ink-2); }
.who-size-row .muted { font-size: 11px; }
.who-lock { font-size: 10.5px; color: var(--muted); padding: 1px 7px; border-radius: 999px; background: #f3efe8; white-space: nowrap; }
.cat-err.ok { color: var(--accent); }

/* ---------- 浮层提示（批量修改回执等） ---------- */
/* 手机：顶部居中；桌面（≥700px）：右下角。2 秒自动消失，也可点 ✕。 */
.toast-host {
  position: fixed; z-index: 90; pointer-events: none;
  left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top));
  display: flex; justify-content: center;
}
.toast {
  --ty: -10px;
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 6px;
  width: 100%; max-width: 560px;
  padding: 11px 8px 11px 14px;
  background: #22302a; color: #f6f3ec;
  border-radius: 13px;
  box-shadow: 0 14px 34px -14px rgba(20, 16, 12, .55);
  font-size: 12.5px; line-height: 1.55;
  opacity: 0; transform: translateY(var(--ty));
  transition: opacity .18s ease, transform .18s ease;
}
.toast.on { opacity: 1; transform: none; }
.toast-msg { flex: 1; min-width: 0; word-break: break-word; }
.toast-x {
  flex: 0 0 auto; width: 24px; height: 24px; margin-top: -1px;
  border: 0; border-radius: 50%; background: transparent;
  color: rgba(246, 243, 236, .65); font-size: 12px; line-height: 1;
  cursor: pointer;
}
.toast-x:hover { background: rgba(255, 255, 255, .14); color: #fff; }

@media (min-width: 700px) {
  .toast-host {
    /* 抬高到悬浮导航条（tabbar）上方，别压住它 */
    left: auto; right: 24px; top: auto;
    bottom: calc(88px + env(safe-area-inset-bottom));
    justify-content: flex-end;
  }
  .toast { --ty: 12px; width: auto; max-width: 380px; min-width: 240px; }
}

/* ============================================================
   视觉统一：层级、节奏与折叠（概览 / 明细 / 库存 / 分析）
   ============================================================ */

/* 概览：宽屏时主数字与月支出一左一右，不再一路往下堆 */
.home-top { display: block; }
@media (min-width: 980px) {
  .app { max-width: 920px; padding: 0 24px 132px; }
  .home-top { display: grid; grid-template-columns: 1.12fr .88fr; gap: 16px; align-items: stretch; }
  .home-top .hero { margin-bottom: 0; }
  .home-top .grid2 { grid-template-columns: 1fr; gap: 12px; margin-bottom: 0; height: 100%; }
  .hero-num { font-size: 58px; }
}

/* 首屏大数字：主次更分明 */
.hero-k { font-size: 11.5px; letter-spacing: .06em; opacity: .72; }
.hero-sub { opacity: .78; }
.hero-split { margin-top: 16px; padding-top: 13px; gap: 18px; }
.hero-split span { font-size: 11px; opacity: .7; }
.hero-split b { font-size: 17px; letter-spacing: -.2px; }

/* 引导条：轻一点，只当提示，不跟主卡抢视线 */
.tpl-onboard {
  padding: 12px 14px; border-radius: 16px;
  background: #eef4ef; border-color: #dde9e1; align-items: center; gap: 10px;
}
.tpl-onboard b { font-size: 13px; }
.tpl-onboard p { font-size: 11.5px; margin-top: 2px; line-height: 1.55; }
.tpl-onboard .btn { flex: none; padding: 8px 12px; font-size: 12.5px; border-radius: 999px; }

/* 每人条：加一条比例尺，扫一眼就知道谁花得多 */
.person-list.compact .person-main { gap: 4px; }
.person-list.compact .person-bar { height: 3px; margin-top: 1px; }
.person-list.compact li { padding: 9px 0; }

/* 明细：筛选条横向滚动，把首屏留给记录 */
.list-filter .chips.sm {
  flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.list-filter .chips.sm::-webkit-scrollbar { display: none; }
.list-filter { padding: 13px 14px 12px; }
.list-filter .list-filter-row > span { margin-bottom: 7px; }

/* 批量修改：默认收成一行，点开才铺四维 */
.list-batch { padding: 0; overflow: hidden; }
.list-batch.open { border-color: #dfe7e0; }
.batch-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; background: none; border: 0; font: inherit;
  color: var(--ink); text-align: left; cursor: pointer;
}
.batch-head b { font-size: 13.5px; font-weight: 600; }
.batch-head span { flex: 1; min-width: 0; font-size: 11.5px; color: var(--muted); }
.batch-head .chev {
  font-style: normal; font-size: 15px; color: var(--muted);
  line-height: 1; transition: transform .16s ease;
}
.list-batch.open .batch-head .chev { transform: rotate(180deg); }
.batch-body { padding: 0 16px 16px; }
.batch-body .batch-grid { margin-top: 0; }

/* 库存行：数量操作一排、文字动作一排，不再参差换行 */
.stock-ops { display: flex; flex-direction: column; gap: 9px; align-items: stretch; margin-top: 10px; }
.stock-qty-ops { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stock-qty-ops .btn { flex: 0 0 auto; padding: 7px 12px; }
.stock-links { display: flex; align-items: center; gap: 16px; padding-left: 2px; }
.stock-links .link-btn { font-size: 12px; }
.stock-qty-ops .stock-n {
  width: 54px; padding: 7px 6px; text-align: center;
  border: 1px solid var(--line-2); border-radius: 9px; background: #fff;
  font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums;
}

/* 分析页：期间三个输入框不再被截断 */
.rpt-ctrl { grid-template-columns: 1fr 1fr; gap: 8px; }
.rpt-ctrl .field:first-child { grid-column: 1 / -1; }
.rpt-ctrl input[type="date"] { font-size: 12.5px; padding: 8px 9px; }

/* 页切换的一点呼吸，不做花哨动画 */
#view { animation: view-in .24s cubic-bezier(.22, .9, .3, 1) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.btn:active, .chip:active, .tchip:active, .tagchip:active { transform: scale(.985); }
.btn, .chip, .tchip, .tagchip { transition: background .12s ease, border-color .12s ease, color .12s ease, transform .1s ease; }

/* ============================================================
   视觉统一：层级、节奏与折叠（概览 / 明细 / 库存 / 分析）
   ============================================================ */

/* 概览：宽屏时主数字与月支出一左一右，不再一路往下堆 */
.home-top { display: block; }
@media (min-width: 980px) {
  .app { max-width: 920px; padding: 0 24px 132px; }
  .home-top { display: grid; grid-template-columns: 1.12fr .88fr; gap: 16px; align-items: stretch; }
  .home-top .hero { margin-bottom: 0; }
  .home-top .grid2 { grid-template-columns: 1fr; gap: 12px; margin-bottom: 0; height: 100%; }
  .hero-num { font-size: 58px; }
}

/* 首屏大数字：主次更分明 */
.hero-k { font-size: 11.5px; letter-spacing: .06em; opacity: .72; }
.hero-sub { opacity: .78; }
.hero-split { margin-top: 16px; padding-top: 13px; gap: 18px; }
.hero-split span { font-size: 11px; opacity: .7; }
.hero-split b { font-size: 17px; letter-spacing: -.2px; }

/* 引导条：轻一点，只当提示，不跟主卡抢视线 */
.tpl-onboard {
  padding: 12px 14px; border-radius: 16px;
  background: #eef4ef; border-color: #dde9e1; align-items: center; gap: 10px;
}
.tpl-onboard b { font-size: 13px; }
.tpl-onboard p { font-size: 11.5px; margin-top: 2px; line-height: 1.55; }
.tpl-onboard .btn { flex: none; padding: 8px 12px; font-size: 12.5px; border-radius: 999px; }

/* 每人条：加一条比例尺，扫一眼就知道谁花得多 */
.person-list.compact .person-main { gap: 4px; }
.person-list.compact .person-bar { height: 3px; margin-top: 1px; }
.person-list.compact li { padding: 9px 0; }

/* 明细：筛选条横向滚动，把首屏留给记录 */
.list-filter .chips.sm {
  flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.list-filter .chips.sm::-webkit-scrollbar { display: none; }
.list-filter { padding: 13px 14px 12px; }
.list-filter .list-filter-row > span { margin-bottom: 7px; }

/* 批量修改：默认收成一行，点开才铺四维 */
.list-batch { padding: 0; overflow: hidden; }
.list-batch.open { border-color: #dfe7e0; }
.batch-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; background: none; border: 0; font: inherit;
  color: var(--ink); text-align: left; cursor: pointer;
}
.batch-head b { font-size: 13.5px; font-weight: 600; }
.batch-head span { flex: 1; min-width: 0; font-size: 11.5px; color: var(--muted); }
.batch-head .chev {
  font-style: normal; font-size: 15px; color: var(--muted);
  line-height: 1; transition: transform .16s ease;
}
.list-batch.open .batch-head .chev { transform: rotate(180deg); }
.batch-body { padding: 0 16px 16px; }
.batch-body .batch-grid { margin-top: 0; }

/* 库存行：数量操作一排、文字动作一排，不再参差换行 */
.stock-ops { display: flex; flex-direction: column; gap: 9px; align-items: stretch; margin-top: 10px; }
.stock-qty-ops { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stock-qty-ops .btn { flex: 0 0 auto; padding: 7px 12px; }
.stock-links { display: flex; align-items: center; gap: 16px; padding-left: 2px; }
.stock-links .link-btn { font-size: 12px; }
.stock-qty-ops .stock-n {
  width: 54px; padding: 7px 6px; text-align: center;
  border: 1px solid var(--line-2); border-radius: 9px; background: #fff;
  font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums;
}

/* 分析页：期间三个输入框不再被截断 */
.rpt-ctrl { grid-template-columns: 1fr 1fr; gap: 8px; }
.rpt-ctrl .field:first-child { grid-column: 1 / -1; }
.rpt-ctrl input[type="date"] { font-size: 12.5px; padding: 8px 9px; }

/* 页切换的一点呼吸，不做花哨动画 */
#view { animation: view-in .24s cubic-bezier(.22, .9, .3, 1) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.btn:active, .chip:active, .tchip:active, .tagchip:active { transform: scale(.985); }
.btn, .chip, .tchip, .tagchip { transition: background .12s ease, border-color .12s ease, color .12s ease, transform .1s ease; }

/* ---------- 轻提示条（替代原来的大引导卡） ---------- */
.tip-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 12px;
  background: var(--accent-soft); border: 1px solid #dde9e1; border-radius: 14px;
}
.tip-bar .tip-ico {
  flex: none; width: 22px; height: 22px; border-radius: 7px;
  display: grid; place-items: center;
  background: #fff; color: var(--accent); font-size: 12px; font-style: normal;
}
.tip-bar p { flex: 1; min-width: 0; margin: 0; font-size: 12px; line-height: 1.5; color: var(--ink-2); }
.tip-bar p b { font-weight: 600; color: var(--ink); margin-right: 2px; }
.tip-bar .link { flex: none; padding: 2px 0; font-size: 12px; }

/* 明细筛选条：右侧渐隐，提示还能横向滑 */
@media (max-width: 700px) {
  .list-filter-row { position: relative; }
  .list-filter-row::after {
    content: ""; position: absolute; right: -14px; top: 20px; bottom: 2px; width: 26px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), #fff 70%);
    pointer-events: none;
  }
}

/* 分析页说明文字收一点，别比数字还抢眼 */
.callout p { font-size: 11.5px; line-height: 1.65; }
.callout p + p { margin-top: 6px; }

/* 宽屏：底部导航保持悬浮，但离内容再远一点，别压住最后一行 */
@media (min-width: 980px) {
  .app { padding-bottom: 148px; }
  .toast-host { bottom: 96px; }
}

/* 宽屏下右侧两张月度卡：文字撑满高度，别堆在顶部留一大块空 */
@media (min-width: 980px) {
  .home-top .stat { display: flex; flex-direction: column; justify-content: space-between; }
  .home-top .stat b { margin: 6px 0 0; font-size: 24px; }
  .home-top .stat em { margin-top: 10px; }
}

/* 宽屏下右侧两张月度卡：文字撑满高度，别堆在顶部留一大块空 */
@media (min-width: 980px) {
  .home-top .stat { display: flex; flex-direction: column; justify-content: space-between; }
  .home-top .stat b { margin: 6px 0 0; font-size: 24px; }
  .home-top .stat em { margin-top: 10px; }
}

/* 手机端筛选：把长解释收起，筛选卡再矮一截 */
@media (max-width: 700px) {
  .list-filter .hint { display: none; }
  .list-filter .chips.sm { padding-right: 20px; }
  .list-filter-row::after { width: 34px; right: -14px; }
  .date-range-sum { margin-top: 8px; }
}

/* 空状态别留太大空隙 */
.empty { padding: 20px 10px; }

/* ---------- 概览：今日实际支出 / 成员环形图 / 今日明细 / 缺依据 ---------- */
.cash-card {
  display: block; width: 100%; text-align: left; font: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 13px; margin-bottom: 14px; box-shadow: var(--shadow);
  cursor: pointer; transition: border-color .12s ease, transform .12s ease;
}
.cash-card:hover { border-color: #dbe6de; }
.cash-card:active { transform: scale(.995); }
.cash-k { display: block; font-size: 11.5px; color: var(--muted); }
.cash-num { display: block; font-size: 27px; font-weight: 600; letter-spacing: -.7px; margin: 2px 0 1px; font-variant-numeric: tabular-nums; }
.cash-meta { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.cash-meta i { font-style: normal; color: var(--accent); font-size: 15px; line-height: 1; }

.member-card .donut-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 2px 0 2px; }
.donut-box { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.donut-title { font-size: 11.5px; color: var(--muted); }
.donut-top { font-size: 13.5px; font-weight: 600; fill: var(--ink); font-variant-numeric: tabular-nums; }
.donut-sub { font-size: 9px; fill: var(--muted); }
.donut-seg { cursor: pointer; transition: opacity .12s ease; }
.donut-seg:hover, .donut-seg:focus { opacity: .8; outline: none; }
.donut-tip {
  position: absolute; z-index: 6; width: 136px; padding: 8px 10px;
  border-radius: 12px; background: #22302a; color: #f6f3ec;
  font-size: 10.5px; line-height: 1.5; pointer-events: none;
  box-shadow: 0 14px 30px -16px rgba(20, 16, 12, .6);
}
.donut-tip b { display: block; font-size: 11.5px; }
.donut-tip em { display: block; font-style: normal; font-size: 13.5px; font-weight: 600; margin: 1px 0 3px; }
.donut-tip span { display: block; color: rgba(246, 243, 236, .74); }
.donut-tip i { display: block; margin-top: 4px; font-style: normal; font-size: 10px; color: #cfe3d6; }

.unknown-note {
  margin: 8px 0 0; padding: 8px 10px; border-radius: 10px;
  background: #fbf3e6; color: #7a5a2c; font-size: 11.5px; line-height: 1.55;
  border-left: 2px solid #d9a441;
}
.unknown-note b { font-weight: 600; }

.member-legend { list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 7px; }.member-legend li { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.member-legend i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.member-legend > li > b { font-weight: 500; flex: none; min-width: 34px; }
.member-legend > li > span { flex: 1; min-width: 0; text-align: right; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.member-legend span b { color: var(--ink); font-weight: 600; }

.today-list { list-style: none; margin: 0; padding: 0; }
.today-list li { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--line); cursor: pointer; }
.today-list li:first-child { border-top: 0; }
.tl-main { flex: 1; min-width: 0; }
.tl-main > b { display: block; font-size: 13px; font-weight: 500; }
.tl-main > span { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-right { text-align: right; flex: none; }
.tl-right b { display: block; font-size: 13px; font-variant-numeric: tabular-nums; }
.tl-right span { display: block; font-size: 10px; color: var(--muted); }

/* 家具家电折成一行 */
.today-list li.tl-group {
  background: var(--accent-soft);
  border-top: 0;
  border-radius: 12px;
  margin: 6px 0;
  padding: 10px 10px;
}
.today-list li.tl-group .tl-main > b { font-weight: 600; color: var(--accent-ink); }
.today-list li.tl-group .tl-main > span { color: var(--accent-ink); opacity: .72; }
.today-list li.tl-group .tl-right b { color: var(--accent-ink); }
.today-list li.tl-group:hover { background: #e2ece5; }

.basis-card { background: #fffdf8; border-color: #efe4d2; }

/* 成员明细弹层 */
.member-sheet .cat-hint { margin: -4px 0 10px; }
.mem-total { font-size: 30px; font-weight: 600; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.mem-total span { margin-left: 6px; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.mem-group { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mem-group > summary {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 10px 12px; background: #fbf8f3; cursor: pointer;
  font-size: 12.5px; font-weight: 500; list-style: none;
}
.mem-group > summary::-webkit-details-marker { display: none; }
.mem-group > summary em { font-style: normal; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.mem-group ul { list-style: none; margin: 0; padding: 2px 12px 8px; }
.mem-group li { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 8px 0; border-top: 1px solid #f5f0e8; }
.mem-group li:first-child { border-top: 0; }
.mem-group li > div { min-width: 0; }
.mem-group li b { display: block; font-size: 12.5px; font-weight: 500; }
.mem-group li span { display: block; font-size: 10.5px; color: var(--muted); }
.mem-group .mn { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 宽屏：主卡 + 今日实际支出并排，成员图左侧、图例右侧 */
@media (min-width: 980px) {
  .home-top { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; align-items: stretch; }
  .home-top .hero { margin-bottom: 0; display: flex; flex-direction: column; justify-content: center; }
  .home-top .cash-card { margin-bottom: 0; display: flex; flex-direction: column; justify-content: center; }
  .home-top .cash-num { font-size: 32px; }
  .member-card { display: grid; grid-template-columns: 1.05fr .95fr; gap: 6px 26px; align-items: center; }
  .member-card .card-h { grid-column: 1 / -1; }
  .member-card .donut-pair { grid-column: 1; margin: 0; }
  .member-card .donut { width: 168px; height: 168px; }
  .member-card .member-legend { grid-column: 2; margin: 0; padding: 0; border-top: 0; gap: 12px; }
  .member-card .hint { grid-column: 1 / -1; margin-top: 10px; }
}

/* 宽屏：主卡 + 今日实际支出并排，成员图左侧、图例右侧 */
@media (min-width: 980px) {
  .home-top { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; align-items: stretch; }
  .home-top .hero { margin-bottom: 0; display: flex; flex-direction: column; justify-content: center; }
  .home-top .cash-card { margin-bottom: 0; display: flex; flex-direction: column; justify-content: center; }
  .home-top .cash-num { font-size: 32px; }
  .member-card { display: grid; grid-template-columns: 1.05fr .95fr; gap: 6px 26px; align-items: center; }
  .member-card .card-h { grid-column: 1 / -1; }
  .member-card .donut-pair { grid-column: 1; margin: 0; }
  .member-card .donut { width: 168px; height: 168px; }
  .member-card .member-legend { grid-column: 2; margin: 0; padding: 0; border-top: 0; gap: 12px; }
  .member-card .hint { grid-column: 1 / -1; margin-top: 10px; }
}

/* ================= 新页面结构：日期条 / 趋势 / 顶部图标 ================= */
.icon-btn {
  width: 34px; height: 34px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--line-2);
  background: #fff; color: var(--ink-2); cursor: pointer;
  transition: border-color .12s ease, color .12s ease;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn:active { transform: scale(.96); }

.page-h-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-h-row .btn { flex: none; margin-bottom: 5px; }

.info-head { padding: 2px 0 4px; }
.back-btn {
  border: 0; background: none; padding: 6px 2px;
  font: inherit; font-size: 13px; color: var(--accent); cursor: pointer;
}
.back-btn:hover { text-decoration: underline; }

/* 单日日期条 */
.daybar { display: flex; align-items: stretch; gap: 8px; margin: 0 0 14px; }
.day-nav {
  width: 40px; flex: none; border: 1px solid var(--line-2); border-radius: 14px;
  background: var(--card); color: var(--ink-2); font: inherit; font-size: 19px;
  line-height: 1; cursor: pointer; transition: border-color .12s ease;
}
.day-nav:hover { border-color: var(--accent); color: var(--accent); }
.day-center {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 14px;
  padding: 0 12px;
}
.day-input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  font: inherit; font-size: 14px; color: var(--ink);
  padding: 11px 0; font-variant-numeric: tabular-nums;
}
.day-wd { font-size: 12px; color: var(--muted); white-space: nowrap; }
.day-today {
  flex: none; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink);
  font: inherit; font-size: 12px; padding: 0 12px; cursor: pointer;
}
.day-today[hidden] { display: none; }

/* 区间条（成本 / 趋势共用） */
.rangebar { display: flex; gap: 8px; margin: 0 0 8px; }
.rb-field {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 14px;
  padding: 0 12px;
}
.rb-field span { font-size: 12px; color: var(--muted); flex: none; }
.rb-field input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  font: inherit; font-size: 13.5px; color: var(--ink); padding: 10px 0;
  font-variant-numeric: tabular-nums;
}
.range-chips { margin-bottom: 14px; }
.date-range-sum { font-size: 12px; color: var(--muted); margin: 0 2px 12px; }
.date-range-sum b { color: var(--ink); font-weight: 600; }

/* 趋势页 */
.trend-card .trend-sum {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 2px 0 4px;
}
.trend-sum div {
  background: #fbf8f3; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 10px;
}
.trend-sum span { display: block; font-size: 11px; color: var(--muted); }
.trend-sum b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.bars { width: 100%; height: auto; display: block; margin: 6px 0 0; }

/* 记账页底部的紧凑提醒 */
.nudges { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.nudge {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 14px;
  padding: 11px 14px; font: inherit; cursor: pointer;
  transition: border-color .12s ease;
}
.nudge:hover { border-color: var(--accent); }
.nudge b { font-size: 13px; font-weight: 600; }
.nudge span { font-size: 12px; color: var(--muted); flex: 1; min-width: 0; }
.nudge i { font-style: normal; color: var(--muted); }

/* 单环图（记账 / 成本页只画一个口径） */
.donut-pair.single { grid-template-columns: 1fr; }
.donut-pair.single .donut-box { grid-column: 1; }

/* 趋势页堆叠柱的图例 */
.trend-legend {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  margin: 10px 0 0; font-size: 12px; color: var(--ink-2);
}
.trend-legend i {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 6px; vertical-align: -1px;
}

/* ---------- 比价总表：物品 × 采购地 ---------- */
.pm-ctrl { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin: 2px 0 12px; }
.pm-days { flex: none; width: 122px; }
.pm-add { display: flex; gap: 8px; flex: 1; min-width: 220px; }
.pm-add input {
  flex: 1; min-width: 0; font: inherit; font-size: 13px;
  padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 10px;
  background: #fdfbf8; outline: none; color: var(--ink);
}
.pm-add .btn { flex: none; white-space: nowrap; }

.price-matrix { border-collapse: separate; border-spacing: 0; font-size: 12.5px; width: 100%; }
.price-matrix th, .price-matrix td {
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.price-matrix thead th {
  font-size: 11px; color: var(--muted); font-weight: 500;
  text-align: right; background: #fdfbf8;
}
.price-matrix thead th.pm-name, .price-matrix thead th.pm-unit { text-align: left; }
.price-matrix thead th em { display: block; font-style: normal; font-size: 9.5px; opacity: .65; }
.price-matrix td.pm-name {
  position: sticky; left: 0; z-index: 1; text-align: left;
  background: var(--card); font-weight: 600;
}
.price-matrix tr.pm-watched td.pm-name { background: #fbf6ec; }
.price-matrix .pm-cell { text-align: right; font-variant-numeric: tabular-nums; }
.price-matrix .pm-cell b { font-weight: 600; }
.price-matrix .pm-cell span { display: block; font-size: 10px; color: var(--muted); }
.price-matrix .pm-none { color: #d7d0c5; }
.price-matrix .pm-best { background: #edf4ef; }
.price-matrix .pm-best b { color: var(--accent); }
.price-matrix .pm-lowest { text-align: right; }
.price-matrix .pm-lowest b { display: block; }
.pm-best-name { display: block; font-size: 10px; color: var(--accent); }
.pm-tag {
  display: inline-block; margin-left: 4px; font-size: 9.5px; padding: 1px 5px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink);
  vertical-align: 1px; font-weight: 500;
}
.pm-x {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  font-size: 11px; padding: 0 0 0 6px; line-height: 1;
}
.pm-x:hover { color: var(--danger); }
.pm-mixed {
  display: inline-block; margin-left: 3px; font-size: 9.5px; padding: 0 4px;
  border-radius: 4px; background: #f6ecdd; color: var(--amber);
}
.price-matrix tbody tr { cursor: pointer; }
.price-matrix tbody tr:hover td { background: #fbf8f3; }
.price-matrix tbody tr:hover td.pm-name { background: #f5efe4; }

/* 比价总表：品牌标签 / 右侧「最便宜」列常驻 */
.pm-brand { margin-left: 5px; font-size: 10.5px; font-weight: 400; color: var(--muted); }
.price-matrix td.pm-name { max-width: 158px; overflow: hidden; text-overflow: ellipsis; }
.price-matrix th.pm-lowest, .price-matrix td.pm-lowest {
  position: sticky; right: 0; z-index: 2;
  background: #fdfbf8; box-shadow: -6px 0 10px -8px rgba(40, 31, 20, .35);
}
.price-matrix tbody tr:hover td.pm-lowest { background: #fbf8f3; }

/* 比价总表：窄屏尽量多放几列 */
.price-matrix th, .price-matrix td { padding: 7px 8px; }
.price-matrix { font-size: 12px; }
.price-matrix .pm-cell span { font-size: 9px; }
.pm-scroll-hint { font-size: 11px; color: var(--muted); margin: -4px 2px 8px; }

/* 「最便宜」紧跟物品列，默认就在首屏（不再固定右边缘，免得盖住后面的采购地） */
.price-matrix th.pm-lowest, .price-matrix td.pm-lowest {
  position: static; box-shadow: none; background: transparent; text-align: right;
}
.price-matrix th.pm-lowest { text-align: right; }
.price-matrix td.pm-lowest { white-space: nowrap; }

/* ---------- 库存列表：只留「品名+数量」和「补货/用掉/删除」两列 ---------- */
.stock-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px 10px 10px;
}
.stock-item .si-main {
  flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 7px;
  cursor: pointer; border-radius: 8px; padding: 2px 4px; margin: -2px -4px;
}
.stock-item .si-main:hover { background: #f7f3ec; }
.stock-item .si-main > b {
  font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stock-item .si-qty { font-size: 11px; color: var(--muted); white-space: nowrap; flex: none; }
.stock-item .si-qty b {
  font-size: 15px; font-weight: 650; color: var(--ink);
  font-variant-numeric: tabular-nums; margin-right: 2px;
}
.stock-item .si-ops { flex: none; display: flex; align-items: center; gap: 5px; }
.stock-item .si-ops .btn { padding: 6px 9px; font-size: 11.5px; white-space: nowrap; }
.stock-item .si-ops .stock-n {
  width: 42px; padding: 6px 4px; font-size: 12px; border-radius: 7px;
}

/* 展开编辑时回到块状排版，表单才能铺开 */
.stock-item.editing { display: block; padding: 12px 10px 13px; }
.stock-item.editing .si-main { display: none; }

@media (max-width: 380px) {
  .stock-item .si-ops .btn { padding: 6px 7px; font-size: 11px; }
  .stock-item .si-ops .stock-n { width: 36px; }
  .stock-item { gap: 6px; }
}

/* 窄屏时先缩品牌，别把品名截掉 */
.stock-item .si-title {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: baseline; gap: 4px;
  font-size: 14px; font-weight: 600;
}
.stock-item .si-brand {
  flex: 0 1000 auto; min-width: 0; font-style: normal; font-weight: 500; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stock-item .si-brand::after { content: '·'; margin-left: 4px; opacity: .45; }
.stock-item .si-nm {
  flex: 0 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stock-item .si-qty { flex: 0 0 auto; }

/* 更窄的屏上品牌整个让位，保证品名完整 */
@media (max-width: 380px) {
  .stock-item .si-brand { display: none; }
}

/* ---------- 库存数量：− 数量 单位 ＋ ---------- */
.stock-item .si-qty {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--muted);
}
.si-step {
  width: 24px; height: 24px; flex: none; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-2); border-radius: 50%;
  background: #fff; color: var(--ink-2);
  font: inherit; font-size: 14px; line-height: 1; cursor: pointer;
  transition: border-color .12s ease, color .12s ease;
}
.si-step:hover { border-color: var(--accent); color: var(--accent); }
.si-step:active { transform: scale(.94); }
.si-step:disabled { opacity: .4; }
.si-num {
  min-width: 32px; text-align: center;
  font-size: 15px; font-weight: 650; color: var(--ink);
  font-variant-numeric: tabular-nums; cursor: text;
  border-bottom: 1px dashed transparent; touch-action: manipulation;
  user-select: none;
}
.si-num:hover { border-bottom-color: var(--line-2); }
.si-unit { font-style: normal; font-size: 11px; color: var(--muted); margin-right: 2px; }
.si-num-input {
  width: 56px; padding: 3px 5px; text-align: center;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ink);
  border: 1px solid var(--accent); border-radius: 7px; background: #fff; outline: none;
}
.si-del { flex: none; padding: 6px 8px !important; font-size: 11.5px !important; }

/* ---------- 编辑库存：必填星号 + 字段小字提示 ---------- */
.req { font-style: normal; color: var(--danger); margin-left: 2px; font-weight: 600; }
.field-note {
  font-style: normal; font-size: 10.5px; color: var(--amber);
  margin-left: 6px; font-weight: 400;
}
.stock-sheet .field:last-of-type { margin-bottom: 6px; }

/* ================= 库存页视觉打磨（2026-11-18） ================= */
/* 统计卡：标签在左、数字在右，一行读完，卡片矮一点 */
.stock-summary { margin-bottom: 12px; }
.stock-summary .stat { padding: 12px 14px; }
.stat-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.stat-row > span { font-size: 11.5px; color: var(--muted); }
.stat-row > b {
  font-size: 24px; font-weight: 650; letter-spacing: -.6px; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-row > b i {
  font-style: normal; font-size: 10.5px; font-weight: 500;
  color: var(--muted); margin-left: 2px; letter-spacing: 0;
}
.stock-summary .stat em { display: block; margin-top: 4px; font-size: 11px; color: #b0a79b; }

/* 筛选：去掉大卡，只留一行 chips + 计数 */
.stock-filter {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 0 2px 12px;
}
.stock-filter .chips { margin: 0; }
.stock-filter-n { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.stock-filter-n b { color: var(--ink); font-weight: 600; }

/* 搜索框轻一点，别抢列表的注意力 */
.stock-search { border-color: transparent; background: #f6f2e9; }
.stock-search:focus { border-color: var(--accent); background: #fff; }

/* 列表：余量是主角，删除退到最轻 */
.stock-item { padding: 8px 2px 8px 10px; transition: background .12s ease; }
.stock-item:hover { background: #fbf8f2; }
.stock-item.out:hover { background: #fdf3f0; }
.stock-item .si-num { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.stock-item .si-unit { font-size: 10.5px; }
.stock-item.low .si-num { color: var(--amber); }
.stock-item.out .si-num { color: var(--danger); }

.si-step {
  width: 23px; height: 23px; border-color: #ebe3d6; color: var(--muted); font-size: 13px;
}
.si-step:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.si-del {
  border: 0; background: none; color: var(--muted);
  font: inherit; font-size: 11.5px; padding: 6px 7px; border-radius: 8px;
  cursor: pointer; transition: color .12s ease, background .12s ease;
}
.si-del:hover { color: var(--danger); background: #fbeeec; }

/* ================= 库存编辑弹窗 ================= */
.edit-meta {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin: -10px 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.edit-meta b { font-size: 14px; font-weight: 600; }
.edit-meta span { font-size: 11.5px; color: var(--muted); }

.stock-sheet .field > span { font-size: 11.5px; letter-spacing: .01em; }
.stock-sheet .field { margin-bottom: 14px; }
.stock-sheet .field input, .stock-sheet .field select { padding: 12px 13px; }
.field-help {
  display: block; margin-top: 6px;
  font-style: normal; font-size: 11px; color: var(--amber);
}
.stock-sheet .sheet-actions { margin-top: 18px; gap: 10px; }
.stock-sheet .sheet-actions .btn { padding: 12px 16px; font-size: 14px; border-radius: 12px; }
.stock-sheet .sheet-actions .btn.ghost { flex: 0 0 92px; }

/* 库存页微调：搜索框带放大镜、行距与数字呼吸 */
.stock-search {
  padding-left: 34px;
  border-color: #ece4d6;
  background-color: #fbf8f3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%238a8175' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}
.stock-search:focus { background-color: #fff; }

.stock-item { padding: 10px 2px 10px 10px; }
.stock-item .si-qty { gap: 4px; }
.stock-item .si-num { min-width: 36px; }
.stock-item .si-unit { margin-left: 2px; margin-right: 3px; }
.stock-item .si-del { margin-left: 3px; }

.stock-sheet .field-qty { margin-bottom: 18px; }

/* 评审后修正：数值轴对齐、按钮加强、状态改用底色 */
.stock-item .si-qty {
  display: grid;
  grid-template-columns: 28px 48px 22px 28px;
  align-items: center;
  column-gap: 6px;
}
.stock-item .si-num {
  min-width: 0; text-align: right; font-size: 17px;
  border-bottom: 1px dashed transparent;
}
.stock-item .si-unit {
  min-width: 0; text-align: left; margin: 0;
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.si-step { width: 28px; height: 28px; border-color: #dcd1bd; color: #6f675c; }
.si-step svg { display: block; }
.stock-item .si-del {
  font-size: 12px; color: #a39a8c; padding: 10px 8px; margin-left: 8px;
}
.stock-item .si-del:hover { color: var(--danger); }

/* 低库存 / 用完不再靠一根竖条，改用整行底色（竖条容易看成"当前选中"） */
.stock-item.low { border-left-color: transparent; background: #fbf6ec; }
.stock-item.out { border-left-color: transparent; background: #fdf3f0; }
.stock-item.low:hover { background: #f8f0e1; }
.stock-item.out:hover { background: #fbeae6; }

/* 弹窗底部：主操作和表单分开 */
.stock-sheet .sheet-actions {
  margin-top: 20px; padding-top: 18px;
  border-top: 1px solid var(--line); gap: 12px;
}
.stock-sheet .sheet-actions .btn {
  padding: 13px 16px; font-size: 15px; border-radius: 14px;
}
.stock-sheet .sheet-actions .btn.ghost { flex: 0 0 96px; color: var(--ink-2); border-color: #d8cdb8; }
.stock-sheet .sheet-actions .btn.primary { font-weight: 600; }

/* 最终微调：回收数字列、删除拉开距离并回到可读的灰 */
.stock-item .si-qty { grid-template-columns: 28px 44px 22px 28px; }
.stock-item .si-del { color: #8a8175; margin-left: 16px; }
.stock-item .si-del:hover { color: var(--danger); }

/* 触控热区放大：视觉尺寸不变，四周补透明可点区域（纵向为主，避免点到隔壁行） */
.si-step, .stock-item .si-del { position: relative; }
.si-step::after { content: ''; position: absolute; inset: -10px -4px; border-radius: 14px; }
.stock-item .si-del::after { content: ''; position: absolute; inset: -8px -6px; border-radius: 10px; }

/* 筛选/搜索无结果时的说明 */
.stock-none {
  text-align: center; color: var(--muted); font-size: 13px;
  padding: 26px 10px 20px; margin: 0; line-height: 1.6;
}
.stock-none .link-btn { margin-left: 4px; }

/* ---------- 清单页头部双按钮 + 现有物品弹层 ---------- */
.page-h-act { display: flex; gap: 8px; flex: none; margin-bottom: 5px; }
.page-h-act .btn { flex: none; margin-bottom: 0; }
@media (max-width: 380px) {
  .page-h-act .btn { padding: 9px 11px; font-size: 12px; }
}
/* 快速录入（和「批量记账」一致的输入方式） */
.ex-entry { margin: 2px 0 16px; }
.ex-entry textarea {
  display: block; width: 100%; box-sizing: border-box; resize: vertical;
  padding: 12px 13px; font: inherit; font-size: 14px; line-height: 1.95;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line-2); border-radius: 12px; outline: none;
}
.ex-entry textarea::placeholder { color: #c3bbaf; }
.ex-entry textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ex-entry-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.ex-entry-bar > span { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); }
.ex-entry-bar > span b { color: var(--accent); font-size: 15px; margin: 0 1px; }
.ex-entry-bar .btn { flex: none; white-space: nowrap; }
.ex-entry-bar .btn[disabled] { opacity: .4; }
.ex-dup { opacity: .6; }
.ex-dup-tag {
  margin-left: 5px; font-style: normal; font-size: 10px; color: var(--muted);
  padding: 0 4px; border-radius: 4px; background: #ece6db;
}
.ex-list-h {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0 2px 2px; font-size: 11.5px; color: var(--muted);
}
.ex-list-h b { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.ex-list-h em { font-style: normal; color: var(--accent); font-weight: 600; }
.ex-list { list-style: none; margin: 0; padding: 0; max-height: 34vh; overflow-y: auto; }
.ex-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.ex-list li:last-child { border-bottom: 0; }
.ex-list li b {
  flex: 1; min-width: 0; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ex-x {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  font-size: 12px; padding: 6px; border-radius: 8px;
}
.ex-x:hover { color: var(--danger); background: #fbeeec; }
.ex-empty { color: var(--muted); font-size: 13px; justify-content: center; padding: 22px 0; }

/* ---------- 记一笔：开始使用日和记账日不同 ---------- */
.use-sec { margin: 0 0 12px; }
.use-sec .switch-row { margin: 0; }
.switch-note {
  display: inline-block; margin-left: 5px;
  font-style: normal; font-size: 11px; color: var(--muted);
}
.use-sec .use-field { margin: 9px 0 0; }
.use-sec .use-field input { width: 100%; }
.use-sec .mini-note { margin: 8px 0 0; line-height: 1.65; }
.use-sec .mini-note b { font-variant-numeric: tabular-nums; color: var(--ink); }

/* 说明型表格：第一列（接口 / 动作名）和第二列的文字别贴在一起 */
.calc-table.tight2 th:first-child, .calc-table.tight2 td:first-child { padding-right: 12px; }

/* ---------- 记一笔：单价 + 单位 / 第二个单位 ---------- */
.price-sec { margin: 0 0 2px; }
.price-row { display: flex; align-items: flex-end; gap: 8px; }
.price-row .price-main { flex: 1; min-width: 0; margin-bottom: 12px; }
.price-wrap { display: flex; align-items: center; gap: 6px; }
.price-wrap input {
  flex: 1; min-width: 0; text-align: right;
  font-variant-numeric: tabular-nums; letter-spacing: .2px;
}
.price-slash { font-style: normal; font-size: 13px; color: var(--muted); }
.price-wrap select.unit-sel {
  flex: 0 0 78px; width: 78px; padding-left: 10px; padding-right: 6px;
  text-align: center; font-variant-numeric: tabular-nums;
}
.price-row .add-unit { flex: none; margin-bottom: 12px; white-space: nowrap; }
.price-row .price-del { flex: none; margin-bottom: 14px; font-size: 12px; }
.price-sec .unit-preview { margin: 0 0 12px; }
.price-sec .unit-preview:empty { display: none; }

/* ---------- 滑动开关（记入库存） ---------- */
.switch-row.sw-row {
  align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 13px; margin: 0 0 12px;
  border: 1px solid var(--line-2); border-radius: 12px; background: #fdfbf8;
}
.sw-row .sw-text { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); }
.sw-row .switch-note { display: inline; margin-left: 4px; }
.sw-row input[type="checkbox"] {
  position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none;
}
.ui-switch {
  position: relative; flex: none; width: 46px; height: 27px; border-radius: 999px;
  background: #e3dbcd; transition: background .18s ease; cursor: pointer;
}
.ui-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(40, 31, 20, .28), 0 0 0 .5px rgba(40, 31, 20, .06);
  transition: transform .18s cubic-bezier(.3, .8, .4, 1);
}
.sw-row input:checked ~ .ui-switch { background: var(--accent); }
.sw-row input:checked ~ .ui-switch::after { transform: translateX(19px); }
.sw-row input:focus-visible ~ .ui-switch { box-shadow: 0 0 0 3px var(--accent-soft); }
.sw-row:active .ui-switch::after { width: 23px; }

/* 单价：第二个单位是自由输入 */
.price-wrap .unit-inp {
  flex: 0 0 84px; width: 84px; text-align: center;
  font-size: 13.5px; padding-left: 6px; padding-right: 6px;
}

/* 单价下面的数量 */
.price-qty { margin-bottom: 12px; }
.price-qty .qty-unit { font-style: normal; color: var(--muted); font-size: 11px; margin-left: 1px; }

/* ============================================================
   v3 纸面主题（覆盖层）
   只改视觉：颜色、圆角、字号、间距、描边。
   不改任何布局顺序与区块结构；同选择器后写覆盖前写。
   ============================================================ */
:root {
  --bg: #ece6da;
  --bg-2: #e6dfd1;
  --card: #fdfbf6;
  --ink: #211d16;
  --ink-2: #655c50;
  --muted: #9d9385;
  --line: #f1e8d7;
  --line-2: #ded3c0;
  --accent: #2f6b56;
  --accent-soft: #edf4ef;
  --accent-ink: #245544;
  --amber: #a9762a;
  --danger: #b0554b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 22px -22px rgba(40, 31, 20, .5);
  --ring: 0 0 0 3px rgba(76, 139, 111, .13);
}

body { background: var(--bg); font-size: 14.5px; }
.app { padding: 0 14px 84px; }

/* ---------- 顶栏 ---------- */
.topbar {
  padding: 13px 0 7px;
  background: var(--bg);
  box-shadow: none;
}
.logo {
  width: 28px; height: 28px; border-radius: 8px; font-size: 14px;
  box-shadow: 0 4px 10px -7px rgba(36, 85, 68, .9);
}
.topbar h1 { font-size: 14.5px; letter-spacing: .02em; }
.topbar p { font-size: 9.5px; letter-spacing: .06em; margin-top: 1px; gap: 5px; }
.db-status { font-size: 8.5px; line-height: 13px; padding: 0 5px; }
.ghost-btn { height: 30px; padding: 0 11px; font-size: 11.5px; border-radius: 8px; }
.icon-btn { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 1px solid #dcd2bf; color: #8b8173; }
.account-chip { height: 26px; font-size: 11px; }

/* ---------- 页头 ---------- */
.page-h { padding: 7px 2px 11px; }
.page-h h2 { font-size: 21px; letter-spacing: -.01em; margin-bottom: 3px; }
.page-h p { font-size: 11px; line-height: 1.5; }

/* ---------- 纸卡 ---------- */
.card {
  background: var(--card);
  border: 1px solid #e8dfcd;
  border-radius: 4px;
  padding: 13px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
@media (min-width: 700px) {
  .card { padding: 15px; margin-bottom: 11px; }
}
.card.tight { padding: 0; }
.card-h { margin-bottom: 9px; gap: 8px; }
.card-h h3 { font-size: 12.5px; letter-spacing: .02em; }
.card-h span { font-size: 10px; letter-spacing: .02em; }

/* ---------- 大数字 ---------- */
.hero {
  background: var(--card);
  color: var(--ink);
  border: 1px solid #e8dfcd;
  border-radius: 4px;
  padding: 14px 15px 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: repeating-linear-gradient(90deg, #c3d2c7 0 6px, transparent 6px 12px);
  opacity: .9;
}
.hero::after { display: none; }
.hero-k { font-size: 10.5px; color: var(--muted); opacity: 1; letter-spacing: .12em; }
.hero-num {
  font-size: 37px; font-weight: 600; letter-spacing: -.035em;
  line-height: 1; margin: 10px 0 4px;
}
.hero-num .cur {
  font-size: 15px; font-weight: 500; color: #8b8173; opacity: 1;
  margin-right: 2px; letter-spacing: 0;
  display: inline-block; transform: translateY(-10px);
}
.hero-sub { font-size: 10.5px; color: #8b8173; opacity: 1; line-height: 1.5; }
.hero-split { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #e6dcc9; gap: 12px; }
.hero-split span { font-size: 9.5px; opacity: 1; color: var(--muted); }
.hero-split b { font-size: 14px; letter-spacing: -.01em; }

/* ---------- 统计卡 ---------- */
.stat { padding: 11px 12px; }
.stat span { font-size: 10.5px; letter-spacing: .04em; }
.stat b { font-size: 21px; letter-spacing: -.03em; margin: 3px 0 1px; }
.stat em { font-size: 9.5px; color: #a99e8f; }

/* ---------- 日期条 / 区间 ---------- */
.daybar {
  gap: 4px; margin-bottom: 10px;
  background: var(--card); border: 1px solid #e8dfcd; border-radius: 4px; padding: 5px 7px;
}
.day-nav { border: 0; background: none; color: #8b8173; border-radius: 7px; }
.day-input, .daybar input[type="date"] {
  font-size: 13px; font-weight: 600; color: var(--ink);
  border: 0; background: none; text-align: center;
}
.day-wd, .daybar .day-wd { font-size: 10.5px; color: var(--muted); letter-spacing: .06em; }
.day-today {
  height: 24px; padding: 0 9px; border-radius: 999px;
  border: 1px solid #cfe0d6; background: var(--accent-soft); color: var(--accent-ink);
  font-size: 10px;
}
.rangebar { gap: 6px; margin-bottom: 7px; }
.rb-field {
  height: 34px; padding: 0 9px; background: #fff;
  border: 1px solid var(--line-2); border-radius: 7px;
  box-shadow: inset 2px 0 0 #eee4d1;
}
.rb-field span { font-size: 10.5px; }
.rb-field input { font-size: 12px; }
.date-range-sum { font-size: 10px; color: var(--muted); letter-spacing: .03em; }

/* ---------- chips ---------- */
.chips { gap: 5px; padding: 2px 2px 10px; }
.chip {
  font-size: 11px; padding: 5px 10px;
  border-color: #e0d6c3; background: #fff; color: #756a5b;
}
.chip.on { background: var(--accent-soft); border-color: #93b7a6; color: var(--accent-ink); font-weight: 500; }
.chip.sm { font-size: 10.5px; padding: 4px 9px; }
.chip em { font-size: 9px; margin-left: 4px; }
.chip.on em { color: #7a9c8d; }

/* ---------- 明细 / 今日账 ---------- */
.rec { padding: 9px 12px; gap: 8px; border-top: 1px solid #f2ead9; border-radius: 0; }
.rec:hover { background: #f8f4ea; }
.rec-main b { font-size: 12px; }
.rec-main span { font-size: 9px; margin-top: 2px; }
.rec-right b { font-size: 12.5px; }
.rec-right span { font-size: 8.5px; }
.rec-check { width: 13px; height: 13px; }
.tag { font-size: 9px; border-radius: 3px; padding: 0 4px; }

.today-list li { padding: 9px 0; gap: 8px; border-top: 1px solid #f2ead9; }
.tl-main > b { font-size: 12.5px; }
.tl-main > span { font-size: 9.5px; margin-top: 2px; }
.today-list li .tl-right b, .tl-right b { font-size: 13px; }
.tl-right span { font-size: 8.5px; }
.daily-list li { padding: 9px 0; gap: 8px; border-top: 1px solid #f2ead9; }
.dl-main b { font-size: 12.5px; }
.dl-main span { font-size: 9.5px; }
.dl-right b { font-size: 13px; }
.dl-right span { font-size: 8.5px; }
.rem li { padding: 9px 0; gap: 8px; }
.rm-main b { font-size: 12px; }
.rm-main span { font-size: 9.5px; }
.rm-tag { font-size: 11px; }

/* 品牌小标签 */
.tpl-brand, .si-brand {
  font-style: normal; font-size: 8.5px; color: #7a6f60;
  background: #eee4cf; border: 1px solid #e3d6bd; border-radius: 3px;
  padding: 1px 4px; margin-right: 5px; letter-spacing: .02em;
  display: inline-block; transform: translateY(-1px);
}

/* ---------- 环图 / 图例 ---------- */
.donut-pair { margin: 2px 0; }
.donut-top { font-size: 17px; }
.donut-sub { font-size: 9px; }
.member-legend { margin: 9px 0 0; padding: 8px 0 0; border-top: 1px solid #f2ead9; gap: 6px; }
.member-legend li { font-size: 10.5px; gap: 6px; }
.member-legend i { width: 6px; height: 6px; border-radius: 2px; }
.member-legend > li > b { min-width: 30px; font-size: 10.5px; }
.member-legend > li > span { font-size: 9.5px; }

/* ---------- 趋势 ---------- */
.trend-card .trend-sum { gap: 4px; }
.trend-sum div { border-left: 2px solid #eee6d5; padding-left: 7px; }
.trend-sum span { font-size: 9px; letter-spacing: .06em; }
.trend-sum b { font-size: 13px; }
.trend-legend { font-size: 9.5px; gap: 10px; }
.trend-legend i { width: 7px; height: 7px; border-radius: 2px; }

/* ---------- 清单筛选 / 批量 ---------- */
.list-filter {
  padding: 11px 12px; margin: -3px 0 10px;
  background: var(--card); border: 1px solid #e8dfcd; border-radius: 4px; box-shadow: var(--shadow);
}
.list-filter-row > span { font-size: 9.5px; letter-spacing: .05em; margin-bottom: 5px; }
.list-filter-row + .list-filter-row { margin-top: 8px; }
.date-range input[type="date"] {
  height: 30px; padding: 0 8px; font-size: 11px;
  border: 1px solid var(--line-2); border-radius: 6px; background: #fff;
}
.list-batch { border-radius: 4px; padding: 0; margin: 0 0 10px; }
.list-batch-h { padding: 10px 13px; margin: 0; font-size: 11.5px; }
.list-selbar { padding: 8px 13px; background: #fbf8f0; }
.list-batch-row .btn { font-size: 11.5px; }
.batch-field select { font-size: 11.5px; border-radius: 7px; padding: 7px 9px; }

/* ---------- 按钮 ---------- */
.btn { border-radius: 8px; font-size: 12.5px; padding: 9px 14px; border-color: var(--line-2); }
.btn.primary { background: var(--accent); border-color: var(--accent-ink); }
.btn.small { padding: 6px 9px; font-size: 10.5px; border-radius: 7px; }
.link-btn { font-size: 10.5px; }

/* ---------- 底部导航：通栏文字条 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  transform: none; width: 100%; max-width: none;
  display: flex; gap: 0; padding: 5px 6px calc(6px + env(safe-area-inset-bottom));
  background: rgba(246, 242, 233, .97);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 0; border-top: 1px solid #e2d9c9; border-radius: 0;
  box-shadow: 0 -1px 0 rgba(40, 31, 20, .03);
  z-index: 30; overflow: visible;
}
.tabbar button {
  flex: 1; position: relative;
  padding: 5px 0 3px; font-size: 10.5px; letter-spacing: .04em;
  color: #9a9082; border-radius: 0; background: none;
}
.tabbar button.active {
  background: none; color: var(--accent-ink); font-weight: 600;
}
.tabbar button.active::before {
  content: ""; position: absolute; top: 1px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 2px; border-radius: 2px; background: var(--accent);
}

/* ---------- 弹层 / 表单 ---------- */
.sheet {
  background: var(--card);
  border-radius: 14px 14px 0 0;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
}
.sheet-h h3 { font-size: 15px; }
.sheet-h { margin-bottom: 13px; }
.x { width: 28px; height: 28px; background: #f4efe4; font-size: 12px; }
.field { margin-bottom: 11px; }
.field > span { font-size: 10.5px; color: var(--muted); margin-bottom: 5px; letter-spacing: .03em; }
.field input, .field select {
  font-size: 14px; padding: 9px 11px;
  border: 1px solid var(--line-2); border-radius: 7px;
  background: #fff; box-shadow: inset 2px 0 0 #eee4d1;
}
.field input:focus, .field select:focus {
  border-color: #6fa08c; background: #fff;
  box-shadow: inset 2px 0 0 var(--accent), var(--ring);
}
.field input::placeholder { color: #bcb1a0; font-size: 12.5px; }
.sheet-foot .btn { padding: 12px 16px; border-radius: 9px; }

.typepick { gap: 6px; }
.tchip { font-size: 11.5px; border-radius: 8px; padding: 9px 3px; border-color: #e0d6c3; }
.tchip.on { border-color: #93b7a6; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.tdesc { font-size: 10.5px; line-height: 1.6; margin: 9px 1px 13px; color: var(--muted); }
.seg { border-radius: 8px; }
.seg button { font-size: 11px; border-radius: 6px; }
.tag-sec { border-radius: 4px; }
.quick button { font-size: 10.5px; padding: 5px 9px; }
.preview { border-radius: 8px; }

/* ---------- 库存 ---------- */
.stock-card { border-radius: 4px; }
.stock-search {
  height: 32px; font-size: 12px; border-radius: 7px;
  border: 1px solid var(--line-2); background: #fff;
}
.stock-item {
  padding: 9px 12px; border-bottom: 1px solid #f2ead9;
  border-left: 0; gap: 8px;
}
.stock-item.low { background: #fdfaf2; }
.stock-item.out { background: #fbf6f5; }
.stock-item .si-main > b { font-size: 12.5px; }
.stock-item .si-num { font-size: 12.5px; font-weight: 600; }
.stock-item .si-unit { font-size: 10px; color: #8b8173; }
.si-step { width: 26px; height: 30px; border: 0; background: none; color: #7d7263; }
.stock-item .si-qty {
  border: 1px solid #e2d8c5; border-radius: 8px; background: #fff; overflow: hidden;
  display: flex; align-items: center; gap: 0;
}
.stock-item .si-del { color: #a2988a; font-size: 10.5px; background: none; border: 0; }

/* ---------- 表格 / 比价 ---------- */
.price-matrix { font-size: 10.5px; }
.price-matrix th, .price-matrix td { padding: 6px 7px; }
.price-matrix thead th { font-size: 9px; color: #a2988a; border-bottom: 1px solid var(--line-2); }
.price-matrix tbody td { border-bottom: 1px solid #f4ecdc; }
.calc-table { font-size: 10.5px; }
.calc-table th { font-size: 9px; color: #a2988a; }
.calc-table td { padding: 7px 6px 7px 0; border-bottom: 1px solid #f4ecdc; }
.callout { background: #f8f4e9; border: 1px dashed #e2d6bd; border-radius: 7px; }
.callout p { font-size: 10px; }
.hint { font-size: 10px; line-height: 1.65; color: #a2988a; margin-top: 9px; }
.lead { font-size: 11px; line-height: 1.8; }
.empty { font-size: 11.5px; }

/* ---------- v3 覆盖：第二批细节 ---------- */
.trend-card .trend-sum { gap: 6px; margin: 0 0 10px; }
.trend-sum div {
  background: none; border: 0; border-radius: 0;
  border-left: 2px solid #eee6d5; padding: 0 0 0 7px;
}
.trend-sum b { font-size: 13.5px; }
.list-filter .chips.sm { flex-wrap: wrap; overflow: visible; padding: 0; }
.donut-title { font-size: 9px; color: var(--muted); letter-spacing: .1em; }
input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0; width: 0; height: 0; margin: 0; padding: 0;
}
.nudge { border-radius: 8px; padding: 10px 12px; }
.nudge b { font-size: 12px; }
.nudge span { font-size: 10.5px; }
.tag { border: 0; background: #f4eee2; padding: 1px 5px; font-size: 8.5px; opacity: 1; }
.list-selall, .list-selbar label { font-size: 10.5px; }
.rec-check { width: 13px; height: 13px; }

/* ---------- v3 覆盖：一级类型选择 ---------- */
.typepick { grid-template-columns: repeat(2, 1fr); }
.tchip { border-radius: 8px; }
.tchip.on {
  background: var(--accent); border-color: var(--accent-ink);
  color: #fbfdfa; font-weight: 600;
  box-shadow: 0 4px 12px -9px rgba(36, 85, 68, .9);
}
.tchip.on i { background: #e8f2ec !important; opacity: .85; }

/* ---------- v3 覆盖：第三批（弹层与细节） ---------- */
.tip-bar { border-radius: 8px; padding: 9px 12px; }
.tip-bar p { font-size: 10.5px; }
.tip-bar .link { font-size: 10.5px; }
.tip-bar .tip-ico { width: 20px; height: 20px; border-radius: 6px; font-size: 11px; }

.tpl-quick {
  border-radius: 8px; padding: 10px 12px;
  background: #f7faf8; border: 1px solid #e2ebe5;
}
.tpl-quick b { font-size: 12px; }
.tpl-quick span { font-size: 10px; }

.seg { background: #f6f2e8; border-radius: 8px; padding: 3px; }
.seg button { font-size: 11px; }
.seg button.on {
  background: #e4efe9; color: var(--accent-ink);
  box-shadow: none; border: 1px solid #c3d9cd; font-weight: 600;
}

.price-wrap select.unit-sel {
  height: 28px; font-size: 11.5px; border-radius: 6px;
  background: #faf7ef; border: 1px solid #e0d6c3; padding: 0 4px;
}
#fAmount::placeholder { font-size: 20px; }
#fAmount {
  font-size: 20px; font-weight: 600; height: 46px;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.preview { border-radius: 8px; padding: 10px 12px; font-size: 11px; }
.preview b { font-size: 14px; }
.preview .muted { font-size: 10.5px; }

.daybar .day-input, .daybar input[type="date"] {
  border: 0; background: none; box-shadow: none;
  font-size: 12.5px; font-weight: 600;
}
.rec-right b { display: block; }
.rec-right span { display: block; font-size: 9px; }
.list-filter-row::after { display: none !important; }
.chip.sm { font-size: 10px; padding: 4px 8px; }
.pm-days select, .pm-add input { height: 36px; font-size: 12px; border-radius: 7px; }
.pm-add .btn { height: 36px; font-size: 11.5px; }
.tag-sec { border-radius: 4px; }

/* 日期条：整条是一张纸，内部不再套一层框 */
.daybar .day-center {
  background: none; border: 0; border-radius: 0; padding: 0;
  justify-content: center; gap: 7px;
}
.daybar .day-input { flex: 0 1 auto; width: 108px; text-align: center; padding: 0; }

/* 人名 / 场景小标签：浅底无框，别抢金额 */
.tagpills i {
  border: 0 !important; background: #f2ece0;
  font-size: 8.5px; line-height: 15px; padding: 0 4px; border-radius: 3px;
}
.list-filter { padding: 10px 11px; }
.list-filter-row + .list-filter-row { margin-top: 7px; }

/* 比价顶部三个控件：去掉 label 的底边距，统一 36 高、内边距只留左右 */
.pm-ctrl { align-items: flex-end; }
.pm-days { margin-bottom: 0; }
.pm-days > span { margin-bottom: 4px; }
.pm-days select,
.pm-add input,
.pm-add .btn {
  height: 36px; box-sizing: border-box;
  padding-top: 0; padding-bottom: 0;
  line-height: 34px;
}
.pm-days select { padding-left: 8px; padding-right: 4px; }
.pm-add input { padding-left: 11px; padding-right: 11px; line-height: normal; }
.pm-add .btn { padding-left: 12px; padding-right: 12px; }

/* 比价顶部：统一白底 + 细箭头，箭头不抢视线 */
.pm-days select,
.pm-add input,
.pm-add .btn { background: #fff; }

.pm-days select {
  -webkit-appearance: none; appearance: none;
  padding-right: 22px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238b8173' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  background-size: 9px 9px;
}
.pm-days select:focus { outline: none; border-color: #6fa08c; box-shadow: var(--ring); }

/* 顶栏「＋ 记一笔」：那条 @media 里的 padding:8px 会把 30 高的按钮挤扁，
   这里用同级选择器收回来，并改成 flex 居中，不再靠行高对齐。 */
.top-actions .ghost-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 30px; padding: 0 12px; font-size: 11.5px; line-height: 1;
  border-radius: 8px;
}
