/* ── Reset & Variables ───────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  /* Theme — overridden at runtime by Theme.js */
  --hero-from:    #7C3AED;
  --hero-to:      #4C1D95;
  --primary:      #7C3AED;
  --primary-dark: #4C1D95;
  --primary-light:#EDE9FE;

  --income:       #10B981;
  --income-bg:    #D1FAE5;
  --expense:      #EF4444;
  --expense-bg:   #FEE2E2;
  --warning:      #F59E0B;

  --bg:           #F1F5F9;
  --card:         #FFFFFF;
  --text:         #1E293B;
  --text-sub:     #64748B;
  --text-muted:   #94A3B8;
  --border:       #E2E8F0;

  --nav-h:   42px;
  --safe-b:  0px;
  --safe-t:  env(safe-area-inset-top, 44px);
}

/* 仅在独立模式（已添加到主屏幕）下才启用底部安全区 */
@media (display-mode: standalone) {
  :root { --safe-b: env(safe-area-inset-bottom, 0px); }
}

html {
  height: 100%;
  height: -webkit-fill-available;
  background: var(--card);
}
body {
  height: 100%;
  min-height: -webkit-fill-available;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
  background: var(--card); color: var(--text);
  overflow: hidden; font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#app {
  display: flex; flex-direction: column;
  height: 100%;
  height: 100dvh;
  width: 100%; max-width: 480px; margin: 0 auto;
  position: relative; overflow: hidden; background: var(--bg);
}

#main-content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding-bottom: 8px;
  overscroll-behavior-y: contain;
}

/* ── Bottom Nav ──────────────────────────────────────────── */
#bottom-nav {
  flex-shrink: 0;
  width: 100%;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--card); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  padding-top: 0; z-index: 100;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.07);
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px 12px; min-width: 52px; transition: color 0.2s;
}
.nav-btn.nav-active { color: var(--primary); }
.nav-icon { font-size: 22px; line-height: 1; }
.nav-label { font-size: 10px; }
.nav-btn.nav-add .nav-icon {
  width: 50px; height: 50px; background: var(--primary);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: white; font-size: 30px; margin-top: -22px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

/* ── Shared helpers ──────────────────────────────────────── */
.screen-content { animation: fadeSlide 0.22s ease; }
@keyframes fadeSlide { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

.income-text  { color: var(--income);  }
.expense-text { color: var(--expense); }
.empty-state  { text-align:center; color:var(--text-muted); padding:40px 20px; font-size:14px; }

/* Hero gradient — uses CSS vars so Theme.js controls it */
.hero-gradient {
  background: linear-gradient(145deg, var(--hero-from) 0%, var(--hero-to) 100%);
}

.page-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(var(--safe-t) + 8px) 20px 14px;
  background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 20px; font-weight: 700; }
.header-action-btn {
  background: var(--primary); color: white; border: none;
  border-radius: 10px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}

.toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%) translateY(-10px);
  background: rgba(30,41,59,0.92); color: white; padding: 10px 22px;
  border-radius: 100px; font-size: 14px; font-weight: 500; z-index: 1000;
  opacity: 0; transition: all 0.25s; pointer-events: none;
  backdrop-filter: blur(10px); white-space: nowrap;
}
.toast-show { opacity:1; transform:translateX(-50%) translateY(0); }

/* ── Modal / Bottom sheets ───────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; z-index: 200;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  width: 100%; background: var(--card); border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(20px + var(--safe-b));
  animation: slideUp 0.25s cubic-bezier(.32,1,.46,1);
}
.cat-modal-card {
  padding: 24px 20px 0;
  /* dvh shrinks when keyboard opens; fall back to vh on older browsers */
  max-height: min(88dvh, 88vh);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: transform 0.2s ease;
  will-change: transform;
}
.cat-modal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 8px;
}
.cat-modal-footer {
  flex-shrink: 0;
  padding: 12px 0 calc(16px + var(--safe-b));
  border-top: 1px solid var(--border);
}
@keyframes slideUp { from { transform:translateY(40px); opacity:0; } to { transform:none; opacity:1; } }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-cancel  { flex:1; padding:14px; border-radius:12px; border:1.5px solid var(--border); background:var(--card); font-size:15px; cursor:pointer; }
.modal-confirm { flex:2; padding:14px; border-radius:12px; border:none; background:var(--primary); color:white; font-size:15px; font-weight:600; cursor:pointer; }

.sheet-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.45); z-index:300; display:flex; flex-direction:column; justify-content:flex-end; }
.sheet-overlay.hidden { display:none; }
.bottom-sheet {
  background:var(--card); border-radius:24px 24px 0 0; padding-bottom:var(--safe-b);
  transform:translateY(100%); transition:transform 0.26s cubic-bezier(.32,1,.46,1);
  max-height: min(70dvh, 70vh); display:flex; flex-direction:column;
}
.bottom-sheet.sheet-open { transform:translateY(0); }
.sheet-handle { width:40px; height:4px; background:var(--border); border-radius:2px; margin:12px auto 0; flex-shrink:0; }
.sheet-header { display:flex; justify-content:space-between; align-items:center; padding:14px 20px 10px; flex-shrink:0; border-bottom:1px solid var(--border); }
.sheet-title { font-size:17px; font-weight:700; }
.sheet-close { background:none; border:none; font-size:18px; color:var(--text-muted); cursor:pointer; padding:4px; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px 0; }
.sheet-item { display:flex; align-items:center; justify-content:space-between; width:100%; padding:14px 20px; border:none; background:none; cursor:pointer; transition:background 0.1s; }
.sheet-item:active { background:var(--bg); }
.sheet-item-left { display:flex; align-items:center; gap:14px; }
.sheet-item-flag { font-size:24px; width:32px; text-align:center; }
.sheet-item-label { font-size:16px; font-weight:500; color:var(--text); }
.sheet-item-right { display:flex; align-items:center; gap:10px; }
.sheet-item-sub { font-size:13px; color:var(--text-muted); }
.sheet-item-check { font-size:16px; color:var(--primary); font-weight:700; width:20px; text-align:center; }
.sheet-empty { text-align:center; color:var(--text-muted); padding:30px 20px; font-size:14px; }

/* ═══════════════════════════════════════════════════════════
   HOME SCREEN
═══════════════════════════════════════════════════════════ */
.home-hero {
  background: linear-gradient(145deg, var(--hero-from) 0%, var(--hero-to) 100%);
  padding: calc(var(--safe-t) + 12px) 20px 24px;
  border-radius: 0 0 36px 36px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  position: relative;
  overflow: hidden;
}
.home-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 80% -10%, rgba(255,255,255,0.22) 0%, transparent 50%),
    radial-gradient(ellipse at 10% 110%, rgba(255,255,255,0.08) 0%, transparent 45%),
    linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 40%);
  pointer-events: none;
}
.home-hero-top { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:14px; position:relative; }
.home-greeting { font-size:16px; font-weight:600; color:rgba(255,255,255,.95); }
.home-date { font-size:12px; color:rgba(255,255,255,.6); margin-top:2px; }
.home-balance-label { font-size:12px; color:rgba(255,255,255,.65); margin-bottom:2px; position:relative; letter-spacing:0.3px; }
.home-balance-amount { font-size:42px; font-weight:700; color:white; letter-spacing:-2px; margin-bottom:18px; position:relative; }
.home-stats-row { display:flex; position:relative; }
.home-stat { flex:1; }
.home-stat + .home-stat { border-left:1px solid rgba(255,255,255,.25); padding-left:16px; }
.home-stat-label { font-size:11px; color:rgba(255,255,255,.65); margin-bottom:4px; }
.home-stat-val { font-size:17px; font-weight:700; color:white; }

.period-tabs { display:flex; gap:6px; padding:14px 20px 0; }
.period-tab { flex:1; padding:8px 4px; border:1.5px solid var(--border); border-radius:10px; background:var(--card); color:var(--text-sub); font-size:13px; font-weight:500; cursor:pointer; transition:all .2s; }
.period-tab.active { background:var(--primary); color:white; border-color:var(--primary); }

.section-header { display:flex; justify-content:space-between; align-items:center; padding:16px 20px 10px; }
.section-title { font-size:15px; font-weight:700; }
.see-all-btn { font-size:13px; color:var(--primary); background:none; border:none; cursor:pointer; font-weight:500; }

.chart-card { background:var(--card); border-radius:18px; margin:14px 20px 0; padding:16px; box-shadow:0 2px 14px rgba(0,0,0,.06); }
.chart-title { font-size:14px; font-weight:700; color:var(--text); margin-bottom:14px; }

.pie-wrap { display:flex; align-items:center; gap:16px; }
#pie-chart { flex-shrink:0; width:130px !important; height:130px !important; }
.pie-legend { flex:1; display:flex; flex-direction:column; gap:6px; }
.legend-item { display:flex; align-items:center; gap:6px; }
.legend-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.legend-label { flex:1; font-size:12px; color:var(--text-sub); }
.legend-val { font-size:12px; font-weight:600; color:var(--text); }

.recent-list { padding:0 20px; }
.txn-card { display:flex; align-items:center; gap:12px; background:var(--card); border-radius:14px; padding:14px; margin-bottom:8px; box-shadow:0 2px 8px rgba(0,0,0,.05); position:relative; }
.txn-icon { font-size:26px; width:44px; height:44px; background:var(--bg); border-radius:12px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.txn-info { flex:1; min-width:0; }
.txn-cat { font-size:14px; font-weight:600; }
.txn-note { font-size:12px; color:var(--text-muted); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.txn-right { text-align:right; flex-shrink:0; }
.txn-amount { font-size:15px; font-weight:700; }
.txn-date { font-size:11px; color:var(--text-muted); margin-top:2px; }

/* ═══════════════════════════════════════════════════════════
   TRANSACTIONS SCREEN
═══════════════════════════════════════════════════════════ */
.txn-hero {
  background: linear-gradient(145deg, var(--hero-from) 0%, var(--hero-to) 100%);
  padding: calc(var(--safe-t) + 10px) 20px 20px;
  border-radius: 0 0 28px 28px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
}
.txn-hero-title { font-size:20px; font-weight:700; color:white; margin-bottom:14px; }

.txn-period-row { display:flex; gap:6px; margin-bottom:14px; overflow-x:auto; scrollbar-width:none; }
.txn-period-row::-webkit-scrollbar { display:none; }
.txn-period-btn {
  padding:7px 14px; border-radius:20px; border:1.5px solid rgba(255,255,255,.35);
  background:rgba(255,255,255,.12); color:rgba(255,255,255,.85);
  font-size:13px; font-weight:500; cursor:pointer; white-space:nowrap; transition:all .2s; flex-shrink:0;
}
.txn-period-btn.active { background:white; color:var(--primary); border-color:white; font-weight:700; }

.txn-summary-row { display:flex; align-items:center; }
.txn-sum-item { flex:1; text-align:center; }
.txn-sum-label { display:block; font-size:11px; color:rgba(255,255,255,.65); margin-bottom:3px; }
.txn-sum-val { display:block; font-size:14px; font-weight:700; color:white; }
.txn-sum-sep { width:1px; height:30px; background:rgba(255,255,255,.25); }

.txn-type-bar { display:flex; gap:8px; padding:14px 20px 0; }
.txn-type-btn { padding:7px 20px; border-radius:20px; border:1.5px solid var(--border); background:var(--card); color:var(--text-sub); font-size:13px; cursor:pointer; transition:all .2s; }
.txn-type-btn.active { background:var(--primary); color:white; border-color:var(--primary); }

.txn-main-list { padding:10px 20px; }
.txn-date-group { margin-bottom:6px; }
.txn-date-header { display:flex; justify-content:space-between; align-items:center; padding:8px 0 6px; }
.txn-date-left { display:flex; align-items:center; gap:8px; }
.txn-date-tag { font-size:13px; font-weight:700; color:var(--text); }
.txn-date-full { font-size:11px; color:var(--text-muted); }
.txn-date-amounts { font-size:12px; font-weight:600; }

.txn-group-cards { display:flex; flex-direction:column; gap:6px; }
/* 左滑删除容器 */
.txn-swipe-wrap {
  position: relative; overflow: hidden; border-radius: 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.txn-del-bg {
  position: absolute; right: 0; top: 0; bottom: 0; width: 80px;
  background: var(--expense); color: white; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 12px; font-weight: 600; user-select: none;
}
.txn-del-bg::before { content: '🗑'; font-size: 18px; }
.txn-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); padding: 12px 14px;
  position: relative; z-index: 1;
  will-change: transform;
}
.txn-row-icon { font-size:24px; width:40px; height:40px; background:var(--bg); border-radius:10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.txn-row-info { flex:1; min-width:0; }
.txn-row-cat { font-size:14px; font-weight:600; }
.txn-row-note { font-size:12px; color:var(--text-muted); margin-top:1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.txn-row-right { text-align:right; flex-shrink:0; }
.txn-row-amount { font-size:15px; font-weight:700; }
.txn-row-orig { font-size:11px; color:var(--text-muted); margin-top:1px; }

/* ═══════════════════════════════════════════════════════════
   STATS SCREEN
═══════════════════════════════════════════════════════════ */
.stats-hero {
  background: linear-gradient(145deg, var(--hero-from) 0%, var(--hero-to) 100%);
  padding: calc(var(--safe-t) + 10px) 20px 24px;
  border-radius: 0 0 32px 32px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.stats-hero-title { font-size:20px; font-weight:700; color:white; margin-bottom:14px; }
.period-pills { display:flex; gap:6px; margin-bottom:10px; }
.period-pill { flex:1; padding:7px 0; border-radius:20px; border:1.5px solid rgba(255,255,255,.3); background:rgba(255,255,255,.12); color:rgba(255,255,255,.8); font-size:13px; font-weight:500; cursor:pointer; transition:all .2s; }
.period-pill.active { background:white; color:var(--primary); border-color:white; font-weight:700; }

/* Period navigation row */
.period-nav-row {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-bottom: 16px;
}
.period-nav-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.4);
  background: rgba(255,255,255,.15); color: white;
  font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.period-nav-btn:disabled { opacity: .35; cursor: default; }
.period-nav-btn:not(:disabled):active { background: rgba(255,255,255,.3); }
.period-nav-label {
  font-size: 14px; font-weight: 600; color: white;
  min-width: 160px; text-align: center;
}

.stats-hero-numbers { display:flex; }

/* Bar selected info (above trend chart) */
.bar-selected-info {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--card); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.bar-selected-info.hidden { display: none; }
.bsi-date  { font-size: 13px; font-weight: 700; color: var(--text); flex-shrink: 0; }
.bsi-item  { font-size: 13px; font-weight: 600; }
.bsi-empty { font-size: 13px; color: var(--text-muted); }
.hero-stat { flex:1; text-align:center; }
.hero-stat + .hero-stat { border-left:1px solid rgba(255,255,255,.2); }
.hero-stat-label { display:block; font-size:11px; color:rgba(255,255,255,.65); margin-bottom:3px; }
.hero-stat-val { display:block; font-size:14px; font-weight:700; color:white; }

.stats-section { margin:16px 20px 0; }
.stats-section-title { font-size:12px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px; margin-bottom:10px; }

/* ── Daily Avg Card ──────────────────────────────────────── */
.daily-avg-card {
  background: var(--card);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: 0 2px 14px rgba(0,0,0,.06);
}
.daily-avg-main {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.daily-avg-value {
  font-size: 28px; font-weight: 700; letter-spacing: -0.5px;
}
.daily-avg-trend {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.trend-up   { background: #FEE2E2; color: var(--expense); }
.trend-down { background: #D1FAE5; color: var(--income); }
.trend-neutral { background: var(--bg); color: var(--text-muted); }
.trend-arrow { font-size: 13px; }
.daily-avg-meta {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.daily-avg-basis { font-size: 12px; color: var(--text-muted); }
.daily-avg-total { font-size: 12px; color: var(--text-sub); font-weight: 500; }

.treemap-container { background:var(--card); border-radius:18px; overflow:hidden; position:relative; height:230px; box-shadow:0 2px 14px rgba(0,0,0,.06); }
#treemap-canvas { display:block; width:100%; height:100%; }
.treemap-empty { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:var(--text-muted); font-size:14px; }
.treemap-empty.hidden { display:none; }

.treemap-legend { display:flex; flex-direction:column; gap:6px; margin-top:10px; }
.tm-legend-item { display:flex; align-items:center; gap:8px; }
.tm-legend-dot { width:10px; height:10px; border-radius:3px; flex-shrink:0; }
.tm-legend-name { flex:1; font-size:13px; color:var(--text-sub); }
.tm-legend-pct { font-size:12px; color:var(--text-muted); width:32px; text-align:right; }
.tm-legend-val { font-size:13px; font-weight:600; color:var(--text); width:80px; text-align:right; }

.rank-item { display:flex; align-items:center; gap:8px; padding:10px 0; border-bottom:1px solid var(--border); }
.rank-item:last-child { border-bottom:none; }
.rank-left { display:flex; align-items:center; gap:6px; width:90px; flex-shrink:0; }
.rank-badge { width:20px; height:20px; border-radius:6px; color:white; font-size:11px; font-weight:700; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.rank-icon { font-size:18px; }
.rank-label { font-size:13px; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.rank-center { flex:1; display:flex; align-items:center; gap:8px; }
.rank-track { flex:1; height:6px; background:var(--border); border-radius:3px; overflow:hidden; }
.rank-fill { height:100%; border-radius:3px; transition:width .6s ease; }
.rank-pct { font-size:11px; color:var(--text-muted); width:28px; text-align:right; flex-shrink:0; }
.rank-val { font-size:13px; font-weight:700; width:76px; text-align:right; flex-shrink:0; }

.view-records-btn { width:100%; padding:14px; border-radius:14px; border:1.5px solid var(--border); background:var(--card); color:var(--primary); font-size:14px; font-weight:600; cursor:pointer; }

/* ═══════════════════════════════════════════════════════════
   ADD SCREEN
═══════════════════════════════════════════════════════════ */
.add-type-bar { display:flex; padding:calc(var(--safe-t) + 8px) 20px 0; background:var(--card); }
.add-type-btn { flex:1; padding:12px; border:none; cursor:pointer; font-size:16px; font-weight:600; transition:all .2s; color:var(--text-muted); background:none; border-bottom:2.5px solid transparent; }
.add-type-btn.active { color:var(--expense); border-bottom-color:var(--expense); }
#type-income.active { color:var(--income); border-bottom-color:var(--income); }

.add-amount-wrap { display:flex; align-items:baseline; justify-content:center; gap:6px; padding:20px 24px 10px; min-height:88px; }
.add-amount-income .add-cur-sym, .add-amount-income .add-num { color:var(--income); }
.add-cur-sym { font-size:26px; font-weight:600; color:var(--expense); }
.add-num { font-size:52px; font-weight:700; color:var(--expense); letter-spacing:-2px; line-height:1; }

.add-fields-card { background:var(--card); border-radius:18px; margin:10px 20px 0; box-shadow:0 2px 12px rgba(0,0,0,.06); overflow:hidden; }
.add-field-row { display:flex; align-items:center; gap:12px; padding:14px 16px; width:100%; border:none; background:none; cursor:pointer; text-align:left; }
.add-field-divider { height:1px; background:var(--border); margin:0 16px; }
.add-field-icon { font-size:18px; flex-shrink:0; }
.add-field-label { font-size:14px; color:var(--text-sub); width:34px; flex-shrink:0; }
.add-field-val { flex:1; font-size:14px; font-weight:500; color:var(--text); text-align:right; padding-right:4px; }
.add-field-arrow { color:var(--text-muted); font-size:18px; flex-shrink:0; }
.add-field-date-input { flex:1; border:none; outline:none; font-size:14px; font-weight:500; color:var(--text); text-align:right; background:none; cursor:pointer; padding-right:4px; font-family:inherit; }
.add-field-text-input { flex:1; border:none; outline:none; font-size:14px; color:var(--text); text-align:right; background:none; padding-right:4px; font-family:inherit; }
.add-field-text-input::placeholder { color:var(--text-muted); }

.add-numpad { padding:10px 20px 4px; }
.numpad-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.nk { padding:18px 0; border-radius:14px; border:none; background:var(--card); color:var(--text); font-size:20px; font-weight:500; cursor:pointer; transition:transform .08s,background .1s; box-shadow:0 2px 6px rgba(0,0,0,.07); }
.nk:active { transform:scale(.92); background:var(--border); }
.nk-del { color:var(--text-sub); }
.nk-confirm { grid-column:span 4; background:var(--primary); color:white; font-size:16px; font-weight:700; border-radius:16px; padding:18px; box-shadow:0 4px 20px rgba(0,0,0,.2); }
.nk-confirm:active { transform:scale(.98); }

/* ── File Storage Card ───────────────────────────────────── */
.fs-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border-radius: 16px;
  padding: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.fs-active  { border: 1.5px solid var(--income); }
.fs-warn    { border: 1.5px solid var(--warning); }
.fs-unsupported { border: 1.5px solid var(--border); opacity: .8; }
.fs-status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--income); flex-shrink: 0; margin-top: 5px;
  box-shadow: 0 0 0 3px rgba(16,185,129,.2);
}
.fs-icon  { font-size: 24px; flex-shrink: 0; }
.fs-text  { flex: 1; min-width: 0; }
.fs-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.fs-filename { font-size: 13px; color: var(--primary); font-weight: 600; margin-bottom: 4px; word-break: break-all; }
.fs-sub   { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ═══════════════════════════════════════════════════════════
   BUDGET SCREEN
═══════════════════════════════════════════════════════════ */
.budget-overview { padding:16px 20px 0; }
.budget-overview-card { background:linear-gradient(135deg,var(--hero-from),var(--hero-to)); color:white; border-radius:18px; padding:18px; }
.overview-row { display:flex; justify-content:space-around; margin-bottom:16px; }
.overview-label { font-size:11px; opacity:.8; margin-bottom:4px; text-align:center; }
.overview-val { font-size:16px; font-weight:700; text-align:center; }
.overview-pct { font-size:12px; opacity:.8; text-align:right; margin-top:6px; }

.budget-list { padding:12px 20px; }
.budget-card { background:var(--card); border-radius:18px; padding:16px; margin-bottom:12px; box-shadow:0 2px 12px rgba(0,0,0,.06); }
.budget-card-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:12px; }
.budget-card-left { display:flex; align-items:center; gap:10px; }
.budget-icon { font-size:28px; }
.budget-name { font-size:15px; font-weight:600; }
.budget-meta { font-size:12px; color:var(--text-muted); margin-top:2px; }
.budget-card-actions { display:flex; gap:8px; }
.budget-edit-btn, .budget-del-btn { border:none; border-radius:8px; padding:5px 10px; font-size:12px; cursor:pointer; }
.budget-edit-btn { background:var(--primary-light); color:var(--primary); }
.budget-del-btn { background:var(--expense-bg); color:var(--expense); }
.budget-amounts { margin-bottom:8px; }
.budget-spent { font-size:18px; font-weight:700; }
.budget-total { font-size:13px; color:var(--text-muted); }
.budget-bar-wrap { height:8px; background:var(--border); border-radius:4px; overflow:hidden; margin-bottom:6px; }
.budget-bar-fill { height:100%; border-radius:4px; transition:width .6s ease; }
.budget-bar-fill.safe { background:var(--income); }
.budget-bar-fill.warning { background:var(--warning); }
.budget-bar-fill.danger { background:var(--expense); }
.budget-remaining { display:flex; justify-content:space-between; font-size:12px; }
.budget-pct { color:var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   SETTINGS SCREEN
═══════════════════════════════════════════════════════════ */
.settings-group { margin:16px 20px 0; }
.settings-group-title { font-size:12px; font-weight:700; color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px; margin-bottom:10px; }
.hint { font-size:11px; color:var(--text-muted); font-weight:400; text-transform:none; letter-spacing:0; }

.settings-card { background:var(--card); border-radius:18px; overflow:hidden; box-shadow:0 2px 12px rgba(0,0,0,.06); }
.settings-row { display:flex; align-items:center; gap:12px; padding:14px 16px; }
.settings-row-label { font-size:14px; color:var(--text-sub); flex-shrink:0; }
.settings-select { flex:1; border:none; outline:none; font-size:14px; color:var(--text); background:none; font-family:inherit; text-align:right; cursor:pointer; -webkit-appearance:none; }
.field-input { width:100%; padding:10px 14px; border:1.5px solid var(--border); border-radius:12px; font-size:14px; background:var(--card); color:var(--text); outline:none; font-family:inherit; -webkit-appearance:none; appearance:none; }
.field-input:focus { border-color:var(--primary); }
.field-row { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.field-row label { font-size:13px; color:var(--text-sub); width:34px; flex-shrink:0; }

/* Theme swatches */
.theme-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; padding:16px; }
.theme-swatch { height:52px; border-radius:14px; border:3px solid transparent; cursor:pointer; transition:transform .15s,border-color .15s; }
.theme-swatch:active { transform:scale(.93); }
.theme-swatch.theme-active { border-color:var(--text); box-shadow:0 0 0 2px white inset; }
.theme-custom-row { display:flex; align-items:center; justify-content:space-between; padding:0 16px 14px; }
.theme-custom-label { font-size:13px; color:var(--text-sub); }
.theme-custom-btn { position:relative; display:flex; align-items:center; gap:8px; padding:8px 14px; border-radius:10px; background:var(--bg); font-size:13px; font-weight:500; color:var(--text); cursor:pointer; border:1.5px solid var(--border); }
.custom-preview-circle { width:18px; height:18px; border-radius:50%; background:conic-gradient(red,yellow,green,blue,red); display:inline-block; flex-shrink:0; }

/* Exchange rate single picker */
.rate-eq-row { display:flex; align-items:center; gap:10px; padding:0 16px 14px; }
.rate-eq-text { font-size:14px; color:var(--text-sub); flex-shrink:0; }
.rate-val-input { flex:1; padding:10px; border:1.5px solid var(--border); border-radius:12px; font-size:16px; font-weight:600; text-align:center; outline:none; }
.rate-val-input:focus { border-color:var(--primary); }
.rate-cny-lbl { font-size:14px; color:var(--text-sub); flex-shrink:0; }

.primary-btn { width:calc(100% - 32px); margin:0 16px 16px; display:block; padding:13px; background:var(--primary); color:white; border:none; border-radius:13px; font-size:15px; font-weight:600; cursor:pointer; box-shadow:0 3px 14px rgba(0,0,0,.15); }

/* Accordion */
.acc-card { padding:0; }
.acc-header { display:flex; align-items:center; gap:10px; width:100%; padding:16px; border:none; background:none; cursor:pointer; transition:background .1s; text-align:left; }
.acc-header:active, .acc-header-open { background:rgba(0,0,0,.02); }
.acc-icon-label { flex:1; font-size:15px; font-weight:600; }
.acc-count { font-size:12px; color:var(--text-muted); }
.acc-chevron { font-size:18px; color:var(--text-muted); transition:transform .22s; }
.chev-open { transform:rotate(90deg); }
.acc-body { padding:0 12px 12px; }
.acc-body.hidden { display:none; }
.acc-sep { height:1px; background:var(--border); margin:0 16px; }

/* Category items in accordion */
.cat-manage-item { display:flex; align-items:center; gap:10px; background:var(--bg); border-radius:12px; padding:11px 12px; margin-bottom:6px; }
.cat-manage-icon { font-size:22px; width:30px; text-align:center; flex-shrink:0; }
.cat-manage-label { flex:1; font-size:14px; font-weight:500; }
.cat-badge { font-size:10px; background:var(--primary-light); color:var(--primary); padding:2px 8px; border-radius:20px; font-weight:600; }
.cat-delete-btn { width:28px; height:28px; border-radius:50%; border:none; background:var(--expense-bg); color:var(--expense); font-size:16px; cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.cat-list-empty { text-align:center; color:var(--text-muted); padding:16px; font-size:13px; }
.add-cat-item-btn { width:100%; padding:11px; border:2px dashed var(--primary); border-radius:12px; background:var(--primary-light); color:var(--primary); font-size:14px; font-weight:600; cursor:pointer; margin-top:4px; }

/* Settings action rows */
.settings-action-row { display:flex; justify-content:space-between; align-items:center; width:100%; padding:15px 16px; border:none; background:none; cursor:pointer; font-size:14px; font-weight:500; }
.settings-action-row:active { background:var(--bg); }
.export-row { color:var(--primary); }
.import-row { color:var(--income); }
.danger-row { color:var(--expense); }

.settings-nav-btn { width:100%; padding:14px 16px; background:var(--card); border:none; border-radius:18px; text-align:left; font-size:15px; font-weight:600; color:var(--primary); cursor:pointer; box-shadow:0 2px 12px rgba(0,0,0,.06); }

.about-card { background:var(--card); border-radius:18px; padding:28px 20px; text-align:center; box-shadow:0 2px 12px rgba(0,0,0,.06); }
.about-icon { font-size:44px; margin-bottom:10px; }
.about-title { font-size:22px; font-weight:700; margin-bottom:6px; }
.about-sub { font-size:13px; color:var(--text-sub); margin-bottom:8px; }
.about-ver { font-size:12px; color:var(--text-muted); }

/* Cat modal */
.cat-modal-type-row { display:flex; gap:8px; margin-bottom:16px; }
.cat-modal-type-btn { flex:1; padding:10px; border-radius:10px; border:1.5px solid var(--border); background:var(--card); font-size:14px; font-weight:500; cursor:pointer; transition:all .15s; }
.cat-modal-type-btn.active { background:var(--primary); color:white; border-color:var(--primary); }
.cat-modal-section-label { font-size:12px; font-weight:700; color:var(--text-muted); margin-bottom:8px; text-transform:uppercase; letter-spacing:.4px; }
.emoji-preview-row { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.emoji-big-preview { font-size:40px; width:56px; height:56px; background:var(--bg); border-radius:14px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.emoji-text-input { flex:1; padding:10px 14px; border:1.5px solid var(--border); border-radius:12px; font-size:20px; text-align:center; }
.emoji-text-input:focus { border-color:var(--primary); outline:none; }
.emoji-grid-wrap { max-height:150px; overflow-y:auto; margin-bottom:14px; background:var(--bg); border-radius:12px; padding:8px; }
.emoji-grid { display:grid; grid-template-columns:repeat(8,1fr); gap:4px; }
.emoji-btn { font-size:22px; padding:6px 2px; border:none; background:none; cursor:pointer; border-radius:8px; transition:background .1s; line-height:1; }
.emoji-btn:hover, .emoji-btn.emoji-selected { background:var(--primary-light); }

/* ── Home Quick Stats Row ────────────────────────────────── */
.home-quick-row { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; padding:14px 20px 0; }
.home-quick-pill { background:var(--card); border-radius:14px; padding:12px 10px; text-align:center; box-shadow:0 2px 8px rgba(0,0,0,.05); }
.home-quick-pill-val { font-size:14px; font-weight:700; color:var(--text); margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.home-quick-pill-label { font-size:11px; color:var(--text-muted); }

/* ── Home Budget Section ─────────────────────────────────── */
.home-budget-card { background:var(--card); border-radius:18px; margin:14px 20px 0; padding:16px; box-shadow:0 2px 14px rgba(0,0,0,.06); }
.home-budget-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.home-budget-title { font-size:14px; font-weight:700; color:var(--text); }
.home-budget-more { background:none; border:none; color:var(--primary); font-size:12px; font-weight:500; cursor:pointer; padding:0; }
.home-budget-item { margin-bottom:12px; }
.home-budget-item:last-child { margin-bottom:0; }
.home-budget-item-top { display:flex; justify-content:space-between; align-items:center; margin-bottom:5px; }
.home-budget-item-name { font-size:13px; color:var(--text); font-weight:500; }
.home-budget-item-pct { font-size:12px; font-weight:700; }
.home-budget-item-sub { display:flex; justify-content:space-between; font-size:11px; color:var(--text-muted); margin-top:3px; }
.safe-text    { color:var(--income); }
.warning-text { color:var(--warning); }
.danger-text  { color:var(--expense); }

/* ── Quick-Add Screen (iOS Shortcut) ─────────────────────── */
.qa-wrap {
  min-height: 100%;
  background: linear-gradient(160deg, #f0e6ff 0%, #e8f4ff 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: calc(var(--safe-t) + 24px) 20px calc(var(--safe-b) + 24px);
}
.qa-header {
  font-size: 15px; font-weight: 700; color: #5B21B6;
  margin-bottom: 20px; text-align: center; line-height: 1.4;
}
.qa-card {
  width: 100%; max-width: 420px;
  background: white; border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(91,33,182,.15);
}
.qa-row {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; background: none; border: none;
  width: 100%; cursor: pointer; text-align: left;
  transition: background .12s;
}
.qa-row:active { background: #f5f0ff; }
.qa-row-icon  { font-size: 22px; width: 28px; text-align: center; flex-shrink: 0; }
.qa-row-label { font-size: 15px; color: #374151; flex-shrink: 0; }
.qa-row-val   { font-size: 15px; font-weight: 600; color: #111827; flex: 1; }
.qa-divider   { height: 1px; background: #F3F0FF; margin: 0 20px; }
.qa-confirm   { background: #f0fff4 !important; }
.qa-confirm .qa-row-label { color: #166534; font-weight: 700; font-size: 16px; }
.qa-cancel    { background: #fff5f5 !important; }
.qa-cancel .qa-row-label  { color: #991B1B; font-weight: 700; font-size: 16px; }

.qa-success {
  min-height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(160deg, #f0e6ff 0%, #e8f4ff 100%);
  padding: 40px;
}
.qa-success-icon  { font-size: 72px; margin-bottom: 20px; }
.qa-success-title { font-size: 24px; font-weight: 800; color: #166534; margin-bottom: 8px; }
.qa-success-sub   { font-size: 18px; font-weight: 600; color: #374151; margin-bottom: 16px; }
.qa-success-hint  { font-size: 13px; color: #9CA3AF; }

/* ── QuickAdd Bottom Sheet ───────────────────────────────── */
.qa-sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0);
  z-index: 200; display: flex; align-items: flex-end;
  transition: background .2s;
}
.qa-sheet-overlay.qa-sheet-open { background: rgba(0,0,0,.45); }
.qa-sheet {
  width: 100%; background: var(--card);
  border-radius: 20px 20px 0 0;
  padding-bottom: calc(12px + var(--safe-b));
  max-height: 75vh; overflow-y: auto;
  transform: translateY(100%); transition: transform .25s cubic-bezier(.32,1,.23,1);
}
.qa-sheet-overlay.qa-sheet-open .qa-sheet { transform: translateY(0); }
.qa-sheet-title {
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  text-align: center; padding: 14px 20px 8px; letter-spacing: .6px; text-transform: uppercase;
}
.qa-sheet-item {
  width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 14px 24px; background: none; border: none; border-top: 1px solid var(--border);
  font-size: 16px; color: var(--text); cursor: pointer; text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.qa-sheet-item:active { background: var(--primary-light); }
.qa-sheet-icon { font-size: 22px; width: 30px; text-align: center; flex-shrink: 0; }
.qa-sheet-label { font-weight: 500; }
.qa-sheet-confirm {
  display: block; width: calc(100% - 32px); margin: 10px 16px 0;
  padding: 14px; background: var(--primary); border: none; border-radius: 12px;
  font-size: 16px; font-weight: 700; color: #fff; cursor: pointer;
}
.qa-sheet-cancel {
  display: block; width: calc(100% - 32px); margin: 8px 16px 0;
  padding: 14px; background: var(--bg); border: none; border-radius: 12px;
  font-size: 16px; font-weight: 600; color: var(--text-sub); cursor: pointer;
}
.qa-sheet-input {
  width: 100%; padding: 12px 16px; border: 2px solid var(--border);
  border-radius: 12px; font-size: 22px; font-family: inherit;
  color: var(--text); background: var(--bg); outline: none;
}
.qa-sheet-input:focus { border-color: var(--primary); }

/* ── Login Screen ────────────────────────────────────────── */
.login-wrap {
  display: flex; flex-direction: column; align-items: center;
  min-height: 100vh; padding: 0 24px 40px;
  background: var(--bg);
}
.login-hero {
  display: flex; flex-direction: column; align-items: center;
  padding: calc(var(--safe-t) + 40px) 0 32px;
}
.login-logo { font-size: 56px; line-height: 1; }
.login-title { font-size: 26px; font-weight: 800; color: var(--text); margin-top: 12px; }
.login-sub { font-size: 14px; color: var(--text-sub); margin-top: 4px; }
.login-tabs {
  display: flex; gap: 0; border-radius: 12px;
  background: var(--border); padding: 3px;
  margin-bottom: 20px; width: 100%; max-width: 320px;
}
.login-tab {
  flex: 1; padding: 9px; border: none; border-radius: 10px;
  background: transparent; font-size: 15px; font-weight: 600;
  color: var(--text-sub); cursor: pointer; transition: all .2s;
}
.login-tab.active { background: var(--card); color: var(--primary); box-shadow: 0 1px 6px rgba(0,0,0,.1); }
.login-card {
  background: var(--card); border-radius: 20px;
  padding: 24px 20px; width: 100%; max-width: 360px;
  box-shadow: 0 4px 24px rgba(0,0,0,.07);
}
.login-field { margin-bottom: 16px; }
.login-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-sub); margin-bottom: 6px; }
.login-input {
  width: 100%; padding: 13px 14px; border: 2px solid var(--border);
  border-radius: 12px; font-size: 16px; font-family: inherit;
  color: var(--text); background: var(--bg); outline: none;
  transition: border-color .2s;
}
.login-input:focus { border-color: var(--primary); }
.login-error {
  font-size: 13px; color: var(--expense); margin-bottom: 12px;
  padding: 8px 12px; background: var(--expense-bg); border-radius: 8px;
}
.login-btn {
  width: 100%; padding: 14px; border: none; border-radius: 14px;
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
  color: #fff; font-size: 16px; font-weight: 700;
  cursor: pointer; margin-top: 4px; letter-spacing: .3px;
}
.login-btn:disabled { opacity: .6; cursor: not-allowed; }
.back-btn {
  display: flex; align-items: center;
  border: none; background: transparent;
  font-size: 17px; font-weight: 600; color: var(--primary);
  cursor: pointer; padding: 4px 0; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.back-btn:active { opacity: .6; }

.login-forgot-link {
  display: block; width: 100%; margin-top: 12px; padding: 8px;
  border: none; background: transparent;
  font-size: 14px; color: var(--text-sub); cursor: pointer; text-align: center;
}
.login-forgot-link:active { color: var(--primary); }
.login-success {
  font-size: 13px; color: var(--income); margin-bottom: 12px;
  padding: 8px 12px; background: var(--income-bg); border-radius: 8px;
}
.settings-row-email { font-size: 13px; color: var(--text-sub); word-break: break-all; }

/* ══════════════════════════════════════════════════════════════
   CALENDAR VIEW
══════════════════════════════════════════════════════════════ */
/* Overlay — slides up over the whole app */
.cal-overlay {
  position: absolute; inset: 0; z-index: 200;
  background: var(--bg);
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.32,1,.6,1);
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.cal-overlay.cal-show { transform: translateY(0); }

/* Panel */
.cal-panel {
  min-height: 100%;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px);
}

/* Header */
.cal-header {
  display: flex; align-items: center; gap: 4px;
  padding: calc(var(--safe-t) + 12px) 14px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.cal-close-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg); border: none; font-size: 16px;
  color: var(--text-sub); cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.cal-nav-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg); border: none; font-size: 22px; line-height: 1;
  color: var(--text); cursor: pointer; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.cal-nav-btn:active { background: var(--border); }
.cal-title {
  flex: 1; text-align: center; font-size: 17px;
  font-weight: 700; color: var(--text); cursor: default;
}
.cal-header-icon { font-size: 22px; flex-shrink: 0; }

/* Weekday row */
.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  padding: 10px 10px 4px;
  background: var(--card);
}
.cal-wday {
  text-align: center; font-size: 12px;
  color: var(--text-muted); font-weight: 500;
}

/* Day grid */
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px; padding: 6px 10px 10px;
  background: var(--card);
}
.cal-cell {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px;
  border-radius: 10px; background: var(--bg);
  padding: 6px 2px; cursor: pointer;
  min-height: 52px; transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.cal-cell:active { background: var(--border); }
.cal-empty { background: transparent; cursor: default; pointer-events: none; }
.cal-today { background: #DBEAFE; }
.cal-today .cal-dn { color: #1D4ED8; }
.cal-selected { background: #BFDBFE !important; }
.cal-selected .cal-dn { color: #1E40AF; font-weight: 800; }

/* Cell content */
.cal-dn {
  font-size: 15px; font-weight: 700; color: var(--text); line-height: 1;
}
.cal-exp { font-size: 10px; color: var(--expense); font-weight: 600; line-height: 1.2; }
.cal-inc { font-size: 10px; color: var(--income);  font-weight: 600; line-height: 1.2; }

/* Month summary */
.cal-summary {
  font-size: 13px; color: var(--text-sub);
  padding: 10px 16px 6px;
  background: var(--card);
  border-top: 1px solid var(--border);
}
.cal-summary .income-text  { font-weight: 600; }
.cal-summary .expense-text { font-weight: 600; }

/* Day list */
.cal-day-list { padding: 0 16px; margin-top: 8px; }
.cal-dl-head {
  font-size: 15px; font-weight: 700; color: var(--text);
  padding: 12px 0 8px;
}
.cal-dl-empty {
  text-align: center; color: var(--text-muted);
  font-size: 13px; padding: 24px 0;
}
.cal-txn-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.cal-txn-icon {
  font-size: 24px; width: 40px; height: 40px;
  background: var(--bg); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cal-txn-info { flex: 1; min-width: 0; }
.cal-txn-cat  { font-size: 14px; font-weight: 600; }
.cal-txn-note { font-size: 12px; color: var(--text-muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-txn-right { text-align: right; flex-shrink: 0; }
.cal-txn-amt   { font-size: 15px; font-weight: 700; }
.cal-txn-acc   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Transactions hero — calendar button */
.txn-hero-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.txn-hero-top .txn-hero-title { margin-bottom: 0; }
.txn-cal-btn {
  font-size: 22px; background: rgba(255,255,255,.18);
  border: none; border-radius: 10px; padding: 4px 8px;
  cursor: pointer; line-height: 1;
}
.txn-cal-btn:active { background: rgba(255,255,255,.32); }

/* ── Account tag ─────────────────────────────────────────── */
.acct-tag {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 11px; padding: 1px 6px; border-radius: 6px;
  background: var(--primary-light); color: var(--primary);
  margin-left: 4px; vertical-align: middle; font-weight: 500;
}

/* ── Search bar ──────────────────────────────────────────── */
.txn-search-wrap { padding: 8px 16px 4px; }
.txn-search-input {
  width: 100%; padding: 9px 14px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--card);
  font-size: 14px; color: var(--text); outline: none;
  transition: border-color 0.2s;
}
.txn-search-input:focus { border-color: var(--primary); }

/* ── Edit hint arrow on txn row ─────────────────────────── */
.txn-row-edit-hint {
  color: var(--text-muted); font-size: 18px; opacity: 0.4; flex-shrink: 0; margin-left: 2px;
}

/* ── Add screen edit mode header ────────────────────────── */
.add-edit-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 0;
}
.add-back-btn {
  background: none; border: none; color: var(--primary);
  font-size: 16px; font-weight: 600; cursor: pointer; padding: 4px 0;
}
.add-edit-title { font-size: 16px; font-weight: 700; color: var(--text); }

/* ── Recurring rules ────────────────────────────────────── */
.recur-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
}
.recur-icon { font-size: 22px; flex-shrink: 0; }
.recur-info { flex: 1; min-width: 0; }
.recur-name { font-size: 14px; font-weight: 600; }
.recur-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.recur-freq-badge {
  background: var(--primary-light); color: var(--primary);
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 6px;
}
.recur-amt { font-size: 14px; font-weight: 700; flex-shrink: 0; }
.recur-toggle {
  font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 8px;
  border: none; cursor: pointer; flex-shrink: 0;
}
.recur-on  { background: var(--income-bg);  color: var(--income);  }
.recur-off { background: var(--expense-bg); color: var(--expense); }
.recur-del {
  width: 24px; height: 24px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--expense-bg); color: var(--expense);
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ── Stats screen additions ────────────────────────────── */
.stats-hero-title-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.stats-hero-title-row .stats-hero-title { margin-bottom: 0; }
.stats-month-card-btn {
  padding: 6px 12px; border-radius: 10px; border: 1.5px solid rgba(255,255,255,.4);
  background: rgba(255,255,255,.15); color: white;
  font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.stats-section-title-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.stats-section-title-row .stats-section-title { margin-bottom: 0; }
.stats-export-btn {
  padding: 4px 10px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--card);
  color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer;
}

/* ── Savings goal (home screen) ───────────────────────── */
.home-goal-card { background: var(--card); border-radius: 18px; margin: 14px 20px 0; padding: 16px; box-shadow: 0 2px 14px rgba(0,0,0,.06); }
.home-goal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.home-goal-title { font-size: 14px; font-weight: 700; }
.home-goal-pct { font-size: 13px; font-weight: 700; }
.home-goal-amounts { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.home-goal-achieved { font-size: 12px; color: var(--income); font-weight: 600; }

/* ── Settings savings goal input ──────────────────────── */
.settings-goal-input { flex: 1; border: none; outline: none; font-size: 14px; font-weight: 600; color: var(--text); text-align: right; background: none; font-family: inherit; -webkit-appearance: none; appearance: none; }

/* ── Batch delete ─────────────────────────────────────── */
.txn-batch-btn {
  padding: 5px 11px; border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,.4);
  background: rgba(255,255,255,.15); color: white;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.batch-action-bar {
  position: fixed; bottom: calc(var(--nav-h) + var(--safe-b));
  left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: var(--card); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; z-index: 90;
  box-shadow: 0 -4px 20px rgba(0,0,0,.1);
  gap: 8px;
}
.batch-action-bar.hidden { display: none; }
.batch-cancel-btn { padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--card); font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-sub); white-space: nowrap; }
.batch-select-all { padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--bg); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.batch-count { flex: 1; text-align: center; font-size: 13px; font-weight: 600; color: var(--text); }
.batch-delete-btn { padding: 8px 14px; border-radius: 10px; border: none; background: var(--expense); color: white; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.batch-delete-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.txn-swipe-wrap.batch-selected .txn-row { background: #EDE9FE; }
.txn-batch-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border);
  background: var(--card); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 13px; font-weight: 700; color: white;
  transition: all .15s;
}
.txn-batch-check.checked { background: var(--primary); border-color: var(--primary); }

/* ── Stats Monthly Trend Toggle ─────────────────────────── */
.stats-trend-m-btn {
  padding: 3px 8px; border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--card); color: var(--text-sub);
  font-size: 11px; font-weight: 600; cursor: pointer;
}
.stats-trend-m-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Recurring Edit Button ───────────────────────────────── */
.recur-edit {
  padding: 4px 8px; border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text-sub);
  font-size: 11px; font-weight: 600; cursor: pointer;
  flex-shrink: 0;
}

/* ── Backup Banner ────────────────────────────────────────── */
.backup-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--primary); color: #fff;
  font-size: 13px; font-weight: 500;
}
.backup-banner.hidden { display: none; }
.backup-banner-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backup-banner-btn {
  padding: 5px 10px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.15); color: #fff;
  font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.backup-banner-close {
  width: 24px; height: 24px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.2); color: #fff;
  font-size: 16px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* ── Account Filter (Transactions) ───────────────────────── */
.txn-acc-filter-row { padding: 0 16px 8px; }
.txn-acc-filter {
  width: 100%; padding: 8px 12px;
  border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--card); color: var(--text);
  font-size: 13px; font-family: inherit;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394A3B8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 30px;
}
.main-batch-active { padding-bottom: 62px !important; }
