/* 记账本 · 手机视图（基于 tokens.css 苹果式简约设计语言） */
:root {
  --app-w: 480px;
  --tabbar-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

html, body { background: var(--bg); }
body { font-size: 15px; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button { background: none; border: 0; padding: 0; }
button:disabled { opacity: 0.35; cursor: default; }
.sr-only { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }
.block { width: 100%; }
.ico { display: inline-flex; }

#app { position: relative; max-width: var(--app-w); margin: 0 auto; height: 100dvh; background: var(--bg); overflow: hidden; }
@media (min-width: 560px) {
  body { background: var(--fill); }
  #app { box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(0, 0, 0, 0.08); }
}

.screen { flex: 1; overflow-y: auto; overflow-x: hidden; padding: calc(var(--safe-t) + 8px) 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); scrollbar-width: none; }
.screen::-webkit-scrollbar { display: none; }
.page.enter { animation: riseIn 0.32s var(--ease-out); }

/* ---------- 页面头部 ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; margin-bottom: 6px; }
.page-title { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -0.03em; }
.month-btn { display: inline-flex; align-items: center; gap: 4px; font-size: 24px; font-weight: 600; letter-spacing: -0.03em; padding: 6px 0; }
.month-btn .ico { color: var(--text-3); margin-top: 3px; }
.tb-round { width: 38px; height: 38px; border-radius: 50%; background: var(--panel); box-shadow: var(--shadow-card); display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); transition: transform 0.15s; }
.tb-round:active { transform: scale(0.92); }

/* ---------- 卡片 ---------- */
.card { background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.card + .card, .card + .quick, .quick + .day-group, .card + .day-group { margin-top: 14px; }
.card-title { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.card-sub { font-size: 13px; font-weight: 500; color: var(--text-3); margin: 18px 0 6px; }
.muted { color: var(--text-3); }

/* 月度概览 */
.summary { padding: 20px 20px 18px; }
.sum-label { font-size: 13px; font-weight: 500; color: var(--text-3); }
.sum-big { font-size: 38px; font-weight: 600; letter-spacing: -0.035em; margin: 4px 0 14px; line-height: 1.1; }
.sum-row { display: flex; gap: 28px; }
.sum-row > div { display: flex; flex-direction: column; gap: 2px; }
.sum-row span { font-size: 12px; }
.sum-row b { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.sum-budget { margin-top: 16px; display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: var(--text-2); }
.sum-budget span.over { color: var(--danger); }

.bar { height: 6px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width 0.5s var(--ease-out); }
.bar i.over { background: var(--danger); }

/* 快捷入口 */
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px 12px; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow-card); font-size: 13px; font-weight: 500; color: var(--text); transition: transform 0.15s; }
.quick-btn:active { transform: scale(0.96); }
.quick-ico { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); }

/* ---------- 记录列表 ---------- */
.day-group { margin-top: 18px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 6px 8px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.day-sum { color: var(--text-3); font-weight: 400; font-size: 12px; white-space: pre; }
.tx-card { padding: 4px 0; overflow: hidden; }
.tx-row { position: relative; width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 16px; text-align: left; transition: background 0.12s; }
.tx-row:active { background: var(--hover); }
.tx-row + .tx-row::before { content: ''; position: absolute; top: 0; left: 66px; right: 0; height: 1px; background: var(--line); }
.tx-main { flex: 1; min-width: 0; }
.tx-title { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 500; }
.tx-badge { display: inline-flex; color: var(--text-3); }
.tx-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-right { text-align: right; flex-shrink: 0; }
.tx-amount { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.tx-amount.income { color: var(--success); }
.tx-orig { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.cat-tile { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 30%; background: var(--fill); color: var(--text-2); transition: background 0.15s, color 0.15s, transform 0.2s var(--spring); }
.cat-tile.active { background: var(--primary); color: #fff; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 56px 20px; color: var(--text-3); font-size: 14px; text-align: center; }
.empty .ico { opacity: 0.6; margin-bottom: 4px; }
.empty-hint { font-size: 13px; color: var(--text-4); max-width: 260px; line-height: 1.5; }
.empty.small { padding: 24px 12px; font-size: 13px; }

/* ---------- 底部标签栏 ---------- */
.tabbar { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--panel); box-shadow: 0 -1px 0 var(--line); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; z-index: 10; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 500; color: var(--text-3); height: 100%; justify-content: center; transition: color 0.15s; }
.tab.active { color: var(--primary); }
.tab:active .ico { transform: scale(0.88); }
.tab .ico { transition: transform 0.2s var(--spring); }
.fab { justify-self: center; width: 54px; height: 54px; margin-top: -26px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0, 113, 227, 0.32), 0 0 0 5px var(--bg); transition: transform 0.2s var(--spring), background 0.15s; }
.fab:hover { background: var(--primary-hover); }
.fab:active { transform: scale(0.9) rotate(90deg); }

/* ---------- 分段控件 ---------- */
.seg { display: inline-flex; padding: 3px; border-radius: 99px; background: var(--fill); }
.seg button { height: 30px; padding: 0 16px; border-radius: 99px; color: var(--text-2); font-weight: 500; font-size: 14px; transition: background 0.18s, color 0.18s, box-shadow 0.18s; white-space: nowrap; }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.seg-sm button { height: 26px; padding: 0 12px; font-size: 13px; }
.seg-wide { display: flex; }
.seg-wide button { flex: 1; }
:root[data-theme='dark'] .seg button.active { background: #636366; }

/* ---------- 按钮补充 ---------- */
.btn-lg { height: 48px; font-size: 16px; border-radius: 99px; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-danger { background: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.4; transform: none; }
.icon-btn.danger { color: var(--danger); }
.icon-btn:disabled { opacity: 0.3; }

/* ---------- 底部弹层 ---------- */
.sheet-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fadeIn 0.2s ease-out; }
.sheet-overlay.closing { animation: fadeOut 0.22s ease-in forwards; }
.sheet-overlay.closing .sheet { animation: sheetDown 0.22s ease-in forwards; }
.sheet { position: absolute; left: 50%; bottom: 0; width: min(100%, var(--app-w)); translate: -50% 0; max-height: calc(100dvh - var(--safe-t) - 40px); background: var(--bg); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; animation: sheetUp 0.36s var(--ease-out); transition: transform 0.25s var(--ease-out); padding-bottom: var(--safe-b); }
.sheet-full { height: calc(100dvh - var(--safe-t) - 40px); }
.sheet-grip { width: 38px; height: 5px; border-radius: 99px; background: var(--text-4); opacity: 0.5; margin: 8px auto 0; flex-shrink: 0; cursor: grab; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px 10px 20px; flex-shrink: 0; touch-action: none; }
.sheet-title { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; min-width: 0; }
.sheet-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.sheet-actions .icon-btn { width: 34px; height: 34px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 16px 16px; display: flex; flex-direction: column; min-height: 0; }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { to { transform: translateY(100%); } }
@keyframes fadeOut { to { opacity: 0; } }

/* ---------- 记一笔 ---------- */
.entry-sheet .sheet-body { padding: 0; }
.cat-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px 4px; padding: 8px 12px 16px; align-content: start; }
.cat-grid.compact { flex: none; max-height: 240px; padding: 4px 0 8px; background: var(--panel); border-radius: 16px; padding: 12px 6px; }
.cat-item { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.cat-item.active { color: var(--primary); font-weight: 500; }
.cat-item.active .cat-tile { transform: scale(1.06); }
.cat-item:active .cat-tile { transform: scale(0.92); }
.entry-panel { background: var(--panel); border-radius: 22px 22px 0 0; box-shadow: 0 -1px 0 var(--line); padding: 14px 12px 10px; flex-shrink: 0; }
.entry-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 6px; }
.entry-row + .entry-row { margin-top: 10px; }
.entry-cat { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; }
.entry-amount { font-size: 32px; font-weight: 600; letter-spacing: -0.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-amount.income { color: var(--success); }
.entry-orig { font-size: 12px; color: var(--text-3); text-align: right; padding: 0 6px; margin-top: 2px; }
.entry-date { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; position: relative; color: var(--text); }
.entry-note { flex: 1; min-width: 0; height: 32px; border: 0; background: var(--fill); border-radius: 99px; padding: 0 14px; outline: none; font-size: 14px; }
.entry-note:focus { box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2); }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 12px; }
.key { height: 50px; border-radius: 14px; background: var(--bg); font-size: 22px; font-weight: 500; display: flex; align-items: center; justify-content: center; transition: background 0.1s, transform 0.1s; user-select: none; }
.key:active { background: var(--fill); transform: scale(0.96); }
.key-fn { color: var(--text-2); }
.key-done { background: var(--primary); color: #fff; font-size: 17px; grid-row: span 1; }
.key-done:active { background: var(--primary-hover); }

/* ---------- 识别 ---------- */
.ai-pick, .voice { display: flex; flex-direction: column; gap: 14px; }
.ai-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 12px 8px 4px; }
.ai-hero p { margin: 12px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.6; }
.ai-hero-ico { width: 60px; height: 60px; border-radius: 18px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.pick-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 8px; border-radius: 18px; background: var(--panel); box-shadow: var(--shadow-card); font-weight: 500; font-size: 14px; color: var(--text); transition: transform 0.15s; }
.pick-btn .ico { color: var(--primary); }
.pick-btn:active { transform: scale(0.97); }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumb { position: relative; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--panel); box-shadow: var(--shadow-card); animation: popIn 0.2s ease-out; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-pdf { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-2); font-size: 11px; padding: 8px; text-align: center; word-break: break-all; }
.thumb-x { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; display: flex; align-items: center; justify-content: center; }

.ai-loading, .ai-error { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 12px 20px; }
.ai-loading .btn { margin-top: 18px; }
.ai-orb { width: 76px; height: 76px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; position: relative; margin-bottom: 14px; }
.ai-orb::before, .ai-orb::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--primary); opacity: 0; animation: ripple 2s var(--ease-out) infinite; }
.ai-orb::after { animation-delay: 1s; }
.ai-orb .ico { animation: breathe 1.6s ease-in-out infinite; }
@keyframes ripple { 0% { transform: scale(1); opacity: 0.5; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes breathe { 50% { transform: scale(1.15) rotate(8deg); } }
.ai-loading-title { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.ai-loading-sub { font-size: 13px; color: var(--text-3); }
.ai-elapsed { font-size: 12px; color: var(--text-4); }
.ai-error .btn { margin-top: 16px; }
.cmd { font-family: var(--mono); font-size: 13px; background: var(--fill); color: var(--text); padding: 6px 12px; border-radius: 8px; user-select: all; display: inline-block; margin-top: 6px; }

.confirm-ico { width: 48px; height: 48px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.confirm-ico.danger { background: var(--danger-bg); color: var(--danger); }
.confirm-title { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; }
.confirm-msg { font-size: 14px; color: var(--text-2); line-height: 1.6; white-space: pre-wrap; }

.hint-bar { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.5; color: var(--warning); background: var(--warning-bg); border-radius: 12px; padding: 10px 12px; }
.hint-bar .ico { margin-top: 1px; }

/* 结果确认 */
.review { display: flex; flex-direction: column; gap: 10px; min-height: 100%; }
.review-msg { font-size: 13px; color: var(--text-2); background: var(--panel); border-radius: 14px; padding: 10px 14px; line-height: 1.55; display: flex; flex-direction: column; gap: 4px; }
.review-src { display: flex; align-items: center; gap: 6px; color: var(--text-3); }
.review-list { display: flex; flex-direction: column; gap: 10px; }
.review-card { background: var(--panel); border-radius: 18px; box-shadow: var(--shadow-card); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; transition: opacity 0.2s; animation: riseIn 0.3s var(--ease-out) both; }
.review-card.off { opacity: 0.45; }
.review-top { display: flex; align-items: center; gap: 10px; }
.check { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-strong); color: transparent; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s, color 0.15s; }
.check.on { background: var(--primary); box-shadow: none; color: #fff; }
.review-cat { position: relative; display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14.5px; min-width: 0; cursor: pointer; }
.review-cat > .ico { color: var(--text-3); }
.cat-select-native { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.review-amount { margin-left: auto; display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.review-cur { font-size: 12px; color: var(--text-3); font-weight: 500; }
.review-amount.income .review-amount-input { color: var(--success); }
.review-amount-input { width: 96px; text-align: right; border: 0; background: transparent; outline: none; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; padding: 0; border-bottom: 1px dashed transparent; }
.review-amount-input:focus { border-bottom-color: var(--primary); }
.review-rate { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); padding-left: 32px; flex-wrap: wrap; }
.rate-input { width: 70px; height: 26px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 8px; background: var(--panel); outline: none; font-size: 12.5px; }
.rate-input:focus { border-color: var(--primary); }
.review-conv { margin-left: auto; color: var(--text-2); font-weight: 500; }
.review-note { height: 36px; width: 100%; font-size: 14px; }
.review-meta { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; }
.review-date { width: auto; border: 0; background: transparent; color: var(--text-2); font-size: 13px; outline: none; padding: 0; }
.review-footer { position: sticky; bottom: -16px; margin: auto -16px -16px; padding: 12px 16px 16px; background: linear-gradient(to bottom, transparent, var(--bg) 30%); }

/* 语音 */
.field-label { font-size: 13px; font-weight: 500; color: var(--text-3); margin-bottom: -6px; }
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; }
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 0 8px; }
.mic-btn { width: 88px; height: 88px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(0, 113, 227, 0.3); position: relative; transition: transform 0.2s var(--spring), background 0.2s; }
.mic-btn:active { transform: scale(0.92); }
.mic-btn.on { background: var(--danger); box-shadow: 0 8px 24px rgba(215, 0, 21, 0.28); }
.mic-btn.on::before, .mic-btn.on::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--danger); animation: ripple 1.6s var(--ease-out) infinite; }
.mic-btn.on::after { animation-delay: 0.8s; }
.voice-status { font-size: 14px; color: var(--text-2); text-align: center; line-height: 1.5; max-width: 300px; }
.voice-status.warn { color: var(--warning); font-size: 13px; }
.voice-text { width: 100%; font-size: 15px; min-height: 84px; resize: none; }

/* ---------- 记录详情 ---------- */
.detail { display: flex; flex-direction: column; gap: 14px; }
.detail-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 6px; text-align: center; }
.detail-cat { font-size: 15px; font-weight: 500; color: var(--text-2); margin-top: 4px; }
.detail-amount { font-size: 36px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.15; }
.detail-amount.income { color: var(--success); }
.detail-orig { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-2); }
.detail-orig span { font-size: 12px; color: var(--text-3); }
.detail-card { padding: 4px 16px; }
.detail-row { position: relative; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 13px 0; font-size: 15px; }
.detail-row + .detail-row::before, .detail-item + .detail-item::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--line); }
.detail-label { color: var(--text-3); flex-shrink: 0; }
.detail-value { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.detail-value.multiline { white-space: pre-wrap; line-height: 1.5; }
.detail-value.muted { color: var(--text-4); }
.detail-source { display: inline-flex; align-items: center; gap: 6px; }
.detail-source .ico { color: var(--text-3); }
.detail-items-head { display: flex; justify-content: space-between; padding: 14px 0 6px; font-size: 13px; font-weight: 500; color: var(--text-3); }
.detail-item { position: relative; display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; font-size: 14.5px; }
.detail-item span:first-child { min-width: 0; overflow-wrap: anywhere; }
.detail-item .tabular { flex-shrink: 0; color: var(--text-2); }
.detail-item .discount { color: var(--success); }
.detail-item.total { font-weight: 500; }
.detail-item.total b { font-weight: 600; }
.detail-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.detail-actions .btn { gap: 6px; }
.detail-head-btn { margin-right: 4px; }
.detail.edit .seg-wide { width: 100%; }
.detail.edit .cat-grid.compact { max-height: none; overflow: visible; }
.detail.edit .field-label { margin: 2px 4px -6px; }
.edit-card { padding: 2px 16px; }
.edit-field { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; font-size: 15px; }
.edit-field + .edit-field::before, .edit-conv-row + .edit-field::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--line); }
.edit-label { color: var(--text-3); flex-shrink: 0; }
.edit-input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; text-align: right; font-size: 15px; color: var(--text); padding: 8px 0; font-family: var(--font); }
.edit-input:focus { color: var(--primary); }
.edit-amount-wrap { display: flex; align-items: center; gap: 6px; flex: 1; justify-content: flex-end; min-width: 0; }
.edit-amount { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; max-width: 160px; }
.edit-rate { max-width: 90px; }
.edit-conv-row { display: flex; justify-content: flex-end; padding: 0 0 10px; margin-top: -6px; }
.detail-conv { font-size: 13px; color: var(--text-2); }
.review-fields { display: flex; flex-direction: column; gap: 6px; }
.review-items { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }

/* ---------- 统计 ---------- */
.stats-period { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.period-nav { display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.stat-card { padding: 18px 16px 12px; }
.stat-tiles { display: grid; grid-template-columns: 1.3fr 1fr 0.7fr; gap: 8px; }
.stat-tiles > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat-tiles span { font-size: 12px; font-weight: 500; color: var(--text-3); }
.stat-tiles b { font-size: 19px; font-weight: 600; letter-spacing: -0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-tiles > div:first-child b { font-size: 22px; }
.chart { position: relative; padding: 0 4px; touch-action: pan-y; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .grid-label { font-size: 10.5px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.chart .x-label { font-size: 10.5px; fill: var(--text-3); }
.chart .x-label.today { fill: var(--primary); font-weight: 600; }
.chart .bar { fill: var(--primary); transition: opacity 0.15s; }
.chart.hovering .bar { opacity: 0.3; }
.chart.hovering .bar.hi { opacity: 1; }
.chart-tip { position: absolute; transform: translateX(-50%) translateY(4px); pointer-events: none; background: var(--panel); box-shadow: var(--shadow-pop); border-radius: 10px; padding: 6px 10px; font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 1px; white-space: nowrap; opacity: 0; transition: opacity 0.15s, transform 0.2s var(--ease-out); z-index: 2; }
.chart-tip span { color: var(--text-3); }
.chart-tip b { font-size: 14px; font-weight: 600; }
.chart-tip.show { opacity: 1; transform: translateX(-50%); }

.rank-card { padding: 18px 16px 10px; }
.rank-card .card-title { margin-bottom: 8px; padding: 0 2px; }
.rank-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 2px; text-align: left; border-radius: 12px; }
.rank-row:active { background: var(--hover); }
.rank-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.rank-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14.5px; font-weight: 500; }
.rank-line em { font-style: normal; font-size: 12px; color: var(--text-3); margin-left: 6px; font-weight: 400; }
.rank-line b { font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.rank-line b.over { color: var(--danger); }
.cat-detail { display: flex; flex-direction: column; }
.cat-detail .day-group:first-child { margin-top: 4px; }

/* ---------- 预算 ---------- */
.budget-main { padding: 18px 18px 20px; }
.budget-head { display: flex; justify-content: space-between; align-items: center; }
.budget-body { display: flex; align-items: center; gap: 18px; margin-top: 12px; }
.ring-wrap { position: relative; width: 156px; height: 156px; flex-shrink: 0; }
.ring-track { fill: none; stroke: var(--fill); stroke-width: 12; }
.ring-val { fill: none; stroke: var(--primary); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 0.8s var(--ease-out); }
.ring-val.over { stroke: var(--danger); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ring-center span { font-size: 12px; color: var(--text-3); font-weight: 500; }
.ring-center b { font-size: 20px; font-weight: 600; letter-spacing: -0.03em; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ring-center b.over { color: var(--danger); }
.ring-center small { font-size: 12px; color: var(--text-3); }
.budget-facts { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.budget-facts div { display: flex; flex-direction: column; gap: 2px; }
.budget-facts span { font-size: 12px; color: var(--text-3); }
.budget-facts b { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.budget-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 20px; }
.add-cat-budget { margin-top: 6px; height: 40px; }
.budget-form { gap: 14px; }
.amount-field { display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 16px; padding: 4px 16px; font-size: 28px; font-weight: 600; }
.amount-field span { color: var(--text-3); }
.amount-input { flex: 1; border: 0 !important; box-shadow: none !important; height: 56px; font-size: 30px; font-weight: 600; letter-spacing: -0.03em; padding: 0; background: transparent; }

/* ---------- 我的 ---------- */
.profile { display: flex; flex-direction: column; align-items: center; padding: 22px 16px 18px; gap: 8px; }
.logo-mark { width: 56px; height: 56px; border-radius: 17px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; }
.profile-name { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.profile-stats { display: flex; gap: 40px; margin-top: 6px; }
.profile-stats div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.profile-stats b { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.profile-stats span { font-size: 12px; color: var(--text-3); }
.group-title { font-size: 13px; font-weight: 500; color: var(--text-3); margin: 22px 6px 8px; }
.card + .group-title { margin-top: 22px; }
.cells { overflow: hidden; }
.cell { position: relative; width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px 8px 16px; text-align: left; font-size: 15px; color: var(--text); cursor: pointer; }
div.cell { cursor: default; }
.cell:active:not(div) { background: var(--hover); }
label.cell:active { background: var(--hover); }
.cell + .cell::before, .cell-note + .cell::before { content: ''; position: absolute; top: 0; left: 52px; right: 0; height: 1px; background: var(--line); }
.cell-ico { width: 26px; height: 26px; border-radius: 8px; background: var(--fill); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cell-label { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cell-label small { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.cell-value { color: var(--text-3); font-size: 14px; }
.cell-chev { color: var(--text-4); display: inline-flex; }
.cell.danger { color: var(--danger); }
.cell.danger .cell-ico { background: var(--danger-bg); color: var(--danger); }
.cell-select { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.cell-note { padding: 0 16px 12px 54px; font-size: 12.5px; color: var(--text-2); line-height: 1.55; display: flex; flex-direction: column; align-items: flex-start; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-3); white-space: nowrap; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--text-4); }
.status.ok { color: var(--success); } .status.ok::before { background: var(--success); }
.status.warn { color: var(--warning); } .status.warn::before { background: var(--warning); }
.status.bad { color: var(--danger); } .status.bad::before { background: var(--danger); }
.cell-input { flex: 0 1 190px; min-width: 0; height: 34px; border: 0; border-radius: 9px; background: var(--fill); color: var(--text); padding: 0 10px; font-family: var(--mono); font-size: 13px; text-align: right; }
.cell-input:focus { outline: 2px solid var(--primary); outline-offset: 0; text-align: left; }
.cell-note a { color: var(--primary); font-weight: 500; margin-top: 4px; }
.api-card { margin-top: 10px; }
.api-card .cell-note { padding-top: 4px; }
.about { padding: 14px 16px; font-size: 13px; color: var(--text-2); line-height: 1.6; }

/* ---------- 月份 / 搜索 ---------- */
.month-picker { padding-bottom: 8px; }
.mp-year { display: flex; align-items: center; justify-content: center; gap: 24px; font-size: 18px; font-weight: 600; margin-bottom: 14px; }
.mp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mp-cell { height: 46px; border-radius: 14px; background: var(--panel); font-size: 15px; font-weight: 500; box-shadow: var(--shadow-card); }
.mp-cell.active { background: var(--primary); color: #fff; }
.search-bar { display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 99px; padding: 0 14px; box-shadow: var(--shadow-card); color: var(--text-3); }
.search-input { flex: 1; border: 0 !important; box-shadow: none !important; background: transparent; height: 44px; padding: 0; font-size: 15px; color: var(--text); }
.search-results { display: flex; flex-direction: column; }

/* ---------- 确认框 ---------- */
.modal.confirm { width: min(340px, calc(100vw - 48px)); padding: 26px 22px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.confirm-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 14px; }
.confirm-btns .btn { height: 44px; font-size: 15px; }
.toast-host { top: calc(var(--safe-t) + 16px); }

.input { font-size: 15px; height: 40px; }
input[type='date'] { font-family: var(--font); }
