:root {
  --bg: #F2F4F3;
  --card: #FFFFFF;
  --ink: #17211D;
  --ink-2: #5A6863;
  --muted: #93A09B;
  --line: #E6EAE8;
  --primary: #0F4D3F;
  --primary-soft: #E4F0EB;
  --income: #1E8E5A;
  --expense: #C74B3F;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 32, 26, .04), 0 8px 24px rgba(16, 32, 26, .05);
  --kp-h: 320px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { overscroll-behavior-y: contain; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

.hidden { display: none !important; }

/* ---------------- 顶部 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 10px;
  background: rgba(242, 244, 243, .94);
  backdrop-filter: blur(12px);
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 600; letter-spacing: .5px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff;
  color: var(--ink-2); font-family: inherit;
  font-size: 11.5px; padding: 5px 11px; border-radius: 999px;
  box-shadow: var(--shadow);
}
.status-pill i { width: 6px; height: 6px; border-radius: 50%; background: #C3CCC8; }
.status-pill.online i { background: #34A176; box-shadow: 0 0 0 3px rgba(52,161,118,.14); }
.status-pill:active { transform: scale(.96); }

.monthbar {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 2px 18px 10px;
}
.monthbar span { font-size: 14px; font-weight: 600; color: var(--ink-2); letter-spacing: .5px; }
.month-nav {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 17px; line-height: 1;
  display: grid; place-items: center; font-family: inherit;
}
.month-nav:active { background: var(--primary-soft); }

/* ---------------- 页面 ---------------- */
main { padding: 0 16px calc(88px + env(safe-area-inset-bottom)); }
.page { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 键盘弹出时，页面留出空间 */
body.kp-open main { padding-bottom: calc(var(--kp-h) + 18px + env(safe-area-inset-bottom)); }
body.kp-open .tabbar { transform: translateY(110%); pointer-events: none; }
.tabbar { transition: transform .24s cubic-bezier(.4,0,.2,1); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 13px; font-weight: 600; color: var(--muted);
  letter-spacing: .6px; margin-bottom: 12px;
}
.card-title-row { display: flex; align-items: center; justify-content: space-between; }
.card-title-row .card-title { margin-bottom: 12px; }

.link-btn {
  border: none; background: none; font-family: inherit;
  color: var(--primary); font-size: 12.5px; font-weight: 600; padding: 0 2px;
}

/* ---------------- 本月快照 ---------------- */
.snap {
  display: flex; align-items: stretch; gap: 0;
  background: linear-gradient(135deg, #0F4D3F 0%, #17624F 100%);
  color: #fff; border-radius: var(--radius);
  padding: 13px 6px; margin-bottom: 12px;
  box-shadow: 0 6px 20px rgba(15, 77, 63, .18);
}
.snap > div {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
  padding: 0 10px; position: relative;
}
.snap > div + div::before {
  content: ''; position: absolute; left: 0; top: 3px; bottom: 3px;
  width: 1px; background: rgba(255,255,255,.16);
}
.snap span { font-size: 11px; color: rgba(255,255,255,.66); letter-spacing: .3px; }
.snap strong { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.snap em { font-size: 10.5px; font-style: normal; color: rgba(255,255,255,.56); }

/* ---------------- 金额输入 ---------------- */
.amount-card { padding: 14px 16px 12px; }
.seg {
  display: flex; background: #EEF2F0; border-radius: 11px; padding: 3px; margin-bottom: 10px;
}
.seg button {
  flex: 1; border: none; background: transparent; padding: 8px 0;
  font-size: 14px; font-weight: 600; color: var(--ink-2); border-radius: 9px;
  transition: .18s; font-family: inherit;
}
.seg button.active { background: #fff; color: var(--expense); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg button.active[data-kind="收入"] { color: var(--income); }

.amount-row {
  width: 100%; display: flex; align-items: baseline; gap: 8px;
  padding: 6px 4px 4px; border: none; background: none; font-family: inherit;
  text-align: left; min-height: 58px; flex-wrap: wrap;
}
.cur { font-size: 24px; font-weight: 500; color: var(--ink-2); }
.amount-view {
  flex: 1; font-size: 38px; font-weight: 600; letter-spacing: .5px;
  color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.2;
  word-break: break-all;
}
.amount-view.is-placeholder { color: #C6CFCB; font-weight: 500; }
.amount-view.income-tone { color: var(--income); }
.expr {
  font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums;
  padding-bottom: 6px; white-space: nowrap;
}
.expr:empty { display: none; }

/* 输入光标 */
.caret {
  display: inline-block; width: 2px; height: 30px; background: var(--primary);
  vertical-align: -4px; margin-left: 2px; animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------------- 快捷模板 ---------------- */
.quick-block {
  position: relative;
  background: var(--card); border-radius: var(--radius);
  padding: 12px 14px 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.quick-block::after {
  content: ''; position: absolute; right: 0; bottom: 14px; top: 36px; width: 30px;
  background: linear-gradient(90deg, rgba(255,255,255,0), #fff 78%);
  border-radius: 0 12px 12px 0; pointer-events: none;
}
.quick-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 10px;
}
.quick-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.quick-row::-webkit-scrollbar { display: none; }
.quick-item {
  flex: none; border: 1px dashed #CFD8D4; background: #FBFCFB;
  border-radius: 12px; padding: 8px 12px; font-family: inherit;
  display: flex; flex-direction: column; gap: 1px; align-items: flex-start;
  min-width: 84px; transition: .15s;
}
.quick-item:active { transform: scale(.96); border-color: var(--primary); }
.quick-item b { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.quick-item span { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.quick-empty {
  font-size: 12.5px; color: var(--muted); padding: 6px 0; line-height: 1.6;
}

/* ---------------- 分类 ---------------- */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cat {
  position: relative;
  border: none; background: #F5F7F6; border-radius: 12px;
  padding: 10px 2px 8px; display: flex; flex-direction: column;
  align-items: center; gap: 4px; font-family: inherit;
  font-size: 12px; color: var(--ink-2); transition: .16s;
}
.cat .ico { font-size: 20px; line-height: 1.1; }
.cat.active {
  background: var(--primary-soft); color: var(--primary); font-weight: 600;
  box-shadow: inset 0 0 0 1.5px var(--primary);
}
.cat:active { transform: scale(.96); }
.cat-add {
  border: 1px dashed #CFD8D4; background: transparent; color: var(--muted);
}
.cat-add .ico { font-size: 18px; color: #A9B5B0; }
.cat-add:active { border-color: var(--primary); color: var(--primary); }
.cat-del {
  position: absolute; top: -5px; right: -5px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--expense); color: #fff; font-size: 12px;
  display: grid; place-items: center; line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}

.emoji-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px;
  margin-bottom: 4px;
}
.emoji {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  font-size: 18px; padding: 7px 0; line-height: 1.25;
  font-family: inherit;
}
.emoji.active { border-color: var(--primary); background: var(--primary-soft); }

/* ---------------- 字段 ---------------- */
.field {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.field:last-child { border-bottom: none; padding-bottom: 2px; }
.field label:not(.date-pick) { width: 40px; flex: none; font-size: 13.5px; color: var(--ink-2); }
.field input[type="date"], .field input[type="text"] {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 14.5px; color: var(--ink); font-family: inherit; min-width: 0;
  text-align: right;
}
.field input[type="text"]::placeholder { color: #BCC5C1; }

.field-date { flex-wrap: wrap; row-gap: 6px; }
.date-quick { display: flex; gap: 6px; flex: 0 1 auto; flex-wrap: nowrap; }
.date-quick button {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 11.5px; padding: 4px 9px; border-radius: 999px; font-family: inherit;
  white-space: nowrap;
}
.date-quick button.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.date-pick {
  position: relative; flex: none; margin-left: auto;
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 5px 10px; font-size: 12px; color: var(--ink-2);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.date-pick svg { color: var(--muted); flex: none; }
.date-pick input[type="date"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; border: none; padding: 0; margin: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; background: transparent;
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; flex: 1; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 12.5px; padding: 5px 11px; border-radius: 999px; font-family: inherit;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* ---------------- 按钮 ---------------- */
.primary-btn {
  display: block; width: 100%; border: none; border-radius: 14px;
  background: var(--primary); color: #fff;
  font-size: 16px; font-weight: 600; padding: 15px 0; font-family: inherit;
  transition: .16s;
}
.primary-btn:active { transform: scale(.985); opacity: .92; }
.primary-btn:disabled { opacity: .5; }
.ghost-wide {
  width: 100%; border: 1px solid var(--line); background: #fff;
  color: var(--expense); font-size: 15px; padding: 14px 0;
  border-radius: 14px; font-family: inherit; margin-top: 4px;
}
.ghost-wide.neutral { color: var(--ink-2); margin-top: 10px; }

.row-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  border: none; background: none; font-family: inherit;
  font-size: 14px; color: var(--ink); padding: 13px 0;
  border-bottom: 1px solid var(--line); text-align: left;
}
.row-btn:last-child { border-bottom: none; padding-bottom: 2px; }
.row-btn i { font-style: normal; color: var(--muted); font-size: 17px; }
.row-btn:active { opacity: .6; }
.row-btn:disabled { opacity: .42; }
.row-btn:disabled i { display: none; }

/* ---------------- 明细 ---------------- */
.search-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.search-input {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: #fff; border-radius: 12px; padding: 9px 12px;
  box-shadow: var(--shadow); color: var(--muted); min-width: 0;
}
.search-input input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 14px; color: var(--ink); min-width: 0;
}
.search-input input::placeholder { color: #B9C3BF; }
.search-input input::-webkit-search-cancel-button,
.search-input input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.q-clear {
  flex: none; border: none; background: #EEF2F0; color: var(--ink-2);
  width: 19px; height: 19px; border-radius: 50%; font-size: 13px;
  line-height: 1; display: grid; place-items: center; padding: 0;
  font-family: inherit;
}
.filter-btn {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 12px; padding: 0 12px; font-family: inherit; font-size: 13px;
  box-shadow: var(--shadow);
}
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.filter-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.filter-tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  border: none; font-family: inherit;
}
.filter-tag i { font-style: normal; opacity: .55; font-size: 13px; }

.filter-group { margin-bottom: 16px; }
.filter-label { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 9px; }
.filter-choices { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-choices .chip { font-size: 12.5px; padding: 6px 12px; }
.amount-range { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.amount-range input {
  flex: 1; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; font-family: inherit; font-size: 14px; outline: none;
  background: #F8FAF9; min-width: 0; color: var(--ink);
}
.amount-range input:focus { border-color: var(--primary); background: #fff; }

.summary-strip {
  display: flex; justify-content: space-between;
  background: var(--primary); color: #fff;
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.summary-strip div { display: flex; flex-direction: column; gap: 3px; }
.summary-strip span { font-size: 11.5px; color: rgba(255,255,255,.66); }
.summary-strip strong { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }

.list-groups { display: flex; flex-direction: column; gap: 12px; }
.day-group { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.day-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 16px 8px; font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.day-head b { color: var(--ink-2); font-weight: 600; font-size: 12.5px; }
.entry {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.entry:last-child { border-bottom: none; }
.entry:active { background: #FAFBFB; }
.e-ico {
  width: 38px; height: 38px; flex: none; border-radius: 11px;
  background: #F2F5F4; display: grid; place-items: center; font-size: 18px;
}
.e-main { flex: 1; min-width: 0; }
.e-main b { display: block; font-size: 14.5px; font-weight: 600; margin-bottom: 2px; }
.e-main span { font-size: 12px; color: var(--muted); display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e-amt { font-size: 15.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.e-amt.income { color: var(--income); }
.e-amt.expense { color: var(--expense); }

.empty { text-align: center; color: var(--muted); font-size: 13.5px; padding: 60px 0; }
.empty .big { font-size: 34px; display: block; margin-bottom: 10px; opacity: .5; }

/* ---------------- 统计 ---------------- */
.stat-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px;
}
.stat-card.wide { grid-column: span 2; }
.stat-card span { font-size: 12px; color: var(--muted); }
.stat-card strong { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-card.balance { background: linear-gradient(135deg, #0F4D3F 0%, #17624F 100%); }
.stat-card.balance span { color: rgba(255,255,255,.66); }
.stat-card.balance strong { color: #fff; font-size: 22px; }
.stat-card.balance em { font-size: 11.5px; color: rgba(255,255,255,.6); font-style: normal; }

.budget-bar { height: 9px; border-radius: 99px; background: #EEF2F0; overflow: hidden; margin: 4px 0 9px; }
.budget-bar i { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width .3s; }
.budget-bar i.warn { background: #D99A2B; }
.budget-bar i.over { background: var(--expense); }
.budget-line { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.budget-line b { color: var(--ink); font-variant-numeric: tabular-nums; }

.cat-stats { display: flex; flex-direction: column; gap: 13px; }
.cs-row { display: flex; flex-direction: column; gap: 6px; }
.cs-top { display: flex; justify-content: space-between; font-size: 13px; }
.cs-top b { font-weight: 500; }
.cs-top span { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 7px; border-radius: 99px; background: #EEF2F0; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--primary); }

.trend { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; height: 132px; padding-top: 6px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 100%; width: 100%; justify-content: center; }
.bars i { width: 9px; border-radius: 4px 4px 0 0; min-height: 2px; }
.bars i.income { background: #34A176; }
.bars i.expense { background: #D87B6E; }
.trend-col span { font-size: 10.5px; color: var(--muted); }
.legend { display: flex; gap: 16px; justify-content: center; margin-top: 12px; font-size: 11.5px; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.dot.income { background: #34A176; }
.dot.expense { background: #D87B6E; }

.acc-stats { display: flex; flex-direction: column; }
.acc-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.acc-row:last-child { border-bottom: none; padding-bottom: 0; }
.acc-row span { color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.acc-row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.acc-row .mini-count { font-size: 11px; color: var(--muted); }

/* ---------------- 我的 ---------------- */
.profile { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-size: 20px; font-weight: 600;
}
.profile-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.profile-info strong { font-size: 16px; }
.profile-info span { font-size: 12.5px; color: var(--muted); }
.kv {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.kv:last-child { border-bottom: none; }
.kv span { color: var(--ink-2); }
.kv strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.kv strong.c-income { color: var(--income); }
.kv strong.c-expense { color: var(--expense); }
.footnote { font-size: 12px; color: var(--muted); text-align: center; margin: 18px 8px 0; line-height: 1.7; }

/* ---------------- 周期账单 ---------------- */
.rec-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.rec-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left; font-family: inherit;
  border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 12px 14px;
}
.rec-item:active { background: #FAFBFB; }
.rec-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rec-main b { font-size: 14.5px; font-weight: 600; }
.rec-main b em {
  font-style: normal; font-size: 11px; color: var(--muted);
  font-weight: 400; background: #F1F4F3; padding: 1px 6px; border-radius: 99px;
}
.rec-main span { font-size: 12px; color: var(--muted); }
.rec-amt { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rec-amt.expense { color: var(--expense); }
.rec-amt.income { color: var(--income); }
.rec-empty { font-size: 13px; color: var(--muted); line-height: 1.8; margin: 0 0 4px; }

/* ---------------- 消费洞察 ---------------- */
.insight { display: flex; flex-direction: column; }
.insight-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-bottom: 1px solid var(--line); gap: 12px;
}
.insight-row:last-child { border-bottom: none; padding-bottom: 0; }
.insight-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.insight-main b { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.insight-main span { font-size: 11.5px; color: var(--muted); }
.insight-row strong { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------- 账单导入 ---------------- */
.imp-help { margin-top: 18px; display: flex; flex-direction: column; gap: 5px; }
.imp-help b { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.imp-help span { font-size: 12px; color: var(--muted); line-height: 1.65; }

.imp-summary { display: flex; gap: 20px; margin-bottom: 8px; }
.imp-summary div { display: flex; flex-direction: column; gap: 2px; }
.imp-summary span { font-size: 11.5px; color: var(--muted); }
.imp-summary strong { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.imp-summary strong.income { color: var(--income); }
.imp-meta { font-size: 12px; color: var(--muted); margin: 0 0 12px; }

.imp-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.imp-row {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.imp-row:last-child { border-bottom: none; }
.imp-date { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; width: 38px; }
.imp-cat { flex: none; background: var(--primary-soft); color: var(--primary); padding: 1px 7px; border-radius: 99px; font-size: 11.5px; }
.imp-note { flex: 1; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-row b { font-variant-numeric: tabular-nums; }
.imp-row b.expense { color: var(--expense); }
.imp-row b.income { color: var(--income); }
.imp-more { padding: 8px 12px; font-size: 12px; color: var(--muted); text-align: center; background: #FAFBFB; }

.imp-progress { margin: 12px 0 0; }
.imp-bar { height: 6px; border-radius: 99px; background: #EEF2F0; overflow: hidden; margin-bottom: 6px; }
.imp-bar i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 99px; transition: width .2s; }
.imp-progress span { font-size: 12px; color: var(--muted); }

/* ---------------- 底部栏 ---------------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  display: flex; background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 9px 0 calc(10px + env(safe-area-inset-bottom));
  z-index: 30;
}
.tab {
  flex: 1; border: none; background: none; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: #A5B0AC; font-size: 10.5px; padding: 2px 0;
  transition: color .16s;
}
.tab.active { color: var(--primary); font-weight: 600; }

/* ---------------- 键盘 ---------------- */
.keypad {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 480px; margin: 0 auto;
  background: #EDF1EF;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -6px 26px rgba(16, 32, 26, .12);
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  z-index: 40;
  transform: translateY(105%);
  transition: transform .24s cubic-bezier(.4,0,.2,1);
}
.keypad.open { transform: translateY(0); }
.kp-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 8px 8px; font-size: 12px; color: var(--muted);
}
.kp-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px;
}
.key {
  border: none; background: #fff; border-radius: 12px;
  font-family: inherit; font-size: 21px; font-weight: 500; color: var(--ink);
  height: 50px; display: grid; place-items: center;
  box-shadow: 0 1px 1px rgba(16,32,26,.06);
  transition: background .1s, transform .08s;
  font-variant-numeric: tabular-nums;
}
.key:active { background: #E3E9E6; transform: scale(.97); }
.key.op { color: var(--primary); font-size: 22px; background: #F4F8F6; }
.key.op:active { background: var(--primary-soft); }
.key.del { background: #F4F8F6; color: var(--ink-2); }
.key.save {
  grid-column: span 3; height: 50px; font-size: 15px; font-weight: 600;
  background: var(--primary); color: #fff; letter-spacing: .3px;
  display: flex; align-items: center; justify-content: center; gap: 2px;
}
.key.save:active { background: #0c3f34; }
.key.save:disabled { opacity: .55; }

/* ---------------- 弹层 ---------------- */
.sheet { position: fixed; inset: 0; z-index: 80; }
.sheet-mask { position: absolute; inset: 0; background: rgba(15, 26, 22, .42); }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 480px; margin: 0 auto;
  background: #fff; border-radius: 22px 22px 0 0;
  padding: 22px 22px calc(22px + env(safe-area-inset-bottom));
  animation: slideUp .24s cubic-bezier(.4,0,.2,1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-body h2 { font-size: 17px; margin: 0 0 8px; font-weight: 600; }
.sheet-body p { font-size: 13px; color: var(--ink-2); line-height: 1.75; margin: 0 0 18px; }
.login-error { color: var(--expense); font-size: 12.5px; min-height: 18px; margin: 10px 0 0; }

.pwd-input {
  width: 100%; font-family: inherit; font-size: 17px;
  border: 1px solid var(--line); border-radius: 13px;
  padding: 14px 16px; margin-bottom: 14px; outline: none;
  background: #F8FAF9; color: var(--ink); letter-spacing: 2px;
  transition: border-color .16s, background .16s;
}
.pwd-input:focus { border-color: var(--primary); background: #fff; }
.pwd-input::placeholder { color: #B9C3BF; letter-spacing: 0; font-size: 15px; }

.edit-grid { display: flex; flex-direction: column; gap: 10px; }
.edit-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.edit-row label { width: 48px; font-size: 13.5px; color: var(--ink-2); flex: none; }
.edit-row input, .edit-row select {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 15px; color: var(--ink); text-align: right;
}
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions button {
  flex: 1; border-radius: 13px; font-family: inherit; font-size: 15px;
  padding: 13px 0; border: none; font-weight: 600;
}
.btn-danger { background: #FBECEA; color: var(--expense); }
.btn-plain { background: #F1F4F3; color: var(--ink-2); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 12px);
  background: rgba(23, 33, 29, .92); color: #fff;
  font-size: 13.5px; padding: 10px 18px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: .22s; z-index: 90;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 520px) {
  body { background: #E8EBEA; }
  #app { box-shadow: 0 0 40px rgba(16, 32, 26, .08); min-height: 100vh; }
}
