:root {
  --bg: #f6f2e9;
  --surface: #fffdfa;
  --surface-2: #eee9de;
  --ink: #28251f;
  --muted: #817b70;
  --line: rgba(71, 65, 54, .13);
  --accent: #6d5ce7;
  --accent-soft: #ece9ff;
  --wife: #e65d87;
  --good: #3f9b72;
  --danger: #d94f55;
  --shadow: 0 18px 50px rgba(73, 61, 37, .09);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; overflow-x: hidden; color: var(--ink); background: radial-gradient(circle at 90% -10%, rgba(109,92,231,.12), transparent 28rem), var(--bg); }
body.sheet-open { overflow: hidden; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid rgba(109,92,231,.28); outline-offset: 2px; }
.hidden { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { display: block; }

.app { width: min(720px, 100%); min-height: 100dvh; margin: 0 auto; background: var(--bg); }
.topbar { position: sticky; top: 0; z-index: 30; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(13px, env(safe-area-inset-top)) 18px 11px; background: rgba(246,242,233,.93); border-bottom: 1px solid rgba(71,65,54,.07); backdrop-filter: blur(18px); }
.topbar h1 { margin: 2px 0 0; font-size: 24px; line-height: 1.05; letter-spacing: -.02em; }
.eyebrow { margin: 0; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.sync-pill { min-height: 42px; display: flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.55); cursor: pointer; }
.sync-pill span { width: 8px; height: 8px; border-radius: 50%; background: #a6a094; }
.sync-pill b { max-width: 94px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sync-pill.online span { background: var(--good); box-shadow: 0 0 0 4px rgba(63,155,114,.1); }
.sync-pill.offline span { background: #d78c40; }
.sync-pill.error span { background: var(--danger); }
.sync-pill.pending span { background: #a6a094; animation: sync-pulse 1.4s ease-in-out infinite; }
.avatar-button { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--accent); color: white; font-weight: 800; cursor: pointer; }
.demo-banner { margin: 8px 12px 0; padding: 9px 12px; border: 1px solid rgba(217,155,55,.25); border-radius: 12px; background: rgba(255,237,194,.65); color: #795c20; font-size: 11px; line-height: 1.35; text-align: center; }
.offline-banner { margin: 8px 12px 0; padding: 9px 12px; border: 1px solid rgba(215,140,64,.28); border-radius: 12px; background: rgba(255,235,210,.72); color: #765022; font-size: 11px; line-height: 1.4; text-align: center; }

main { padding: 13px 12px calc(102px + env(safe-area-inset-bottom)); }
.screen { display: none; }
.screen.active { display: block; animation: screen-in .18s ease-out; }
.hero-card { padding: 21px; border: 1px solid rgba(109,92,231,.13); border-radius: 26px; background: linear-gradient(145deg, #fffdf9 0%, #f0edff 100%); box-shadow: var(--shadow); }
.hero-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.hero-heading span { color: var(--muted); font-size: 12px; }
.hero-heading strong { display: block; margin-top: 5px; font-size: clamp(34px, 10vw, 46px); line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.budget-percent { padding: 6px 9px; border-radius: 999px; background: rgba(109,92,231,.1); color: var(--accent) !important; font-weight: 800; }
.budget-track { height: 8px; margin: 19px 0 9px; overflow: hidden; border-radius: 999px; background: rgba(109,92,231,.11); }
.budget-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #998ff3); transition: width .25s; }
.budget-track i.over { background: linear-gradient(90deg, #e3974f, var(--danger)); }
.budget-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.user-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px; margin-top: 18px; }
.user-share { display: grid; grid-template-columns: 32px minmax(0,1fr); align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.58); }
.user-dot { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: white; font-size: 12px; font-weight: 800; }
.user-share small, .user-share b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-share small { color: var(--muted); font-size: 10px; }
.user-share b { margin-top: 2px; font-size: 13px; font-variant-numeric: tabular-nums; }

.section-block { margin-top: 21px; }
.last-section { padding-bottom: 12px; }
.section-heading { min-height: 42px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 4px 10px; }
.section-heading h2 { margin: 3px 0 0; font-size: 18px; letter-spacing: -.015em; }
.text-button { min-height: 42px; padding: 7px 0 5px 14px; border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 700; cursor: pointer; }
.repeat-list { display: grid; grid-auto-columns: minmax(156px, 44vw); grid-auto-flow: column; gap: 9px; padding: 1px 1px 5px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
.repeat-list::-webkit-scrollbar { display: none; }
.repeat-card { min-height: 104px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 13px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 5px 17px rgba(73,61,37,.05); text-align: left; scroll-snap-align: start; cursor: pointer; }
.repeat-card .category-icon { width: 34px; height: 34px; }
.repeat-card b, .repeat-card small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repeat-card b { font-size: 13px; }
.repeat-card small { color: var(--muted); font-size: 10px; }

.category-bars { display: grid; gap: 9px; }
.category-bar { width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); color: inherit; text-align: left; }
button.category-bar { cursor: pointer; }
.category-disclosure { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.category-disclosure .category-bar { border: 0; border-radius: 0; }
.category-toggle { scroll-margin-top: 84px; }
.category-disclosure.expanded .category-toggle { background: color-mix(in srgb, var(--category-color) 4%, var(--surface)); }
.category-breakdown { border-top: 1px solid rgba(71,65,54,.09); animation: disclosure-in .16s ease-out; }
.category-breakdown .transaction-list { border: 0; border-radius: 0; }
.category-breakdown-note { margin: 0; padding: 9px 13px 11px; border-top: 1px solid rgba(71,65,54,.07); color: var(--muted); font-size: 10px; text-align: center; }
.category-bar-head { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 10px; }
.category-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: var(--category-color, var(--accent)); background: color-mix(in srgb, var(--category-color, var(--accent)) 14%, white); }
.category-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.category-bar-name b, .category-bar-name small { display: block; }
.category-bar-name b { font-size: 13px; }
.category-bar-name small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.category-bar-amount { text-align: right; }
.category-bar-amount b, .category-bar-amount small { display: block; font-variant-numeric: tabular-nums; }
.category-bar-amount b { font-size: 13px; }
.category-bar-amount small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.mini-track { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: #eeeae2; }
.mini-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--category-color, var(--accent)); }

.transaction-list, .feed-list { display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: 19px; background: var(--surface); }
.transaction-swipe { --swipe-actions-width: 156px; position: relative; overflow: hidden; border-bottom: 1px solid rgba(71,65,54,.09); background: var(--surface-2); }
.transaction-swipe:last-child { border-bottom: 0; }
.transaction-actions { position: absolute; z-index: 0; inset: 0 0 0 auto; width: var(--swipe-actions-width); display: grid; grid-template-columns: 1fr 1fr; }
.transaction-action { min-width: 0; padding: 7px 4px; border: 0; color: white; font-size: 10px; font-weight: 800; cursor: pointer; touch-action: manipulation; }
.transaction-action.edit { background: var(--accent); }
.transaction-action.delete { background: var(--danger); }
.transaction { position: relative; z-index: 1; width: 100%; min-height: 70px; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 11px 13px; border: 0; background: var(--surface); text-align: left; cursor: pointer; touch-action: pan-y; user-select: none; will-change: transform; transition: transform .18s ease-out; }
.transaction-swipe.open .transaction { transform: translateX(calc(-1 * var(--swipe-actions-width))); }
.transaction:active { background: rgba(109,92,231,.05); }
.transaction-copy { min-width: 0; }
.transaction-copy b, .transaction-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transaction-copy b { font-size: 13px; }
.transaction-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.transaction-amount { text-align: right; }
.transaction-amount b, .transaction-amount small { display: block; font-variant-numeric: tabular-nums; white-space: nowrap; }
.transaction-amount b { font-size: 13px; }
.transaction-amount small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.empty-state { padding: 30px 18px; color: var(--muted); font-size: 13px; line-height: 1.5; text-align: center; }

.feed-toolbar, .stats-toolbar { display: grid; gap: 10px; margin-bottom: 12px; }
.gesture-hint { margin: -2px 3px 0; color: var(--muted); font-size: 10px; line-height: 1.35; text-align: center; }
.month-switcher { min-height: 46px; display: grid; grid-template-columns: 46px minmax(0,1fr) 46px; align-items: center; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.month-switcher button { width: 46px; height: 46px; border: 0; background: transparent; color: var(--accent); font-size: 25px; cursor: pointer; }
.month-switcher strong { text-align: center; font-size: 14px; }
.search-field { min-height: 48px; display: grid; grid-template-columns: 22px minmax(0,1fr); align-items: center; gap: 8px; padding: 0 13px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.search-field svg { width: 19px; height: 19px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 14px; }
.filter-row { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-button { min-height: 42px; flex: 0 0 auto; padding: 8px 15px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.filter-button.active { border-color: transparent; background: var(--ink); color: white; }
.day-group { margin-bottom: 13px; }
.feed-list .day-group { margin: 0; border-bottom: 1px solid rgba(71,65,54,.1); }
.feed-list .day-group:last-child { border-bottom: 0; }
.feed-list .day-heading { padding: 12px 13px 7px; background: rgba(238,233,222,.42); }
.day-heading { display: flex; justify-content: space-between; gap: 10px; padding: 5px 5px 7px; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }

.stats-total-card { padding: 19px; border: 1px solid var(--line); border-radius: 21px; background: var(--surface); box-shadow: 0 10px 28px rgba(73,61,37,.05); }
.stats-total-card span, .stats-total-card small { display: block; color: var(--muted); }
.stats-total-card span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.stats-total-card strong { display: block; margin: 7px 0 5px; font-size: 35px; line-height: 1; font-variant-numeric: tabular-nums; }
.stats-total-card small { font-size: 11px; }
.merchant-stats { display: grid; gap: 7px; }
.merchant-row { min-height: 52px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.merchant-row b { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.merchant-row span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.trend-chart { height: 190px; display: grid; grid-template-columns: repeat(6, 1fr); align-items: end; gap: 7px; padding: 16px 12px 10px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.trend-column { height: 100%; display: grid; grid-template-rows: minmax(0,1fr) 22px; align-items: end; gap: 7px; }
.trend-bars { height: 100%; display: flex; align-items: end; justify-content: center; gap: 2px; }
.trend-bars i { width: min(13px, 40%); min-height: 3px; border-radius: 6px 6px 2px 2px; }
.trend-column span { color: var(--muted); font-size: 9px; text-align: center; text-transform: uppercase; }

.bottom-nav { position: fixed; z-index: 40; left: 50%; bottom: 0; width: min(720px, 100%); min-height: calc(70px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr 1fr 78px 1fr; align-items: start; transform: translateX(-50%); padding: 5px 7px max(5px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,253,250,.96); backdrop-filter: blur(20px); }
.nav-button { min-height: 56px; display: grid; place-items: center; align-content: center; gap: 2px; border: 0; border-radius: 13px; background: transparent; color: #999386; cursor: pointer; }
.nav-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-button span { font-size: 10px; font-weight: 700; }
.nav-button.active { color: var(--accent); background: rgba(109,92,231,.07); }
.add-slot { position: relative; }
.add-button { position: absolute; left: 50%; top: -23px; width: 62px; height: 62px; display: grid; place-items: center; transform: translateX(-50%); border: 5px solid var(--surface); border-radius: 50%; background: linear-gradient(145deg, #806ef1, #5948d4); color: white; box-shadow: 0 10px 25px rgba(83,66,202,.3); cursor: pointer; }
.add-button svg { width: 29px; height: 29px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.activation { position: fixed; z-index: 100; inset: 0; min-height: 100dvh; padding: max(18px, env(safe-area-inset-top)) 15px max(18px, env(safe-area-inset-bottom)); overflow-y: auto; background: radial-gradient(circle at 75% 8%, rgba(109,92,231,.18), transparent 24rem), var(--bg); }
.activation-card { width: min(430px, 100%); min-height: calc(100dvh - 36px); display: flex; flex-direction: column; justify-content: center; margin: auto; padding: 30px 24px; border: 1px solid var(--line); border-radius: 28px; background: rgba(255,253,250,.92); box-shadow: var(--shadow); }
.app-mark { width: 54px; height: 54px; display: grid; grid-template-columns: repeat(3,1fr); align-items: end; gap: 4px; padding: 10px; border-radius: 17px; background: var(--accent-soft); }
.app-mark span { border-radius: 4px 4px 2px 2px; background: var(--accent); }
.app-mark span:nth-child(1) { height: 44%; opacity: .65; }
.app-mark span:nth-child(2) { height: 82%; }
.app-mark span:nth-child(3) { height: 62%; opacity: .8; }
.test-badge { align-self: flex-start; margin-top: 20px; padding: 6px 9px; border-radius: 999px; background: #fff0c9; color: #795b1b; font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.activation-card h1 { margin: 12px 0 7px; font-size: 30px; }
.activation-card > p { margin: 0 0 9px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.activation-card label { display: grid; gap: 7px; margin-top: 15px; color: #5f5a50; font-size: 11px; font-weight: 750; }
.activation-card input, .line-input, .details-content input, .details-content textarea { width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; outline: 0; background: #fbf9f4; color: var(--ink); font-size: 16px; }
.activation-card input:focus, .line-input:focus, .details-content input:focus, .details-content textarea:focus { border-color: rgba(109,92,231,.5); box-shadow: 0 0 0 3px rgba(109,92,231,.08); }
.primary-button, .secondary-button { min-height: 50px; border-radius: 14px; font-weight: 800; cursor: pointer; }
.primary-button { border: 0; background: linear-gradient(135deg, #7866ed, #5948d4); color: white; box-shadow: 0 9px 24px rgba(89,72,212,.2); }
.primary-button:disabled { opacity: .42; box-shadow: none; cursor: default; }
button:disabled { cursor: default; opacity: .42; }
.activation-card .primary-button { margin-top: 18px; }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.form-error { min-height: 19px; margin: 11px 0 0 !important; color: var(--danger) !important; font-size: 11px !important; text-align: center; }
.activation-card > small { color: var(--muted); font-size: 10px; line-height: 1.45; text-align: center; }

.sheet { position: fixed; z-index: 80; inset: 0; }
.sheet-backdrop { position: absolute; inset: 0; width: 100%; border: 0; border-radius: 0; background: rgba(45,39,29,.46); backdrop-filter: blur(4px); }
.sheet-card { position: absolute; left: 50%; bottom: 0; width: min(720px,100%); max-height: min(94dvh, 940px); overflow-y: auto; transform: translateX(-50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 27px 27px 0 0; background: var(--bg); box-shadow: 0 -24px 70px rgba(51,42,27,.2); animation: sheet-up .22s ease-out; }
.expense-sheet-card { height: 100dvh; max-height: 100dvh; overflow: hidden; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.sheet-handle { width: 44px; height: 4px; margin: 9px auto 1px; border-radius: 999px; background: #c8c1b5; }
.sheet-header { position: sticky; top: 0; z-index: 4; min-height: 64px; display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; align-items: center; gap: 10px; padding: 8px 15px; background: rgba(246,242,233,.95); border-bottom: 1px solid rgba(71,65,54,.07); backdrop-filter: blur(16px); }
.sheet-header h2 { margin: 2px 0 0; font-size: 20px; text-align: center; }
.sheet-header .eyebrow { text-align: center; }
.circle-button, .circle-spacer { width: 44px; height: 44px; }
.circle-button { display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); cursor: pointer; }
.circle-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.circle-button.danger { color: var(--danger); }
.quick-entry { min-height: 0; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.amount-editor { width: 100%; min-height: 91px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 9px 16px 5px; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.amount-editor > small { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .04em; }
.amount-value { max-width: 100%; display: flex; align-items: baseline; justify-content: center; gap: 8px; color: var(--accent); }
.amount-value output { max-width: calc(100vw - 92px); overflow: hidden; font-size: clamp(43px, 13vw, 62px); font-weight: 820; line-height: .98; letter-spacing: -.045em; text-overflow: ellipsis; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount-value b { flex: 0 0 auto; font-size: 24px; font-weight: 780; }
.amount-editor em { min-height: 14px; color: var(--muted); font-size: 10px; font-style: normal; }
.amount-editor.replace-pending .amount-value { padding: 2px 12px; border-radius: 14px; background: var(--accent-soft); }
.quick-category-section { margin-top: auto; padding: 4px 12px 3px; }
.quick-category-section .form-section-heading { margin-bottom: 6px; }
.keypad { min-height: 0; display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; padding: 5px 25px max(10px, env(safe-area-inset-bottom)); }
.keypad button { min-height: 50px; border: 0; border-radius: 15px; background: rgba(255,253,250,.82); color: var(--ink); font-size: 22px; font-weight: 680; cursor: pointer; touch-action: manipulation; }
.keypad button:active { background: var(--accent-soft); }
.keypad .key-delete { color: var(--accent); font-size: 24px; }
.keypad .key-decimal { color: var(--muted); }
.form-section { padding: 15px 14px; border-top: 1px solid var(--line); }
.muted-section { background: rgba(238,233,222,.42); }
.form-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 3px 10px; }
.form-section-heading span { font-size: 13px; font-weight: 800; }
.form-section-heading small { color: var(--muted); font-size: 10px; }
.category-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; }
.category-choice { min-height: 59px; display: grid; place-items: center; align-content: center; gap: 3px; padding: 5px 2px; border: 1px solid transparent; border-radius: 13px; background: var(--surface); cursor: pointer; touch-action: manipulation; }
.category-choice .category-icon { width: 31px; height: 31px; border-radius: 10px; }
.category-choice span { max-width: 100%; overflow: hidden; color: var(--muted); font-size: 9px; font-weight: 720; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.category-choice.active { border-color: var(--category-color); background: color-mix(in srgb, var(--category-color) 7%, white); }
.category-choice.active span { color: var(--ink); }
.entry-picker { position: absolute; z-index: 12; inset: 0; overflow: hidden; border-radius: inherit; }
.entry-picker-backdrop { position: absolute; inset: 0; width: 100%; border: 0; border-radius: 0; background: rgba(45,39,29,.48); backdrop-filter: blur(4px); }
.entry-picker-card { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92%; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-bottom: 0; border-radius: 25px 25px 0 0; background: var(--bg); box-shadow: 0 -22px 55px rgba(42,34,22,.22); animation: picker-up .2s ease-out; }
.entry-picker-header { min-height: 59px; display: grid; grid-template-columns: minmax(0,1fr) 44px; align-items: center; gap: 10px; padding: 5px 14px 8px; }
.entry-picker-header h3, .merchant-picker-header h3 { margin: 2px 0 0; font-size: 20px; }
.category-picker-card { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.more-category-grid { padding: 4px 12px 10px; }
.more-category-grid .category-choice { min-height: 68px; }
.merchant-picker-header { min-height: 79px; display: grid; grid-template-columns: 50px minmax(0,1fr) 44px; align-items: center; gap: 10px; padding: 5px 14px 4px; }
.merchant-picker-card { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.picker-category-icon { width: 48px; height: 48px; display: grid; place-items: center; }
.picker-category-icon .category-icon { width: 46px; height: 46px; border-radius: 15px; }
.picker-amount { display: block; min-height: 31px; margin: 0 0 0 -8px; padding: 3px 8px; border: 0; border-radius: 9px; background: transparent; color: var(--accent); font-size: 15px; font-weight: 800; cursor: pointer; }
.picker-amount:active { background: var(--accent-soft); }
.picker-hint { margin: 0; padding: 0 14px 9px; color: var(--muted); font-size: 11px; }
.merchant-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; padding: 0 14px 10px; }
.merchant-grid .empty-state { grid-column: 1 / -1; margin: 0; padding-block: 14px; }
.merchant-choice { min-height: 53px; padding: 9px 11px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; touch-action: manipulation; }
.merchant-choice b { display: block; overflow: hidden; font-size: 12px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.merchant-choice.active { border-color: rgba(109,92,231,.4); background: var(--accent-soft); color: var(--accent); }
.merchant-actions { display: grid; grid-template-columns: 1.2fr .8fr; gap: 7px; padding: 0 14px 10px; }
.merchant-actions .secondary-button { min-width: 0; padding-inline: 8px; font-size: 11px; }
.merchant-manual { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; padding: 0 14px 10px; }
.merchant-manual .primary-button { min-width: 98px; padding-inline: 12px; }
.details-card { margin: 2px 14px 0; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.details-card summary { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; list-style: none; font-size: 12px; font-weight: 750; cursor: pointer; }
.details-card summary::-webkit-details-marker { display: none; }
.details-card summary svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; transition: transform .2s; }
.details-card[open] summary svg { transform: rotate(90deg); }
.details-content { display: grid; gap: 14px; padding: 3px 14px 15px; }
.details-content label { display: grid; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 700; }
.details-content textarea { min-height: 74px; resize: vertical; }
.details-content fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.details-content legend { margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 700; }
.choice-row { display: grid; grid-template-columns: repeat(auto-fit,minmax(88px,1fr)); gap: 7px; }
.choice-button { min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fbf9f4; color: var(--muted); font-size: 12px; font-weight: 750; cursor: pointer; }
.choice-button.active { border-color: rgba(109,92,231,.35); background: var(--accent-soft); color: var(--accent); }
.save-dock { position: sticky; bottom: 0; z-index: 4; display: grid; gap: 7px; margin-top: 10px; padding: 10px 14px max(14px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(246,242,233,.96); backdrop-filter: blur(18px); }
.save-dock span { min-height: 14px; color: var(--muted); font-size: 10px; text-align: center; }
.save-dock-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
.save-dock.editing .save-dock-actions { grid-template-columns: minmax(94px,.7fr) minmax(0,1.3fr); }
.save-dock-actions .primary-button, .save-dock-actions .secondary-button { min-width: 0; min-height: 48px; padding-inline: 10px; }
#delete-expense-inline { border-color: rgba(217,79,85,.25); background: rgba(217,79,85,.08); }

.profile-card { padding: 16px 18px max(18px, env(safe-area-inset-bottom)); text-align: center; }
.profile-avatar { width: 66px; height: 66px; display: grid; place-items: center; margin: 18px auto 8px; border-radius: 50%; background: var(--accent); color: white; font-size: 24px; font-weight: 800; }
.profile-card h2 { margin: 0; font-size: 24px; }
.profile-card > p { margin: 6px 0 16px; color: var(--muted); font-size: 12px; }
.profile-info { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 11px 15px; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); text-align: left; }
.profile-info span { color: var(--muted); font-size: 11px; }
.profile-info b { overflow: hidden; font-size: 11px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.profile-card .secondary-button { width: 100%; margin-top: 9px; }
.danger-text { color: var(--danger); }

.confirm-dialog { position: fixed; z-index: 120; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(45,39,29,.58); backdrop-filter: blur(6px); }
.confirm-dialog article { width: min(390px,100%); padding: 22px; border-radius: 22px; background: var(--surface); box-shadow: 0 25px 70px rgba(42,34,22,.25); }
.confirm-dialog h2 { margin: 0 0 8px; font-size: 20px; }
.confirm-dialog p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.confirm-dialog article > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }

.toast { position: fixed; z-index: 130; left: 50%; bottom: calc(82px + env(safe-area-inset-bottom)); width: min(420px, calc(100% - 24px)); min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 10px 15px; transform: translate(-50%, 16px); border-radius: 15px; background: rgba(40,37,31,.95); color: white; opacity: 0; pointer-events: none; transition: .22s; box-shadow: 0 15px 35px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translate(-50%,0); pointer-events: auto; }
.toast span { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.toast button { min-height: 34px; flex: 0 0 auto; padding: 6px 9px; border: 0; border-radius: 9px; background: rgba(255,255,255,.13); color: #c8bfff; font-size: 11px; font-weight: 800; cursor: pointer; }

@media (max-width: 390px) {
  .topbar { padding-inline: 12px; }
  .sync-pill b { display: none; }
  main { padding-inline: 9px; }
  .hero-card { padding: 18px; }
  .category-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .category-choice { min-height: 57px; }
  .more-category-grid .category-choice { min-height: 65px; }
  .keypad { padding-inline: 18px; }
}

@media (max-height: 620px) {
  .expense-sheet-card > .sheet-handle { height: 3px; margin-top: 5px; }
  .expense-sheet-card > .sheet-header { min-height: 56px; padding-block: 5px; }
  .amount-editor { min-height: 68px; padding-block: 4px 2px; }
  .amount-editor > small { display: none; }
  .amount-value output { font-size: clamp(37px, 11vw, 48px); }
  .amount-editor em { font-size: 9px; }
  .quick-category-section { padding-top: 1px; }
  .quick-category-section .form-section-heading { margin-bottom: 4px; }
  .category-choice { min-height: 50px; }
  .category-choice .category-icon { width: 27px; height: 27px; }
  .keypad { gap: 4px; padding-top: 3px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .keypad button { min-height: 44px; }
}

@media (min-width: 721px) {
  body { padding-block: 18px; }
  .app { min-height: calc(100dvh - 36px); border: 1px solid var(--line); border-radius: 28px; overflow: hidden; box-shadow: var(--shadow); }
  .bottom-nav { bottom: 18px; border: 1px solid var(--line); border-radius: 0 0 28px 28px; }
  .sheet-card { bottom: 18px; border-bottom: 1px solid var(--line); border-radius: 27px; }
  .expense-sheet-card { height: min(820px, calc(100dvh - 36px)); max-height: calc(100dvh - 36px); padding-top: 0; }
  .entry-picker-card { border-bottom: 1px solid var(--line); border-radius: 25px; }
}

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

@keyframes screen-in { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes disclosure-in { from { opacity: .4; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { opacity: .7; transform: translate(-50%, 35px); } to { opacity: 1; transform: translate(-50%,0); } }
@keyframes picker-up { from { opacity: .75; transform: translateY(30px); } to { opacity: 1; transform: none; } }
@keyframes sync-pulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }
