:root {
  color-scheme: dark;
  --bg: #08181f;
  --surface: #0c2028;
  --surface-raised: #0f2730;
  --surface-soft: #112b34;
  --text: #dce8e9;
  --muted: #96a9ae;
  --border: #203f4a;
  --accent: #3bb5a7;
  --accent-strong: #218f85;
  --income: #47b997;
  --expense: #f17465;
  --expense-surface: #382629;
  --focus: #68cfc3;
  --shadow: 0 18px 54px rgb(0 0 0 / 24%);
  --radius: 22px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f6f3;
  --surface: #fffdf8;
  --surface-raised: #ffffff;
  --surface-soft: #e8f1ed;
  --text: #0b2830;
  --muted: #556c71;
  --border: #cad8d8;
  --accent: #087f75;
  --accent-strong: #05675f;
  --income: #087f69;
  --expense: #bd4d48;
  --expense-surface: #f7e9e6;
  --focus: #0d766d;
  --shadow: 0 18px 54px rgb(19 54 62 / 9%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; max-width: 100%; overflow-x: clip; overscroll-behavior: none contain; background: var(--bg); }
body { width: 100%; max-width: 100%; margin: 0; min-height: 100vh; overflow-x: clip; overscroll-behavior: none contain; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a, input, select, textarea, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus), transparent 15%); outline-offset: 3px; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.app-shell { width: 100%; max-width: 100%; min-height: 100vh; overflow-x: clip; }
.side-nav { display: none; }
.main-area { min-width: 0; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(16px,4vw,40px); border-bottom: 1px solid var(--border); background: color-mix(in srgb,var(--bg) 90%,transparent); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(18px); }
.brand { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 800; letter-spacing: .17em; }
.brand svg { width: 28px; height: 28px; color: var(--accent); }
.brand--desktop { display: none; }
.topbar__controls { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.compact-control, .icon-control, .account-control { min-width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; }
.compact-control { padding: 0 12px; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.icon-control { display: grid; place-items: center; }
.icon-control svg { width: 20px; height: 20px; }
.account-control { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 11px; color: var(--accent); font-size: 13px; font-weight: 750; }
.account-control svg { width: 19px; height: 19px; }
.compact-control:hover, .icon-control:hover, .account-control:hover { border-color: var(--accent); background: var(--surface-raised); }

.content-frame { width: min(100%,1180px); max-width: 100%; min-width: 0; margin: 0 auto; padding: clamp(20px,4vw,48px) clamp(16px,4vw,40px) calc(96px + var(--safe-bottom)); }
.preview-badge { width: fit-content; margin: 0 0 12px auto; padding: 5px 9px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 12px; }
.data-status { position: fixed; z-index: 55; right: 16px; bottom: calc(88px + var(--safe-bottom)); width: min(calc(100% - 32px),440px); margin: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-raised); color: var(--muted); box-shadow: var(--shadow); font-size: 14px; line-height: 1.4; contain: layout paint; }
.data-status[data-tone="warning"] { border-color: color-mix(in srgb,#ffc56b 48%,var(--border)); color: var(--text); }
.data-status[data-tone="error"] { border-color: color-mix(in srgb,var(--expense) 50%,var(--border)); color: var(--text); }
.data-status[data-tone="success"] { border-color: color-mix(in srgb,var(--accent) 58%,var(--border)); color: var(--text); }
.money-dashboard { display: grid; gap: 18px; }
.money-column { display: grid; gap: 14px; min-width: 0; align-content: start; }
.raslin-cut { clip-path: polygon(0 0,100% 0,100% 100%,16px 100%,0 calc(100% - 16px)); }
.balance-card, .operations-card, .goal-invitation, .goal-card { border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.balance-card { padding: clamp(22px,5vw,34px); }
.card-kicker, .period-label, .picker-section-label { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.balance-value { width: 100%; min-height: 60px; display: flex; align-items: baseline; gap: 8px; margin: 6px 0 24px; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left; }
.balance-value:hover #currentAmount { color: var(--accent); }
#currentAmount { font-size: clamp(38px,9vw,58px); line-height: 1; font-weight: 780; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.balance-currency { color: var(--muted); font-size: 17px; font-weight: 700; }
.balance-card.is-loading .balance-value { pointer-events: none; }
.balance-card.is-loading .balance-value, .balance-card.is-loading .period-stats { visibility: hidden; }
.amount-skeleton { display: inline-block; color: transparent !important; border-radius: 999px; background: linear-gradient(100deg,var(--surface-soft) 25%,color-mix(in srgb,var(--accent) 15%,var(--surface-raised)) 45%,var(--surface-soft) 65%); background-size: 220% 100%; animation: amount-skeleton-pulse 1.45s ease-in-out infinite; }
#currentAmount.amount-skeleton--current { width: min(58%,190px); height: clamp(36px,8vw,50px); }
.period-stats strong.amount-skeleton--small { width: min(72%,92px); height: 20px; }
@keyframes amount-skeleton-pulse { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .amount-skeleton { animation: none; } }
.period-stats { display: grid; grid-template-columns: 1fr 1fr; margin-top: 9px; }
.period-stats > div { display: grid; gap: 3px; }
.period-stats > div + div { padding-left: 18px; border-left: 1px solid var(--border); }
.period-stats span { color: var(--muted); font-size: 13px; }
.period-stats strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.money-positive { color: var(--income); }
.money-negative { color: var(--expense); }
.money-actions { width: min(100%,460px); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-button { min-height: 48px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface); font-weight: 720; cursor: pointer; box-shadow: none; }
.action-button--add { color: var(--text); border-color: color-mix(in srgb,var(--accent) 52%,var(--border)); background: color-mix(in srgb,var(--accent) 12%,var(--surface)); }
.action-button--spend { color: var(--text); border-color: color-mix(in srgb,var(--expense) 40%,var(--border)); background: color-mix(in srgb,var(--expense) 7%,var(--surface)); }
.action-button--add > span:first-child { color: var(--accent); }
.action-button--spend > span:first-child { color: var(--expense); }
.action-button:hover { transform: translateY(-1px); border-color: currentColor; }
.action-button:active { transform: translateY(0); }

.goal-invitation { display: grid; grid-template-columns: auto 1fr; gap: 13px; align-items: center; padding: 18px; box-shadow: none; }
.goal-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; color: var(--accent); background: var(--surface-soft); }
.goal-mark svg { width: 26px; }
.goal-invitation h2 { margin: 0 0 3px; font-size: 16px; }
.goal-invitation p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.quiet-button { grid-column: 1 / -1; min-height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border: 1px solid var(--border); border-radius: 14px; background: transparent; color: var(--accent); font-weight: 700; cursor: pointer; }
.quiet-button:hover { background: var(--surface-soft); border-color: var(--accent); }
.goal-card { overflow: hidden; position: relative; box-shadow: none; }
.goal-card__layout { width: 100%; min-height: 184px; display: grid; grid-template-columns: minmax(0,1fr) minmax(148px,44%); gap: 12px 18px; align-items: stretch; padding: 8px; }
.goal-card__copy-button, .goal-card__visual-button { min-width: 0; border: 0; border-radius: 16px; background: transparent; text-align: left; cursor: pointer; }
.goal-card__copy-button { display: grid; align-items: center; padding: 10px 12px; }
.goal-card__visual-button { display: grid; place-items: center; padding: 2px; }
.goal-card__copy-button:hover, .goal-card__visual-button:hover { background: var(--surface-soft); }
.goal-card__copy { display: grid; align-content: center; gap: 4px; min-width: 0; }
.goal-card__copy strong { font-size: 21px; }
.goal-card__copy small { color: var(--muted); font-variant-numeric: tabular-nums; }
.goal-percent { color: var(--accent); font-size: 20px !important; font-variant-numeric: tabular-nums; }
.goal-visual-host { position: relative; display: grid; place-items: center; width: 100%; max-width: 276px; justify-self: end; }
.goal-card--without-visual .goal-card__layout { min-height: 126px; grid-template-columns: 1fr; }
.goal-card--without-visual .goal-visual-host { display: none; }
.goal-card--without-visual .goal-card__visual-button { display: none; }
.goal-visual-art { --goal-progress: 0; --goal-art-scale: 1; position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; isolation: isolate; pointer-events: none; }
.goal-visual-art__image { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; object-position: center; transform: scale(var(--goal-art-scale)); transform-origin: center; user-select: none; }
.goal-visual-art__image--base { opacity: .1; filter: grayscale(1) saturate(0) brightness(1.08) contrast(.7); }
.goal-visual-art__image--fill { clip-path: inset(var(--goal-reveal,100%) 0 0 0); transition: clip-path 520ms cubic-bezier(.22,1,.36,1); }
.goal-visual-art[data-reveal="horizontal"] .goal-visual-art__image--fill { clip-path: inset(0 var(--goal-reveal,100%) 0 0); }
.goal-visual-art[data-reveal="radial"] .goal-visual-art__image--fill { clip-path: circle(var(--goal-progress-pct,0%) at 50% 50%); }
:root:not([data-theme="light"]) .goal-visual-art__image--base { opacity: .11; filter: grayscale(1) saturate(0) brightness(1.28) contrast(.7); }
.goal-visual-art--piggy { contain: layout paint; }
.goal-piggy__layers { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transform: scale(var(--goal-art-scale)); transform-origin: center; }
.goal-piggy__coin { opacity: 0; transform-box: fill-box; transform-origin: center; transform: translateY(var(--piggy-coin-lift,7px)) rotate(var(--piggy-coin-rotation,0deg)); }
.goal-piggy__glint { opacity: 0; }
.goal-card--complete .goal-visual-art__image--base { opacity: 0; }
.goal-card--complete .goal-visual-art__image--fill { -webkit-mask-image: none; mask-image: none; filter: drop-shadow(0 10px 24px color-mix(in srgb,var(--accent) 24%,transparent)); }
.goal-card--complete.is-celebrating .goal-visual-art { animation: goal-complete-pop 760ms cubic-bezier(.16,1,.3,1); }
.goal-card--complete.is-celebrating { animation: goal-card-celebrate 900ms cubic-bezier(.16,1,.3,1); }
.goal-card--complete.is-celebrating .goal-visual-host::before { content: ''; position: absolute; inset: 8%; border-radius: 50%; background: radial-gradient(circle,color-mix(in srgb,var(--accent) 34%,transparent),transparent 68%); animation: goal-burst 820ms cubic-bezier(.16,1,.3,1); pointer-events: none; }
.goal-card--complete.is-celebrating .goal-visual-host::after { content: '✓'; position: absolute; right: 18px; top: 18px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #06231f; font-weight: 850; animation: goal-check-in 650ms cubic-bezier(.16,1,.3,1); }
.goal-new-button { width: calc(100% - 40px); min-height: 46px; margin: -6px 20px 18px; border: 1px solid var(--accent); border-radius: 13px; background: color-mix(in srgb,var(--accent) 13%,var(--surface)); color: var(--text); font-weight: 760; cursor: pointer; }
.goal-new-button:hover { background: color-mix(in srgb,var(--accent) 21%,var(--surface)); }
@keyframes goal-complete-pop { 0% { transform: scale(.96); filter: brightness(1); } 46% { transform: scale(1.045); filter: brightness(1.16); } 100% { transform: scale(1); filter: brightness(1); } }
@keyframes goal-check-in { from { transform: scale(.35); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes goal-card-celebrate { 0%,100% { border-color: var(--border); } 45% { border-color: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb,var(--accent) 13%,transparent); } }
@keyframes goal-burst { from { opacity: 0; transform: scale(.35); } 48% { opacity: 1; } to { opacity: 0; transform: scale(1.5); } }
.goal-visual-picker { min-width: 0; margin: 18px 0 0; padding: 0; border: 0; }
.goal-visual-picker legend { margin-bottom: 10px; color: var(--muted); font-size: 13px; font-weight: 650; }
.goal-visual-live { min-height: 164px; display: grid; grid-template-columns: minmax(132px,42%) 1fr; align-items: center; gap: 18px; margin-bottom: 12px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.goal-visual-live__image { width: min(100%,190px); justify-self: center; }
.goal-visual-live__copy { display: grid; gap: 4px; min-width: 0; }
.goal-visual-live__copy strong { overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.goal-visual-live__copy small { color: var(--accent); font-size: 22px; font-weight: 780; font-variant-numeric: tabular-nums; }
.goal-visual-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.goal-visual-grid[hidden] { display: none; }
.goal-visual-option { min-width: 0; padding: 7px 7px 9px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); cursor: pointer; }
.goal-visual-option:hover { border-color: color-mix(in srgb,var(--accent) 60%,var(--border)); background: var(--surface-soft); }
.goal-visual-option.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb,var(--accent) 18%,transparent); }
.goal-visual-option__preview { display: grid; place-items: center; width: min(100%,110px); aspect-ratio: 1 / 1; margin: 0 auto 4px; }
.goal-visual-thumbnail { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; transform: scale(var(--goal-art-scale,1)); transform-origin: center; }
.goal-visual-option__preview--none { color: var(--muted); font-size: 30px; }
.goal-visual-option__label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 680; text-align: center; }
.goal-visual-more { margin: 5px 0; }
.goal-field { margin-top: 14px; }
.goal-form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.goal-form-actions button { padding-inline: 14px; }

.operations-card { min-width: 0; padding: clamp(20px,4vw,30px); }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.card-heading h2 { margin: 3px 0 0; font-size: clamp(20px,3vw,25px); }
.text-button { min-height: 44px; padding: 0 4px; border: 0; background: transparent; color: var(--accent); font-weight: 700; cursor: pointer; }
.operation-list { display: grid; }
.operation-row { width: 100%; min-height: 66px; display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; cursor: pointer; }
.operation-row:hover { background: color-mix(in srgb,var(--surface-soft) 65%,transparent); }
.operation-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; background: var(--surface-soft); color: var(--accent); font-size: 20px; }
.operation-icon svg { width: 20px; height: 20px; }
.operation-copy { display: grid; min-width: 0; }
.operation-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operation-copy small { color: var(--muted); }
.operation-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty-state { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 7px; text-align: center; color: var(--muted); }
.empty-state[hidden] { display: none; }
.empty-state svg { width: 44px; height: 44px; margin-bottom: 5px; color: var(--accent); }
.empty-state h3 { margin: 0; color: var(--text); }
.empty-state p { margin: 0; font-size: 14px; }

.app-view[hidden] { display: none !important; }
.page-view { display: grid; align-content: start; gap: 18px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.page-heading h1 { margin: 4px 0 0; font-size: clamp(30px,5vw,44px); letter-spacing: -.035em; }
.page-action { min-height: 46px; padding: 0 17px; border: 1px solid var(--accent); border-radius: 13px; background: var(--accent); color: #06110e; font-weight: 760; cursor: pointer; }
.segmented-control { width: fit-content; display: grid; grid-auto-flow: column; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.segmented-control button { min-height: 38px; padding: 0 16px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.segmented-control button.is-active { background: var(--surface-soft); color: var(--accent); }
.segmented-control--dialog { width: 100%; grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
.filter-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(150px,220px); gap: 10px; }
.search-field--page { margin: 0; background: var(--surface); }
.filter-select { min-height: 50px; padding: 0 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); }
.grouped-operation-list, .history-list { padding: clamp(16px,3vw,24px); border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.operation-date-heading { margin: 20px 0 5px; color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .055em; }
.operation-date-heading:first-child { margin-top: 0; }
.history-list { display: grid; }
.history-row { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.history-row:last-child { border-bottom: 0; }
.history-row > div { display: grid; gap: 4px; }
.history-row small { color: var(--muted); }
.empty-state--page { min-height: 220px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.settings-grid { display: grid; gap: 16px; }
.settings-card { border: 1px solid var(--border); border-radius: 18px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.settings-card h2 { margin: 0; padding: 18px 18px 10px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .055em; }
.settings-row { width: 100%; min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 18px; border: 0; border-top: 1px solid var(--border); background: transparent; text-align: left; cursor: pointer; }
.settings-row:hover { background: var(--surface-soft); }
.settings-row strong { max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.settings-row--static { cursor: default; }
.settings-row--static:hover { background: transparent; }
.settings-hint { margin: 0; padding: 12px 18px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; line-height: 1.5; }

.mobile-nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; min-height: calc(72px + var(--safe-bottom)); padding: 8px 8px var(--safe-bottom); display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border-top: 1px solid var(--border); background: color-mix(in srgb,var(--surface) 95%,transparent); backdrop-filter: blur(18px); }
.mobile-nav__item { min-height: 54px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 3px; font-size: 11px; cursor: pointer; }
.mobile-nav__item svg { width: 21px; height: 21px; }
.mobile-nav__item.is-active { color: var(--accent); background: var(--surface-soft); }

.picker-dialog { width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; margin: 0; padding: 0; overflow: hidden; border: 0; background: transparent; color: var(--text); }
.picker-dialog::backdrop { background: rgb(0 0 0 / 52%); }
#moneyDialog::backdrop, #balanceDialog::backdrop, #goalDialog::backdrop { background: rgb(0 0 0 / 38%); }
.picker-panel { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; max-width: 100%; max-height: min(88vh,760px); max-height: min(88dvh,760px); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 22px 18px calc(22px + var(--safe-bottom)); border: 1px solid var(--border); border-radius: 24px 24px 0 0; background: var(--surface-raised); box-shadow: var(--shadow); }
.picker-heading { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 18px; }
.picker-heading h2 { margin: 3px 0 0; font-size: 24px; }
.dialog-close { width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); font-size: 26px; line-height: 1; cursor: pointer; }
.search-field { min-height: 50px; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 0 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.search-field:focus-within { border-color: var(--focus); }
.search-field svg { width: 20px; height: 20px; color: var(--muted); }
.search-field input { width: 100%; min-width: 0; height: 48px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; }
.picker-list { display: grid; gap: 7px; }
.picker-option { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 14px; border: 1px solid transparent; border-radius: 14px; background: transparent; text-align: left; cursor: pointer; }
.picker-option:hover, .picker-option.is-selected { border-color: var(--border); background: var(--surface); }
.picker-option > span:first-child { display: grid; gap: 1px; }
.picker-option small { color: var(--muted); }
.picker-check { opacity: 0; color: var(--accent); font-size: 19px; }
.picker-option.is-selected .picker-check { opacity: 1; }
.picker-section-label { margin: 18px 0 8px; }
.currency-chips { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.currency-chip { min-height: 46px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); font-weight: 760; cursor: pointer; }
.currency-chip.is-selected { border-color: var(--accent); color: var(--accent); background: var(--surface-soft); }
.show-all-button { width: 100%; min-height: 46px; margin: 10px 0; border: 0; background: transparent; color: var(--accent); font-weight: 700; cursor: pointer; }
.picker-panel--confirm { max-height: none; }
.confirm-copy { margin: 0; color: var(--text); line-height: 1.55; }
.warning-box { margin-top: 14px; padding: 13px 14px; border-left: 3px solid var(--expense); background: var(--expense-surface); color: var(--text); font-size: 14px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.secondary-button, .primary-button { min-height: 48px; border-radius: 14px; font-weight: 730; cursor: pointer; }
.secondary-button { border: 1px solid var(--border); background: transparent; }
.primary-button { border: 0; color: #06110e; background: var(--accent); }
.picker-panel--auth { max-height: none; }
.auth-copy { margin: 0 0 18px; color: var(--muted); line-height: 1.55; }
.auth-field { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 650; }
.auth-field input { width: 100%; min-height: 50px; padding: 0 14px; border: 1px solid var(--border); border-radius: 14px; outline: 0; background: var(--surface); color: var(--text); font-size: 16px; }
.auth-field input:focus { border-color: var(--focus); }
.auth-field textarea { width: 100%; min-height: 88px; resize: vertical; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; outline: 0; background: var(--surface); color: var(--text); font-size: 16px; line-height: 1.45; }
.auth-field textarea:focus { border-color: var(--focus); }
.auth-field select { width: 100%; min-height: 50px; padding: 0 14px; border: 1px solid var(--border); border-radius: 14px; outline: 0; background: var(--surface); color: var(--text); font: inherit; }
.auth-field select:focus { border-color: var(--focus); }
.currency-field-button { width: 100%; min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.currency-field-button[aria-expanded="true"] { border-color: var(--focus); }
.inline-currency-picker { margin-top: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.inline-currency-picker__search { margin-bottom: 8px; }
.inline-currency-picker__list { max-height: 218px; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 3px; }
.inline-currency-option { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.inline-currency-option:hover, .inline-currency-option.is-selected { background: var(--surface-soft); color: var(--accent); }
.operation-currency-target { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 0 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--muted); }
.operation-currency-target strong { color: var(--accent); font-size: 18px; }
.auth-submit { width: 100%; margin-top: 14px; padding-inline: 16px; }
.auth-submit:disabled { cursor: wait; opacity: .62; }
.auth-pending-email { margin: -8px 0 14px; color: var(--text); font-weight: 720; overflow-wrap: anywhere; }
.auth-code-input { text-align: center; font-size: 24px !important; font-weight: 780; letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.auth-text-button { width: 100%; min-height: 44px; margin-top: 7px; border: 0; background: transparent; color: var(--accent); font-weight: 700; cursor: pointer; }
.signed-in-email { min-height: 50px; display: flex; align-items: center; padding: 0 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow-wrap: anywhere; }
.auth-message { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.auth-message[data-tone="error"] { border-color: color-mix(in srgb,var(--expense) 50%,var(--border)); color: var(--text); }
.money-currency-field { margin-top: 14px; }
.money-impact { margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.operation-details { margin-top: 14px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb,var(--surface) 72%,transparent); }
.operation-details summary { min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; color: var(--accent); font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; }
.operation-details summary::-webkit-details-marker { display: none; }
.operation-details summary::after { content: '+'; font-size: 20px; font-weight: 500; }
.operation-details[open] summary::after { content: '−'; }
.operation-details__body { display: grid; gap: 14px; padding: 4px 14px 16px; }
.category-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.category-button { min-height: 44px; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 9px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); color: var(--muted); text-align: left; cursor: pointer; }
.category-button > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-button:hover, .category-button.is-selected { border-color: var(--accent); background: var(--surface-soft); color: var(--text); }
.category-button__icon { flex: 0 0 auto; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 9px; background: color-mix(in srgb,var(--accent) 12%,transparent); color: var(--accent); font-size: 12px; font-weight: 800; }
.money-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.money-form-actions .primary-button { min-width: 140px; padding-inline: 18px; }
.goal-visual-grid--dialog { grid-template-columns: repeat(3,minmax(0,1fr)); }
.danger-button { min-height: 48px; padding: 0 16px; border: 1px solid color-mix(in srgb,var(--expense) 55%,var(--border)); border-radius: 14px; background: color-mix(in srgb,var(--expense) 8%,var(--surface)); color: var(--expense); font-weight: 730; cursor: pointer; }

@media (min-width: 700px) {
  .picker-dialog::backdrop { backdrop-filter: blur(4px); }
  #moneyDialog::backdrop, #balanceDialog::backdrop, #goalDialog::backdrop { backdrop-filter: blur(1px); }
  .content-frame { padding-bottom: calc(96px + var(--safe-bottom)); }
  .money-dashboard { grid-template-columns: minmax(300px, .82fr) minmax(360px, 1.18fr); align-items: start; gap: clamp(18px,3vw,30px); }
  .goal-invitation { padding: 20px; }
  .picker-dialog { display: none; place-items: center; padding: 24px; }
  .picker-dialog[open] { display: grid; }
  .picker-panel { position: static; width: min(100%,520px); max-height: min(78vh,720px); border-radius: 24px; padding: 26px; }
  .picker-panel--money { width: min(100%,620px); }
  .picker-panel--confirm, .picker-panel--auth { width: min(100%,500px); }
  .picker-panel--balance { width: min(100%,480px); }
  .picker-panel--visuals { width: min(100%,680px); }
  .picker-heading--drag { cursor: grab; touch-action: none; user-select: none; }
  .picker-panel.is-dragging .picker-heading--drag { cursor: grabbing; }
  .category-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .settings-grid { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
}

@media (max-width: 699px) {
  .topbar { min-height: calc(62px + var(--safe-top)); padding: calc(9px + var(--safe-top)) 8px 9px; gap: 6px; }
  .brand { flex: 0 0 auto; min-width: 0; gap: 0; }
  .brand svg { width: 25px; height: 25px; }
  .brand--mobile > span { display: none; }
  .topbar__controls { gap: 4px; }
  .account-control { width: 42px; min-width: 42px; height: 42px; padding: 0; }
  .account-control #accountLabel { display: none; }
  .compact-control, .icon-control { min-width: 42px; height: 42px; }
  .compact-control { padding-inline: 8px; }
  .content-frame { padding-inline: 12px; }
  .picker-panel { padding-inline: 16px; border-inline: 0; }
  .picker-heading { position: sticky; top: -22px; z-index: 3; margin: -6px -2px 16px; padding: 6px 2px 8px; background: var(--surface-raised); }
  .picker-heading h2 { font-size: clamp(22px,7vw,28px); }
  .money-form-actions, .goal-form-actions { position: sticky; bottom: calc(-22px - var(--safe-bottom)); z-index: 3; margin: 18px -2px calc(-22px - var(--safe-bottom)); padding: 12px 2px calc(18px + var(--safe-bottom)); background: linear-gradient(to top,var(--surface-raised) 82%,transparent); }
  .money-form-actions .primary-button { flex: 1; }
}

@media (max-width: 560px) {
  .page-heading { align-items: start; }
  .page-action span:last-child { display: none; }
  .filter-row { grid-template-columns: 1fr; }
  .segmented-control { width: 100%; grid-auto-columns: 1fr; }
  .operation-row { grid-template-columns: 36px minmax(0,1fr) auto; gap: 9px; }
  .operation-amount { font-size: 13px; }
  .goal-card__layout { min-height: 164px; grid-template-columns: minmax(0,1fr) minmax(118px,40%); padding: 7px; gap: 4px; }
  .goal-card__copy-button { padding: 9px; }
  .goal-card__copy strong { font-size: 18px; }
  .goal-visual-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
  .goal-visual-option { padding-inline: 4px; }
  .goal-visual-live { min-height: 136px; grid-template-columns: minmax(108px,42%) 1fr; padding: 10px 12px; gap: 12px; }
  .goal-visual-grid--dialog { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (min-width: 1040px) {
  .mobile-nav { display: none; }
  .app-shell { display: grid; grid-template-columns: 224px minmax(0,1fr); }
  .side-nav { position: sticky; top: 0; min-height: 100vh; height: 100vh; display: flex; flex-direction: column; padding: 26px 18px; border-right: 1px solid var(--border); background: var(--surface); }
  .brand--desktop { display: inline-flex; padding: 0 10px 28px; }
  .brand--mobile { display: none; }
  .side-nav__items { display: grid; gap: 6px; }
  .nav-item { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); cursor: pointer; text-align: left; }
  .nav-item svg { width: 21px; height: 21px; }
  .nav-item:hover, .nav-item.is-active { color: var(--accent); background: var(--surface-soft); }
  .side-nav__settings { margin-top: auto; }
  .topbar { justify-content: flex-end; padding-inline: 40px; }
  .content-frame { padding-top: 52px; padding-bottom: 48px; }
  .money-actions { width: 100%; max-width: 460px; }
  .data-status { bottom: 20px; }
  .goal-card__layout { min-height: 210px; grid-template-columns: minmax(0,1fr) minmax(178px,46%); }
  .goal-visual-host { max-width: 310px; }
}

@media (prefers-reduced-motion: no-preference) {
  .picker-dialog[open] .picker-panel { animation: sheet-enter 220ms cubic-bezier(.22,1,.36,1); }
  .goal-visual-art { animation: visual-enter 240ms cubic-bezier(.22,1,.36,1); }
  .goal-visual-art--piggy[data-ready="true"] .goal-piggy__coin { transition: opacity 360ms cubic-bezier(.22,1,.36,1), transform 360ms cubic-bezier(.22,1,.36,1); }
  .goal-visual-art--piggy[data-ready="true"] .goal-piggy__glint { transition: opacity 260ms ease; }
  .action-button, .compact-control, .icon-control, .account-control, .picker-option, .operation-row, .settings-row, .mobile-nav__item, .goal-card__copy-button, .goal-card__visual-button, .currency-field-button, .inline-currency-option { transition: transform 90ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease; }
  .action-button:active, .compact-control:active, .icon-control:active, .account-control:active, .picker-option:active, .operation-row:active, .settings-row:active, .mobile-nav__item:active, .goal-card__copy-button:active, .goal-card__visual-button:active, .currency-field-button:active, .inline-currency-option:active { transform: scale(.975); }
  @keyframes sheet-enter { from { transform: translate3d(0,18px,0); opacity: .72; } to { transform: translate3d(0,0,0); opacity: 1; } }
  @keyframes visual-enter { from { transform: scale(.965); opacity: .45; } to { transform: scale(1); opacity: 1; } }
}

@media (prefers-reduced-motion: no-preference) and (min-width: 700px) {
  .picker-dialog[open] .picker-panel { animation-name: dialog-enter; }
  @keyframes dialog-enter { from { transform: translate3d(0,8px,0) scale(.985); opacity: .7; } to { transform: translate3d(0,0,0) scale(1); opacity: 1; } }
}

@media (prefers-reduced-motion: reduce) {
  .goal-visual-art__image--fill { transition: none !important; }
  .goal-piggy__coin, .goal-piggy__glint { transition: none !important; }
  .goal-card--complete.is-celebrating,
  .goal-card--complete.is-celebrating .goal-visual-art,
  .goal-card--complete.is-celebrating .goal-visual-host::before,
  .goal-card--complete.is-celebrating .goal-visual-host::after { animation: none !important; }
}
