:root {
  color-scheme: light;
  --bg: #f8f6f0;
  --paper: #fffdf8;
  --line: #e7e4d8;
  --ink: #223f31;
  --muted: #56665c;
  --green: #24513c;
  --focus: #6b8242;
  --mint: #e6eee0;
  --peach: #f7e9d8;
  --lilac: #eee8f5;
  --blue: #e7eef4;
  --pink: #f7e7e6;
  --sand: #f5eedb;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-synthesis: none;
  background: var(--bg);
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: wait; opacity: .58; }
button, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1, h2, p { margin: 0; }
svg { width: 20px; height: 20px; flex: none; vertical-align: middle; }
small { color: var(--muted); line-height: 1.4; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.layout { display: block; min-height: 100dvh; }
main { width: 100%; max-width: 1160px; min-width: 0; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(94px, calc(80px + env(safe-area-inset-bottom))) max(14px, env(safe-area-inset-left)); }
.sidebar, .button.desktop-add { display: none; }
.mobile-brand { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 9px; line-height: 1.22; text-align: left; min-width: 0; }
.brand img { flex: none; border-radius: 12px; object-fit: cover; width: 39px; height: 39px; }
.brand strong { display: block; font-size: 1rem; letter-spacing: -.025em; }
.brand small { display: block; font-size: .79rem; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 15px; }
.page-header > div { min-width: 0; }
h1 { font-size: clamp(2.07rem, 8.5vw, 2.85rem); line-height: 1.08; letter-spacing: -.06em; overflow-wrap: anywhere; }
.eyebrow { color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 5px; font-size: .88rem; }
.eyebrow svg { width: 15px; height: 15px; }
.eyebrow span { padding: 2px 7px; border-radius: 30px; background: #eee9dc; margin-inline-start: 2px; font-size: .75rem; }
.avatar {
  display: inline-grid; flex: none; place-items: center; width: 38px; height: 38px; overflow: hidden;
  border-radius: 50%; background: #e6e9d7; color: #3a533c; font-weight: 750;
}
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.avatar-button { border: 0; border-radius: 50%; background: transparent; padding: 3px; display: grid; min-height: 44px; }
.icon-button { display: inline-grid; place-items: center; padding: 0; flex: none; width: 42px; height: 42px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--mint); }
.button {
  display: inline-flex; gap: 6px; justify-content: center; align-items: center; min-width: 0; min-height: 44px;
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 11px; background: var(--paper);
  font-size: .9rem; font-weight: 670; line-height: 1.17; text-align: center; overflow-wrap: anywhere;
}
.button svg { width: 17px; height: 17px; }
.button:hover { background: #edece0; }
.button.primary { color: #fffcf2; background: var(--green); border-color: var(--green); }
.button.primary:hover { background: #1c4330; }
.button.selected { background: #e2ebdb; border-color: #bdcdb6; color: #284b35; }
.text-button { border: 0; border-radius: 6px; background: transparent; font-weight: 680; color: #38664b; min-height: 42px; padding: 4px; font-size: .84rem; text-align: end; line-height: 1.2; }
.text-button:hover { text-decoration: underline; }
.hero {
  position: relative; overflow: hidden; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) clamp(73px, 26vw, 135px);
  align-items: center; gap: 6px; min-height: 195px; border-radius: 22px; padding: 15px 11px 15px 15px;
  background: radial-gradient(ellipse at 86% 60%, hsl(var(--hero-hue) 31% 34%) 0, transparent 70%),
    linear-gradient(118deg, hsl(var(--hero-hue) 41% 20%), hsl(var(--hero-hue) 37% 25%));
  color: #fffaf0;
}
.hero-copy { min-width: 0; position: relative; z-index: 1; }
.hero-label { display: flex; gap: 5px; align-items: center; color: #e6eddf; font-size: .87rem; line-height: 1.2; font-weight: 650; margin-bottom: 5px; }
.hero-label svg { width: 15px; height: 15px; color: #f0d091; }
.hero-copy > .balance-amount { display: block; font-size: clamp(1.75rem, 8.15vw, 3.1rem); line-height: 1.08; margin-bottom: 10px; letter-spacing: -.06em; overflow-wrap: anywhere; }
.hero-forecast { border-top: 1px solid #fff9d64d; padding-top: 8px; display: grid; gap: 2px; }
.hero-forecast span, .hero-percent { font-size: .81rem; color: #f0eee3; line-height: 1.28; }
.hero-forecast .balance-amount { font-size: clamp(1.1rem, 5vw, 1.4rem); line-height: 1.12; overflow-wrap: anywhere; }
.hero-percent { margin-top: 7px; }
.hero-art { position: relative; align-self: stretch; min-width: 0; display: grid; place-items: center; }
.hero-pig { position: relative; width: 100%; max-width: 235px; height: auto; object-fit: contain; z-index: 1; animation: breathe var(--pulse, 4s) ease-in-out infinite; }
.orbit, .orbit::before, .orbit::after { position: absolute; border: 1px solid #fff9d244; border-radius: 50%; }
.orbit { width: 107%; aspect-ratio: 1; animation: ripple var(--pulse, 4s) ease-in-out infinite; }
.orbit::before, .orbit::after { content: ''; inset: 9%; }
.orbit::after { inset: -10%; opacity: .6; }
@keyframes breathe { 0%, 100% { transform: translateY(3%) scale(.96) rotate(-4deg); } 50% { transform: translateY(-2%) scale(1.04) rotate(1deg); } }
@keyframes ripple { 0%, 100% { opacity: .57; transform: scale(.88); } 50% { opacity: 1; transform: scale(1.09); } }
.home-top { position: relative; isolation: isolate; display: flow-root; }
.home-top .page-header { position: relative; z-index: 2; }
.home-top .page-header h1 { text-shadow: 0 1px 3px #f8f6f0, 0 0 8px #f8f6f0bc; }
.hero-coins { position: absolute; z-index: 1; top: -19px; inset-inline-start: clamp(94px,30%,170px);
  width: clamp(164px,54vw,315px); height: 96px; max-width: 67%; pointer-events: none; }
.context-help { margin: 6px 0 10px; color: var(--muted); font-size: .83rem; }
.context-help summary { width: fit-content; color: var(--green); font-weight: 650; cursor: pointer; padding: 3px 0; }
.context-help p { max-width: 640px; margin: 5px 0 2px; line-height: 1.48; }
.balance-amount, .row-amount, .goal-card strong, .preview strong, .staged-card strong { font-variant-numeric: tabular-nums; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin: 10px 0 13px; }
.metric, .panel, .onboarding { border: 1px solid var(--line); background: var(--paper); box-shadow: 0 2px 6px #34261807; }
.metric { border-radius: 14px; padding: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.metric > div { min-width: 0; }
.metric p { color: var(--muted); font-size: .87rem; line-height: 1.24; margin-bottom: 3px; }
.metric .balance-amount { display: block; font-size: clamp(1.04rem, 4.65vw, 1.5rem); letter-spacing: -.04em; font-weight: 750; line-height: 1.15; overflow-wrap: anywhere; }
.metric small { display: block; margin-top: 3px; font-size: .79rem; }
.metric > .badge { width: 30px; height: 30px; border-radius: 8px; }
.metric > .badge svg { width: 16px; height: 16px; }
.badge { display: inline-grid; place-items: center; flex: none; width: 35px; height: 35px; border-radius: 10px; }
.badge svg { width: 18px; height: 18px; }
.mint { background: var(--mint); color: #3b644d; }
.peach { background: var(--peach); color: #834a22; }
.lilac { background: var(--lilac); color: #705885; }
.blue { background: var(--blue); color: #41647c; }
.pink { background: var(--pink); color: #8d4a50; }
.sand { background: var(--sand); color: #7a6326; }
.columns { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; align-items: start; }
.columns.secondary, .plan-columns { margin-top: 12px; }
.panel { padding: 11px 12px; border-radius: 16px; min-width: 0; }
.panel + .columns, .metrics + .panel { margin-bottom: 12px; }
.panel-head { display: flex; flex-wrap: wrap; gap: 2px 7px; justify-content: space-between; align-items: center; margin-bottom: 6px; min-height: 34px; }
.panel h2 { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 1.08rem; letter-spacing: -.027em; line-height: 1.22; overflow-wrap: anywhere; }
.panel h2 svg { color: #567d60; width: 18px; height: 18px; }
.rows { display: grid; }
.data-row { display: flex; width: 100%; align-items: center; gap: 8px; padding: 9px 0; min-height: 55px; border: 0; border-bottom: 1px solid #eeece4; background: transparent; text-align: start; }
.data-row:last-child { border-bottom-color: transparent; }
.row-button:hover, .limit-row:hover { background: #f8f7ef; }
.row-button > svg { width: 13px; height: 13px; color: var(--muted); }
.row-text { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.row-text strong { font-size: .92rem; display: block; line-height: 1.24; }
.row-text small { font-size: .78rem; display: block; margin-top: 3px; }
.row-amount { flex: 0 1 auto; max-width: 43%; font-size: .89rem; text-align: end; overflow-wrap: anywhere; }
.positive { color: #397c4d; }
.row-author { display: flex; width: fit-content; max-width: 100%; align-items: center; gap: 4px; color: var(--muted); font-size: .76rem; margin-top: 4px; overflow-wrap: anywhere; }
.row-author .avatar { width: 18px; height: 18px; font-size: .64rem; }
.empty { padding: 8px 0; color: var(--muted); line-height: 1.4; }
.goals-preview, .goals-full, .people-grid { display: grid; gap: 7px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.goal-card, .credit-card, .person-card { text-align: start; border: 1px solid #27473112; border-radius: 13px; padding: 10px; min-width: 0; overflow-wrap: anywhere; }
.goal-card:hover, .credit-card:hover, .person-card:hover { filter: brightness(.98); }
.goal-card .badge, .credit-card .badge { background: #ffffff9e; width: 30px; height: 30px; margin-bottom: 6px; border-radius: 8px; }
.goal-card .badge svg, .credit-card .badge svg { width: 16px; height: 16px; }
.goal-card strong, .credit-card strong { display: block; line-height: 1.1; font-size: clamp(1.04rem, 4.8vw, 1.35rem); }
.goal-name { display: block; min-height: 2.6em; font-size: .86rem; font-weight: 720; line-height: 1.23; overflow-wrap: anywhere; }
.goal-target, .credit-card small { display: block; font-size: .79rem; margin-top: 3px; }
.credit-card { background: var(--lilac); color: #4a3e62; }
.credit-card:only-child { grid-column: 1 / -1; }
.progress { display: block; background: #45684f22; height: 6px; border-radius: 30px; overflow: hidden; margin-top: 7px; }
.progress i { display: block; height: 100%; border-radius: inherit; background: #588363; transform-origin: left; animation: grow .39s ease-out both; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.peach .progress, .peach.progress { background: #b0764130; }
.peach .progress i { background: #ad7137; }
.lilac .progress i { background: #8a75a0; }
.pink .progress i, .progress.over i { background: #ae574b; }
.goal-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 4px; margin-top: 5px; font-size: .75rem; font-weight: 700; }
.person-card { color: var(--ink); background: #f5f6ed; }
.person-card > span:first-child { display: flex; gap: 6px; align-items: center; min-width: 0; margin-bottom: 7px; }
.person-card .avatar { width: 27px; height: 27px; }
.person-totals, .person-totals > span { display: grid; gap: 1px; }
.person-totals { gap: 4px; color: var(--muted); font-size: .78rem; }
.person-totals b { color: var(--ink); font-size: .88rem; }
.limit-row { display: flex; gap: 8px; align-items: center; padding: 7px 2px; min-height: 48px; width: 100%; background: transparent; border: 0; text-align: start; border-radius: 6px; }
.limit-row > div { flex: 1; min-width: 0; }
.limit-title { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 3px 6px; font-size: .89rem; line-height: 1.2; overflow-wrap: anywhere; }
.limit-title small, .limit-left { font-size: .78rem; }
.limit-left { display: block; margin-top: 3px; }
.onboarding { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px; border-radius: 13px; margin-bottom: 12px; }
.onboarding div { flex: 1; min-width: 125px; }
.onboarding p { color: var(--muted); font-size: .87rem; line-height: 1.35; }
.trend { width: 100%; text-align: start; }
.trend:hover { background: #f2f3e8; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; margin-bottom: 12px; }
.settings-footer { margin-top: 12px; }
.section-banner { display: grid; grid-template-columns: minmax(0,1fr) clamp(75px, 28vw, 150px); align-items: center; gap: 6px; min-height: 136px; padding: 12px; margin-bottom: 12px; border-radius: 17px; }
.section-banner strong { display: block; font-size: clamp(1.05rem, 5.9vw, 1.65rem); line-height: 1.15; margin-bottom: 9px; overflow-wrap: anywhere; }
.section-banner img { width: 100%; max-height: 145px; object-fit: contain; }
.savings-banner { background: var(--peach); }
.credit-banner { background: var(--lilac); }
.section-banner p { font-size: .89rem; margin-bottom: 2px; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 9px; }
.chips .button { border-radius: 40px; }
.history-tabs.segmented { grid-template-columns: repeat(4,minmax(0,1fr)); }
.history-tabs.segmented button { font-size: clamp(.74rem, 3.2vw, .94rem); }
.history-entries { margin-top: 12px; }
.history-authors .panel { display: grid; grid-template-columns: minmax(88px,29%) minmax(0,1fr); align-items: center; gap: 0 8px; }
.history-authors .panel-head { grid-column: 1 / -1; }
.history-authors .donut { width: min(100%,108px); margin-block: 4px; }
.history-authors .donut strong { font-size: .79rem; }
.history-authors .donut small { font-size: .68rem; }
.trend-section { min-width: 0; margin: 12px 0; }
.trend-section h2 { font-size: 1.14rem; letter-spacing: -.025em; }
.trend-section > .panel-head { margin: 0; }
.trend-intro { font-size: .88rem; line-height: 1.4; color: var(--muted); max-width: 580px; margin: 5px 0 12px; }
.trend-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%, 240px),1fr)); gap: 10px; }
.trend-card { min-width: 0; padding: 12px 14px; border: 1px solid #27362314; border-radius: 17px; }
.trend-card header { display: flex; align-items: center; gap: 8px; }
.trend-card header .badge { background: #fffdf89e; width: 32px; height: 32px; }
.trend-card h3 { margin: 0; font-size: .95rem; line-height: 1.2; overflow-wrap: anywhere; }
.trend-metric { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  gap: 6px 10px; color: var(--ink); margin: 9px 0; }
.trend-metric strong { font-size: clamp(1.37rem,4.9vw,1.75rem); line-height: 1.08; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.trend-metric small { display: block; margin-top: 2px; color: inherit; }
.trend-metric span { background: #fffdf89e; border-radius: 16px; padding: 4px 8px; font-size: .78rem; font-weight: 650; }
.trend-insight { margin: 0 0 10px; color: var(--ink); font-size: .88rem; line-height: 1.4; overflow-wrap: anywhere; }
.trend-comparison { display: grid; gap: 4px; margin: 0; padding-top: 7px; border-top: 1px solid #27362322;
  color: var(--ink); font-size: .8rem; }
.trend-comparison div { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: 3px 8px; }
.trend-comparison dd { margin: 0; font-weight: 650; }
.entry-details { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 6px 12px; }
.entry-details dt { color: var(--muted); }
.entry-details dd { margin: 0; overflow-wrap: anywhere; }
.button.danger { color: #a13c3e; }
.donut { position: relative; display: grid; place-items: center; width: min(100%, 188px); aspect-ratio: 1; margin: 4px auto 10px; }
.donut-ring { position: absolute; inset: 0; border-radius: 50%; background: var(--slices);
  -webkit-mask: radial-gradient(circle closest-side, #0000 72%, #000 73% 99%, #0000 100%);
  mask: radial-gradient(circle closest-side, #0000 72%, #000 73% 99%, #0000 100%);
}
.donut > div + div { text-align: center; min-width: 0; max-width: 68%; overflow-wrap: anywhere; }
.donut strong { display: block; font-size: 1.17rem; margin-top: 2px; }
.legend { display: grid; gap: 2px; }
.legend-row { display: grid; grid-template-columns: 10px minmax(0,1fr) minmax(auto,max-content); align-items: center; gap: 6px; padding: 7px 5px; min-height: 43px; border: 0; border-radius: 8px; background: transparent; text-align: start; font-size: .89rem; }
.legend-row > span, .legend-row > strong { min-width: 0; overflow-wrap: anywhere; }
.legend-row > strong { text-align: end; }
.legend-row:hover, .legend-row[aria-pressed="true"] { background: #e8eee1; }
.legend-row i { width: 9px; height: 9px; border-radius: 50%; background: var(--swatch); }
.legend-row.minor { padding-inline-start: 17px; }
.other-row { grid-template-columns: 10px minmax(0,1fr) max-content 13px; }
.other-row svg { width: 13px; height: 13px; }
.month-selector { display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; gap: 4px; align-items: center; text-align: center; min-width: 0; }
.month-selector .icon-button { justify-self: center; }
.month-previous svg { transform: rotate(180deg); }
.calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 3px; max-width: 580px; margin: 0 auto 8px; }
.weekday { text-align: center; color: var(--muted); font-size: .79rem; padding: 4px 0; }
.calendar-day { border: 1px solid transparent; background: #f6f4eb; border-radius: 8px; padding: 3px 0; min-height: 38px; min-width: 0; display: grid; justify-items: center; align-content: center; gap: 3px; font-weight: 630; font-size: .86rem; }
.calendar-day:hover, .calendar-day[aria-pressed="true"] { background: var(--mint); border-color: #abbea5; }
.calendar-day.today { border-color: #6b896f; }
.calendar-day > span { display: flex; gap: 2px; min-height: 5px; }
.expense-dot, .income-dot, .calendar-key span::before { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #9c6035; }
.income-dot, .calendar-key span + span::before { background: #367459; }
.calendar-key { display: flex; gap: 12px; margin-block: 4px; color: var(--muted); font-size: .83rem; }
.calendar-key span::before { content: ''; margin: 0 5px 2px 0; }
.bottom-nav { position: fixed; z-index: 3; inset: auto 0 0; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); justify-items: center; align-items: center; padding: 4px max(4px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: #fffdf8; box-shadow: 0 -3px 15px #23190908; }
.nav-item { display: flex; width: 100%; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 47px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: clamp(.62rem, 2.72vw, .78rem); font-weight: 650; padding: 3px 0; }
.nav-item.active, .nav-item:hover { color: #254c36; }
.nav-item.active { font-weight: 750; }
.nav-item.active svg { border-radius: 7px; background: var(--mint); }
.nav-item svg { width: 28px; height: 22px; padding: 1px 5px; }
.mobile-add { display: grid; place-items: center; border: 0; background: var(--green); color: #fffdf6; width: 44px; height: 44px; border-radius: 14px; box-shadow: 0 3px 5px #163a2940; }
.mobile-add svg { width: 23px; height: 23px; }
dialog {
  position: fixed; inset: auto 0 var(--sheet-bottom,0px); margin: 0 auto; width: min(100%, 550px); max-width: 100%;
  max-height: min(94dvh, var(--sheet-height,94dvh)); border: 1px solid var(--line); border-radius: 21px 21px 0 0;
  padding: 12px 14px max(13px, env(safe-area-inset-bottom)); background: var(--paper); color: var(--ink);
  overflow: auto; overscroll-behavior: contain; box-shadow: 0 15px 55px #13231b44;
}
dialog[open] { animation: rise .24s cubic-bezier(.18,.75,.32,1); }
dialog::backdrop { background: #14281ec0; }
@keyframes rise { from { transform: translateY(38px); opacity: .45; } to { transform: none; opacity: 1; } }
body:has(dialog[open]) { overflow: hidden; }
.sheet-header { display: flex; gap: 6px; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sheet-header h2 { font-size: 1.46rem; line-height: 1.13; letter-spacing: -.05em; overflow-wrap: anywhere; }
.sheet-description { color: var(--muted); line-height: 1.42; margin: 4px 0 12px; }
.sheet-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.stack { display: grid; gap: 8px; min-width: 0; }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font-size: .87rem; font-weight: 680; line-height: 1.2; }
.field input, .field select {
  display: block; min-height: 44px; border: 1px solid #dcdacd; border-radius: 9px; background: #fffefa; color: var(--ink);
  padding: 7px 8px; width: 100%; min-width: 0; max-width: 100%; font-size: 1rem; line-height: 1.22;
}
.field input[type="date"] { appearance: none; -webkit-appearance: none; }
.field input[type="date"]::-webkit-date-and-time-value { text-align: start; min-height: 1.25em; }
.field input[type="file"] { font-size: .9rem; }
.field select {
  appearance: none; padding-right: 22px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%2356665c' stroke-width='1.5'/%3E%3C/svg%3E");
  background-position: right 6px center; background-repeat: no-repeat; background-size: 15px;
}
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.source-fields > .field:last-child:nth-child(odd) { grid-column: 1 / -1; }
.source-fields:empty { display: none; }
.source-buttons { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 5px; }
.source-choice { display: grid; grid-template-rows: auto 1fr; gap: 3px; justify-items: stretch; min-width: 0; }
.source-choice small { text-align: center; font-size: clamp(.63rem,2.7vw,.69rem); line-height: 1.15; overflow-wrap: anywhere; }
.source-choice:has([aria-pressed="true"]) small { color: var(--ink); font-weight: 680; }
.operation-help { margin: 0; }
.source-button.button { width: 100%; padding: 6px 0; }
.source-button.button svg { width: 22px; height: 22px; }
.source-button[aria-pressed="true"] { background: #e2ebdb; border-color: #9bbc9c; color: #284b35; }
.segmented { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px; padding: 3px; background: #eeeee4; border-radius: 11px; margin-bottom: 8px; }
.segmented button { border: 0; min-height: 40px; background: transparent; border-radius: 8px; font-weight: 670; font-size: .94rem; padding: 5px 2px; }
.segmented button[aria-pressed="true"] { background: #fffdf8; box-shadow: 0 1px 3px #16281c1f; }
.operation-details { border: 1px solid #ebe8de; padding: 0 8px; border-radius: 10px; }
.operation-details summary { padding: 7px 0; min-height: 34px; font-size: .86rem; font-weight: 630; cursor: pointer; }
.operation-details .field { margin-bottom: 8px; }
.preview { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; background: var(--mint); padding: 9px; border-radius: 9px; font-size: .88rem; }
.preview strong { font-size: 1.02rem; overflow-wrap: anywhere; }
.form-error { color: #9c3938; font-size: .91rem; }
.form-hint, .budget-hint { color: var(--muted); font-size: .81rem; line-height: 1.32; }
.form-error:empty, .budget-hint:empty { display: none; }
.category-toast { position: fixed; z-index: 5; inset: max(var(--category-toast-y,12px),env(safe-area-inset-top)) 12px auto; width: max-content; max-width: calc(100vw - 24px);
  margin: 0 auto; display: flex; align-items: center; gap: 7px; padding: 8px 12px; color: #fffdf8; background: #224838;
  border-radius: 12px; opacity: 0; transform: translateY(-6px); pointer-events: none; transition: .2s ease-out; font-size: .88rem; }
.category-toast.visible { opacity: 1; transform: none; }
.category-sparks i { position: fixed; z-index: 4; aspect-ratio: 1; pointer-events: none; image-rendering: pixelated;
  background: url('/pixel-ruble.png') center / contain no-repeat; }
.category-section { padding-bottom: 8px; }
.category-section h3 { margin: 8px 0 2px; font-size: 1rem; }
.rule-count { border-radius: 20px; background: var(--mint); padding: 3px 8px; font-size: .84rem; font-variant-numeric: tabular-nums; }
.form-buttons { display: flex; gap: 6px; }
.form-buttons .button { flex: 1; min-height: 44px; }
.goal-summary { margin: 4px 0 13px; color: var(--muted); }
.goal-summary strong { font-size: 1.55rem; color: var(--ink); }
.credit-forecast { display: grid; gap: 8px; background: #f0ecef; border-radius: 11px; padding: 10px; margin-bottom: 12px; font-size: .9rem; }
.rule-list { max-height: min(49dvh, 375px); overflow: auto; margin-bottom: 8px; }
.profile-preview { margin: 8px 0; }
.profile-preview .avatar { width: 72px; height: 72px; font-size: 1.8rem; }
#dialog > .button { margin-top: 7px; }
dialog.with-drafts, dialog.pig-theater {
  inset: auto 0 var(--sheet-bottom,0px); width: min(100%, 620px); max-width: 100%; height: var(--sheet-height,100dvh); max-height: 100dvh;
  border: 0; border-radius: 0; background: transparent; box-shadow: none; padding: 0; overflow: hidden; animation: none;
}
dialog.with-drafts[open] { display: flex; flex-direction: column; justify-content: space-between; }
.sheet-content {
  align-self: center; width: min(100%, 550px); min-height: 0; max-height: 100%;
  border-radius: 21px 21px 0 0; padding: 12px 14px max(13px, env(safe-area-inset-bottom));
  background: var(--paper); border: 1px solid var(--line); overflow: auto; overscroll-behavior: contain;
}
.draft-stack, .pig-queue {
  display: grid; flex: none; gap: 4px; justify-self: center; width: min(calc(100% - 24px), 510px);
  margin: max(7px, env(safe-area-inset-top)) auto 5px; padding: 2px; max-height: min(29dvh, 162px); overflow: auto; overscroll-behavior: contain;
}
.staged-card {
  display: flex; align-items: center; gap: 6px; border: 1px solid #e8e4d6; border-radius: 9px; background: var(--paper);
  color: var(--ink); padding: 3px 7px; min-height: 31px; font-size: .82rem; overflow-wrap: anywhere;
}
.staged-card > span:not(.badge) { flex: 1; min-width: 0; }
.staged-card strong { font-size: .86rem; text-align: end; max-width: 46%; }
.staged-card .badge { width: 24px; height: 24px; border-radius: 6px; }
.staged-card svg { width: 14px; height: 14px; }
.staged-card .icon-button { width: 31px; height: 31px; }
.draft-flight { position: absolute; z-index: 3; pointer-events: none; }
.pig-stage { position: relative; width: 100%; height: 100%; overflow: hidden; display: grid; place-items: center; isolation: isolate; }
.pig-stage::before { content: ''; border-radius: 50%; background: #a4ca8720; width: min(82vw, 360px); aspect-ratio: 1; position: absolute; filter: blur(35px); z-index: -1; }
.pig-queue { position: absolute; inset: 0 0 auto; z-index: 2; }
.pig-position { position: relative; width: clamp(158px, 52vw, 251px); aspect-ratio: 98 / 63; }
.pixel-pig { position: relative; z-index: 1; display: block; image-rendering: pixelated; width: 100%; height: auto; transform-origin: center 75%; }
.flying-coin { position: absolute; top: 19.2%; left: 46.3%; z-index: 3; image-rendering: pixelated; aspect-ratio: 1; pointer-events: none; }
.coin-feedback { position: absolute; top: 79%; left: 50%; color: #f7f5e4; font-weight: 800; font-size: 1rem; text-shadow: 0 1px 5px #14281e; white-space: nowrap; pointer-events: none; }
.coin-feedback.coin-in { color: #deffad; }
.coin-feedback.coin-out { color: #ffc9c6; }
.stage-skip { position: absolute; bottom: max(15px, env(safe-area-inset-bottom)); background: #eaf0e3; }
.toast { position: fixed; z-index: 5; inset: auto 12px max(64px,calc(57px + env(safe-area-inset-bottom))) auto; display: flex; gap: 7px; align-items: center; color: #fffdf8; background: #224838; padding: 9px 12px; border-radius: 10px; max-width: min(calc(100vw - 24px), 450px); opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .16s, transform .16s; }
.toast.visible { opacity: 1; transform: none; }
body:has(dialog.pig-theater[open]) .toast { opacity: 0; }
.auth { max-width: 930px; min-height: 100dvh; display: grid; align-content: center; grid-template-columns: minmax(0,1fr); gap: 12px; padding: 14px; }
.auth-aside { display: none; }
.auth-card { padding: 17px; border-radius: 17px; border: 1px solid var(--line); background: var(--paper); }
.auth-card .brand { display: flex; margin-bottom: 16px; }
.auth-card h1 { font-size: 1.88rem; margin-bottom: 15px; }
.auth-card > .button { margin-top: 11px; }
.loading, .fallback { padding: 23px 15px; }
.fallback p { margin: 12px 0; }
@media (min-width: 460px) {
  main { padding-inline: max(18px, env(safe-area-inset-left)) max(18px, env(safe-area-inset-right)); }
  .hero { padding-inline: 20px; grid-template-columns: minmax(0,1fr) minmax(112px, 30%); }
  .metric { flex-direction: row; align-items: flex-start; gap: 8px; }
  .goal-card, .credit-card, .person-card { padding: 13px; }
  .person-totals { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
}
@media (min-width: 720px) {
  main { padding-inline: max(23px, env(safe-area-inset-left)) max(23px, env(safe-area-inset-right)); }
  .columns { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .history-authors .panel { display: block; }
  .history-authors .donut { width: min(100%,188px); margin-block: 4px 10px; }
  .history-authors .donut strong { font-size: 1.17rem; }
  .history-authors .donut small { font-size: .83rem; }
  .metrics { gap: 12px; }
  .goals-full { grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); }
  .toast { inset-inline-end: 20px; }
}
@media (min-width: 910px) {
  .layout { display: grid; grid-template-columns: 200px minmax(0,1fr); }
  .sidebar { position: sticky; inset-block-start: 0; height: 100dvh; display: flex; flex-direction: column; padding: 24px 12px 17px; background: #fcfaf5; border-right: 1px solid var(--line); }
  .sidebar .brand { margin: 0 4px 28px; }
  .sidebar nav { display: grid; gap: 4px; }
  .nav-item { flex-direction: row; justify-content: flex-start; font-size: .91rem; gap: 8px; padding: 6px 8px; }
  .nav-item.active, .nav-item:hover { background: #e9eee2; }
  .nav-item svg { width: 24px; height: 21px; padding: 1px 2px; }
  .family { margin-top: auto; display: flex; align-items: center; gap: 7px; padding: 8px 1px 0; border-top: 1px solid var(--line); }
  .family div { flex: 1; min-width: 0; }
  .family strong, .family small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .family small { font-size: .75rem; }
  main { padding: 27px 28px 40px; }
  h1 { font-size: clamp(2.35rem, 4vw, 3.18rem); }
  .mobile-brand, .bottom-nav { display: none; }
  .money-tabs.segmented { display: none; }
  .button.desktop-add { display: inline-flex; }
  .hero { min-height: 245px; grid-template-columns: minmax(0,1fr) minmax(200px, 33%); padding: 20px 29px; }
  .hero-copy > .balance-amount { font-size: clamp(3rem, 5.5vw, 4.55rem); }
  .hero-art { margin-inline-end: clamp(0px, 3vw, 32px); }
  .orbit { max-width: 270px; }
  .hero-coins { width: clamp(258px,35vw,365px); inset-inline-start: clamp(95px,12%,155px); }
  .panel { padding: 14px 16px; }
  .panel h2 { font-size: 1.15rem; }
  .metric { padding: 12px 14px; }
  .metric .balance-amount { font-size: 1.5rem; }
  .person-totals { font-size: .85rem; }
  .credit-card:only-child { grid-column: auto; }
  dialog { inset: 0; margin: auto; width: min(94vw, 515px); max-height: 94dvh; border-radius: 21px; padding: 15px 17px; }
  .sheet-content { align-self: center; margin-top: auto; margin-bottom: auto; border-radius: 21px; padding: 15px 17px; }
  .toast { inset-block-end: 17px; }
  .auth { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .auth-aside { padding: 21px; min-height: 370px; background: var(--green); border-radius: 19px; display: grid; align-content: space-between; color: var(--paper); }
  .auth-aside small { color: #eff5e8; }
  .auth-aside > img { display: block; justify-self: center; width: min(100%, 235px); }
  .auth-card .brand { display: none; }
}
@media (min-width: 1200px) {
  .layout { grid-template-columns: 224px minmax(0,1fr); }
  main { padding-inline: 35px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
