:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --bg: #f6f2e9;
  --surface: #fffdf8;
  --surface-soft: #f4f1e9;
  --ink: #292d29;
  --muted: #858b82;
  --muted-strong: #60655f;
  --line: #e2e1da;
  --hero: #292d29;
  --hero-deep: #1b1e1b;
  --brand: #292d29;
  --brand-deep: #171a17;
  --brand-soft: #ecece7;
  --accent: #d6a75f;
  --accent-soft: #f6ebd8;
  --income: #5f806a;
  --expense: #c66f67;
  --shadow: 0 16px 42px rgba(36, 39, 36, .07);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }

html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: pan-x pan-y;
}

/* Keep every top-level page centered in the viewport, including mobile browsers
   that report a visual viewport narrower than the layout viewport. */
.app-shell {
  position: relative;
  left: auto;
  right: auto;
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
}

@media (max-width: 760px) {
  .app-shell { width: 100%; }
}

button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.modal-open { overflow: hidden; }
body.auth-open { min-height: 100svh; overflow-x: hidden; }

.auth-shell {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: min(100%, 540px);
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  gap: clamp(24px, 5.5vh, 50px);
  margin: 0 auto;
  padding: max(24px, calc(var(--safe-top) + 14px)) 20px max(26px, calc(var(--safe-bottom) + 18px));
}
.auth-shell::before {
  position: absolute;
  z-index: -1;
  width: min(72vw, 380px);
  aspect-ratio: 1;
  right: -22%;
  top: 8%;
  content: "";
  background: rgba(214,167,95,.1);
  border-radius: 50%;
  pointer-events: none;
}
.auth-brand { display: flex; align-items: center; }
.auth-brand { gap: 12px; width: 100%; padding: 0 8px; margin: 0; }
.auth-brand-mark { width: 48px; height: 48px; border-radius: 16px; }
.auth-brand strong, .auth-brand span { display: block; }
.auth-brand strong { font-size: 20px; letter-spacing: -.045em; }
.auth-brand span { margin-top: 4px; color: var(--muted); font-size: 11px; letter-spacing: .01em; }
.auth-card {
  width: 100%;
  padding: 29px 24px 22px;
  background: rgba(255,255,255,.93);
  border: 1px solid rgba(255,255,255,.88);
  border-radius: 28px;
  box-shadow: 0 24px 64px rgba(36,31,24,.09), inset 0 0 0 1px rgba(232,228,220,.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.auth-card h1 { margin: 8px 0 9px; font-size: 30px; line-height: 1.12; letter-spacing: -.06em; }
.auth-lead { max-width: 30em; margin: 0; color: var(--muted-strong); font-size: 13px; line-height: 1.65; }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 24px 0 22px; padding: 4px; background: #f1efe9; border-radius: 14px; }
.auth-switch button { min-height: 42px; color: var(--muted); background: transparent; border: 0; border-radius: 11px; font-size: 12px; font-weight: 750; }
.auth-switch button.is-active { color: var(--brand); background: #fff; box-shadow: 0 3px 10px rgba(36,31,24,.06); }
.auth-form { display: flex; flex-direction: column; gap: 19px; }
.auth-form > label > span { display: block; margin: 0 0 7px 2px; color: var(--muted-strong); font-size: 11px; font-weight: 750; }
.auth-form input { width: 100%; min-height: 52px; padding: 0 15px; color: var(--ink); background: #fbfaf8; border: 1px solid #e4dfd6; border-radius: 14px; outline: 0; font-size: 15px; }
.auth-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(41,45,41,.11); background: #fff; }
.auth-form input::placeholder { color: #b3aea4; }
.primary-action { width: 100%; min-height: 52px; margin-top: 5px; color: #fff; background: var(--brand); border: 0; border-radius: 15px; font-size: 13px; font-weight: 800; box-shadow: 0 12px 26px rgba(23,26,23,.18); }
.primary-action:hover { background: var(--brand-deep); }
.primary-action:disabled { cursor: wait; opacity: .55; box-shadow: none; }
.form-error { margin: -4px 2px 0; padding: 10px 12px; color: #8f3f3a; background: #fbefed; border: 1px solid #efd3d0; border-radius: 11px; font-size: 11px; line-height: 1.45; }
.auth-footnote { display: flex; align-items: center; justify-content: center; gap: 5px; margin: 19px 0 0; color: #aaa59b; font-size: 10px; line-height: 1.45; text-align: center; }
.auth-footnote .icon { width: 13px; height: 13px; transform: scale(.8); }

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 18px 34px;
}

.topbar, .brand-lockup, .tabbar, .section-heading, .hero-stats, .card-title-row,
.composer, .filter-row, .bill-main, .bill-meta, .tip-card, .live-pill, .hero-stat {
  display: flex;
  align-items: center;
}

.topbar { justify-content: space-between; margin-bottom: 18px; }
.brand-lockup { gap: 10px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #f3ddb7;
  background: var(--hero);
  border: 1px solid rgba(214, 167, 95, .4);
  border-radius: 14px;
  box-shadow: 0 9px 22px rgba(23, 26, 23, .18);
  font-size: 20px;
  font-weight: 800;
}
.brand-name { font-size: 18px; line-height: 1.1; font-weight: 800; letter-spacing: -0.04em; }
.brand-tagline { margin-top: 3px; color: var(--muted); font-size: 11px; }

.icon-button, .send-button {
  border: 0;
  display: grid;
  place-items: center;
}
.icon-button {
  width: 40px;
  height: 40px;
  color: var(--muted-strong);
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(232,228,220,.95);
  border-radius: 13px;
  transition: 160ms ease;
}
.icon-button:hover { color: var(--brand-deep); border-color: #cfcec7; background: #fff; }

.icon { display: inline-block; width: 18px; height: 18px; position: relative; }
.icon::before, .icon::after { content: ""; position: absolute; }
.icon-sliders::before { inset: 3px 2px; border-top: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; }
.icon-sliders::after { width: 4px; height: 4px; left: 4px; top: 1px; border: 1.5px solid currentColor; border-radius: 50%; box-shadow: 6px 7px 0 -0.5px var(--surface), 6px 7px 0 0 currentColor; }
.icon-send::before { width: 14px; height: 14px; left: 1px; top: 1px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(45deg); border-radius: 2px; }
.icon-send::after { width: 14px; height: 2px; left: 1px; top: 8px; background: currentColor; transform: rotate(-45deg); border-radius: 3px; }
.icon-lock::before { width: 11px; height: 9px; left: 3px; bottom: 2px; border: 1.5px solid currentColor; border-radius: 3px; }
.icon-lock::after { width: 7px; height: 8px; left: 5px; top: 1px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 8px 8px 0 0; }
.icon-chat::before { inset: 3px 1px 2px; border: 1.7px solid currentColor; border-radius: 6px; }
.icon-chat::after { width: 5px; height: 5px; left: 3px; bottom: 0; border-left: 1.7px solid currentColor; transform: skew(-28deg); }
.icon-list::before { inset: 2px 3px; border: 1.7px solid currentColor; border-radius: 3px; box-shadow: inset 0 4px 0 -3px currentColor, inset 0 8px 0 -3px currentColor; }
.icon-home::before { left: 2px; top: 7px; width: 14px; height: 10px; border: 1.7px solid currentColor; border-top: 0; border-radius: 2px; }
.icon-home::after { left: 3px; top: 2px; width: 11px; height: 11px; border-top: 1.7px solid currentColor; border-left: 1.7px solid currentColor; transform: rotate(45deg) scale(.76); border-radius: 2px 0 0 0; }
.icon-chart::before { width: 13px; height: 13px; left: 2px; bottom: 2px; border-left: 1.7px solid currentColor; border-bottom: 1.7px solid currentColor; }
.icon-chart::after { width: 13px; height: 10px; left: 2px; bottom: 4px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: skewY(-27deg) rotate(-28deg); }

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  color: #fffaf2;
  background: var(--hero);
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 18px 38px rgba(23,26,23,.18);
}
.hero-card::before { display: none; }
.hero-glow { display: none; }
.hero-copy, .hero-total, .hero-stats { position: relative; z-index: 1; }
.eyebrow, .section-kicker { margin: 0; font-size: 10px; letter-spacing: .13em; font-weight: 800; }
.eyebrow { color: #e5c48e; }
.hero-card h1 { margin: 5px 0 3px; font-size: 19px; line-height: 1.2; letter-spacing: -0.04em; }
.hero-note { margin: 0; color: rgba(255,250,242,.7); font-size: 12px; }
.hero-total { margin: 17px 0 13px; }
.hero-total span, .hero-stat span { display: block; color: rgba(255,250,242,.58); font-size: 10px; }
.hero-total strong { display: block; margin-top: 4px; color: #fffaf2; font-size: 31px; line-height: 1; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.hero-stats { gap: 0; padding: 12px 0; background: rgba(255,252,247,.08); border: 1px solid rgba(255,255,255,.09); border-radius: 14px; }
.hero-stat { flex: 1; gap: 5px; flex-direction: column; align-items: flex-start; }
.hero-stat:first-child { padding-left: 13px; }
.hero-stat strong { color: #fffaf2; font-size: 14px; font-variant-numeric: tabular-nums; }
.hero-stat-divider { padding-left: 13px; border-left: 1px solid rgba(255,255,255,.12); }

.nav-dock {
  position: sticky;
  z-index: 20;
  top: max(0px, var(--safe-top));
  margin: 6px -18px 16px;
  padding: 8px 18px 10px;
  background: var(--bg);
  border-top: 1px solid rgba(255,255,255,.7);
  border-bottom: 1px solid rgba(226,225,218,.96);
  box-shadow: 0 8px 18px rgba(36,39,36,.06);
}
.chat-overview-strip {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 10px 13px;
  background: rgba(255,255,255,.78);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(36,31,24,.035);
}
.app-shell[data-page="chat"] .chat-overview-strip { display: flex; }
.chat-overview-main { min-width: 0; }
.chat-overview-label { display: block; overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.chat-overview-main > strong { display: block; margin-top: 3px; color: var(--ink); font-size: 15px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.chat-overview-metrics { display: flex; flex: 0 0 auto; align-items: center; gap: 14px; }
.chat-overview-metrics span { display: block; min-width: 47px; }
.chat-overview-metrics span + span { padding-left: 14px; border-left: 1px solid var(--line); }
.chat-overview-metrics small, .chat-overview-metrics strong { display: block; }
.chat-overview-metrics small { color: var(--muted); font-size: 9px; }
.chat-overview-metrics strong { margin-top: 3px; color: var(--muted-strong); font-size: 12px; font-variant-numeric: tabular-nums; }
.tabbar {
  gap: 0;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(36,39,36,.045);
}
.tab-button {
  position: relative;
  flex: 1;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 8px 2px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 720;
  transition: color 160ms ease, background-color 160ms ease;
}
.tab-button::after {
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 28px;
  height: 2px;
  content: "";
  background: var(--brand);
  border-radius: 999px 999px 0 0;
  opacity: 0;
  transform: translateX(-50%) scaleX(.5);
  transition: opacity 160ms ease, transform 160ms ease;
}
.tab-button:hover { color: var(--muted-strong); background: rgba(255,255,255,.34); }
.tab-button.is-active { color: var(--brand); background: transparent; font-weight: 820; }
.tab-button.is-active::after { opacity: 1; transform: translateX(-50%) scaleX(1); }
.tab-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: currentColor;
  transform: none;
  transition: color 160ms ease, transform 160ms ease;
}
.tab-button.is-active .tab-icon { color: var(--ink); transform: translateY(-1px); }

.section-heading { justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.section-kicker { color: var(--accent); }
.section-heading h2 { margin: 5px 0 0; font-size: 21px; line-height: 1.2; letter-spacing: -0.045em; }
.heading-actions { display: flex; align-items: center; gap: 8px; }
.manual-entry-trigger { padding: 7px 9px; color: var(--brand); background: var(--brand-soft); border: 1px solid #ddd8cf; border-radius: 10px; font-size: 10px; }
.live-pill, .month-chip {
  gap: 6px;
  color: var(--muted-strong);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.live-pill { padding: 7px 10px; }
.live-pill i { width: 6px; height: 6px; background: #24b47e; border-radius: 50%; box-shadow: 0 0 0 3px #e7f8f1; }
.month-chip { padding: 7px 11px; }

.chat-card, .category-card, .stats-kpi-card, .trend-card, .tip-card {
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.stats-overview-card { margin-bottom: 14px; padding: 20px 18px 17px; }
.chat-card {
  height: clamp(390px, calc(100dvh - 205px - var(--safe-top)), 640px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 15px;
  border-radius: var(--radius-lg);
}
.chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
  overflow-y: auto;
  padding: 2px 2px 12px;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #d9d3c9 transparent;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: #d9d3c9; border-radius: 999px; }
.chat-input-dock {
  flex: 0 0 auto;
  padding: 10px 14px max(10px, var(--safe-bottom));
  background: rgba(255,255,255,.96);
  border: 1px solid #eeeae3;
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
}
body.chat-page-active .chat-input-dock {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 0;
  width: min(100%, 760px);
  padding-inline: 18px;
  transform: translateX(-50%);
  box-shadow: 0 -12px 30px rgba(36,31,24,.1);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
body.chat-page-active { overflow: hidden; }
body.chat-page-active .app-shell {
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: max(10px, var(--safe-bottom));
}
body.chat-page-active .topbar,
body.chat-page-active .chat-overview-strip,
body.chat-page-active .nav-dock { flex: 0 0 auto; }
body.chat-page-active #chatPage {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}
body.chat-page-active #chatPage .section-heading { flex: 0 0 auto; margin-bottom: 10px; }
body.chat-page-active .chat-card { height: auto; min-height: 0; flex: 1 1 auto; }
body.chat-page-active .chat-messages { padding-bottom: 150px; }
body.chat-page-active .toast { bottom: calc(148px + var(--safe-bottom)); }
.message { display: flex; gap: 9px; align-items: flex-end; animation: rise-in .25s ease both; }
.message.user { justify-content: flex-end; }
.bot-avatar { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; color: #f3ddb7; background: var(--hero); border: 1px solid rgba(214,167,95,.38); border-radius: 10px; font-size: 13px; font-weight: 800; box-shadow: 0 5px 12px rgba(23,26,23,.16); }
.bubble { max-width: min(86%, 470px); padding: 11px 13px; color: var(--ink); background: #f4f2ee; border-radius: 14px 14px 14px 4px; font-size: 13px; line-height: 1.58; }
.message.user .bubble { color: #fffdf8; background: var(--hero); border-radius: 14px 14px 4px 14px; }
.message.bot .bubble strong { display: block; margin-bottom: 4px; color: var(--brand-deep); font-size: 13px; }
.message.bot .bubble .money-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 7px; padding-top: 7px; border-top: 1px solid #e5e0d7; }
.money-copy { min-width: 0; }
.money-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; }
.message.bot .bubble .money-line b { color: var(--expense); font-size: 14px; }
.message.bot .bubble .money-line.income b { color: var(--income); }
.message.bot .bubble .sub-line { color: var(--muted); font-size: 11px; }
.message.bot .bubble .action-link { display: inline-block; margin-top: 7px; color: var(--brand); font-size: 11px; font-weight: 700; }
.filter-pill {
  flex: 1 1 0;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--muted-strong);
  background: transparent;
  border: 0;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  transition: 160ms ease;
}
.filter-pill:hover { color: var(--brand); background: rgba(255,255,255,.72); }
.composer { gap: 7px; padding: 6px 6px 6px 7px; background: #f6f4f0; border: 1px solid #e7e2d9; border-radius: 15px; }
.composer:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(41,45,41,.1); }
.composer input { flex: 1; min-width: 0; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 13px; }
.composer input::placeholder { color: #aaa59b; }
.template-button { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; min-height: 34px; padding: 0 8px; color: var(--muted-strong); background: #fff; border: 1px solid #e2ddd4; border-radius: 10px; font-size: 10px; font-weight: 800; }
.template-button span:first-child { color: var(--accent); font-size: 13px; }
.template-button:hover { color: var(--ink); background: var(--accent-soft); border-color: #e1cda9; }
.send-button { flex: 0 0 auto; width: 34px; height: 34px; color: #fff; background: var(--brand); border-radius: 11px; transition: 160ms ease; }
.send-button:hover { background: var(--brand-deep); transform: translateY(-1px); }
.privacy-note { display: flex; justify-content: center; gap: 5px; margin: 11px 0 1px; color: #aaa59b; font-size: 10px; }
.privacy-note .icon { width: 12px; height: 12px; transform: scale(.75); }

.transaction-more {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0 0 6px;
  color: var(--muted-strong);
  background: rgba(255,255,255,.72);
  border: 1px solid #e2ddd4;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: -1px;
  line-height: 1;
}
.transaction-more:hover { color: var(--brand-deep); background: var(--brand-soft); border-color: #cfcec7; }

.text-button { color: var(--brand); background: transparent; border: 0; font-size: 12px; font-weight: 800; }
.bill-filter-card {
  margin-bottom: 12px;
  padding: 15px;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 10px 28px rgba(36,39,36,.05);
}
.bill-filter-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.bill-filter-card-head div { min-width: 0; }
.bill-filter-card-head strong,
.bill-filter-card-head span { display: block; }
.bill-filter-card-head strong { color: var(--ink); font-size: 13px; }
.bill-filter-card-head div > span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.bill-search-field { position: relative; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 0 10px; background: #f7f5f1; border: 1px solid #e5e0d7; border-radius: 12px; }
.bill-search-field:focus-within { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(41,45,41,.08); }
.bill-search-icon { position: relative; display: block; width: 14px; height: 14px; flex: 0 0 14px; border: 1.6px solid var(--muted-strong); border-radius: 50%; }
.bill-search-icon::after { position: absolute; right: -4px; bottom: -2px; width: 5px; height: 1.6px; content: ""; background: var(--muted-strong); transform: rotate(45deg); transform-origin: left center; }
.bill-search-field input { width: 100%; min-width: 0; height: 40px; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 12px; }
.bill-search-field input::placeholder { color: #aaa59b; }
.bill-search-clear { display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 22px; color: var(--muted-strong); background: #e9e6df; border: 0; border-radius: 50%; font-size: 16px; line-height: 1; }
.bill-search-clear:hover { color: var(--ink); background: #ddd9d0; }
.bill-filter-head-icon {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  background: var(--brand-soft);
  border-radius: 11px;
}
.bill-filter-head-icon::before {
  position: absolute;
  inset: 9px 8px;
  content: "";
  border-top: 2px solid var(--brand);
  border-bottom: 2px solid var(--brand);
}
.bill-filter-head-icon::after {
  position: absolute;
  width: 5px;
  height: 5px;
  left: 11px;
  top: 7px;
  content: "";
  background: #fff;
  border: 2px solid var(--brand);
  border-radius: 50%;
  box-shadow: 7px 9px 0 -2px #fff, 7px 9px 0 0 var(--brand);
}
.bill-filter-block { min-width: 0; }
.bill-filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.bill-filter-heading strong { color: var(--ink); font-weight: 800; }
.period-filter-row {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #eeece7;
  border-radius: 14px;
}
.bill-type-block { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line); }
.type-filter-row { display: flex; gap: 8px; padding: 0; background: transparent; }
.bill-filter-button {
  flex: 1 1 0;
  min-height: 40px;
  padding: 8px 7px;
  color: var(--muted-strong);
  background: transparent;
  border: 0;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  transition: 160ms ease;
}
.bill-filter-button:hover { color: var(--brand); background: rgba(255,255,255,.72); }
.bill-filter-button.is-active,
.filter-pill.is-active {
  color: var(--brand);
  background: #fff;
  box-shadow: 0 3px 12px rgba(36,39,36,.09);
}
.type-filter-row .filter-pill {
  position: relative;
  min-height: 38px;
  color: var(--muted-strong);
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  box-shadow: none;
}
.type-filter-row .filter-pill::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  content: "";
  background: #aaa9a3;
  border-radius: 50%;
  vertical-align: 1px;
}
.type-filter-row .filter-pill[data-filter="expense"]::before { background: var(--expense); }
.type-filter-row .filter-pill[data-filter="income"]::before { background: var(--income); }
.type-filter-row .filter-pill.is-active { color: #fff; background: var(--brand); border-color: var(--brand); box-shadow: 0 7px 16px rgba(23,26,23,.17); }
.type-filter-row .filter-pill[data-filter="expense"].is-active { background: var(--expense); border-color: var(--expense); box-shadow: 0 7px 16px rgba(223,98,104,.18); }
.type-filter-row .filter-pill[data-filter="income"].is-active { background: var(--income); border-color: var(--income); box-shadow: 0 7px 16px rgba(36,154,116,.18); }
.type-filter-row .filter-pill.is-active::before { background: rgba(255,255,255,.86); }
.custom-date-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  margin-top: 11px;
  padding: 11px;
  background: #f7f5f1;
  border: 1px solid #e8e2d8;
  border-radius: 14px;
}
.custom-date-field { min-width: 0; }
.custom-date-field span { display: block; margin: 0 0 6px 2px; color: var(--muted); font-size: 10px; font-weight: 700; }
.custom-date-field input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #ded8ce;
  border-radius: 10px;
  outline: 0;
  font-size: 16px;
}
.custom-date-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(41,45,41,.1); }
.custom-date-apply {
  grid-column: 1 / -1;
  height: 42px;
  padding: 0 15px;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}
.custom-date-error { grid-column: 1 / -1; margin: 0; color: var(--expense); font-size: 11px; }
.bill-category-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 13px;
  padding: 10px 11px;
  color: var(--muted-strong);
  background: var(--accent-soft);
  border: 1px solid #ead8ba;
  border-radius: 12px;
  font-size: 11px;
}
.bill-category-filter strong { color: var(--ink); }
.bill-category-filter button { padding: 4px 7px; color: var(--muted-strong); background: rgba(255,255,255,.6); border: 1px solid #e1d2b8; border-radius: 7px; font-size: 10px; font-weight: 750; }
.bill-summary-card {
  margin-bottom: 16px;
  padding: 13px;
  color: var(--ink);
  background: rgba(255,255,255,.82);
  border: 0;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(36,39,36,.065);
}
.bill-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1px 2px 11px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}
.bill-summary-head strong { padding: 4px 8px; color: var(--ink); background: #efede7; border-radius: 999px; font-size: 10px; font-variant-numeric: tabular-nums; }
.bill-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bill-summary-item { min-width: 0; padding: 12px 11px 13px; background: #f4f2ed; border-radius: 14px; }
.bill-summary-item.expense { background: #fff5f3; }
.bill-summary-item.income { background: #f2faf6; }
.bill-summary-item span { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.bill-summary-item span::before { width: 6px; height: 6px; flex: 0 0 6px; content: ""; background: #aaa69d; border-radius: 50%; }
.bill-summary-item.expense span::before { background: var(--expense); }
.bill-summary-item.income span::before { background: var(--income); }
.bill-summary-item strong { display: block; overflow: hidden; color: var(--ink); font-size: clamp(14px, 4.1vw, 18px); font-variant-numeric: tabular-nums; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.bill-summary-item.expense strong { color: var(--expense); }
.bill-summary-item.income strong { color: var(--income); }
.bill-list-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; }
.bill-list-heading strong { color: var(--ink); font-size: 13px; }
.bill-list-heading span { color: var(--muted); font-size: 10px; }
.bill-list { display: flex; flex-direction: column; gap: 14px; }
.date-group { padding: 0 2px; }
.date-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.date-heading span:last-child { color: #aaa59b; font-weight: 500; }
.bill-card { padding: 13px 14px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.bill-main { justify-content: space-between; gap: 10px; }
.bill-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.category-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; background: var(--brand-soft); color: var(--hero-deep); border-radius: 12px; font-size: 16px; }
.bill-title { overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.bill-subtitle { margin-top: 3px; color: var(--muted); font-size: 11px; }
.bill-amount { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bill-amount.expense { color: var(--expense); }
.bill-amount.income { color: var(--income); }
.bill-card-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; }
.bill-more { background: #f8f6f2; }
.empty-state { padding: 45px 20px; color: var(--muted); text-align: center; background: var(--surface); border: 1px dashed #d3d2cb; border-radius: 18px; }
.empty-state .empty-icon { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 12px; color: var(--brand); background: var(--brand-soft); border-radius: 15px; font-size: 20px; }
.empty-state strong { display: block; color: var(--ink); font-size: 14px; }
.empty-state p { margin: 6px 0 0; font-size: 12px; }
.empty-action { margin-top: 14px; padding: 9px 14px; color: #fff; background: var(--brand); border: 0; border-radius: 10px; font-size: 11px; font-weight: 800; }

.stats-heading { align-items: flex-end; }
.stats-current-button { padding: 7px 10px; color: var(--muted-strong); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 10px; font-weight: 750; }
.stats-month-switcher {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 5px;
  background: rgba(255,255,255,.64);
  border: 1px solid var(--line);
  border-radius: 15px;
}
.stats-month-arrow { width: 40px; height: 38px; color: var(--muted-strong); background: transparent; border: 0; border-radius: 11px; font-size: 24px; line-height: 1; }
.stats-month-arrow:hover:not(:disabled) { color: var(--ink); background: var(--surface-soft); }
.stats-month-arrow:disabled { cursor: default; opacity: .28; }
.stats-month-picker { position: relative; min-width: 0; text-align: center; }
.stats-month-picker span { color: var(--ink); font-size: 13px; font-weight: 800; }
.stats-month-picker input { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; opacity: 0; }
.stats-overview-card { box-shadow: 0 15px 34px rgba(23,26,23,.13); }
.budget-card {
  margin-bottom: 12px;
  padding: 16px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.budget-card-head, .budget-title-wrap, .budget-amount-row, .budget-progress-meta { display: flex; align-items: center; }
.budget-card-head, .budget-amount-row, .budget-progress-meta { justify-content: space-between; gap: 12px; }
.budget-title-wrap { min-width: 0; gap: 10px; }
.budget-icon { position: relative; width: 34px; height: 34px; flex: 0 0 34px; background: var(--accent-soft); border-radius: 11px; }
.budget-icon::before { position: absolute; inset: 8px 7px; content: ""; border: 1.6px solid #a06d24; border-radius: 50%; }
.budget-icon::after { position: absolute; width: 8px; height: 5px; right: 6px; top: 8px; content: ""; background: var(--accent-soft); border-right: 1.6px solid #a06d24; border-bottom: 1.6px solid #a06d24; transform: rotate(-18deg); }
.budget-title-wrap strong, .budget-title-wrap small { display: block; }
.budget-title-wrap strong { color: var(--ink); font-size: 13px; }
.budget-title-wrap small { overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.budget-edit-button { flex: 0 0 auto; padding: 7px 10px; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 9px; font-size: 10px; font-weight: 800; }
.budget-edit-button:hover { background: var(--accent-soft); border-color: #e1cda9; }
.budget-amount-row { align-items: flex-end; margin-top: 17px; }
.budget-amount-row span, .budget-amount-row strong { display: block; }
.budget-amount-row span { color: var(--muted); font-size: 9px; }
.budget-amount-row strong { margin-top: 4px; color: var(--ink); font-size: 21px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.budget-remaining { text-align: right; }
.budget-remaining strong { font-size: 15px; }
.budget-progress { height: 8px; overflow: hidden; margin-top: 13px; background: #ebe7df; border-radius: 999px; }
.budget-progress > span { display: block; width: 0; height: 100%; background: var(--income); border-radius: inherit; transition: width 220ms ease, background-color 180ms ease; }
.budget-progress-meta { margin-top: 7px; color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.budget-progress-meta strong { color: var(--muted-strong); font-size: 9px; }
.budget-card.is-empty .budget-progress, .budget-card.is-empty .budget-progress-meta { opacity: .52; }
.budget-card.is-warning .budget-progress > span { background: var(--accent); }
.budget-card.is-warning #budgetStatusText { color: #9a681d; }
.budget-card.is-over { border-color: #e4c0bd; background: #fffaf9; }
.budget-card.is-over .budget-progress > span { background: var(--expense); }
.budget-card.is-over #budgetRemaining, .budget-card.is-over #budgetStatusText { color: var(--expense); }
.reminder-card {
  margin-bottom: 12px;
  padding: 16px;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.reminder-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.reminder-title-wrap { display: flex; align-items: center; min-width: 0; gap: 10px; }
.reminder-title-wrap h3 { margin: 4px 0 0; color: var(--ink); font-size: 14px; letter-spacing: -.02em; }
.reminder-title-wrap p:not(.section-kicker) { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.reminder-icon {
  position: relative;
  display: block;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  background: var(--accent-soft);
  border-radius: 11px;
}
.reminder-icon::before { position: absolute; inset: 9px 8px 8px; content: ""; border: 1.7px solid var(--accent); border-radius: 5px; }
.reminder-icon::after { position: absolute; width: 5px; height: 5px; top: 6px; left: 10px; content: ""; border: 1.7px solid var(--accent); border-radius: 50%; box-shadow: 9px 0 0 -1.7px var(--accent); }
.reminder-add-button { flex: 0 0 auto; padding: 7px 9px; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; font-size: 10px; }
.reminder-add-button:hover { background: var(--accent-soft); border-color: #e1cda9; }
.reminder-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.reminder-item { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 10px; background: var(--surface-soft); border: 1px solid transparent; border-radius: 14px; }
.reminder-item.overdue { background: #fff7f5; border-color: #f0d8d4; }
.reminder-item.today { background: #fffaf0; border-color: #eeddbd; }
.reminder-item-icon { display: grid; place-items: center; width: 34px; height: 34px; color: var(--muted-strong); background: #fff; border: 1px solid var(--line); border-radius: 11px; font-size: 15px; }
.reminder-item-copy, .reminder-item-side { min-width: 0; }
.reminder-item-copy strong, .reminder-item-copy span, .reminder-item-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reminder-item-copy strong { color: var(--ink); font-size: 12px; }
.reminder-item-copy span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.reminder-item-copy .reminder-due { margin-top: 3px; color: var(--muted-strong); font-size: 9px; font-weight: 750; }
.reminder-item.overdue .reminder-due { color: var(--expense); }
.reminder-item.today .reminder-due, .reminder-item.soon .reminder-due { color: #a36c1d; }
.reminder-item-side { text-align: right; }
.reminder-item-side > b { display: block; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.reminder-item-side > b.expense { color: var(--expense); }
.reminder-item-side > b.income { color: var(--income); }
.reminder-item-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; margin-top: 6px; }
.reminder-pay-button, .reminder-more-button { min-height: 25px; border-radius: 8px; font-size: 9px; font-weight: 800; }
.reminder-pay-button { padding: 0 7px; color: #fff; background: var(--brand); border: 1px solid var(--brand); }
.reminder-pay-button:hover { background: var(--brand-deep); }
.reminder-more-button { width: 25px; padding: 0 0 5px; color: var(--muted-strong); background: #fff; border: 1px solid var(--line); letter-spacing: -1px; }
.reminder-more-button:hover { color: var(--ink); border-color: #cfcec7; }
.reminder-summary { margin: 10px 2px 0; color: var(--muted); font-size: 10px; }
.reminder-empty { display: flex; align-items: center; gap: 10px; padding: 13px; background: var(--surface-soft); border-radius: 14px; }
.reminder-empty-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; color: var(--accent); background: var(--accent-soft); border-radius: 10px; font-size: 17px; }
.reminder-empty strong { color: var(--ink); font-size: 11px; }
.reminder-empty p { margin: 3px 0 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.stats-kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.stats-kpi-card { min-width: 0; padding: 15px 16px; border-radius: 17px; }
.stats-kpi-card span { display: block; color: var(--muted); font-size: 10px; }
.stats-kpi-card strong { display: block; overflow: hidden; margin-top: 5px; color: var(--ink); font-size: clamp(18px, 6vw, 24px); letter-spacing: -.045em; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.stats-kpi-card small { display: block; overflow: hidden; margin-top: 4px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.comparison-kpi-card { grid-column: 1 / -1; }
.comparison-kpi-card strong.is-positive { color: var(--income); }
.comparison-kpi-card strong.is-negative { color: var(--expense); }
.category-budget-card { margin-bottom: 12px; padding: 17px; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.category-budget-card .text-button { flex: 0 0 auto; padding: 7px 9px; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; font-size: 10px; }
.category-budget-card .text-button:hover { background: var(--accent-soft); border-color: #e1cda9; }
.category-budget-month { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 13px; padding-top: 11px; color: var(--muted); border-top: 1px solid var(--line); font-size: 10px; }
.category-budget-month strong { color: var(--muted-strong); font-size: 10px; }
.category-budget-list { display: flex; flex-direction: column; gap: 9px; margin-top: 11px; }
.category-budget-item { padding: 11px 12px; background: var(--surface-soft); border: 1px solid transparent; border-radius: 13px; }
.category-budget-item.is-warning { background: #fffaf0; border-color: #eeddbd; }
.category-budget-item.is-over { background: #fff7f5; border-color: #f0d8d4; }
.category-budget-head, .category-budget-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.category-budget-name { display: flex; align-items: center; min-width: 0; gap: 7px; }
.category-budget-name i { display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 25px; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-style: normal; }
.category-budget-name > span { min-width: 0; }
.category-budget-name strong, .category-budget-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-budget-name strong { color: var(--ink); font-size: 11px; }
.category-budget-name small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.category-budget-amount { flex: 0 0 auto; color: var(--muted-strong); font-size: 10px; font-variant-numeric: tabular-nums; }
.category-budget-track { height: 6px; overflow: hidden; margin-top: 9px; background: #e5e2da; border-radius: 999px; }
.category-budget-track span { display: block; height: 100%; background: var(--income); border-radius: inherit; }
.category-budget-item.is-warning .category-budget-track span { background: var(--accent); }
.category-budget-item.is-over .category-budget-track span { background: var(--expense); }
.category-budget-meta { margin-top: 6px; color: var(--muted); font-size: 9px; }
.category-budget-meta button { padding: 0; color: var(--muted-strong); background: transparent; border: 0; font-size: 9px; }
.category-budget-meta button + button { margin-left: 9px; color: var(--expense); }
.category-budget-meta button:hover { color: var(--ink); }
.category-budget-empty, .preference-empty { display: flex; align-items: center; gap: 10px; padding: 12px; color: var(--muted); background: var(--surface-soft); border-radius: 13px; }
.category-budget-empty > span, .preference-empty > span { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; color: var(--accent); background: var(--accent-soft); border-radius: 10px; font-size: 16px; }
.category-budget-empty strong, .preference-empty strong { color: var(--ink); font-size: 11px; }
.category-budget-empty p, .preference-empty p { margin: 3px 0 0; font-size: 9px; line-height: 1.4; }
.trend-card, .category-card { padding: 17px; border-radius: 18px; }
.trend-card { margin-bottom: 12px; }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-title-row h3 { margin: 0; font-size: 14px; }
.card-title-row p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.card-title-row > span { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.trend-legend { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 9px; }
.trend-legend span::before { display: inline-block; width: 7px; height: 7px; margin-right: 4px; content: ""; border-radius: 50%; }
.trend-legend .expense::before { background: var(--expense); }
.trend-legend .income::before { background: var(--income); }
.stats-trend-chart { min-height: 156px; margin-top: 13px; }
.stats-trend-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.trend-grid line { stroke: #e8e4dc; stroke-width: 1; }
.trend-line { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.trend-line.expense { stroke: var(--expense); }
.trend-line.income { stroke: var(--income); }
.trend-axis-labels { fill: var(--muted); font-size: 8px; }
.category-bars { margin-top: 13px; }
.category-row {
  width: 100%;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 62px;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 10px 0;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #ece8e0;
}
.category-row:last-child { border-bottom: 0; }
.category-row:hover .category-name b { color: var(--accent); }
.category-name { min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--muted-strong); }
.category-name > i { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 29px; background: var(--surface-soft); border-radius: 9px; font-size: 13px; font-style: normal; }
.category-name > span { min-width: 0; }
.category-name b, .category-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-name b { color: var(--ink); font-size: 11px; transition: color 160ms ease; }
.category-name small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.bar-track { height: 7px; overflow: hidden; background: #ebe7df; border-radius: 999px; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.category-value { color: var(--ink); text-align: right; font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats-empty-state { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; color: var(--muted); text-align: center; background: var(--surface-soft); border-radius: 14px; }
.stats-empty-state > span { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 9px; color: var(--muted-strong); background: #fff; border: 1px solid var(--line); border-radius: 11px; font-size: 17px; }
.stats-empty-state strong { color: var(--ink); font-size: 12px; }
.stats-empty-state p { margin: 5px 0 0; font-size: 10px; line-height: 1.45; }
.stats-empty-state.category-empty { min-height: 132px; }
.tip-card { gap: 12px; margin-top: 14px; padding: 15px 17px; border-radius: 18px; }
.tip-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; color: #c27b13; background: #fff4d7; border-radius: 11px; }
.tip-card strong { font-size: 12px; }
.tip-card p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }

.modal-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: var(--modal-viewport-height, 100dvh);
  max-width: 100%;
  padding: max(12px, var(--safe-top)) 12px max(12px, var(--safe-bottom));
  background: rgba(14, 16, 19, .48);
  backdrop-filter: blur(8px);
  box-sizing: border-box;
  overflow: hidden;
  animation: fade-in .18s ease both;
}
.settings-sheet {
  width: min(100%, 520px);
  max-height: min(88vh, 760px);
  overflow-y: auto;
  padding: 21px 18px 18px;
  background: #f8f7f4;
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 25px;
  box-shadow: 0 28px 70px rgba(10,12,15,.24);
  animation: sheet-in .22s ease both;
}
.transaction-backdrop { z-index: 38; }
.transaction-sheet {
  width: min(100%, 500px);
  max-width: 100%;
  min-width: 0;
  max-height: min(760px, calc(var(--modal-viewport-height, 100dvh) - max(24px, var(--safe-top) + var(--safe-bottom))));
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 9px 16px max(18px, var(--safe-bottom));
  background: #f8f7f4;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 25px 25px 20px 20px;
  box-shadow: 0 28px 70px rgba(10,12,15,.28);
  box-sizing: border-box;
  animation: sheet-in .22s ease both;
}
.preference-sheet { max-height: min(88vh, 700px); overflow-y: auto; }
.preference-lead { margin: -3px 2px 14px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.preference-form { display: flex; flex-direction: column; gap: 12px; }
.preference-form label > span { display: block; margin: 0 0 6px 2px; color: var(--muted-strong); font-size: 10px; font-weight: 750; }
.preference-form input, .preference-form select { width: 100%; min-height: 44px; padding: 0 11px; color: var(--ink); background: #fff; border: 1px solid #e2ddd4; border-radius: 12px; outline: 0; font-size: 12px; }
.preference-form select { min-height: 52px; padding-block: 8px; }
#categoryBudgetForm select { min-height: 56px; padding-inline: 14px; }
.preference-form input:focus, .preference-form select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(41,45,41,.1); }
.preference-grid { display: grid; grid-template-columns: minmax(0, 1fr) 82px; gap: 10px; }
.preference-form .sheet-primary-button { width: 100%; }
.preference-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.preference-list-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: 9px 10px; background: var(--surface-soft); border: 1px solid transparent; border-radius: 13px; }
.template-use-button { display: flex; align-items: center; min-width: 0; gap: 8px; padding: 0; color: var(--ink); text-align: left; background: transparent; border: 0; font-size: 12px; font-weight: 700; }
.template-use-button > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.template-use-button:hover { color: var(--accent); }
.template-use-icon { display: grid; place-items: center; width: 27px; height: 27px; flex: 0 0 27px; color: var(--accent); background: #fff; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; }
.preference-delete-button { display: grid; place-items: center; width: 26px; height: 26px; flex: 0 0 26px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: 17px; line-height: 1; }
.preference-delete-button:hover { color: var(--expense); border-color: #e4cfcc; background: #fff7f5; }
.preference-note { margin: 0 2px 2px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.category-preference-copy { display: flex; align-items: center; min-width: 0; gap: 8px; }
.category-preference-copy > span:last-child { min-width: 0; }
.category-preference-icon { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 29px; background: #fff; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; }
.category-preference-copy strong, .category-preference-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-preference-copy strong { color: var(--ink); font-size: 11px; }
.category-preference-copy small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.sheet-grabber { width: 40px; height: 4px; margin: 1px auto 14px; background: #d8d3ca; border-radius: 999px; }
.transaction-sheet-header { margin-bottom: 14px; }
.transaction-summary {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.transaction-summary-icon { display: grid; place-items: center; width: 42px; height: 42px; background: var(--accent-soft); border-radius: 13px; font-size: 18px; }
.transaction-summary strong, .transaction-summary small { display: block; }
.transaction-summary strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.transaction-summary small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.transaction-summary b { color: var(--expense); font-size: 14px; font-variant-numeric: tabular-nums; }
.transaction-summary b.income { color: var(--income); }
.transaction-actions { margin-top: 12px; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.transaction-action {
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
}
.transaction-action + .transaction-action { border-top: 1px solid var(--line); }
.transaction-action:hover { background: #fbfaf7; }
.transaction-action-icon { display: grid; place-items: center; width: 36px; height: 36px; color: var(--hero-deep); background: var(--brand-soft); border-radius: 11px; font-size: 17px; font-weight: 800; }
.transaction-action strong, .transaction-action small { display: block; }
.transaction-action strong { font-size: 12px; }
.transaction-action small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.transaction-action.is-danger strong { color: var(--expense); }
.transaction-action.is-danger .transaction-action-icon { color: var(--expense); background: #fbefed; }
.sheet-cancel-button { width: 100%; min-height: 42px; margin-top: 11px; color: var(--muted-strong); background: #fff; border: 1px solid var(--line); border-radius: 13px; font-size: 12px; font-weight: 750; }
.transaction-edit-form { display: flex; flex-direction: column; gap: 14px; }
.edit-grid { display: grid; gap: 11px; }
.edit-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.edit-grid > * { min-width: 0; }
.transaction-edit-form label > span { display: block; margin: 0 0 6px 2px; color: var(--muted-strong); font-size: 10px; font-weight: 750; }
.transaction-edit-form input, .transaction-edit-form select { width: 100%; min-height: 44px; padding: 0 11px; color: var(--ink); background: #fff; border: 1px solid #e2ddd4; border-radius: 12px; outline: 0; font-size: 12px; }
.transaction-edit-form select { min-height: 52px; padding-block: 8px; }
.transaction-edit-form input:focus, .transaction-edit-form select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(41,45,41,.11); }
.manual-entry-form { display: flex; flex-direction: column; gap: 14px; }
.manual-entry-form label > span { display: block; margin: 0 0 6px 2px; color: var(--muted-strong); font-size: 10px; font-weight: 750; }
.manual-entry-form input, .manual-entry-form select { width: 100%; min-height: 44px; padding: 0 11px; color: var(--ink); background: #fff; border: 1px solid #e2ddd4; border-radius: 12px; outline: 0; font-size: 12px; }
.manual-entry-form select { min-height: 52px; padding-block: 8px; }
.manual-entry-form input:focus, .manual-entry-form select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(41,45,41,.11); }
.manual-type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; background: #ebe8e1; border-radius: 14px; }
.manual-type-button { min-height: 38px; color: var(--muted); background: transparent; border: 0; border-radius: 10px; font-size: 12px; font-weight: 800; }
.manual-type-button.is-active { color: var(--brand); background: #fff; box-shadow: 0 3px 10px rgba(36,31,24,.08); }
.manual-type-button[data-manual-type="income"].is-active { color: var(--income); }
.manual-amount-field { padding: 12px 13px 13px; background: #fff; border: 1px solid var(--line); border-radius: 15px; }
.amount-input-wrap { display: flex; align-items: center; gap: 8px; }
.amount-input-wrap b { color: var(--accent); font-size: 23px; }
.manual-amount-field input { min-height: 42px; padding: 0; border: 0; font-size: 27px; font-weight: 800; letter-spacing: -.04em; }
.manual-amount-field input:focus { box-shadow: none; }
.budget-sheet-lead { margin: -2px 2px 14px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.budget-form { display: flex; flex-direction: column; gap: 14px; }
.budget-form .manual-amount-field > span { display: block; margin: 0 0 6px 2px; color: var(--muted-strong); font-size: 10px; font-weight: 750; }
.budget-form input { width: 100%; min-height: 42px; padding: 0; color: var(--ink); background: #fff; border: 0; outline: 0; font-size: 27px; font-weight: 800; letter-spacing: -.04em; }
.budget-form-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 9px; }
.reminder-form { display: flex; flex-direction: column; gap: 13px; }
.reminder-sheet { max-height: min(760px, calc(var(--modal-viewport-height, 100dvh) - max(24px, var(--safe-top) + var(--safe-bottom)))); scroll-padding-block: 18px 28px; }
.reminder-form label { min-width: 0; }
.reminder-form label > span:not(.reminder-date-control) { display: block; margin: 0 0 6px 2px; color: var(--muted-strong); font-size: 10px; font-weight: 750; }
.reminder-form label > input, .reminder-form label > select { width: 100%; min-width: 0; max-width: 100%; min-height: 44px; padding: 0 11px; color: var(--ink); background: #fff; border: 1px solid #e2ddd4; border-radius: 12px; box-sizing: border-box; outline: 0; font-size: 12px; }
.reminder-form label > select { min-height: 52px; padding-block: 8px; }
.reminder-date-grid { align-items: end; }
.reminder-date-field { min-width: 0; }
.reminder-date-control { position: relative; display: flex; align-items: center; inline-size: 100%; block-size: 52px; min-inline-size: 0; max-inline-size: 100%; overflow: hidden; background: #fff; border: 1px solid #e2ddd4; border-radius: 12px; box-sizing: border-box; }
.reminder-date-value { display: flex; align-items: center; inline-size: 100%; block-size: 100%; min-inline-size: 0; padding: 0 11px; color: var(--ink); font-size: 12px; line-height: 1.2; box-sizing: border-box; pointer-events: none; }
.reminder-date-control input { position: absolute; inset: 0; z-index: 1; display: block; inline-size: 100%; block-size: 100%; min-inline-size: 0; max-inline-size: 100%; min-height: 0; padding: 0; color: transparent; background: transparent; border: 0; border-radius: inherit; box-sizing: border-box; outline: 0; opacity: 0; cursor: pointer; }
.reminder-date-control:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(41,45,41,.11); }
.reminder-form label > input:focus, .reminder-form label > select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(41,45,41,.11); }
.reminder-amount-field { min-width: 0; padding: 10px 11px 9px; }
.reminder-amount-field input { width: 100%; min-height: 30px; padding: 0; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 21px; font-weight: 800; letter-spacing: -.04em; }
.reminder-amount-field input:focus { box-shadow: none; }
.reminder-interval-field { min-width: 0; }
.reminder-form .sheet-button-row { grid-template-columns: auto 1fr 1.35fr; }
.reminder-form .sheet-button-row .is-hidden { display: none; }
.reminder-form .sheet-button-row:has(#deleteReminderButton.is-hidden) { grid-template-columns: 1fr 1.35fr; }
.reminder-form .sheet-button-row:has(#deleteReminderButton.is-hidden) #cancelReminderButton { grid-column: 1; }
.reminder-form .sheet-button-row:has(#deleteReminderButton.is-hidden) .sheet-primary-button { grid-column: 2; }
.reminder-form .sheet-button-row #deleteReminderButton { color: var(--expense); background: #fff; border-color: #e4cfcc; }
.budget-clear-button { min-height: 44px; color: var(--expense); background: #fff; border: 1px solid #e4cfcc; border-radius: 13px; font-size: 12px; font-weight: 800; }
.sheet-button-row { display: grid; grid-template-columns: 1fr 1.35fr; gap: 9px; margin-top: 3px; }
.sheet-secondary-button, .sheet-primary-button, .sheet-danger-button { min-height: 44px; border-radius: 13px; font-size: 12px; font-weight: 800; }
.sheet-secondary-button { color: var(--muted-strong); background: #fff; border: 1px solid var(--line); }
.sheet-primary-button { color: #fff; background: var(--brand); border: 1px solid var(--brand); }
.sheet-danger-button { color: #fff; background: var(--expense); border: 1px solid var(--expense); }
.delete-confirm { padding: 7px 2px 1px; text-align: center; }
.delete-confirm-icon { display: grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 11px; color: var(--expense); background: #fbefed; border-radius: 15px; font-size: 19px; font-weight: 900; }
.delete-confirm h3 { margin: 0; font-size: 17px; letter-spacing: -.03em; }
.delete-confirm p { margin: 7px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.sheet-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.sheet-header h2 { margin: 5px 0 0; font-size: 22px; letter-spacing: -.04em; }
.sheet-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--muted-strong);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 22px;
  line-height: 1;
}
.storage-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
}
.storage-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; color: var(--income); background: rgba(95,128,106,.12); border-radius: 11px; font-size: 14px; font-weight: 900; }
.storage-status strong { color: var(--ink); font-size: 13px; }
.storage-status p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.member-code-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 13px 14px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.member-code-card span, .member-code-card strong, .member-code-card small { display: block; }
.member-code-card span { color: var(--muted); font-size: 10px; font-weight: 750; }
.member-code-card strong { margin-top: 4px; color: var(--brand); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; letter-spacing: .07em; }
.member-code-card small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.copy-code-button { flex: 0 0 auto; padding: 7px 10px; color: var(--brand); background: var(--brand-soft); border: 1px solid #ddd8cf; border-radius: 9px; font-size: 10px; font-weight: 800; }
.copy-code-button:hover { background: var(--brand-soft); border-color: #cfcec7; }
.settings-group { margin-top: 18px; }
.account-settings-group { margin-top: 14px; }
.settings-label { margin: 0 0 8px 4px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.settings-action {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-width: 0;
}
.settings-action:first-of-type { border-radius: 15px 15px 0 0; }
.settings-action:last-of-type { border-bottom-width: 1px; border-radius: 0 0 15px 15px; }
.settings-group .settings-action:only-of-type { border-bottom-width: 1px; border-radius: 15px; }
.settings-action:hover { background: #fbfaf7; }
.logout-action strong { color: var(--expense); }
.logout-action .action-icon { color: var(--expense); background: #fbefed; }
.logout-action:hover { background: #fff8f7; }
.action-icon { display: grid; place-items: center; width: 34px; height: 34px; color: var(--hero-deep); background: var(--brand-soft); border-radius: 11px; font-size: 17px; font-weight: 800; }
.settings-action strong, .settings-action small { display: block; }
.settings-action strong { font-size: 12px; }
.settings-action small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.action-arrow { color: #b4aea3; font-size: 20px; }
.danger-button {
  width: 100%;
  margin-top: 20px;
  padding: 11px 14px;
  color: var(--expense);
  background: transparent;
  border: 1px solid #dec9c6;
  border-radius: 13px;
  font-size: 11px;
  font-weight: 750;
}
.danger-button:hover { background: #fbf2f1; }
.sheet-footnote { margin: 11px 0 0; color: var(--muted); text-align: center; font-size: 9px; }
.visually-hidden { position: fixed !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }

.footer-note { margin: 28px 0 0; color: #aaa59b; text-align: center; font-size: 10px; letter-spacing: .05em; }
.is-hidden { display: none !important; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: max(18px, var(--safe-bottom)); display: flex; align-items: center; gap: 13px; max-width: calc(100% - 32px); padding: 10px 12px 10px 14px; color: #fffdf8; background: var(--hero); border-radius: 12px; box-shadow: 0 10px 26px rgba(23,26,23,.18); font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: 180ms ease; }
.toast.is-visible { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.toast-action { padding: 5px 8px; color: #f1d7a8; background: rgba(255,255,255,.08); border: 0; border-radius: 8px; font-size: 11px; font-weight: 850; }

/* Improve readability on the bill and stats surfaces without enlarging their layout. */
#billsPage .section-heading h2,
#statsPage .section-heading h2 { font-size: 23px; }
#billsPage .bill-filter-card-head strong { font-size: 14px; }
#billsPage .bill-filter-card-head div > span { font-size: 11px; }
#billsPage .bill-search-field input { font-size: 14px; }
#billsPage .bill-filter-heading { font-size: 12px; }
#billsPage .bill-filter-button,
#billsPage .type-filter-row .filter-pill { font-size: 13px; }
#billsPage .custom-date-field span { font-size: 11px; }
#billsPage .bill-category-filter { font-size: 12px; }
#billsPage .bill-category-filter button { font-size: 11px; }
#billsPage .bill-summary-head { font-size: 12px; }
#billsPage .bill-summary-head strong { font-size: 11px; }
#billsPage .bill-summary-item span { font-size: 11px; }
#billsPage .bill-list-heading strong { font-size: 14px; }
#billsPage .bill-list-heading span { font-size: 11px; }
#billsPage .date-heading { font-size: 12px; }
#billsPage .bill-title { font-size: 14px; }
#billsPage .bill-subtitle { font-size: 12px; }
#billsPage .bill-amount { font-size: 15px; }
#billsPage .empty-state strong { font-size: 15px; }
#billsPage .empty-state p { font-size: 13px; }

#statsPage .stats-current-button { font-size: 11px; }
#statsPage .stats-month-picker span { font-size: 14px; }
#statsPage .budget-title-wrap strong { font-size: 14px; }
#statsPage .budget-title-wrap small { font-size: 11px; }
#statsPage .budget-amount-row span { font-size: 11px; }
#statsPage .budget-amount-row strong { font-size: 22px; }
#statsPage .budget-progress-meta { font-size: 10px; }
#statsPage .budget-progress-meta strong { font-size: 10px; }
#statsPage .reminder-title-wrap h3 { font-size: 15px; }
#statsPage .reminder-title-wrap p:not(.section-kicker) { font-size: 11px; }
#statsPage .reminder-item-copy strong { font-size: 13px; }
#statsPage .reminder-item-copy span,
#statsPage .reminder-item-copy .reminder-due { font-size: 11px; }
#statsPage .reminder-item-side > b { font-size: 14px; }
#statsPage .reminder-pay-button,
#statsPage .reminder-more-button { font-size: 10px; }
#statsPage .reminder-summary { font-size: 11px; }
#statsPage .reminder-empty strong { font-size: 12px; }
#statsPage .reminder-empty p { font-size: 10px; }
#statsPage .stats-kpi-card span { font-size: 11px; }
#statsPage .stats-kpi-card small { font-size: 11px; }
#statsPage .category-budget-card .card-title-row h3,
#statsPage .trend-card .card-title-row h3,
#statsPage .category-card .card-title-row h3 { font-size: 15px; }
#statsPage .category-budget-card .card-title-row p,
#statsPage .trend-card .card-title-row p,
#statsPage .category-card .card-title-row p { font-size: 11px; }
#statsPage .category-budget-month,
#statsPage .category-budget-month strong { font-size: 11px; }
#statsPage .category-budget-name strong { font-size: 12px; }
#statsPage .category-budget-name small,
#statsPage .category-budget-meta,
#statsPage .category-budget-meta button { font-size: 10px; }
#statsPage .category-budget-amount { font-size: 11px; }
#statsPage .trend-legend { font-size: 10px; }
#statsPage .trend-axis-labels { font-size: 9px; }
#statsPage .category-name b { font-size: 12px; }
#statsPage .category-name small { font-size: 10px; }
#statsPage .category-value { font-size: 11px; }
#statsPage .stats-empty-state strong { font-size: 13px; }
#statsPage .stats-empty-state p { font-size: 11px; }
#statsPage .tip-card strong { font-size: 13px; }
#statsPage .tip-card p { font-size: 12px; }

@keyframes rise-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(18px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (min-width: 680px) {
  .auth-shell { width: min(100%, 580px); padding-inline: 30px; }
  .auth-card { padding: 34px 32px 27px; }
  .app-shell { padding: 30px 30px 42px; }
  .hero-card { padding: 28px 29px 22px; }
  .chat-card { padding: 18px; }
  .custom-date-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .custom-date-apply { grid-column: auto; }
  body.chat-page-active .chat-input-dock { width: min(100%, 760px); padding-inline: 30px; }
  .modal-backdrop { align-items: center; }
  .transaction-sheet { border-radius: 25px; }
}

@media (max-width: 679px) {
  .modal-backdrop { padding-inline: 8px; }
  .transaction-sheet { width: 100%; border-radius: 23px 23px 18px 18px; }
  .composer input,
  .auth-form input,
  .transaction-edit-form input,
  .transaction-edit-form select,
  .manual-entry-form input,
  .manual-entry-form select,
  .reminder-form input,
  .reminder-form select { font-size: 16px; }
}

@media (max-height: 720px) {
  .auth-shell { align-content: start; gap: 20px; }
  .auth-card { padding-top: 24px; padding-bottom: 18px; }
  .auth-switch { margin-block: 19px 17px; }
}

@media (max-width: 370px) {
  .auth-shell { padding-inline: 14px; }
  .auth-card { padding-inline: 19px; border-radius: 24px; }
  .auth-card h1 { font-size: 27px; }
  .auth-footnote { padding-inline: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* Ledger-first home and visual quick-entry surface. */
.app-shell:not([data-page="chat"]) {
  padding-bottom: calc(104px + var(--safe-bottom));
}
.app-shell:not([data-page="chat"]) .nav-dock {
  position: fixed;
  z-index: 30;
  left: 50%;
  top: auto;
  bottom: 0;
  width: min(100%, 760px);
  margin: 0;
  padding: 8px 18px max(10px, var(--safe-bottom));
  background: rgba(246,242,233,.92);
  border-top: 1px solid rgba(226,225,218,.96);
  border-bottom: 0;
  box-shadow: 0 -10px 26px rgba(36,39,36,.08);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.app-shell:not([data-page="chat"]) .tabbar { border-radius: 20px; }
.app-shell:not([data-page="chat"]) .tab-button { min-height: 54px; flex-direction: column; gap: 3px; padding-top: 4px; font-size: 11px; }
.app-shell:not([data-page="chat"]) .tab-icon { width: 19px; height: 19px; flex-basis: 19px; }
.app-shell:not([data-page="chat"]) .tab-entry-button { color: var(--brand); }
.app-shell:not([data-page="chat"]) .tab-entry-button .tab-icon {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  color: #f8f1e6;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 6px 14px rgba(23,26,23,.18);
}
.app-shell:not([data-page="chat"]) .tab-entry-button .icon-plus::before,
.app-shell:not([data-page="chat"]) .tab-entry-button .icon-plus::after { width: 15px; height: 2px; left: 9px; top: 16px; background: currentColor; border: 0; transform: none; }
.app-shell:not([data-page="chat"]) .tab-entry-button .icon-plus::after { transform: rotate(90deg); }
.app-shell:not([data-page="chat"]) .tab-entry-button::after { display: none; }
body.chat-page-active .nav-dock {
  position: sticky;
  z-index: 20;
  left: auto;
  top: max(0px, var(--safe-top));
  bottom: auto;
  width: auto;
  margin: 6px -18px 16px;
  padding: 8px 18px 10px;
  background: var(--bg);
  border-top: 1px solid rgba(255,255,255,.7);
  border-bottom: 1px solid rgba(226,225,218,.96);
  box-shadow: 0 8px 18px rgba(36,39,36,.06);
  transform: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.app-shell[data-page="home"] .chat-overview-strip { display: block; }
.chat-overview-strip {
  min-height: 0;
  margin-bottom: 14px;
  padding: 17px 18px 14px;
  color: #fffaf2;
  background: var(--hero);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 23px;
  box-shadow: 0 16px 32px rgba(23,26,23,.14);
}

.home-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin: 1px 2px 14px; }
.home-heading h2 { margin: 5px 0 4px; color: var(--ink); font-size: 23px; line-height: 1.15; letter-spacing: -.05em; }
.home-heading p:not(.section-kicker) { margin: 0; color: var(--muted); font-size: 11px; }
.home-detail-button { display: inline-flex; align-items: center; gap: 5px; min-height: 38px; flex: 0 0 auto; padding: 0 11px; color: var(--muted-strong); background: rgba(255,255,255,.74); border: 1px solid var(--line); border-radius: 12px; font-size: 11px; font-weight: 780; }
.home-detail-button:hover { color: var(--brand); background: #fff; }
.home-detail-button span, .home-more-records span { color: var(--accent); font-size: 15px; }
.home-records-card { padding: 16px 15px 13px; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 21px; box-shadow: var(--shadow); }
.home-records-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 12px; }
.home-records-head > div { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.home-records-head strong { color: var(--ink); font-size: 15px; }
.home-records-head span { color: var(--muted); font-size: 11px; }
.home-view-all { padding: 5px 0; color: var(--muted-strong); background: transparent; border: 0; font-size: 11px; font-weight: 760; }
.home-view-all:hover { color: var(--brand); }
.home-record-list { display: flex; flex-direction: column; gap: 0; }
.home-record-row { display: flex; align-items: center; gap: 10px; min-height: 67px; padding: 10px 2px; border-top: 1px solid #eeeae3; }
.home-record-row:first-child { border-top: 0; }
.home-record-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; background: var(--accent-soft); border-radius: 13px; font-size: 20px; }
.home-record-copy { min-width: 0; flex: 1 1 auto; }
.home-record-copy strong, .home-record-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-record-copy strong { color: var(--ink); font-size: 13px; font-weight: 780; }
.home-record-copy span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.home-record-side { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.home-record-side b { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.home-record-side b.expense { color: var(--expense); }
.home-record-side b.income { color: var(--income); }
.home-record-more { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; color: var(--muted); background: var(--surface-soft); border: 1px solid #e8e3da; border-radius: 9px; font-size: 12px; letter-spacing: 1px; }
.home-record-more:hover { color: var(--brand); background: #fff; }
.home-more-records { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 40px; margin-top: 4px; color: var(--muted-strong); background: var(--surface-soft); border: 0; border-radius: 12px; font-size: 11px; font-weight: 760; }
.home-more-records:hover { color: var(--brand); background: var(--brand-soft); }
.home-empty-state { display: grid; justify-items: center; padding: 27px 14px 22px; text-align: center; }
.home-empty-state > span { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 10px; color: var(--accent); background: var(--accent-soft); border-radius: 13px; font-size: 24px; }
.home-empty-state strong { color: var(--ink); font-size: 14px; }
.home-empty-state p { max-width: 24em; margin: 6px 0 14px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.home-empty-state button { min-height: 38px; padding: 0 14px; color: var(--brand); background: var(--brand-soft); border: 1px solid var(--line); border-radius: 11px; font-size: 11px; font-weight: 800; }
.home-empty-state button:hover { background: #fff; }

/* Mobile bill actions: reveal edit/delete with a left swipe. */
.swipe-row { position: relative; overflow: hidden; }
.swipe-row-content { position: relative; z-index: 1; transform: translateX(0); transition: transform 180ms ease; will-change: transform; touch-action: pan-y; }
.swipe-row.is-open .swipe-row-content { transform: translateX(-128px); }
.swipe-row-actions { position: absolute; z-index: 0; top: 0; right: 0; bottom: 0; display: flex; width: 128px; }
.swipe-row-actions button { width: 64px; min-height: 100%; padding: 0; color: #fff; background: var(--brand); border: 0; font-size: 12px; font-weight: 800; }
.swipe-row-actions button.is-danger { background: var(--expense); }
.swipe-row-actions button:active { filter: brightness(.92); }
.swipe-row.home-record-row { display: block; min-height: 0; padding: 0; border-top: 1px solid #eeeae3; background: transparent; }
.swipe-row.home-record-row .swipe-row-content { display: flex; align-items: center; gap: 10px; min-height: 67px; padding: 10px 2px; background: rgba(255,255,255,.9); }
.swipe-row.bill-card { padding: 0; background: #fff; }
.swipe-row.bill-card .swipe-row-content { padding: 13px 14px; background: #fff; }
.swipe-row.bill-card .bill-main { display: flex; align-items: center; }
.swipe-row.bill-card .bill-card-actions { display: flex; align-items: center; }
.swipe-row.bill-card .swipe-row-actions { border-radius: 0 15px 15px 0; overflow: hidden; }
.swipe-row:has(.swipe-row-content:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Refined action tray: light, compact and consistent with the cream visual system. */
.swipe-row.is-open .swipe-row-content { transform: translateX(-136px); }
.swipe-row-actions { width: 136px; gap: 6px; padding: 6px; background: #efede7; }
.swipe-row-actions button { display: flex; width: auto; min-height: 100%; flex: 1 1 0; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0; color: var(--brand); background: #fffdf9; border: 1px solid #e4dfd5; border-radius: 12px; box-shadow: 0 3px 8px rgba(36,31,24,.07); font-size: 11px; font-weight: 800; }
.swipe-row-actions button.is-danger { color: #ad5d55; background: #fff4f1; border-color: #f0d8d3; }
.swipe-row-actions button:active { filter: none; transform: scale(.97); }
.swipe-action-icon { position: relative; display: block; width: 17px; height: 17px; color: currentColor; }
.icon-edit::before { position: absolute; left: 7px; top: 1px; width: 5px; height: 14px; content: ""; border: 1.7px solid currentColor; border-radius: 2px; transform: rotate(42deg); }
.icon-edit::after { position: absolute; left: 2px; bottom: 1px; width: 6px; height: 5px; content: ""; border-left: 1.7px solid currentColor; border-bottom: 1.7px solid currentColor; transform: skew(-18deg) rotate(-8deg); }
.icon-trash::before { position: absolute; left: 4px; top: 5px; width: 9px; height: 10px; content: ""; border: 1.7px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; }
.icon-trash::after { position: absolute; left: 2px; top: 2px; width: 13px; height: 3px; content: ""; border-top: 1.7px solid currentColor; border-bottom: 1.7px solid currentColor; border-radius: 2px; }
.swipe-row-actions button.is-danger .swipe-action-icon::before { border-color: currentColor; }
.swipe-row-actions { opacity: 0; visibility: hidden; pointer-events: none; transform: translateX(8px); transition: opacity 140ms ease, transform 140ms ease, visibility 0s linear 180ms; }
.swipe-row.is-open .swipe-row-actions { opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(0); transition-delay: 0s; }
.overview-topline, .overview-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.overview-topline { margin-bottom: 17px; }
.overview-topline .chat-overview-label { color: rgba(255,250,242,.78); font-size: 13px; font-weight: 800; }
.overview-period { color: #e5c48e; font-size: 10px; font-weight: 800; letter-spacing: .11em; }
.overview-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.overview-total { min-width: 0; padding-right: 12px; }
.overview-total + .overview-total { padding-left: 14px; border-left: 1px solid rgba(255,255,255,.15); }
.overview-total small { display: block; color: rgba(255,250,242,.56); font-size: 10px; }
.overview-total strong { display: block; margin-top: 5px; overflow: hidden; color: #fffaf2; font-size: 19px; letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.overview-total.expense strong { color: #f3ddb7; }
.overview-foot { margin-top: 16px; padding-top: 11px; color: rgba(255,250,242,.55); border-top: 1px solid rgba(255,255,255,.12); font-size: 10px; }

#entryPage { padding-bottom: 3px; }
.entry-page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.entry-page-heading h2 { margin: 5px 0 4px; font-size: 24px; letter-spacing: -.05em; }
.entry-page-heading p:not(.section-kicker) { margin: 0; color: var(--muted); font-size: 11px; }
.smart-entry-button { flex: 0 0 auto; min-height: 38px; padding: 0 12px; color: var(--muted-strong); background: rgba(255,255,255,.68); border: 1px solid var(--line); border-radius: 12px; font-size: 11px; }
.smart-entry-button:hover { color: var(--brand); background: #fff; }
.visual-entry-card { padding: 16px; background: rgba(255,255,255,.93); border: 1px solid var(--line); border-radius: 23px; box-shadow: var(--shadow); }
.entry-type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; background: var(--surface-soft); border-radius: 15px; }
.entry-type-button { min-height: 44px; color: var(--muted); background: transparent; border: 0; border-radius: 11px; font-size: 13px; font-weight: 800; }
.entry-type-button.is-active { color: #fffaf2; background: var(--brand); box-shadow: 0 6px 14px rgba(23,26,23,.16); }
.entry-type-button[data-entry-type="income"].is-active { background: var(--income); }
.entry-amount-field { display: block; margin: 21px 4px 18px; }
.entry-amount-field > span, .entry-details-grid label > span { display: block; margin: 0 0 7px 2px; color: var(--muted-strong); font-size: 11px; font-weight: 800; }
.entry-amount-input { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 0 13px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 16px; }
.entry-amount-input:focus-within { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(41,45,41,.1); }
.entry-amount-input b { color: var(--accent); font-size: 27px; }
.entry-amount-input input { width: 100%; min-width: 0; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 27px; font-weight: 800; letter-spacing: -.04em; }
.entry-amount-input input::placeholder { color: #b9b4ab; }
.entry-section-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 2px 10px; color: var(--ink); font-size: 13px; font-weight: 800; }
.entry-section-label > span:last-child { color: var(--muted); font-size: 10px; font-weight: 650; }
.entry-category-back { padding: 4px 0; color: var(--muted-strong); background: transparent; border: 0; font-size: 10px; font-weight: 800; }
.entry-category-back:hover { color: var(--brand); }
.entry-recent-block { margin-bottom: 18px; }
.entry-recent-list { display: flex; gap: 8px; overflow-x: auto; padding: 1px 2px 3px; scrollbar-width: none; }
.entry-recent-list::-webkit-scrollbar { display: none; }
.entry-recent-button { display: inline-flex; align-items: center; gap: 5px; min-height: 38px; flex: 0 0 auto; padding: 0 11px; color: var(--muted-strong); background: var(--accent-soft); border: 1px solid #ead8ba; border-radius: 999px; font-size: 11px; font-weight: 750; }
.entry-recent-button.is-selected { color: var(--brand); border-color: var(--accent); box-shadow: 0 0 0 2px rgba(214,167,95,.18); }
.entry-recent-button span { font-size: 14px; }
.entry-category-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.entry-category-button { position: relative; display: flex; min-width: 0; min-height: 88px; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 9px 4px 8px; color: var(--muted-strong); background: #fbfaf8; border: 1px solid #ebe7df; border-radius: 16px; font-size: 11px; font-weight: 750; transition: 160ms ease; }
.entry-category-button:hover { border-color: #d8d1c4; background: #fff; transform: translateY(-1px); }
.entry-category-button.is-selected { color: var(--brand); background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 2px rgba(214,167,95,.16); }
.entry-category-button.has-children { padding-right: 10px; }
.entry-category-icon { display: grid; place-items: center; width: 48px; height: 48px; background: #f0eee9; border-radius: 50%; font-size: 25px; line-height: 1; }
.entry-category-button.is-selected .entry-category-icon { background: #fff8e9; }
.entry-category-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-category-arrow { position: absolute; top: 8px; right: 8px; color: var(--accent); font-size: 17px; line-height: 1; }
.entry-category-parent { position: absolute; right: 7px; top: 7px; color: var(--muted); font-size: 8px; font-weight: 700; }
.entry-details-grid { display: grid; grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); gap: 10px; margin-top: 19px; }
.entry-details-grid label { min-width: 0; }
.entry-details-grid input { width: 100%; min-height: 48px; padding: 0 11px; color: var(--ink); background: #fbfaf8; border: 1px solid #e2ddd4; border-radius: 13px; outline: 0; font-size: 15px; }
.entry-details-grid input:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(41,45,41,.1); }
.entry-details-grid input::placeholder { color: #aaa59b; }
.entry-submit-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 19px; padding-top: 14px; border-top: 1px solid var(--line); }
.entry-submit-row > span { min-width: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.entry-submit-button { min-height: 48px; flex: 0 0 auto; padding: 0 18px; color: #fffaf2; background: var(--brand); border: 0; border-radius: 14px; font-size: 12px; font-weight: 800; box-shadow: 0 9px 18px rgba(23,26,23,.15); }
.entry-submit-button:hover { background: var(--brand-deep); transform: translateY(-1px); }

@media (max-width: 520px) {
  .app-shell:not([data-page="chat"]) .nav-dock { padding-inline: 10px; }
  .chat-overview-strip { padding-inline: 15px; }
  .home-heading { margin-inline: 0; }
  .home-records-card { padding-inline: 13px; }
  .overview-total { padding-right: 8px; }
  .overview-total + .overview-total { padding-left: 9px; }
  .overview-total strong { font-size: 16px; }
  .visual-entry-card { padding: 13px; }
  .entry-category-grid { gap: 8px; }
  .entry-category-button { min-height: 82px; border-radius: 14px; }
  .entry-category-icon { width: 43px; height: 43px; font-size: 22px; }
}

@media (max-width: 380px) {
  .entry-category-button { min-height: 76px; font-size: 10px; }
  .entry-category-icon { width: 39px; height: 39px; font-size: 20px; }
  .entry-details-grid { grid-template-columns: 1fr; }
  .entry-submit-row { align-items: stretch; flex-direction: column; }
  .entry-submit-button { width: 100%; }
}

/* Home reference layout: cream ledger, illustrated hero and three-tab dock. */
.app-shell[data-page="home"] {
  width: min(100%, 887px);
  min-height: 100svh;
  padding: 24px clamp(16px, 4.7vw, 42px) calc(126px + var(--safe-bottom));
  color: #3d2b1d;
  background: #fcfaf6;
}
.app-shell[data-page="home"] .topbar {
  align-items: center;
  margin-bottom: clamp(23px, 4vw, 38px);
}
.app-shell[data-page="home"] .brand-lockup { gap: clamp(10px, 2.3vw, 24px); }
.app-shell[data-page="home"] .home-brand-mark {
  width: clamp(58px, 12.5vw, 112px);
  height: clamp(58px, 12.5vw, 112px);
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: clamp(18px, 2.7vw, 29px);
  box-shadow: none;
}
.app-shell[data-page="home"] .topbar { justify-content: flex-start; }
.app-shell[data-page="home"] .home-brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.app-shell[data-page="home"] .brand-name { color: #3d2b1d; font-size: clamp(28px, 5.2vw, 48px); letter-spacing: -.065em; }
.app-shell[data-page="home"] .brand-tagline { margin-top: clamp(3px, .7vw, 8px); color: #8b8781; font-size: clamp(12px, 1.8vw, 18px); }
.app-shell[data-page="home"] .chat-overview-strip { display: none; }

.app-shell[data-page="home"] .home-hero-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  align-items: center;
  min-height: clamp(240px, 30vw, 390px);
  overflow: hidden;
  padding: clamp(27px, 5vw, 55px) clamp(22px, 5vw, 53px);
  background: #fff8e9;
  border: 1px solid #f5e4c3;
  border-radius: clamp(28px, 4vw, 39px);
  box-shadow: 0 14px 28px rgba(112, 78, 25, .07);
}
.home-hero-copy { position: relative; z-index: 1; min-width: 0; }
.home-hero-label {
  margin: 0;
  color: #614328;
  font-size: clamp(20px, 3.1vw, 30px);
  font-weight: 650;
  letter-spacing: -.04em;
}
.home-hero-amount {
  display: block;
  margin-top: clamp(10px, 2vw, 20px);
  color: #352315;
  font-size: clamp(40px, 7.8vw, 78px);
  font-weight: 850;
  letter-spacing: -.07em;
  line-height: .98;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.home-month-pill {
  display: inline-flex;
  align-items: center;
  gap: clamp(8px, 1.3vw, 13px);
  min-height: clamp(42px, 5vw, 62px);
  margin-top: clamp(20px, 3.3vw, 34px);
  padding: 0 clamp(15px, 2.2vw, 25px);
  color: #6c4922;
  background: #ffedc5;
  border: 0;
  border-radius: 999px;
  font-size: clamp(14px, 2vw, 20px);
  font-weight: 650;
  white-space: nowrap;
}
.home-month-pill:hover { background: #ffe5ae; }
.home-pill-arrow { color: #d98914; font-size: clamp(23px, 3vw, 31px); line-height: 1; }
.home-hero-art {
  display: block;
  align-self: end;
  justify-self: end;
  width: min(100%, 360px);
  max-height: 310px;
  object-fit: contain;
  object-position: right bottom;
  transform: translate(5%, 8%);
}

.app-shell[data-page="home"] .home-bills-card {
  margin-top: clamp(25px, 4vw, 40px);
  padding: clamp(24px, 4vw, 38px) clamp(22px, 4.2vw, 40px) clamp(18px, 3vw, 27px);
  background: #fff;
  border: 1px solid #f0ece6;
  border-radius: clamp(28px, 4vw, 39px);
  box-shadow: 0 12px 26px rgba(80, 57, 31, .04);
}
.home-bills-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-bills-head h2 {
  margin: 0;
  color: #3d2b1d;
  font-size: clamp(25px, 4vw, 37px);
  letter-spacing: -.06em;
  line-height: 1.15;
}
.app-shell[data-page="home"] .home-view-all {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0;
  color: #8b8883;
  background: transparent;
  border: 0;
  font-size: clamp(15px, 2.3vw, 22px);
  font-weight: 600;
}
.app-shell[data-page="home"] .home-view-all:hover { color: #e99516; }
.app-shell[data-page="home"] .home-view-all span { color: #aaa8a2; font-size: clamp(25px, 3.4vw, 34px); line-height: 1; }
.app-shell[data-page="home"] .home-record-list { margin-top: clamp(14px, 2.6vw, 25px); }
.app-shell[data-page="home"] .home-record-row { border-top: 1px solid #f1eee9; }
.app-shell[data-page="home"] .home-record-row:first-child { border-top: 0; }
.app-shell[data-page="home"] .home-record-row .swipe-row-content {
  min-height: clamp(94px, 16.3vw, 145px);
  gap: clamp(13px, 2.1vw, 20px);
  padding: clamp(12px, 1.8vw, 17px) 0;
  background: #fff;
}
.app-shell[data-page="home"] .home-record-icon {
  width: clamp(50px, 12.2vw, 108px);
  height: clamp(50px, 12.2vw, 108px);
  flex-basis: clamp(50px, 12.2vw, 108px);
  overflow: hidden;
  background: #fff3d7;
  border-radius: clamp(16px, 2.6vw, 24px);
  font-size: clamp(24px, 3vw, 31px);
}
.app-shell[data-page="home"] .home-record-icon img { display: block; width: 100%; height: 100%; object-fit: contain; }
.app-shell[data-page="home"] .home-record-copy strong { color: #443021; font-size: clamp(17px, 2.5vw, 25px); font-weight: 760; }
.app-shell[data-page="home"] .home-record-copy span { margin-top: 6px; color: #8c8883; font-size: clamp(14px, 2.1vw, 21px); }
.app-shell[data-page="home"] .home-record-side b { font-size: clamp(18px, 2.8vw, 28px); font-weight: 800; }
.app-shell[data-page="home"] .home-record-side b.expense { color: #ec684b; }
.app-shell[data-page="home"] .home-record-side b.income { color: #5e8967; }
.app-shell[data-page="home"] .home-empty-state { padding: 30px 12px 24px; }
.app-shell[data-page="home"] .home-empty-state strong { font-size: clamp(16px, 2.4vw, 23px); }
.app-shell[data-page="home"] .home-empty-state p { font-size: clamp(13px, 1.8vw, 17px); }
.app-shell[data-page="home"] .home-empty-state button { color: #8b5a1f; background: #fff2d5; border-color: #f3dfb8; font-size: clamp(13px, 1.8vw, 17px); }

.app-shell[data-page="home"] .home-insight-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: clamp(190px, 23vw, 278px);
  overflow: hidden;
  margin-top: clamp(25px, 4vw, 40px);
  padding: clamp(26px, 4vw, 42px) clamp(22px, 4.2vw, 40px);
  background: #fff8e9;
  border: 1px solid #f5e4c3;
  border-radius: clamp(28px, 4vw, 39px);
  box-shadow: 0 14px 28px rgba(112, 78, 25, .06);
}
.home-insight-copy { position: relative; z-index: 1; min-width: 0; }
.home-insight-kicker {
  margin: 0 0 clamp(16px, 2.6vw, 25px);
  color: #5b3b21;
  font-size: clamp(17px, 2.6vw, 25px);
  font-weight: 760;
  letter-spacing: -.04em;
}
.home-insight-kicker span { color: #f6ad24; margin-right: 5px; }
.home-insight-title {
  max-width: 21em;
  margin: 0;
  color: #4a311f;
  font-size: clamp(20px, 3.1vw, 30px);
  font-weight: 650;
  letter-spacing: -.05em;
  line-height: 1.35;
}
.home-insight-title em { color: #ed6d37; font-style: normal; }
.home-insight-note { margin: clamp(8px, 1.5vw, 14px) 0 0; color: #93877a; font-size: clamp(14px, 2vw, 20px); }
.home-insight-art { display: block; align-self: end; width: min(37%, 270px); min-width: 130px; object-fit: contain; }

.app-shell[data-page="home"] .nav-dock {
  left: 50%;
  bottom: 0;
  width: min(100%, 887px);
  margin: 0;
  padding: 13px clamp(16px, 4.7vw, 42px) max(14px, var(--safe-bottom));
  background: rgba(252,250,246,.94);
  border-top: 0;
  border-bottom: 0;
  box-shadow: 0 -10px 30px rgba(80, 57, 31, .08);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.app-shell[data-page="home"] .tabbar {
  min-height: clamp(84px, 13vw, 126px);
  overflow: visible;
  background: #fff;
  border: 1px solid #f0ece6;
  border-radius: clamp(25px, 3.2vw, 34px);
  box-shadow: 0 12px 25px rgba(80, 57, 31, .07);
}
.app-shell[data-page="home"] .tab-button {
  min-height: clamp(72px, 11vw, 108px);
  gap: clamp(4px, .9vw, 9px);
  color: #8e8b86;
  font-size: clamp(13px, 2vw, 20px);
  font-weight: 650;
}
.app-shell[data-page="home"] .tab-button.is-active { color: #eb9b12; background: transparent; }
.app-shell[data-page="home"] .tab-button.is-active::after {
  bottom: clamp(8px, 1.2vw, 14px);
  width: clamp(35px, 5.4vw, 54px);
  height: clamp(3px, .45vw, 5px);
  background: #efa312;
}
.app-shell[data-page="home"] .tab-icon { width: clamp(23px, 3.5vw, 36px); height: clamp(23px, 3.5vw, 36px); flex-basis: clamp(23px, 3.5vw, 36px); }
.app-shell[data-page="home"] .tab-button.is-active .tab-icon { color: currentColor; }
.app-shell[data-page="home"] .tab-entry-button { color: #3d2b1d; }
.app-shell[data-page="home"] .tab-entry-button .tab-icon {
  width: clamp(49px, 7.4vw, 72px);
  height: clamp(49px, 7.4vw, 72px);
  flex-basis: clamp(49px, 7.4vw, 72px);
  color: #fff;
  background: #f3ac1e;
  border-radius: 50%;
  box-shadow: 0 8px 16px rgba(226, 143, 15, .23);
  transform: translateY(clamp(-18px, -1.8vw, -9px));
}
.app-shell[data-page="home"] .tab-entry-button .icon-plus::before,
.app-shell[data-page="home"] .tab-entry-button .icon-plus::after {
  width: clamp(20px, 3vw, 30px);
  height: clamp(3px, .45vw, 5px);
  left: 50%;
  top: 50%;
  background: currentColor;
  border: 0;
  border-radius: 999px;
  transform: translate(-50%, -50%);
}
.app-shell[data-page="home"] .tab-entry-button .icon-plus::after { transform: translate(-50%, -50%) rotate(90deg); }
.app-shell[data-page="home"] .tab-entry-button::after { display: none; }

@media (max-width: 520px) {
  .app-shell[data-page="home"] { padding-top: 18px; }
  .app-shell[data-page="home"] .home-hero-card { grid-template-columns: minmax(0, 1fr) minmax(0, .92fr); }
  .app-shell[data-page="home"] .home-hero-art { width: 115%; transform: translate(7%, 9%); }
  .app-shell[data-page="home"] .home-insight-art { width: 39%; min-width: 112px; }
}

@media (max-width: 380px) {
  .app-shell[data-page="home"] .home-hero-card { padding-inline: 18px; }
  .app-shell[data-page="home"] .home-hero-amount { font-size: 37px; }
  .app-shell[data-page="home"] .home-month-pill { padding-inline: 12px; font-size: 13px; }
  .app-shell[data-page="home"] .home-bills-card,
  .app-shell[data-page="home"] .home-insight-card { padding-inline: 17px; }
  .app-shell[data-page="home"] .home-insight-art { min-width: 100px; }
}

/* Single-screen homepage: compact sections, no card outlines, and two recent bills. */
html:has(#appShell:not(.is-hidden)[data-page="home"]),
body:has(#appShell:not(.is-hidden)[data-page="home"]) {
  overflow: hidden;
}

body:has(#appShell:not(.is-hidden)[data-page="home"]) .app-shell[data-page="home"] {
  height: 100svh;
  min-height: 100svh;
  max-height: 100svh;
  overflow: hidden;
  overscroll-behavior: none;
}

.app-shell[data-page="home"] .topbar {
  margin-bottom: clamp(14px, 2.4vw, 24px);
}

.app-shell[data-page="home"] .home-hero-card {
  min-height: clamp(190px, 22vw, 286px);
  padding-block: clamp(16px, 3vw, 30px);
  border: 0;
  border-radius: clamp(24px, 3.4vw, 34px);
  box-shadow: none;
}

.app-shell[data-page="home"] .home-hero-amount {
  margin-top: clamp(7px, 1.3vw, 13px);
}

.app-shell[data-page="home"] .home-month-pill {
  min-height: clamp(38px, 4.2vw, 52px);
  margin-top: clamp(12px, 2vw, 20px);
}

.app-shell[data-page="home"] .home-hero-art {
  max-height: 238px;
  transform: translate(4%, 4%);
}

.app-shell[data-page="home"] .home-hero-sparkles {
  position: absolute;
  z-index: 0;
  top: clamp(7px, 2vw, 20px);
  right: clamp(10px, 8vw, 72px);
  width: clamp(108px, 18vw, 176px);
  height: auto;
  pointer-events: none;
  opacity: .9;
}

.app-shell[data-page="home"] .home-bills-card,
.app-shell[data-page="home"] .home-insight-card {
  border: 0;
  box-shadow: none;
}

.app-shell[data-page="home"] .home-bills-card {
  margin-top: clamp(14px, 2.4vw, 24px);
  padding-top: clamp(15px, 2.4vw, 23px);
  padding-bottom: clamp(9px, 1.6vw, 15px);
  border-radius: clamp(24px, 3.4vw, 34px);
}

.app-shell[data-page="home"] .home-record-list { margin-top: clamp(5px, 1vw, 10px); }
.app-shell[data-page="home"] .home-record-row .swipe-row-content {
  min-height: clamp(68px, 10.5vw, 94px);
  padding-block: clamp(6px, 1vw, 10px);
}
.app-shell[data-page="home"] .home-record-icon {
  width: clamp(42px, 8.8vw, 70px);
  height: clamp(42px, 8.8vw, 70px);
  flex-basis: clamp(42px, 8.8vw, 70px);
}
.app-shell[data-page="home"] .home-record-copy strong { font-size: clamp(16px, 2.2vw, 22px); }
.app-shell[data-page="home"] .home-record-copy span { margin-top: 3px; font-size: clamp(13px, 1.8vw, 18px); }
.app-shell[data-page="home"] .home-record-side b { font-size: clamp(17px, 2.4vw, 24px); }

/* The compact homepage follows the reference composition: banner, two recent bills, dock. */
.app-shell[data-page="home"] .home-insight-card {
  display: flex !important;
  min-height: 0;
  margin-top: clamp(12px, 2vw, 18px);
  padding: clamp(12px, 2vw, 18px) clamp(18px, 3.6vw, 30px);
  border: 0;
  border-radius: clamp(22px, 3vw, 30px);
  box-shadow: none;
}
.app-shell[data-page="home"] .home-insight-kicker {
  margin-bottom: clamp(5px, 1vw, 8px);
  font-size: clamp(14px, 2vw, 19px);
}
.app-shell[data-page="home"] .home-insight-title {
  font-size: clamp(16px, 2.5vw, 24px);
  line-height: 1.2;
}
.app-shell[data-page="home"] .home-insight-note {
  margin-top: 4px;
  font-size: clamp(12px, 1.7vw, 17px);
}
.app-shell[data-page="home"] .home-insight-art {
  width: min(27%, 150px);
  min-width: 72px;
}

@media (min-width: 521px) and (max-height: 760px) {
  .app-shell[data-page="home"] .home-insight-card {
    margin-top: 6px;
    padding: 4px 18px;
  }
  .app-shell[data-page="home"] .home-insight-kicker {
    margin-bottom: 3px;
    font-size: 12px;
  }
  .app-shell[data-page="home"] .home-insight-title { font-size: 16px; }
  .app-shell[data-page="home"] .home-insight-note { display: none; }
  .app-shell[data-page="home"] .home-insight-art {
    width: 34px;
    min-width: 34px;
  }
}

.app-shell[data-page="home"] .nav-dock {
  padding-top: 2px;
  padding-bottom: max(4px, var(--safe-bottom));
}
.app-shell[data-page="home"] .tabbar { min-height: 44px; }
.app-shell[data-page="home"] .tab-button {
  min-height: 40px;
  padding-bottom: 1px;
}
.app-shell[data-page="home"] .tab-button.is-active::after { height: 2px; }

@media (max-width: 520px) {
  .app-shell[data-page="home"] .home-hero-art {
    width: 108%;
    transform: translate(7%, 5%);
  }
  .app-shell[data-page="home"] .home-hero-sparkles {
    right: 17%;
    width: 116px;
  }
}

@media (min-width: 521px) and (max-height: 760px) {
  .app-shell[data-page="home"] { padding-top: 16px !important; }
  .app-shell[data-page="home"] .home-brand-mark {
    width: 72px !important;
    height: 72px !important;
  }
  .app-shell[data-page="home"] .topbar { margin-bottom: 16px !important; }
  .app-shell[data-page="home"] .home-hero-card {
    min-height: 0 !important;
    padding-block: 20px !important;
  }
  .app-shell[data-page="home"] .home-hero-art { max-height: 190px !important; }
  .app-shell[data-page="home"] .home-bills-card {
    margin-top: 16px !important;
    padding-top: 16px !important;
    padding-bottom: 10px !important;
  }
  .app-shell[data-page="home"] .home-record-row .swipe-row-content { min-height: 68px !important; }
  .app-shell[data-page="home"] .home-record-icon {
    width: 54px !important;
    height: 54px !important;
    flex-basis: 54px !important;
  }
}

@media (min-width: 521px) and (max-height: 760px) {
  .app-shell[data-page="home"] { padding-top: 16px; }
  .app-shell[data-page="home"] .home-brand-mark {
    width: 72px;
    height: 72px;
  }
  .app-shell[data-page="home"] .topbar { margin-bottom: 16px; }
  .app-shell[data-page="home"] .home-hero-card {
    min-height: 0;
    padding-block: 20px;
  }
  .app-shell[data-page="home"] .home-hero-art { max-height: 190px; }
  .app-shell[data-page="home"] .home-bills-card {
    margin-top: 16px;
    padding-top: 16px;
    padding-bottom: 10px;
  }
  .app-shell[data-page="home"] .home-record-row .swipe-row-content { min-height: 68px; }
  .app-shell[data-page="home"] .home-record-icon {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
  }
}

/* Compact homepage pass: preserve the reference composition while reducing visual bulk. */
html:has(#appShell:not(.is-hidden)[data-page="home"]),
body:has(#appShell:not(.is-hidden)[data-page="home"]) {
  background: #fcfaf6;
}

.app-shell[data-page="home"] .home-hero-card {
  min-height: clamp(220px, 27vw, 360px);
  padding-block: clamp(23px, 4.2vw, 45px);
}
.app-shell[data-page="home"] .home-hero-amount { margin-top: clamp(8px, 1.7vw, 16px); }
.app-shell[data-page="home"] .home-month-pill { margin-top: clamp(16px, 2.8vw, 29px); }
.app-shell[data-page="home"] .home-hero-art {
  max-height: 280px;
  transform: translate(4%, 6%);
}

.app-shell[data-page="home"] .home-bills-card {
  margin-top: clamp(20px, 3.2vw, 32px);
  padding-top: clamp(18px, 3vw, 28px);
  padding-right: clamp(18px, 3.6vw, 34px);
  padding-bottom: clamp(13px, 2.2vw, 20px);
  padding-left: clamp(18px, 3.6vw, 34px);
}
.app-shell[data-page="home"] .home-record-list { margin-top: clamp(9px, 1.8vw, 17px); }
.app-shell[data-page="home"] .home-record-row .swipe-row-content {
  min-height: clamp(78px, 13vw, 116px);
  padding-block: clamp(8px, 1.4vw, 13px);
}
.app-shell[data-page="home"] .home-record-icon {
  width: clamp(46px, 10.5vw, 82px);
  height: clamp(46px, 10.5vw, 82px);
  flex-basis: clamp(46px, 10.5vw, 82px);
}

.app-shell[data-page="home"] {
  padding-bottom: calc(82px + var(--safe-bottom));
}
.app-shell[data-page="home"] .nav-dock {
  padding-top: 4px;
  padding-bottom: max(6px, var(--safe-bottom));
  background: #fcfaf6;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.app-shell[data-page="home"] .tabbar {
  min-height: 48px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.app-shell[data-page="home"] .tab-button {
  min-height: 44px;
  flex-direction: row;
  gap: 0;
  padding: 0 8px 2px;
  font-size: clamp(13px, 2vw, 20px);
}
.app-shell[data-page="home"] .tab-button .tab-icon { display: none; }
.app-shell[data-page="home"] .tab-button.is-active::after {
  bottom: 0;
  width: clamp(32px, 5vw, 50px);
  height: 3px;
}
.app-shell[data-page="home"] .tab-entry-button,
.app-shell[data-page="home"] .tab-entry-button .tab-icon {
  color: #3d2b1d;
  background: transparent;
  box-shadow: none;
  transform: none;
}

@media (max-width: 520px) {
  .app-shell[data-page="home"] .home-hero-art { transform: translate(5%, 6%); }
}

/* Final single-screen homepage overrides. Keep these last so they win over earlier responsive rules. */
html:has(#appShell:not(.is-hidden)[data-page="home"]),
body:has(#appShell:not(.is-hidden)[data-page="home"]) {
  overflow: hidden;
}

body:has(#appShell:not(.is-hidden)[data-page="home"]) .app-shell[data-page="home"] {
  height: 100svh;
  min-height: 100svh;
  max-height: 100svh;
  overflow: hidden;
  overscroll-behavior: none;
}

.app-shell[data-page="home"] .topbar { margin-bottom: clamp(14px, 2.4vw, 24px); }
.app-shell[data-page="home"] .home-hero-card {
  min-height: clamp(190px, 22vw, 286px);
  padding-block: clamp(16px, 3vw, 30px);
  border: 0;
  border-radius: clamp(24px, 3.4vw, 34px);
  box-shadow: none;
}
.app-shell[data-page="home"] .home-hero-amount { margin-top: clamp(7px, 1.3vw, 13px); }
.app-shell[data-page="home"] .home-month-pill {
  min-height: clamp(38px, 4.2vw, 52px);
  margin-top: clamp(12px, 2vw, 20px);
}
.app-shell[data-page="home"] .home-hero-art {
  max-height: 238px;
  transform: translate(4%, 4%);
}
.app-shell[data-page="home"] .home-hero-sparkles {
  position: absolute;
  z-index: 0;
  top: clamp(7px, 2vw, 20px);
  right: clamp(10px, 8vw, 72px);
  width: clamp(108px, 18vw, 176px);
  height: auto;
  pointer-events: none;
  opacity: .9;
}
.app-shell[data-page="home"] .home-bills-card,
.app-shell[data-page="home"] .home-insight-card {
  border: 0;
  box-shadow: none;
}
.app-shell[data-page="home"] .home-bills-card {
  margin-top: clamp(14px, 2.4vw, 24px);
  padding-top: clamp(15px, 2.4vw, 23px);
  padding-bottom: clamp(9px, 1.6vw, 15px);
  border-radius: clamp(24px, 3.4vw, 34px);
}
.app-shell[data-page="home"] .home-record-list { margin-top: clamp(5px, 1vw, 10px); }
.app-shell[data-page="home"] .home-record-row .swipe-row-content {
  min-height: clamp(68px, 10.5vw, 94px);
  padding-block: clamp(6px, 1vw, 10px);
}
.app-shell[data-page="home"] .home-record-icon {
  width: clamp(42px, 8.8vw, 70px);
  height: clamp(42px, 8.8vw, 70px);
  flex-basis: clamp(42px, 8.8vw, 70px);
}
.app-shell[data-page="home"] .home-record-copy strong { font-size: clamp(16px, 2.2vw, 22px); }
.app-shell[data-page="home"] .home-record-copy span { margin-top: 3px; font-size: clamp(13px, 1.8vw, 18px); }
.app-shell[data-page="home"] .home-record-side b { font-size: clamp(17px, 2.4vw, 24px); }
.app-shell[data-page="home"] .home-insight-card { display: none; }
.app-shell[data-page="home"] .nav-dock {
  padding-top: 2px;
  padding-bottom: max(4px, var(--safe-bottom));
}
.app-shell[data-page="home"] .tabbar { min-height: 44px; }
.app-shell[data-page="home"] .tab-button {
  min-height: 40px;
  padding-bottom: 1px;
}
.app-shell[data-page="home"] .tab-button.is-active::after { height: 2px; }

@media (max-width: 520px) {
  .app-shell[data-page="home"] .home-hero-art {
    width: 108%;
    transform: translate(7%, 5%);
  }
  .app-shell[data-page="home"] .home-hero-sparkles {
    right: 17%;
    width: 116px;
  }
}
