:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #1a1d23; --muted: #6b7280; --line: #e7e8ec;
  --primary: #3b6cf6; --primary-soft: #eaf0ff; --exp: #e5534b; --inc: #1f9d55; --warn: #f59f0b; --warn-text: #b45309;
  --radius: 14px; --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --side: 0px; --tabh: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111318; --card: #1b1e25; --text: #e8eaef; --muted: #9aa1ad; --line: #2b2f38;
    --primary: #6b8cff; --primary-soft: #222b45; --exp: #ff6b63; --inc: #3fcf7f; --warn-text: #fbbf24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111318; --card: #1b1e25; --text: #e8eaef; --muted: #9aa1ad; --line: #2b2f38;
  --primary: #6b8cff; --primary-soft: #222b45; --exp: #ff6b63; --inc: #3fcf7f; --warn-text: #fbbf24;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-appearance: none; appearance: none; }
a { color: var(--primary); text-decoration: none; }
code { background: var(--line); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
details summary { cursor: pointer; }
[hidden] { display: none !important; }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.pad { padding: 0 4px; }
.grow { flex: 1; min-width: 0; }
.exp { color: var(--exp); }
.inc { color: var(--inc); }
.neu { color: var(--muted); }
.warn-t { color: var(--warn-text); }
.danger { color: var(--exp); }

/* ---------- 布局 ---------- */
main#view { min-height: 100vh; padding-bottom: calc(var(--tabh) + 24px + env(safe-area-inset-bottom)); }
.page { max-width: 820px; margin: 0 auto; padding: 8px 16px 24px; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, calc((100% - 820px) / 2 + 16px)) 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.topbar h2 { margin: 0; font-size: 18px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  height: calc(var(--tabh) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar .brand, .tabbar .kbd-hint, .tabbar .fab-txt { display: none; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 0 7px; color: var(--muted); font-size: 11px; }
.tabbar a .ti { font-size: 21px; line-height: 1.2; filter: grayscale(1); opacity: .65; }
.tabbar a.on { color: var(--primary); font-weight: 600; }
.tabbar a.on .ti { filter: none; opacity: 1; }
.tabbar .fab { align-self: center; padding: 0; }
.fab-ic {
  width: 50px; height: 50px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 28px; font-weight: 300;
  display: grid; place-items: center; box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 45%, transparent); transform: translateY(-10px);
}

@media (min-width: 900px) {
  :root { --side: 216px; }
  main#view { margin-left: var(--side); padding-bottom: 40px; }
  .topbar { padding-left: max(24px, calc((100% - 820px) / 2 + 16px)); padding-right: max(24px, calc((100% - 820px) / 2 + 16px)); }
  .page { padding: 8px 24px 32px; }
  .tabbar {
    top: 0; right: auto; width: var(--side); height: auto; display: flex; flex-direction: column; align-items: stretch; gap: 2px;
    padding: 20px 12px; border-top: 0; border-right: 1px solid var(--line); background: var(--card);
  }
  .tabbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding: 0 8px 18px; order: 0; }
  .logo { width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 17px; }
  .tabbar .fab { order: 1; align-self: stretch; flex-direction: row; justify-content: center; gap: 6px; margin-bottom: 14px; padding: 11px 0; border-radius: 12px; background: var(--primary); color: #fff; font-size: 15px; font-weight: 600; }
  .tabbar .fab-ic { width: auto; height: auto; background: none; box-shadow: none; transform: none; font-size: 20px; }
  .tabbar .fab-txt { display: inline; }
  .tabbar a[data-tab] { order: 2; flex-direction: row; gap: 10px; padding: 10px 12px; border-radius: 10px; font-size: 15px; color: var(--text); }
  .tabbar a[data-tab] .ti { font-size: 18px; }
  .tabbar a[data-tab].on { background: var(--primary-soft); color: var(--primary); }
  .tabbar .kbd-hint { display: block; order: 9; margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 8px; }
}
@media (hover: hover) {
  .tabbar a[data-tab]:hover { color: var(--primary); }
  .tx:hover, .acc-row:hover, .row-link:hover, .pick:hover, .rank-row:hover, .menu-i:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
  .icon-btn:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
}

/* ---------- 通用组件 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 12px; }
.card.list { padding: 2px 0; overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-h h4 { margin: 0; font-size: 15px; font-weight: 600; }

.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 15px; padding: 10px 16px; border-radius: 10px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn.danger { background: var(--exp); border-color: var(--exp); color: #fff; }
.btn.danger-text { color: var(--exp); }
.btn.ghost { background: transparent; border-style: dashed; color: var(--primary); }
.btn.full { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row.wrap { flex-wrap: wrap; }
.btn-row .btn.grow { flex: 1; }
.dlg .btn-row .btn { flex: 1; }
.icon-btn { border: 0; background: none; width: 36px; height: 36px; border-radius: 10px; font-size: 20px; cursor: pointer; display: grid; place-items: center; flex: none; color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; font-size: 15px; }
.icon-btn:disabled { opacity: .25; cursor: default; }
.text-btn { border: 0; background: none; color: var(--primary); font-size: 14.5px; cursor: pointer; padding: 6px 8px; white-space: nowrap; }
.text-btn.primary { font-weight: 600; }
.text-btn.danger { color: var(--exp); }
.link-btn { border: 0; background: none; color: var(--primary); font-size: 14px; padding: 6px 0; cursor: pointer; text-align: left; }
.link-btn.danger { color: var(--exp); }

.seg { display: inline-flex; background: color-mix(in srgb, var(--text) 7%, transparent); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.seg.full { display: flex; width: 100%; margin-bottom: 10px; }
.seg.full button { flex: 1; }
.seg.mini button { padding: 4px 11px; font-size: 13px; }

.chip { border: 1px solid var(--line); background: var(--card); font-size: 13px; padding: 5px 11px; border-radius: 99px; white-space: nowrap; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; flex: none; }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.chip.dashed { border-style: dashed; color: var(--muted); }
.badge { font-style: normal; font-size: 10.5px; line-height: 16px; padding: 0 6px; border-radius: 99px; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--muted); white-space: nowrap; font-weight: 400; }
.badge.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn-text); }
.badge.ok { background: var(--primary-soft); color: var(--primary); }
.tag { font-style: normal; color: var(--primary); margin-left: 6px; }

.bar { height: 6px; background: color-mix(in srgb, var(--text) 8%, transparent); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }
.bar i.warn { background: var(--warn); }
.bar i.over { background: var(--exp); }
.bar i.done { background: var(--inc); }
.bar.thin { height: 4px; margin-top: 0; }

.cat-ic { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 18px; background: color-mix(in srgb, var(--c) 16%, transparent); }
.acc-ic { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--c); color: #fff; display: inline-grid; place-items: center; font-style: normal; font-size: 14px; font-weight: 600; }
.acc-ic.xs { width: 18px; height: 18px; font-size: 10px; }
.emoji { font-size: 20px; line-height: 1; }
.emoji.big { font-size: 30px; }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; line-height: 1.9; }
.empty.small { padding: 24px 12px; font-size: 13.5px; }
.empty-ill { font-size: 44px; line-height: 1.3; }
.empty .btn { margin-top: 12px; }
.empty-card { display: block; width: 100%; border: 1px dashed var(--line); text-align: center; color: var(--muted); padding: 18px; cursor: pointer; box-shadow: none; }
.banner { display: block; width: 100%; border: 0; background: color-mix(in srgb, var(--warn) 15%, var(--card)); color: var(--warn-text); padding: 10px 14px; border-radius: 12px; font-size: 13px; text-align: left; margin-bottom: 12px; cursor: pointer; }

/* ---------- 明细 ---------- */
.ledger-btn { border: 0; background: var(--card); box-shadow: var(--shadow); padding: 7px 12px; border-radius: 99px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
.caret { color: var(--muted); font-size: 11px; }
.hero label { font-size: 13px; color: var(--muted); display: block; }
.hero strong { display: block; font-size: 30px; font-weight: 700; letter-spacing: -.5px; line-height: 1.25; margin: 2px 0; word-break: break-all; }
.hero-row { display: flex; gap: 18px; color: var(--muted); font-size: 13px; flex-wrap: wrap; margin-top: 4px; }
.hero-row b { color: var(--text); font-weight: 600; }
.hero .btn-row .btn { flex: 1; }
.hero-main { margin-top: 6px; }
.period-sw { display: flex; align-items: center; gap: 2px; margin: -4px 0 0 -8px; flex-wrap: wrap; }
.period-sw.center { justify-content: center; margin: 0 0 8px; }
.p-label { font-weight: 600; font-size: 15px; text-align: center; min-width: 86px; }
.p-label small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.budget-mini { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); cursor: pointer; }
.bm-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.hero .link-btn { margin-top: 8px; font-size: 13px; }

.day-h { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 10px 4px 6px; }
.tx { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; background: none; border: 0; text-align: left; cursor: pointer; }
.tx + .tx { border-top: 1px solid var(--line); }
.tx.static { cursor: default; }
.tx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.t1 { font-size: 15px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.t1 small { color: var(--muted); font-size: 12px; }
.t2 { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amt { font-weight: 600; font-size: 15.5px; white-space: nowrap; }

.cal-h, .cal-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-h span { text-align: center; font-size: 12px; color: var(--muted); padding: 2px 0 6px; }
.cal-c { min-height: 50px; border: 0; background: none; border-radius: 10px; display: flex; flex-direction: column; align-items: center; padding: 5px 0 4px; gap: 1px; cursor: pointer; min-width: 0; }
.cal-c.empty { cursor: default; }
.cal-c b { font-size: 13px; font-weight: 500; }
.cal-c small { font-size: 10px; line-height: 1.2; max-width: 100%; overflow: hidden; }
.cal-c.today b { color: var(--primary); font-weight: 700; }
.cal-c.on { background: var(--primary-soft); box-shadow: inset 0 0 0 1.5px var(--primary); }
.cal-c.future { opacity: .4; }

/* ---------- 统计 ---------- */
.sum-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 640px) { .sum-cards { grid-template-columns: repeat(4, 1fr); } }
.sum-c { background: var(--card); border: 1.5px solid transparent; border-radius: var(--radius); padding: 11px 14px; text-align: left; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
button.sum-c { cursor: pointer; }
.sum-c.on { border-color: var(--primary); }
.sum-c label { font-size: 12.5px; color: var(--muted); cursor: inherit; }
.sum-c b { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
svg.bars { display: block; overflow: visible; }
svg text.axis { font-size: 11px; fill: var(--muted); }
svg line.grid { stroke: var(--line); stroke-dasharray: 3 3; }
.bar-g { cursor: pointer; }
.chart-tip { font-size: 13px; min-height: 22px; margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.lg::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: currentColor; margin-right: 4px; vertical-align: -1px; }
.donut { flex: none; }
.donut-c { font-size: 15px; font-weight: 700; fill: var(--text); }
.donut-s { font-size: 11px; fill: var(--muted); }
.comp { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.comp-list { width: 100%; min-width: 0; }
@media (min-width: 640px) { .comp { flex-direction: row; align-items: flex-start; gap: 20px; } .comp-chart { position: sticky; top: 70px; } }
.rank-row { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 4px; text-align: left; cursor: pointer; border-radius: 10px; }
.rank-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rank-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.sub-break { margin: 0 0 8px 50px; padding: 6px 12px; background: var(--bg); border-radius: 10px; }
.sb-row { display: grid; grid-template-columns: 1fr auto 52px; gap: 8px; font-size: 13px; padding: 4px 0; }
.sb-row .muted { text-align: right; }

/* ---------- 资产 / 账户 ---------- */
.grp-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding: 10px 4px 6px; }
.acc-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; border: 0; background: none; text-align: left; cursor: pointer; }
.acc-row + .acc-row { border-top: 1px solid var(--line); }
div.acc-row { cursor: default; }
.acc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.acc-main > span:first-child { display: flex; align-items: center; gap: 6px; }
.acc-main small { color: var(--muted); font-size: 12.5px; }
.acc-main.plain { border: 0; background: none; text-align: left; cursor: pointer; padding: 0; }
.nw strong { font-size: 32px; }
.grp + .btn, .page > .btn.full { margin: 6px 0 12px; }

/* ---------- 我的 ---------- */
.me-card { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 6px; }
.me-card b { font-size: 19px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-card label { font-size: 12px; color: var(--muted); }
.menu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 10px; }
.menu-i { position: relative; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; border-radius: 12px; font-size: 13px; cursor: pointer; }
.menu-i .emoji { font-size: 26px; }
.dot-badge { position: absolute; top: 4px; left: calc(50% + 8px); background: var(--exp); color: #fff; font-style: normal; font-size: 10.5px; min-width: 17px; height: 17px; border-radius: 99px; display: grid; place-items: center; padding: 0 4px; }
.row-link { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 14px 16px; border: 0; background: none; cursor: pointer; text-align: left; gap: 10px; }
.row-link + .row-link { border-top: 1px solid var(--line); }
.row-link span:first-child { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-link span:last-child { font-size: 13px; white-space: nowrap; }

/* ---------- 预算 / 目标 / 分类 / 报销 / 搜索 / 数据 ---------- */
.budget-total { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.bt-info { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 4px; }
.bt-info label { font-size: 13px; color: var(--muted); }
.bt-info b { font-size: 26px; display: block; }
.bud-row { display: flex; gap: 12px; padding: 10px 0; align-items: flex-start; }
.bud-row + .bud-row { border-top: 1px solid var(--line); }
.bud-row .bar { margin: 6px 0 4px; }
.goal-h { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.goal-h small { display: block; font-size: 12.5px; }
.goal-row { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 14px; flex-wrap: wrap; }
.cat-head { display: flex; align-items: center; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sel-row { display: flex; align-items: center; padding-left: 14px; }
.sel-row + .sel-row { border-top: 1px solid var(--line); }
.sel-row .tx { padding-left: 10px; }
.ck { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: none; color: #fff; font-size: 13px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.sel-row.on .ck { background: var(--primary); border-color: var(--primary); }
.sticky-act { position: sticky; bottom: calc(var(--tabh) + 8px + env(safe-area-inset-bottom)); padding: 8px 0; z-index: 5; }
@media (min-width: 900px) { .sticky-act { bottom: 12px; } }
.sheet .sticky-act { bottom: 0; background: var(--card); padding: 10px 0 12px; }
.search-box input { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 11px 14px; font-size: 16px; }
.filters { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.filter-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: var(--card); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; box-shadow: var(--shadow); }
.filter-panel label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.filter-panel input, .filter-panel select { width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 8px 10px; font-size: 15px; color: var(--text); }
.filter-panel .btn { grid-column: 1 / -1; }
.sr-sum { display: flex; gap: 16px; font-size: 13px; color: var(--muted); padding: 4px 4px 0; flex-wrap: wrap; }
.file-btn { cursor: pointer; }
.howto { font-size: 13px; margin: 8px 0 12px; color: var(--muted); }
.howto summary { color: var(--primary); }
.howto p { margin: 6px 0; line-height: 1.6; }
.imp-sum { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; padding: 8px 0; }
.imp-sum b { font-size: 17px; display: block; }
.imp-sum label { font-size: 12px; color: var(--muted); }
.imp .form { padding: 0 0 8px; }

/* ---------- 弹层 ---------- */
.sheet-bd { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0); transition: background .2s; }
.sheet-bd.open { background: rgba(0, 0, 0, .38); }
.sheet {
  background: var(--card); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; max-height: 92vh; max-height: 92dvh; overflow: auto;
  transform: translateY(100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .2s; padding-bottom: env(safe-area-inset-bottom); overscroll-behavior: contain;
}
.sheet-bd.open .sheet { transform: none; }
.sheet.small { max-width: 420px; }
.sheet.tall { height: 86vh; height: 86dvh; display: flex; flex-direction: column; overflow: hidden; }
.sheet-scroll { overflow: auto; flex: 1; padding: 0 16px 16px; }
@media (min-width: 900px) {
  .sheet-bd { align-items: center; }
  .sheet { border-radius: 18px; max-height: 88vh; transform: translateY(16px) scale(.98); opacity: 0; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
  .sheet-bd.open .sheet { opacity: 1; }
  .sheet.tall { height: 80vh; }
}
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 6px; position: sticky; top: 0; background: var(--card); z-index: 3; }
.sheet-head h3 { flex: 1; text-align: center; margin: 0; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-head-r { min-width: 36px; display: flex; justify-content: flex-end; }
.sheet-foot { padding: 8px 16px 16px; }
.sheet-foot .btn { width: 100%; }
.dlg { padding: 22px 18px 16px; }
.dlg p { margin: 0 0 8px; font-size: 15px; line-height: 1.6; }

.pick-list { padding: 0 8px 8px; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 10px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left; }
.pick.on { background: var(--primary-soft); }
.pick-name { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pick-name small { font-size: 12px; color: var(--muted); }
.check { color: var(--primary); font-weight: 700; }
.tag-add { display: flex; gap: 8px; padding: 4px 16px 8px; }
.tag-add input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 9px 12px; font-size: 16px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 16px; }

/* 表单 */
.form { padding: 4px 16px 16px; }
.card.form { padding: 6px 16px 12px; }
.f-row { padding: 8px 0; }
.f-row > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.f-row input:not([type=checkbox]), .f-row select, .f-row textarea { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 16px; color: var(--text); min-height: 44px; }
.f-row.inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.f-row.inline > label { margin: 0; font-size: 15px; color: var(--text); }
.f-hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.f-err { color: var(--exp); font-size: 13px; padding: 4px 0; }
.switch { position: relative; width: 48px; height: 28px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: color-mix(in srgb, var(--text) 15%, transparent); border-radius: 99px; transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + span { background: var(--inc); }
.switch input:checked + span::after { transform: translateX(20px); }
.colors { display: flex; flex-wrap: wrap; gap: 10px; }
.dot { width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer; }
.dot.on { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--text); }
.f-row input.emoji-in { width: 72px; font-size: 22px; text-align: center; }
.emojis { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; margin-top: 8px; }
.emojis button { border: 0; background: var(--bg); border-radius: 8px; font-size: 20px; height: 38px; cursor: pointer; }

/* ---------- 记一笔 ---------- */
.sheet.editor { display: flex; flex-direction: column; }
.type-seg { display: flex; margin: 0 16px 6px; }
.type-seg button { flex: 1; }
.ed-amount { display: flex; justify-content: space-between; align-items: center; padding: 4px 16px 8px; gap: 10px; min-height: 52px; }
.ed-cat { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; max-width: 45%; }
.ed-expr { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; min-width: 0; overflow-wrap: anywhere; line-height: 1.15; }
.ed-expr small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
.ed-amount.expense .ed-expr { color: var(--exp); }
.ed-amount.income .ed-expr { color: var(--inc); }
.ed-body { padding: 0 10px; overflow-y: auto; flex: 1 1 auto; min-height: 120px; max-height: 38vh; }
.cat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; }
@media (min-width: 520px) { .cat-grid { grid-template-columns: repeat(6, 1fr); } }
.cat { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; font-size: 12px; cursor: pointer; border-radius: 10px; min-width: 0; color: var(--muted); }
.cat span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat i { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 20px; background: color-mix(in srgb, var(--c) 14%, transparent); transition: box-shadow .15s; }
.cat.on i { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--c); background: color-mix(in srgb, var(--c) 28%, transparent); }
.cat.on span { color: var(--text); font-weight: 600; }
.sub-row { display: flex; gap: 6px; overflow-x: auto; padding: 8px 4px 6px; scrollbar-width: none; }
.sub-row::-webkit-scrollbar, .ed-meta::-webkit-scrollbar { display: none; }
.ed-meta { display: flex; gap: 6px; padding: 10px 16px 6px; overflow-x: auto; scrollbar-width: none; flex: none; }
.date-chip { position: relative; }
.date-in { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ed-note { display: block; width: calc(100% - 32px); margin: 4px 16px 8px; border: 0; background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 16px; flex: none; }
.ed-actions { display: flex; gap: 14px; padding: 0 12px 8px; align-items: center; flex: none; }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border-top: 1px solid var(--line); flex: none; }
.keypad button { border: 0; background: var(--card); font-size: 22px; font-weight: 500; height: 54px; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.keypad button:active { background: var(--bg); }
.keypad .op { color: var(--muted); }
.keypad .ok { background: var(--primary); color: #fff; font-size: 17px; font-weight: 600; }
.keypad .ok:active { background: color-mix(in srgb, var(--primary) 85%, #000); }
.keypad .again { font-size: 15px; color: var(--primary); }
@media (max-height: 700px) { .keypad button { height: 46px; } .ed-body { max-height: 30vh; } }
.xfer { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; padding: 8px 4px; }
.xfer-acc { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; min-width: 0; }
.xfer-acc b { font-weight: 600; font-size: 14px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xfer-acc small { color: var(--muted); font-size: 12px; }
.fee-row { display: flex; align-items: center; justify-content: space-between; padding: 8px; font-size: 14px; color: var(--muted); }
.fee-row input { width: 130px; text-align: right; border: 0; background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 16px; }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- 提示 / 锁 ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabh) + 28px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); z-index: 300;
  background: rgba(24, 26, 32, .94); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: min(86vw, 420px); text-align: center; line-height: 1.5;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { #toast { left: calc(50% + var(--side) / 2); bottom: 32px; } }
.lock { position: fixed; inset: 0; z-index: 400; background: var(--bg); display: grid; place-items: center; }
.lock-box { text-align: center; width: 280px; }
.lock-ic { font-size: 36px; }
.lock-t { margin: 8px 0 0; font-size: 16px; }
.lock-dots { display: flex; gap: 16px; justify-content: center; margin: 18px 0 6px; }
.lock-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); }
.lock-dots i.on { background: var(--text); border-color: var(--text); }
.lock-err { color: var(--exp); min-height: 20px; font-size: 13px; margin: 0; }
.lock-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 14px; }
.lock-pad button { height: 64px; width: 64px; justify-self: center; border-radius: 50%; border: 0; background: var(--card); font-size: 22px; box-shadow: var(--shadow); cursor: pointer; }
.lock-pad button[data-k="取消"], .lock-pad button[data-k="⌫"] { background: none; box-shadow: none; font-size: 15px; }
.lock-pad button:disabled { visibility: hidden; }
