:root {
  color-scheme: light;
  --ink: #14211d;
  --muted: #6c7773;
  --line: #dfe5e2;
  --surface: #ffffff;
  --canvas: #f4f7f5;
  --green: #1fa778;
  --green-dark: #117454;
  --coral: #ed6a5a;
  --cyan: #2589bd;
  --yellow: #e7b03f;
  --shadow: 0 14px 38px rgba(29, 48, 42, .09);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); letter-spacing: 0; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
button, input, select { font: inherit; letter-spacing: 0; }
button { color: inherit; }
.app-shell { width: min(100%, 520px); min-height: 100dvh; margin: 0 auto; background: var(--canvas); position: relative; padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.topbar { height: calc(92px + env(safe-area-inset-top)); padding: calc(18px + env(safe-area-inset-top)) 22px 12px; display: flex; align-items: center; justify-content: space-between; }
.title-group { min-width: 0; }
.title-line { display: flex; align-items: center; gap: 8px; }
.version-badge { flex: 0 0 auto; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: 10px; font-weight: 700; cursor: pointer; }
.version-badge.checking { color: var(--green-dark); border-color: #abd7c7; }
.update-banner { margin: 0 0 12px; padding: 11px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid #abd7c7; border-radius: 8px; background: #ecf9f4; }
.update-banner[hidden] { display: none; }
.update-banner span { min-width: 0; }
.update-banner strong, .update-banner small { display: block; }
.update-banner strong { font-size: 12px; }
.update-banner small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.update-banner button { flex: 0 0 auto; border: 0; border-radius: 7px; padding: 8px 10px; color: white; background: var(--green-dark); font-size: 11px; font-weight: 700; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 25px; line-height: 1.15; }
h2 { margin-bottom: 0; font-size: 19px; line-height: 1.2; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 20px; cursor: pointer; }
main { padding: 0 18px; }
.view { display: none; animation: enter .32s cubic-bezier(.2,.75,.25,1); }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(9px) scale(.995); } }

.balance-band { background: var(--ink); color: white; padding: 22px; border-radius: 8px; box-shadow: var(--shadow); }
.balance-head { display: flex; justify-content: space-between; align-items: center; color: #c6d2ce; font-size: 13px; }
.month-pill { border: 1px solid #42504b; padding: 4px 8px; border-radius: 6px; }
.balance-value { margin: 14px 0 22px; font-size: 36px; font-weight: 760; font-variant-numeric: tabular-nums; }
.balance-band .negative { color: #ff9b8e; }
.balance-split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; border-top: 1px solid #3a4843; padding-top: 16px; }
.balance-split div { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 7px; font-size: 12px; color: #bec9c5; }
.balance-split strong { grid-column: 2; color: white; font-size: 16px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.income { background: #56d7a5; }
.dot.expense { background: #ff8878; }
.section-heading { margin: 28px 2px 12px; display: flex; justify-content: space-between; align-items: end; }
.section-heading select { border: 0; background: transparent; color: var(--muted); padding: 5px; }
.text-button { border: 0; padding: 6px 0; color: var(--green-dark); background: transparent; font-weight: 700; cursor: pointer; }
.chart-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 17px; }
.chart-summary { display: flex; align-items: baseline; gap: 10px; }
.chart-summary strong { font-size: 25px; font-variant-numeric: tabular-nums; }
.chart-summary span { color: var(--muted); font-size: 12px; }
.bar-chart { height: 124px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 5px; margin-top: 14px; overflow: visible; }
.bar-wrap { position: relative; height: 100%; min-width: 0; padding: 0; border: 0; display: grid; align-items: end; grid-template-rows: 1fr 18px; gap: 5px; text-align: center; color: var(--muted); background: transparent; font-size: 9px; cursor: pointer; }
.bar { width: 100%; min-height: 3px; border-radius: 3px 3px 1px 1px; background: var(--green); transition: height .3s ease, background-color .18s ease, transform .18s ease; transform-origin: bottom; }
.bar-wrap:active .bar, .bar-wrap.selected .bar { background: var(--ink); transform: scaleX(.9); }
.bar-wrap.negative .bar { background: var(--coral); }
.bar-label { line-height: 18px; }
.bar-tooltip { position: absolute; z-index: 3; left: 50%; top: 2px; transform: translateX(-50%) scale(.9); padding: 6px 8px; border-radius: 6px; color: white; background: var(--ink); font-size: 10px; font-weight: 750; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .16s ease, transform .16s ease; }
.bar-tooltip::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px; background: var(--ink); transform: translateX(-50%) rotate(45deg); }
.bar-wrap.selected .bar-tooltip, .bar-wrap:focus-visible .bar-tooltip { opacity: 1; transform: translateX(-50%) scale(1); }
.insight-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 9px; }
.insight-card { min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.insight-card:last-child { grid-column: 1 / -1; }
.insight-card small, .insight-card strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insight-card small { color: var(--muted); font-size: 10px; }
.insight-card strong { margin-top: 5px; font-size: 12px; font-variant-numeric: tabular-nums; }
.budget-panel { width: 100%; padding: 14px 15px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); text-align: left; cursor: pointer; }
.budget-panel:active { transform: scale(.995); }
.budget-panel > div:last-child { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 10px; }
.budget-panel strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.budget-panel small { color: var(--muted); font-size: 11px; }
.budget-panel.over { border-color: #efb6af; background: #fff8f6; }
.budget-track { height: 8px; overflow: hidden; border-radius: 999px; background: #e7eeea; }
.budget-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .3s ease, background-color .2s ease; }
.budget-panel.over .budget-track span { background: var(--coral); }
.budget-analysis-actions { min-height: 34px; display: flex; justify-content: flex-end; align-items: center; }
.budget-analysis-actions .text-button { font-size: 12px; }
.budget-analysis-actions .text-button[hidden] { display: none; }
.budget-recommendations { padding: 13px 14px; border: 1px solid #efc5bf; border-radius: 8px; background: #fff8f6; }
.budget-recommendations[hidden] { display: none; }
.recommendation-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.recommendation-head strong { font-size: 13px; }
.recommendation-head small, .recommendation-row small, .recommendation-disclaimer { color: var(--muted); font-size: 10px; }
.recommendation-summary { margin: 8px 0 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.recommendation-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; border-top: 1px solid #f1d8d4; }
.recommendation-row > div:first-child { min-width: 0; }
.recommendation-row strong, .recommendation-row small { display: block; overflow: hidden; text-overflow: ellipsis; }
.recommendation-row strong { font-size: 12px; }
.recommendation-row small { margin-top: 3px; line-height: 1.4; white-space: normal; }
.recommendation-money { text-align: right; white-space: nowrap; }
.recommendation-money b, .recommendation-money small { display: block; }
.recommendation-money b { font-size: 12px; color: #bb3f31; font-variant-numeric: tabular-nums; }
.recommendation-money small { margin-top: 3px; }
.recommendation-disclaimer { display: block; margin-top: 7px; line-height: 1.45; }
.section-meta { color: var(--muted); font-size: 11px; }
.section-meta.over { color: #bb3f31; }

.transaction-list { display: grid; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.transaction { width: 100%; min-height: 76px; padding: 12px 14px; border: 0; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 12px; color: var(--ink); background: var(--surface); text-align: left; content-visibility: auto; contain-intrinsic-size: 76px; cursor: pointer; transition: background-color .16s ease, transform .16s ease; }
.transaction:active { background: #f0f5f2; transform: scale(.995); }
.transaction:focus-visible { position: relative; z-index: 1; outline: 2px solid var(--green); outline-offset: -2px; }
.tx-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: #eef3f1; overflow: hidden; }
.tx-icon img { width: 41px; height: 41px; object-fit: contain; transform: translateZ(0); }
.tx-main { min-width: 0; }
.tx-main strong, .tx-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-main strong { font-size: 14px; }
.tx-main small, .tx-side small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.tx-side { text-align: right; }
.tx-side strong, .tx-side small { display: block; }
.tx-side strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.tx-side strong.income { color: var(--green-dark); }
.tx-side strong.refund { color: var(--cyan); }
.tx-side strong.transfer { color: var(--cyan); }
.empty { padding: 34px 18px; text-align: center; background: var(--surface); color: var(--muted); font-size: 13px; }

.search-row { display: grid; grid-template-columns: minmax(0, 1fr) 42px 42px; gap: 8px; }
.pending-daily-panel { margin-top: 12px; padding: 15px; border: 1px solid #b8ddd0; border-radius: 8px; background: #f3fbf7; }
.pending-daily-panel[hidden] { display: none; }
.pending-daily-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.pending-daily-head h2 { font-size: 16px; }
.pending-daily-badge { flex: 0 0 auto; padding: 4px 7px; border-radius: 6px; color: var(--green-dark); background: #dcefe7; font-size: 10px; font-weight: 750; }
.pending-daily-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; padding: 10px 0; border-top: 1px solid #d8ebe3; }
.pending-daily-row > div:first-child { min-width: 0; }
.pending-daily-row strong, .pending-daily-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-daily-row strong { font-size: 12px; }
.pending-daily-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.pending-daily-row > b { font-size: 12px; font-variant-numeric: tabular-nums; }
.pending-row-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.pending-row-actions button { min-width: 48px; padding: 5px 9px; border: 0; border-radius: 6px; color: var(--muted); background: #e8f2ee; font-size: 10px; }
.pending-row-actions button:last-child { color: white; background: var(--green-dark); }
.pending-daily-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 8px; border-top: 1px solid #d8ebe3; }
.pending-daily-actions .compact-button { min-height: 40px; margin-top: 10px; font-size: 11px; }
.search-box { height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; }
.filter-chips { display: flex; gap: 7px; overflow-x: auto; padding: 14px 0 10px; scrollbar-width: none; }
.filter-chips button { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 7px 12px; font-size: 12px; }
.filter-chips button.active { color: white; border-color: var(--ink); background: var(--ink); }
.ledger-filter-row { display: flex; justify-content: flex-end; margin: 1px 0 2px; }
.month-filter { min-width: 148px; max-width: 100%; display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 11px; }
.month-filter span { flex: 0 0 auto; }
.month-filter select { min-width: 0; max-width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.ledger-summary { display: flex; justify-content: space-between; padding: 9px 2px 11px; color: var(--muted); font-size: 12px; }
.ledger-summary strong { color: var(--ink); }
.ledger-summary-actions { display: flex; align-items: center; gap: 10px; }
.ledger-summary-actions .text-button { font-size: 11px; }
.ledger-list { margin-bottom: 18px; }
.load-more { width: 100%; min-height: 46px; margin: -4px 0 20px; border: 0; border-radius: 8px; color: var(--green-dark); background: #e7f3ee; font-weight: 700; }
.load-more[hidden] { display: none; }

.entry-form { padding-bottom: 10px; }
.type-switch { width: 190px; margin: 0 auto 18px; padding: 3px; display: grid; grid-template-columns: 1fr 1fr; background: #e7ece9; border-radius: 8px; }
.type-switch.three-way { width: min(280px, 100%); grid-template-columns: repeat(3, 1fr); }
.type-switch button { border: 0; padding: 8px; border-radius: 6px; background: transparent; font-weight: 700; color: var(--muted); }
.type-switch button.active { background: white; color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.amount-field { display: flex; justify-content: center; align-items: center; gap: 5px; margin-bottom: 22px; font-size: 28px; font-weight: 700; }
.amount-field input { width: min(70%, 260px); border: 0; outline: 0; background: transparent; font-size: 42px; font-weight: 760; text-align: center; font-variant-numeric: tabular-nums; }
.category-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 20px; }
.category-grid button { min-height: 76px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); display: grid; place-items: center; align-content: center; gap: 1px; font-size: 19px; transition: transform .16s ease, border-color .16s ease, background-color .16s ease; }
.category-grid button:active { transform: scale(.96); }
.category-grid button img { width: 42px; height: 42px; object-fit: contain; }
.category-grid button small { font-size: 11px; color: var(--muted); }
.category-grid button.active { border: 2px solid var(--green); background: #ecf9f4; }
.category-grid[hidden] { display: none; }
.form-fields { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0 15px; }
.form-fields label, .dialog-card label { display: grid; grid-template-columns: 92px 1fr; align-items: center; min-height: 54px; border-bottom: 1px solid var(--line); font-size: 13px; }
.form-fields label[hidden] { display: none; }
.form-fields label:last-child { border-bottom: 0; }
.form-fields input, .form-fields select, .dialog-card input { min-width: 0; border: 0; outline: 0; background: transparent; text-align: right; color: var(--ink); }
.category-memory-hint { grid-column: 1 / -1; margin: -2px 0 8px; color: var(--green-dark); font-size: 10px; line-height: 1.4; }
.category-memory-hint:empty { display: none; }
.primary-button, .secondary-button, .danger-button { width: 100%; min-height: 50px; margin-top: 16px; border-radius: 8px; font-weight: 750; cursor: pointer; }
.primary-button { border: 0; color: white; background: var(--green-dark); }
.secondary-button { border: 1px solid var(--ink); color: var(--ink); background: transparent; }
.danger-button { border: 0; color: #bb3f31; background: transparent; }

.networth-band { background: var(--ink); color: white; padding: 22px; border-radius: 8px; box-shadow: var(--shadow); }
.networth-band .negative { color: #ff9b8e; }
.position-intro { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 15px 2px 0; color: var(--muted); }
.position-intro p { margin: 0; max-width: 300px; font-size: 12px; line-height: 1.5; }
.position-intro small { flex: 0 0 auto; font-size: 10px; }
.position-list { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.position-row { min-height: 76px; padding: 11px 14px; display: grid; grid-template-columns: 44px minmax(90px, 1fr) minmax(105px, 145px); align-items: center; gap: 11px; background: var(--surface); border-bottom: 1px solid var(--line); }
.position-row:last-child { border-bottom: 0; }
.position-row > span:nth-child(2) { min-width: 0; }
.position-row strong, .position-row small { display: block; }
.position-row strong { font-size: 14px; }
.position-row small { margin-top: 4px; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.position-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: white; font-size: 15px; font-weight: 800; }
.wechat-balance { background: #20ad67; }
.alipay-balance { background: #1689e7; }
.bank-balance { background: #263d4d; }
.huabei-balance { background: #5e73df; }
.meituan-balance { background: #edb72f; color: #26312d; }
.currency-input { height: 42px; padding: 0 11px; display: flex; align-items: center; gap: 3px; border: 1px solid var(--line); border-radius: 7px; background: #f7f9f8; transition: border-color .16s ease, box-shadow .16s ease; }
.currency-input:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31, 167, 120, .12); }
.currency-input b { color: var(--muted); font-size: 13px; }
.currency-input input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); text-align: right; font-weight: 720; font-variant-numeric: tabular-nums; }
.position-note { margin: 14px 2px 24px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.reconcile-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.reconcile-note { padding: 11px 13px; color: var(--muted); background: var(--surface); font-size: 11px; line-height: 1.45; }
.reconcile-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(145px, 1.25fr); gap: 10px; padding: 12px 13px; border-top: 1px solid var(--line); background: var(--surface); }
.reconcile-row strong, .reconcile-row small, .reconcile-values span, .reconcile-values b { display: block; }
.reconcile-row strong { font-size: 13px; }
.reconcile-row small, .reconcile-values span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.reconcile-values { text-align: right; }
.reconcile-values b { margin-top: 5px; color: var(--green-dark); font-size: 10px; }
.reconcile-values b.mismatch { color: #bb3f31; }
.compact-button { width: auto; min-height: 36px; margin: 10px 13px 13px; padding: 0 12px; font-size: 11px; }

.payment-hero { padding: 18px 2px 10px; }
.payment-hero h2 { font-size: 28px; margin-bottom: 8px; }
.payment-hero > p:last-child { max-width: 340px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.payment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay-tile { aspect-ratio: 1.25; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); display: grid; justify-items: start; align-content: space-between; padding: 16px; text-align: left; cursor: pointer; }
.pay-tile strong { font-size: 15px; }
.pay-tile small { color: var(--muted); }
.pay-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: white; font-weight: 800; }
.wechat .pay-mark { background: #20ad67; }
.alipay .pay-mark { background: #1689e7; }
.campus .pay-mark { background: #e76b59; }
.bank .pay-mark { background: #263d4d; }
.source-list { display: grid; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.source-row { min-height: 58px; padding: 10px 13px; display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 11px; background: white; }
.source-row .source-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.source-row strong { font-size: 13px; }
.source-row small { display: block; color: var(--muted); margin-top: 3px; }
.source-row button { border: 0; color: var(--green-dark); background: transparent; font-weight: 700; }
.data-actions { display: grid; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.data-actions button { min-height: 68px; padding: 11px 13px; border: 0; display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 11px; color: var(--ink); background: var(--surface); text-align: left; cursor: pointer; transition: background-color .16s ease, transform .16s ease; }
.data-actions button:active { background: #eef4f1; transform: scale(.995); }
.data-actions button > span:last-child { min-width: 0; }
.data-actions strong, .data-actions small { display: block; }
.data-actions strong { font-size: 13px; }
.data-actions small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.data-action-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--green-dark); background: #e7f3ee; font-size: 19px; font-weight: 800; }
.data-note { margin: 10px 2px 20px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.recurring-list { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.recurring-empty { border: 0; }
.recurring-row { min-height: 62px; padding: 10px 13px; display: grid; grid-template-columns: minmax(0, 1fr) 32px; align-items: center; gap: 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.recurring-row:last-child { border-bottom: 0; }
.recurring-row strong, .recurring-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recurring-row strong { font-size: 13px; }
.recurring-row small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.recurring-row.overdue small { color: #bb3f31; font-weight: 700; }
.delete-recurring { width: 28px; height: 28px; border: 0; border-radius: 50%; color: var(--muted); background: #f1f4f2; font-size: 19px; line-height: 1; cursor: pointer; }
.privacy-lock-row { min-height: 54px; padding: 0 13px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 12px; }
.privacy-lock-row .compact-button { margin: 0; }

.tabbar { position: fixed; z-index: 10; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 520px); height: calc(72px + env(safe-area-inset-bottom)); padding: 6px 12px env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(255,255,255,.94); border-top: 1px solid var(--line); backdrop-filter: blur(18px); }
.tabbar button { border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 2px; cursor: pointer; transition: color .18s ease, transform .18s ease; }
.tabbar button:active { transform: scale(.9); }
.tabbar button span { font-size: 21px; line-height: 1; }
.tabbar button small { font-size: 10px; }
.tabbar button.active { color: var(--green-dark); }
.tabbar .add-tab span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--ink); }
.tabbar .add-tab.active span { background: var(--green-dark); }

dialog { width: min(calc(100% - 28px), 470px); border: 0; border-radius: 8px; padding: 0; color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(11, 24, 20, .45); backdrop-filter: blur(3px); }
.dialog-card { padding: 20px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-card > p { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 12px 0; }
.dialog-card .budget-endpoint-field { min-height: 62px; }
.dialog-card .budget-endpoint-note { margin: 8px 0 2px; font-size: 10px; }
.dialog-card .dialog-error { min-height: 18px; margin: 8px 0 -4px; color: #bb3f31; font-weight: 650; }
.transaction-dialog { max-height: calc(100dvh - 24px); }
.transaction-detail { max-height: calc(100dvh - 24px); overflow-y: auto; }
.detail-amount-row { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 14px; margin: 18px 0 14px; }
.detail-category-image { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 16px; background: #eef3f1; }
.detail-category-image img { width: 52px; height: 52px; object-fit: contain; }
.detail-amount { display: block !important; min-height: 0 !important; border: 0 !important; }
.detail-amount > span:first-child { display: block; color: var(--muted); font-size: 10px; }
.detail-amount > span:last-child { display: flex; align-items: baseline; gap: 4px; }
.detail-amount b { font-size: 20px; }
.detail-amount input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); text-align: left; font-size: 32px; font-weight: 760; font-variant-numeric: tabular-nums; }
.detail-amount input, .amount-field input, .money-input { appearance: textfield; -moz-appearance: textfield; }
.detail-amount input::-webkit-inner-spin-button, .detail-amount input::-webkit-outer-spin-button,
.amount-field input::-webkit-inner-spin-button, .amount-field input::-webkit-outer-spin-button,
.money-input::-webkit-inner-spin-button, .money-input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.detail-type-switch { margin-bottom: 14px; }
.detail-fields { display: grid; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.detail-fields label { min-height: 50px; display: grid; grid-template-columns: 92px 1fr; align-items: center; border-bottom: 1px solid var(--line); font-size: 12px; }
.detail-fields label[hidden] { display: none; }
.detail-fields label:last-child { border-bottom: 0; }
.detail-fields input, .detail-fields select { min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; text-align: right; }
.detail-fields .category-memory-hint { margin: -2px 0 8px; }
.detail-source { margin: 10px 2px 0 !important; min-height: 18px; color: var(--muted); font-size: 10px !important; }
.receipt-preview { min-height: 42px; margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.receipt-preview img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
.receipt-preview > div { min-width: 0; }
.receipt-preview small { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.receipt-preview .text-button { font-size: 11px; }
.receipt-empty { color: var(--muted); font-size: 10px; }
.import-preview-list { max-height: 300px; overflow-y: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.import-date-filter { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0 4px; }
.import-date-filter label { min-width: 0; min-height: 48px; padding: 6px 9px; display: block; border: 1px solid var(--line); border-radius: 8px; background: #f7f9f8; }
.import-date-filter label span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 9px; }
.dialog-card .import-date-filter input { width: 100%; min-width: 0; text-align: left; font-size: 11px; }
.import-date-filter .compact-button { grid-column: 1 / -1; min-height: 36px; margin-top: 0; font-size: 11px; }
.import-preview-row { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 4px 8px; padding: 9px 11px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 11px; }
.import-preview-row:last-child { border-bottom: 0; }
.import-preview-row span, .import-preview-row small { color: var(--muted); }
.import-preview-row small { grid-column: 1 / -1; font-size: 9px; }
.import-preview-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-preview-row b { font-variant-numeric: tabular-nums; }
.relation-box { margin-top: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; background: #f7faf8; }
.relation-box[hidden] { display: none; }
.relation-box label { min-height: 36px; display: grid; grid-template-columns: 92px 1fr; align-items: center; font-size: 12px; }
.relation-box select { min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; text-align: right; }
.relation-box small { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; line-height: 1.45; }
#expenseRefundSummary { grid-template-columns: 92px 1fr; align-items: center; font-size: 12px; }
#expenseRefundSummary:not([hidden]) { display: grid; }
#expenseRefundSummary span { color: var(--green-dark); text-align: right; font-weight: 700; }
.detail-actions { display: grid; grid-template-columns: 92px 1fr; gap: 10px; }
.detail-actions .primary-button { margin-top: 12px; }
.delete-transaction { min-height: 50px; margin-top: 12px; border: 1px solid #efb6af; border-radius: 8px; color: #bb3f31; background: #fff7f5; font-weight: 750; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translate(-50%, 18px); max-width: calc(100% - 36px); padding: 11px 15px; border-radius: 8px; background: var(--ink); color: white; font-size: 12px; opacity: 0; pointer-events: none; transition: .2s ease; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.privacy-lock-overlay { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 22px; background: var(--canvas); }
.privacy-lock-overlay[hidden] { display: none; }
.privacy-lock-card { width: min(100%, 340px); padding: 28px 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.privacy-lock-card h2 { margin-bottom: 8px; }
.privacy-lock-card > p:not(.eyebrow):not(.dialog-error) { color: var(--muted); font-size: 12px; line-height: 1.5; }
.privacy-lock-icon { width: 58px; height: 58px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 18px; color: white; background: var(--ink); font-size: 28px; }
.privacy-lock-card input { width: 170px; margin: 12px auto 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: #f7f9f8; text-align: center; letter-spacing: 8px; font-size: 23px; }
.privacy-lock-card input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31, 167, 120, .12); }
.privacy-lock-card .primary-button { margin-top: 10px; }
.privacy .money { filter: blur(7px); user-select: none; }
.privacy .money-input { filter: blur(7px); }

@media (min-width: 700px) {
  body { background: #dfe6e2; }
  .app-shell { box-shadow: 0 0 55px rgba(20,33,29,.13); }
}

@media (max-width: 360px) {
  .balance-value { font-size: 31px; }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .payment-grid { grid-template-columns: 1fr; }
  .pay-tile { aspect-ratio: auto; min-height: 128px; }
}
