/* ─────────────────────────────────────────────────────────────
   iOS 风格基线
   · 17pt 正文 / 34pt 大标题 / 44pt 最小触控
   · 分组列表：白卡片 + 内缩 0.5px 分割线
   · 底部标签栏：毛玻璃 + 安全区内边距
   ───────────────────────────────────────────────────────────── */
:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #000000;
  --muted: #8e8e93;
  --muted-weak: rgba(142, 142, 147, 0.16);
  --line: #e5e5ea;
  --separator: #c6c6c8;
  --accent: #007aff;
  --accent-fg: #ffffff;
  --accent-weak: rgba(0, 122, 255, 0.12);
  --out: #ff3b30;
  --in: #34c759;
  --warn: #ff9500;
  --warn-weak: rgba(255, 149, 0, 0.14);
  --transfer: #5856d6;
  --refund: #ff9500;
  --tabbar: rgba(249, 249, 249, 0.92);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #ffffff;
    --muted: #8e8e93;
    --muted-weak: rgba(142, 142, 147, 0.24);
    --line: #38383a;
    --separator: #38383a;
    --accent: #0a84ff;
    --accent-fg: #ffffff;
    --accent-weak: rgba(10, 132, 255, 0.18);
    --out: #ff453a;
    --in: #30d158;
    --warn: #ff9f0a;
    --warn-weak: rgba(255, 159, 10, 0.16);
    --transfer: #5e5ce6;
    --refund: #ff9f0a;
    --tabbar: rgba(28, 28, 30, 0.92);
  }
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  max-width: 640px;
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
  overscroll-behavior-y: contain;
}

/* 给底部标签栏留位置 */
#app { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }

/* 屏幕阅读器专用 */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.loading { padding: 80px 20px; color: var(--muted); text-align: center; }

/* ── 口令页 ─────────────────────────────────────────────── */
.gate { padding: 88px 24px 0; }
.gate-title { font-size: 34px; font-weight: 700; letter-spacing: -0.6px; }
.gate-sub { color: var(--muted); font-size: 15px; margin: 6px 0 22px; line-height: 1.5; }
.gate input {
  width: 100%;
  padding: 15px 16px;
  border: 0;
  background: var(--card);
  color: var(--text);
  border-radius: 12px;
  font-size: 17px;
  font-family: inherit;
  text-align: center;
  margin-bottom: 10px;
}
.gate input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.gate-tip { color: var(--muted); font-size: 13px; margin-top: 16px; line-height: 1.6; }

/* ── 顶部：大标题 + 分段控件 ─────────────────────────────── */
.hd {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 10px 16px 4px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}
.hd .title {
  flex: 1;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.6px;
  line-height: 1.15;
}
.hd .month { flex: 1; text-align: center; font-weight: 600; font-size: 17px; }

.nav {
  min-width: 44px; height: 44px;
  border: 0; background: transparent;
  color: var(--accent);
  font-size: 22px; line-height: 1;
  border-radius: 10px;
  cursor: pointer;
}
.nav:disabled { color: var(--separator); }
.nav.ghost { color: var(--accent); font-size: 17px; font-weight: 500; }
.nav:active { opacity: 0.5; }

/* 月份分段控件 */
.seg {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 16px 12px;
  padding: 2px;
  border-radius: 9px;
  background: var(--muted-weak);
}
.seg button {
  width: 38px; height: 30px;
  border: 0; background: transparent;
  color: var(--accent);
  font-size: 17px; line-height: 1;
  border-radius: 7px;
  cursor: pointer;
}
.seg button:disabled { color: var(--separator); }
.seg .label {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
}

/* ── 汇总卡 ─────────────────────────────────────────────── */
.summary {
  margin: 0 16px 12px;
  padding: 14px 16px;
  background: var(--card);
  border-radius: 14px;
}
.summary .cap { color: var(--muted); font-size: 13px; }
.summary .big {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -1.2px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  margin-top: 2px;
}
.summary .sub { color: var(--muted); font-size: 13px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.summary .sub .neg { color: var(--out); font-weight: 600; }
.summary .sub .pos { color: var(--in); }

/* ── 分类占比 ───────────────────────────────────────────── */
.bars-title { padding: 0 20px 6px; color: var(--muted); font-size: 13px; }
.bars { padding: 0 20px 14px; display: flex; flex-direction: column; gap: 8px; }
.bars:empty { display: none; }
.bar-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  cursor: pointer; border: 0; background: transparent;
  padding: 2px 0; text-align: left; color: inherit; width: 100%;
  font-family: inherit;
}
.bar-row.on .bar-label { color: var(--accent); font-weight: 600; }
.bar-label { width: 52px; color: var(--muted); flex-shrink: 0; }
.bar-track { flex: 1; height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar-val { width: 40px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* ── 搜索栏（iOS 灰底圆角 + 放大镜） ─────────────────────── */
.search { padding: 0 16px 10px; position: relative; }
.search::before {
  content: "⌕";
  position: absolute;
  left: 28px; top: 50%;
  transform: translateY(-58%);
  color: var(--muted);
  font-size: 18px;
  pointer-events: none;
}
.search input::placeholder { color: rgba(60, 60, 67, 0.55); opacity: 1; }
@media (prefers-color-scheme: dark) {
  .search input::placeholder { color: rgba(235, 235, 245, 0.55); }
}
.search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 0;
  border-radius: 10px;
  background: var(--muted-weak);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  -webkit-appearance: none;
}
.search input:focus { outline: none; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ── 按钮 ──────────────────────────────────────────────── */
.actions { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 10px; }
button.primary, button.secondary {
  width: 100%;
  min-height: 50px;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
button.primary { background: var(--accent); color: var(--accent-fg); }
button.secondary { background: var(--card); color: var(--accent); }
button.primary:active, button.secondary:active { opacity: 0.72; transform: scale(0.99); }
button:disabled { opacity: 0.4; cursor: default; }

/* ── 分组列表 ──────────────────────────────────────────── */
.list { background: var(--card); border-radius: 14px; margin: 0 16px; overflow: hidden; }
.list .pad { padding: 18px 16px; }
.row {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px;
  padding: 10px 16px;
  position: relative;
  cursor: pointer;
}
.row::after {
  content: "";
  position: absolute;
  left: 16px; right: 0; bottom: 0;
  height: 0.5px;
  background: var(--separator);
}
.row:last-child::after { display: none; }
.row:active { background: var(--muted-weak); }
.row-main { flex: 1; min-width: 0; }
.row-title {
  font-size: 17px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.row-amt {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 17px;
  white-space: nowrap;
  flex-shrink: 0;
}
.row-amt.out { color: var(--text); }
.row-amt.in { color: var(--in); }
.row-amt.transfer { color: var(--transfer); }
.row-amt.refund { color: var(--refund); }
.row-del {
  width: 32px; height: 32px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer;
  flex-shrink: 0;
}
.row-del:active { background: var(--line); }
.type-tag {
  display: inline-block; font-size: 11px; color: var(--muted);
  border: 1px solid var(--separator); border-radius: 5px;
  padding: 0 4px; margin-left: 5px;
}

.more-row {
  display: block;
  width: calc(100% - 32px);
  min-height: 46px;
  margin: 10px 16px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  color: var(--accent);
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
}
.more-row:active { opacity: 0.6; }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 16px 8px; line-height: 1.6; }
.foot button { border: 0; background: transparent; color: var(--muted); font: inherit; padding: 6px; cursor: pointer; }
.foot .bad { color: var(--out); }

/* ── 确认页 / 编辑页 ───────────────────────────────────── */
.pad { padding: 0 16px 12px; }
.card {
  background: var(--card);
  border-radius: 14px;
  margin: 0 16px 12px;
  padding: 14px 16px;
}
.card.warn-card { box-shadow: inset 0 0 0 2px var(--warn); }
.card-head { display: flex; align-items: center; gap: 4px; }
.card-head .cny { color: var(--muted); font-size: 22px; font-weight: 500; }
.amount {
  flex: 1; min-width: 0;
  border: 0; background: transparent;
  color: var(--text);
  font-size: 34px; font-weight: 700;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  padding: 2px 0;
  font-family: inherit;
}
.amount:focus { outline: none; }
.card-head .del {
  border: 0; background: transparent;
  color: var(--muted); font-size: 15px;
  padding: 10px 4px; cursor: pointer; min-height: 40px;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 6px; }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  cursor: pointer;
  min-height: 36px;
  font-family: inherit;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }

.field {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px;
  padding: 6px 0;
  border-top: 0.5px solid var(--separator);
}
.field:first-of-type { border-top: 0; }
.field span { width: 58px; color: var(--muted); font-size: 16px; flex-shrink: 0; }
.field input, .field select {
  flex: 1; min-width: 0;
  border: 0; background: transparent;
  color: var(--text); font-size: 17px;
  padding: 8px 0;
  font-family: inherit;
  -webkit-appearance: none;
}
.field input:focus, .field select:focus { outline: none; }
.field input[type="date"], .field input[type="time"] { min-height: 40px; }

/* ── 文本杂项 ──────────────────────────────────────────── */
.tiny { font-size: 13px; line-height: 1.5; padding-top: 6px; }
.tag-mem {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-weak);
  border-radius: 6px;
  padding: 2px 7px;
  margin-left: 8px;
}
.muted { color: var(--muted); }
.warn-text { color: var(--warn); }
.msg-warn {
  background: var(--warn-weak);
  color: var(--warn);
  font-size: 14px;
  border-radius: 12px;
  padding: 11px 14px;
  margin: 0 16px 10px;
  line-height: 1.5;
}
.ok { color: var(--in); font-weight: 600; }
.bad { color: var(--out); font-weight: 600; }

.evidence {
  margin: 6px 0 2px;
  padding: 9px 11px;
  background: var(--warn-weak);
  border-radius: 10px;
  color: var(--warn);
  font-size: 13px;
  line-height: 1.55;
}
.evidence b { font-variant-numeric: tabular-nums; }
.badge {
  display: inline-block;
  font-size: 11px;
  border-radius: 6px;
  padding: 1px 7px;
  margin-left: 6px;
  background: var(--accent-weak);
  color: var(--accent);
  vertical-align: middle;
}
.badge.warn { background: var(--warn-weak); color: var(--warn); }

/* ── 查看原图 ──────────────────────────────────────────── */
.image-entry { margin: 0 16px 10px; }
.image-entry button {
  width: 100%; min-height: 46px;
  border: 0; border-radius: 12px;
  background: var(--card); color: var(--accent);
  font-size: 16px; font-family: inherit; cursor: pointer;
}
.image-viewer {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 70;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.image-viewer[hidden] { display: none; }
.image-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.image-viewer .close {
  position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 12px;
  width: 44px; height: 44px; border: 0; border-radius: 22px;
  background: rgba(255, 255, 255, 0.18); color: #fff; font-size: 24px; cursor: pointer;
}

/* ── 保存结果面板 ──────────────────────────────────────── */
.result-card {
  margin: 0 16px 12px;
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
}
.result-title { font-weight: 700; font-size: 17px; margin-bottom: 6px; }
.result-line { font-size: 14px; color: var(--muted); margin: 3px 0; }
.result-line .ok, .result-line .bad { font-weight: 600; }
.result-fail { margin-top: 10px; border-top: 0.5px solid var(--separator); padding-top: 10px; }
.result-fail .item { font-size: 14px; padding: 4px 0; line-height: 1.5; }
.result-fail .why { color: var(--warn); }
.result-actions { display: flex; gap: 8px; margin-top: 12px; }
.result-actions button {
  flex: 1; min-height: 46px; border-radius: 12px; border: 0;
  font-size: 16px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.result-actions .retry { background: var(--accent); color: var(--accent-fg); }
.result-actions .done { background: var(--accent-weak); color: var(--accent); }

/* ── 底部标签栏 ────────────────────────────────────────── */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  max-width: 640px;
  margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--tabbar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
  z-index: 30;
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 50px;
  color: var(--muted);
  text-decoration: none;
  font-size: 10px;
  cursor: pointer;
}
.tabbar a.on { color: var(--accent); }
.tabbar svg { width: 25px; height: 25px; display: block; }
.tabbar a:active { opacity: 0.55; }

/* ── 覆盖层 / 提示 ─────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  z-index: 50;
  color: #fff;
  padding: 24px;
}
.overlay[hidden] { display: none; }
.spinner {
  width: 30px; height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.overlay-text { font-size: 15px; text-align: center; }
.overlay-cancel {
  margin-top: 6px; min-width: 120px; min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.14);
  color: #fff; border-radius: 12px; font-size: 16px; font-family: inherit; cursor: pointer;
}

/* 识别失败重试条 */
.retry-bar {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(env(safe-area-inset-bottom) + 62px);
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border-radius: 14px;
  padding: 11px 13px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  z-index: 40;
}
.retry-msg { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.retry-btn {
  flex-shrink: 0; border: 0; background: var(--accent); color: var(--accent-fg);
  font-size: 15px; font-weight: 600; padding: 9px 15px; border-radius: 10px;
  cursor: pointer; min-height: 38px; font-family: inherit;
}
.retry-x {
  flex-shrink: 0; border: 0; background: transparent; color: var(--muted);
  font-size: 20px; line-height: 1; padding: 4px; cursor: pointer;
  min-width: 38px; min-height: 38px;
}

/* 轻提示 */
.toast {
  position: fixed;
  left: 50%; bottom: calc(env(safe-area-inset-bottom) + 72px);
  transform: translateX(-50%);
  max-width: 88vw;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 14px;
  z-index: 60;
  text-align: center;
  line-height: 1.45;
  backdrop-filter: blur(10px);
}
.toast[hidden] { display: none; }

/* 长按不选文字，手感更接近原生 */
.row-title, .row-sub, .hd .title, .summary .big, .tabbar a, .chip, .bar-row {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  button.primary:active, button.secondary:active { transform: none; }
}

/* ═════════════════════════════════════════════════════════
   iOS 原生化：导航栏 / 分段控件 / 标签栏 / 操作面板 / 滑动删除
   目标机型 iPhone 16 Pro Max（440×956pt，安全区 62/34）
   ═════════════════════════════════════════════════════════ */

/* 主屏滚动容器：只有显示标签栏时才给它让位 */
#app { padding-bottom: env(safe-area-inset-bottom); }
body.has-tab #app { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }

/* ── 导航栏：大标题在左，操作图标在右 ───────────────────── */
.hd {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 12px 4px;
  min-height: 48px;
  background: var(--bg);
}
.hd .title {
  flex: 1;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.7px;
  line-height: 1.1;
  padding-left: 4px;
}
/* 二级页标题（居中、17pt 半粗），左右各留一个 44pt 位 */
.hd .title.mid {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0;
  text-align: center;
  padding-left: 0;
}
.hd .txt-btn {
  min-width: 44px; height: 44px;
  border: 0; background: transparent;
  color: var(--accent);
  font-size: 17px; font-family: inherit;
  padding: 0 8px;
  border-radius: 10px;
  cursor: pointer;
}
.hd .txt-btn:active { opacity: 0.45; }
.hd .txt-btn.strong { font-weight: 600; }
.nav-ico {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; background: transparent;
  color: var(--accent);
  border-radius: 22px;
  cursor: pointer;
}
.nav-ico svg { width: 22px; height: 22px; display: block; }
.nav-ico:active { background: var(--muted-weak); }
.nav-ico:disabled { color: var(--separator); }

/* ── 月份分段控件（贴边、等宽、拇指友好） ───────────────── */
.seg {
  margin: 0 16px 12px;
  height: 36px;
  padding: 2px;
  border-radius: 10px;
  background: var(--muted-weak);
  display: flex;
  align-items: center;
  gap: 2px;
}
.seg button {
  width: 44px; height: 32px;
  border: 0; background: transparent;
  color: var(--accent);
  font-size: 20px; line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  display: grid; place-items: center;
}
.seg button:active:not(:disabled) { background: var(--card); }
.seg button:disabled { color: var(--separator); }
.seg .label {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
}

/* ── 汇总卡：数值 + 占比条装在同一张卡片里 ─────────────── */
.summary { padding: 16px 16px 12px; }
.summary .cap { font-size: 13px; color: var(--muted); }
.summary .bars-title {
  padding: 14px 0 8px;
  margin-top: 12px;
  border-top: 0.5px solid var(--separator);
}
.summary .bars { padding: 0; gap: 10px; }
.summary .bars:empty,
.summary .bars-title:has(+ .bars:empty) { display: none; }

/* ── 标签栏：3 个位，中间凸起的 ＋ ─────────────────────── */
.tabbar .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 50px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.tabbar .tab svg { width: 24px; height: 24px; display: block; }
.tabbar .tab.on { color: var(--accent); }
.tabbar .tab:active { opacity: 0.5; }
.tabbar .tab-add { flex: 0 0 72px; }
.tabbar .tab-add > span {
  width: 42px; height: 42px;
  margin-top: -10px;
  border-radius: 21px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.34);
}
.tabbar .tab-add svg { width: 24px; height: 24px; stroke: #fff; }
.tabbar .tab-add:active > span { transform: scale(0.94); }

/* ── 操作面板（底部上滑卡片） ──────────────────────────── */
.sheet { position: fixed; inset: 0; z-index: 45; }
.sheet[hidden] { display: none; }
.sheet-bg {
  position: absolute; inset: 0;
  border: 0; padding: 0;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: sheetFade 0.18s ease-out;
}
.sheet-panel {
  position: absolute;
  left: 8px; right: 8px;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: sheetUp 0.26s cubic-bezier(0.32, 0.72, 0, 1);
}
/* 一组操作放在同一张卡片里，行间 0.5px 分割线（iOS 操作表的样子） */
.sheet-group {
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.sheet-item, .sheet-cancel {
  width: 100%;
  min-height: 57px;
  border: 0;
  border-radius: 0;
  background: var(--card);
  color: var(--accent);
  font-size: 20px;
  font-family: inherit;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.sheet-item + .sheet-item {
  border-top: 0.5px solid var(--separator);
}
.sheet-item:active, .sheet-cancel:active { background: var(--muted-weak); }
.sheet-cancel {
  border-radius: 14px;
  font-weight: 600;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
@keyframes sheetUp { from { transform: translateY(110%); } to { transform: translateY(0); } }
@keyframes sheetFade { from { opacity: 0; } to { opacity: 1; } }

/* ── 列表行：圆形分类图标 + 左滑删除 ───────────────────── */
.list { background: transparent; border-radius: 0; margin: 0 16px; overflow: visible; }
.row-wrap { position: relative; background: var(--card); overflow: hidden; }
.row-wrap:first-child { border-radius: 14px 14px 0 0; }
.row-wrap:last-child { border-radius: 0 0 14px 14px; }
.row-wrap:only-child { border-radius: 14px; }
.row-wrap .row { background: var(--card); transition: transform 0.2s ease; }
.row-ico {
  width: 34px; height: 34px;
  border-radius: 17px;
  background: var(--accent-weak);
  color: var(--accent);
  display: grid; place-items: center;
  font-size: 17px;
  flex-shrink: 0;
}
.row-del-action {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 88px;
  border: 0;
  background: var(--out);
  color: #fff;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
}
/* 行尾的 × 换成 iOS 的 ›，删除交给左滑 */
.row-del { display: none; }
.row-chev { color: var(--muted); opacity: 0.55; font-size: 17px; flex-shrink: 0; padding-left: 2px; }

/* ── 设置页：分组列表 ─────────────────────────────────── */
.sect {
  padding: 18px 20px 7px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.2px;
}
.list button.row {
  width: 100%;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-align: left;
  color: inherit;
}
.list button.row:active { background: var(--muted-weak); }
.chev { color: var(--separator); font-size: 18px; line-height: 1; flex-shrink: 0; }
.card .row + .row { border-top: 0.5px solid var(--separator); }
.card .row:first-child { border-top: 0; }

/* ═════════════════════════════════════════════════════════
   大胆版视觉层：渐变主卡 + 环形图 + 分类色 + 日期分组
   （覆盖上面的保守样式，iOS 骨架不变）
   ═════════════════════════════════════════════════════════ */
:root {
  /* iOS 系统色（与深色模式各自的 systemBlue / systemTeal 对齐） */
  --brand-1: #007aff;
  --brand-2: #34aadc;
  --brand-3: #5ac8fa;
  --hero: linear-gradient(135deg, #0a84ff 0%, #2f9bff 52%, #5ac8fa 100%);
  --hero-shadow: 0 18px 38px -18px rgba(10, 132, 255, 0.55);
  --sheet: rgba(255, 255, 255, 0.86);
  --sheet-solid: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand-1: #0a84ff;
    --brand-2: #409cff;
    --hero: linear-gradient(135deg, #0a5ec7 0%, #0a74e0 55%, #128fd1 100%);
    --hero-shadow: 0 18px 38px -18px rgba(0, 0, 0, 0.8);
    --sheet: rgba(38, 38, 42, 0.88);
    --sheet-solid: #1c1c1e;
  }
}

.hd { padding: 4px 12px 0; }
.hd .title { font-size: 32px; font-weight: 700; letter-spacing: -0.8px; }

/* ── 主卡：渐变底 + 大数字 + 环形图 ─────────────────── */
.hero {
  position: relative;
  margin: 4px 16px 12px;
  padding: 15px 16px 14px;
  border-radius: 24px;
  background: var(--hero);
  color: #fff;
  box-shadow: var(--hero-shadow);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -46px; top: -60px;
  width: 190px; height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0) 68%);
  pointer-events: none;
}
.hero .cap {
  font-size: 13px;
  letter-spacing: 0.4px;
  color: rgba(255, 255, 255, 0.82);
  display: flex;
  align-items: center;
  gap: 6px;
}
.hero .num {
  margin-top: 1px;
  font-size: 38px;
  font-weight: 750;
  line-height: 1.06;
  letter-spacing: -1.6px;
  font-variant-numeric: tabular-nums;
}
.hero .num small { font-size: 22px; font-weight: 600; letter-spacing: 0; opacity: 0.85; margin-right: 2px; }
.hero .pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.hero .pill {
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hero .pill b { font-weight: 700; letter-spacing: 0; }
.hero .pill.up { background: rgba(255, 255, 255, 0.34); }

.hero .charts { display: flex; align-items: center; gap: 14px; margin-top: 13px; }
.ring { flex: 0 0 auto; width: 92px; height: 92px; position: relative; }
.ring svg { display: block; width: 92px; height: 92px; }
.ring .rt {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 11px; color: rgba(255, 255, 255, 0.72);
  line-height: 1.2;
}
.ring .rt b { font-size: 16px; color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; }

.legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.legend button {
  display: flex; align-items: center; gap: 8px;
  border: 0; background: transparent; color: #fff;
  font-size: 13px; font-family: inherit; padding: 0;
  text-align: left; cursor: pointer;
  border-radius: 6px;
}
.legend .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.legend .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .pc {
  min-width: 34px;
  text-align: right;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.legend button.on .nm { font-weight: 700; }
.legend button.on .pc { color: #fff; }

.hero .budget { margin-top: 12px; }
.hero .budget .bt {
  display: flex; justify-content: space-between;
  font-size: 12px; color: rgba(255, 255, 255, 0.78);
  margin-bottom: 6px; font-variant-numeric: tabular-nums;
}
.hero .budget .track { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.22); overflow: hidden; }
.hero .budget .fill { height: 100%; border-radius: 4px; background: #fff; transition: width 0.5s cubic-bezier(0.32, 0.72, 0, 1); }
.hero .budget.over .fill { background: #ffd60a; }

/* ── 分类筛选 chips ───────────────────────────────── */
.chips-row {
  display: flex; gap: 8px;
  padding: 0 16px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chips-row::-webkit-scrollbar { display: none; }
.chips-row:empty { display: none; }
.cf {
  flex: 0 0 auto;
  border: 0;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-family: inherit;
  box-shadow: inset 0 0 0 0.5px var(--separator);
  cursor: pointer;
}
.cf.on { background: var(--brand-1); color: #fff; box-shadow: none; }
.cf:active { opacity: 0.75; }

/* ── 日期分组 ─────────────────────────────────────── */
.dhead {
  display: flex; align-items: baseline; gap: 8px;
  padding: 14px 26px 7px 20px;
  font-size: 13px; font-weight: 700;
  color: rgba(60, 60, 67, 0.72);
  letter-spacing: 0.3px;
}
.dhead .sum {
  margin-left: auto;
  font-weight: 600;
  color: var(--text);
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}
.group { margin-bottom: 4px; }
.group .list { margin-bottom: 0; }

/* ── 行：分类色气泡 + 更松的高度 ─────────────────── */
.row { min-height: 62px; padding: 11px 16px; }
.row-ico {
  width: 38px; height: 38px;
  border-radius: 19px;
  font-size: 15px;
  font-weight: 700;
  background: var(--accent-weak);
  color: var(--accent);
  letter-spacing: 0;
}
.row-title { font-size: 16.5px; font-weight: 500; }
.row-amt { font-size: 16.5px; font-weight: 600; }

/* ── 空状态 ───────────────────────────────────────── */
.empty { padding: 46px 28px 30px; text-align: center; color: var(--muted); }
.empty .em { font-size: 44px; line-height: 1; margin-bottom: 12px; }
.empty .t { font-size: 15px; line-height: 1.6; }
.empty button {
  margin-top: 16px;
  border: 0; border-radius: 999px;
  padding: 12px 22px;
  background: var(--brand-1); color: #fff;
  font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer;
}
.empty button:active { opacity: 0.8; }

/* ── 标签栏中间按钮：用主色渐变 ─────────────────── */
.tabbar .tab-add > span { background: var(--hero); box-shadow: 0 6px 18px -6px rgba(10, 132, 255, 0.55); }

/* ── 操作面板：毛玻璃 + 更贴系统 ─────────────────── */
.sheet-group, .sheet-cancel, .sheet-item {
  background: var(--sheet);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}
.sheet-group { border-radius: 16px; }
.sheet-cancel { border-radius: 16px; }
.sheet-item, .sheet-cancel { min-height: 58px; font-size: 19px; }
.sheet-item + .sheet-item { border-top: 0.5px solid rgba(60, 60, 67, 0.22); }
.sheet-cancel { font-weight: 700; }

/* ── 下拉刷新 ─────────────────────────────────────── */
.ptr {
  height: 0;
  overflow: hidden;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  transition: height 0.18s ease;
}
.ptr.on { height: 44px; line-height: 44px; }

/* ── 数字滚动（首屏出现时） ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hero .budget .fill { transition: none; }
}


/* 深色下给卡片一圈极细的边，避免和纯黑背景糊成一块 */
@media (prefers-color-scheme: dark) {
  .row-wrap, .list, .card { box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.07); }
  .row::after { background: rgba(255, 255, 255, 0.1); }
}


/* ── 设置页：内嵌分组卡片 ─────────────────────────── */
.cardlist {
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
  margin: 0 16px;
}
.cardlist .row { min-height: 54px; padding: 12px 16px; }
.cardlist .row + .row { border-top: 0; }
.cardlist .chev { margin-left: 2px; }
.sect { padding: 22px 20px 8px; }
.row-sub { line-height: 1.38; }


/* ── 深色模式收尾：占位符、标签、箭头亮度 ─────────── */
.search input::placeholder { color: rgba(60, 60, 67, 0.62); opacity: 1; }
@media (prefers-color-scheme: dark) {
  .search input::placeholder { color: rgba(235, 235, 245, 0.62); }
  .search input { background: rgba(118, 118, 128, 0.24); }
  .cf { color: rgba(235, 235, 245, 0.92); background: rgba(28, 28, 30, 0.9); }
  .cf.on { color: #fff; background: var(--brand-1); }
  .seg button:not(:disabled) { color: #0a84ff; }
  .hero::after { opacity: 0.45; }
  .tabbar .tab { color: rgba(235, 235, 245, 0.55); }
  .tabbar .tab.on { color: #0a84ff; }
  .dhead { color: rgba(235, 235, 245, 0.6); }
}


/* 操作面板：文字用品牌色，配线性图标 */
.sheet-item { color: var(--brand-1); }
@media (prefers-color-scheme: dark) { .sheet-item { color: #0a84ff; } }
.sheet-item .si { width: 21px; height: 21px; flex-shrink: 0; opacity: 0.9; }


/* ═════════════════════════════════════════════════════════
   B 版：白卡 + 黑数字（iOS 自带「健康 / 钱包」那种排法）
   渐变只留给底部 ＋ 和选中态，主卡回归素色
   ═════════════════════════════════════════════════════════ */
.hero {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), inset 0 0 0 0.5px rgba(0, 0, 0, 0.05);
}
.hero::after { display: none; }
.hero .cap { color: var(--muted); }
.hero .num { color: var(--text); }
.hero .num small { color: var(--muted); opacity: 1; }
.hero .pill {
  background: rgba(118, 118, 128, 0.12);
  color: var(--text);
}
.hero .pill b { color: var(--text); }
.hero .pill.up { background: rgba(118, 118, 128, 0.18); }
.hero .charts {
  margin-top: 0;
  padding-top: 13px;
  border-top: 0.5px solid var(--separator);
}
.hero .charts { margin-top: 13px; }
.hero .ring .rt { color: var(--muted); }
.hero .ring .rt b { color: var(--text); }
.hero .legend button { color: var(--text); }
.hero .legend .pc { color: var(--muted); font-weight: 600; }
.hero .legend .dot { box-shadow: none; }
.hero .budget .bt { color: var(--muted); }
.hero .budget .track { background: rgba(118, 118, 128, 0.18); }
.hero .budget .fill { background: var(--accent); }
.hero .budget.over .fill { background: var(--warn); }
@media (prefers-color-scheme: dark) {
  .hero { box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.08); }
}


/* ── B 版收尾：浅色下的对比度与呼吸感 ─────────────── */
.tabbar .tab { color: #6b6b72; }
@media (prefers-color-scheme: dark) { .tabbar .tab { color: rgba(235, 235, 245, 0.55); } }

.hero .legend .dot { box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.12); }
@media (prefers-color-scheme: dark) { .hero .legend .dot { box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.18); } }

.hero .charts { border-top-color: rgba(60, 60, 67, 0.16); }
@media (prefers-color-scheme: dark) { .hero .charts { border-top-color: rgba(255, 255, 255, 0.12); } }

.hero .ring .rt { font-size: 10px; gap: 1px; }
.hero .ring .rt b { font-size: 17px; }

.search input::placeholder { color: rgba(60, 60, 67, 0.7); }

.chips-row { padding-right: 20px; scroll-padding-left: 16px; }

.dhead { padding-top: 16px; }
