:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --sidebar: #101218;
  --surface: #14171f;
  --surface-2: #191d26;
  --surface-3: #20252f;
  --line: rgba(255,255,255,.075);
  --line-strong: rgba(255,255,255,.12);
  --text: #f2f4f8;
  --text-soft: #a6adba;
  --muted: #777f8d;
  --green: #8ad1a7;
  --green-strong: #55b97c;
  --green-muted: rgba(108,196,139,.13);
  --red: #ec8d91;
  --blue: #91a9f7;
  --purple: #b39cf5;
  --amber: #efbe7a;
  --shadow: 0 22px 65px rgba(0,0,0,.22);
  --radius: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f8;
  --sidebar: #fbfcfd;
  --surface: #fff;
  --surface-2: #f6f7fa;
  --surface-3: #eceff4;
  --line: rgba(25,35,52,.075);
  --line-strong: rgba(25,35,52,.14);
  --text: #202631;
  --text-soft: #6e7785;
  --muted: #939ba7;
  --green: #278f54;
  --green-strong: #20814b;
  --green-muted: rgba(48,161,91,.1);
  --red: #cb5960;
  --blue: #5273da;
  --purple: #7d5bd0;
  --amber: #b77826;
  --shadow: 0 18px 52px rgba(34,48,68,.08);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); font-size: 14px; transition: background .2s ease, color .2s ease; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
button:disabled { opacity: .5; cursor: not-allowed; }
[hidden] { display: none !important; }
.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 { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 5; display: flex; flex-direction: column; width: 252px; padding: 27px 17px 16px; background: var(--sidebar); border-right: 1px solid var(--line); }
.brand-lockup { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; width: 37px; height: 37px; place-items: center; border: 1px solid rgba(138,209,167,.25); border-radius: 12px; background: linear-gradient(145deg,rgba(111,200,143,.2),rgba(84,144,197,.11)); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.brand-mark svg { width: 23px; fill: none; stroke: var(--green); stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.brand-lockup strong { display: block; font-size: 14px; font-weight: 650; letter-spacing: -.2px; }
.brand-lockup small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; letter-spacing: .01em; }
.sidebar-label { margin: 43px 11px 12px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .16em; }
.primary-nav { display: grid; gap: 4px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 43px; padding: 0 11px; border: 0; border-radius: 11px; background: transparent; color: var(--text-soft); text-align: left; font-size: 12.5px; font-weight: 530; cursor: pointer; transition: background .16s ease, color .16s ease; }
.mobile-settings-nav { display: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--green-muted); color: var(--green); font-weight: 620; }
.nav-item.active::before { position: absolute; left: -17px; width: 3px; height: 20px; border-radius: 0 4px 4px 0; background: var(--green); content: ""; }
.nav-icon { display: grid; width: 19px; height: 19px; place-items: center; }
.nav-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-spacer { flex: 1; min-height: 25px; }
.settings-nav { margin-bottom: 14px; }
.sidebar-footer { border-top: 1px solid var(--line); padding: 13px 4px 0; }
.sync-indicator { display: flex; align-items: center; gap: 7px; padding: 2px 8px 15px; color: var(--muted); font-size: 10px; }
.sync-dot, .privacy-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(138,209,167,.65); }
.sync-dot.saving { background: var(--amber); box-shadow: 0 0 9px rgba(239,190,122,.6); }
.sync-dot.error { background: var(--red); box-shadow: 0 0 9px rgba(236,141,145,.55); }
.household-note { display: flex; align-items: center; gap: 9px; padding: 9px 8px 4px; }
.household-avatar { display: grid; width: 31px; height: 31px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface-2); color: var(--green); font-size: 17px; }
.household-note strong, .household-note small { display: block; }
.household-note strong { font-size: 11px; font-weight: 600; }
.household-note small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.main-content { width: calc(100% - 252px); min-height: 100vh; margin-left: 252px; }
.topbar { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; min-height: 82px; padding: 15px clamp(24px,4vw,57px); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(22px); }
.topbar-title .eyebrow { margin-bottom: 5px; }
.topbar h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.45px; }
.eyebrow { display: block; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .15em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.month-select-wrap { display: flex; align-items: center; gap: 8px; height: 37px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text-soft); }
.month-select-wrap input { width: 125px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 11px; color-scheme: inherit; }
.calendar-icon { color: var(--green); font-size: 17px; }
.icon-button { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text-soft); cursor: pointer; transition: color .15s ease, background .15s ease, border-color .15s ease; }
.icon-button:hover { border-color: var(--line-strong); background: var(--surface-2); color: var(--text); }
.icon-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sun-icon { display: none; }
:root[data-theme="light"] .moon-icon { display: none; }
:root[data-theme="light"] .sun-icon { display: block; }
.logout-button { margin-left: 1px; }
.content-wrap { width: min(100%, 1490px); margin: 0 auto; padding: 32px clamp(24px,4vw,57px) 0; }
.view-page { animation: appear .22s ease both; }
@keyframes appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.welcome-row, .page-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-intro { margin: 0; color: var(--text-soft); font-size: 12px; line-height: 1.6; }
.button { display: inline-flex; min-height: 37px; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; border: 1px solid transparent; border-radius: 10px; font-size: 11px; font-weight: 620; white-space: nowrap; cursor: pointer; transition: transform .12s ease, background .15s ease, border-color .15s ease; }
.button:active { transform: scale(.985); }
.button-primary { background: linear-gradient(135deg,#79c894,#66b982); color: #0e2517; box-shadow: 0 5px 18px rgba(78,176,109,.14); }
.button-primary:hover { background: linear-gradient(135deg,#8fdaa7,#74c78d); }
.button-secondary { border-color: var(--line-strong); background: var(--surface-2); color: var(--text); }
.button-secondary:hover { background: var(--surface-3); }
.button-tertiary { border-color: var(--line); background: transparent; color: var(--text-soft); }
.button-tertiary:hover { background: var(--surface-2); color: var(--text); }
.plus { font-size: 17px; font-weight: 400; line-height: 0; }
.overview-grid { display: grid; grid-template-columns: minmax(0,1.48fr) minmax(190px,.78fr) minmax(190px,.78fr); gap: 14px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.balance-card { position: relative; min-height: 197px; overflow: hidden; padding: 21px 23px 16px; background: linear-gradient(120deg,rgba(35,69,53,.72),rgba(24,34,39,.92) 55%,rgba(24,29,40,.98)),var(--surface); }
:root[data-theme="light"] .balance-card { background: linear-gradient(120deg,#e9f5ec,#f5f9f6 58%,#f8fafc); }
.balance-card::before { position: absolute; top: -118px; right: 23%; width: 260px; height: 260px; border: 1px solid rgba(163,220,177,.08); border-radius: 50%; content: ""; }
.balance-card::after { position: absolute; top: -83px; right: 28%; width: 190px; height: 190px; border: 1px solid rgba(163,220,177,.07); border-radius: 50%; content: ""; }
.balance-card-top { position: relative; z-index: 1; display: flex; justify-content: space-between; }
.card-kicker { display: flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: 9px; font-weight: 700; letter-spacing: .13em; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.hero-balance { margin-top: 13px; font-size: clamp(30px,3.2vw,40px); font-weight: 650; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; }
.balance-caption { margin: 3px 0 0; color: var(--text-soft); font-size: 10px; }
.balance-orb { position: relative; z-index: 1; display: grid; width: 74px; height: 74px; margin: 1px 8px 0 10px; place-items: center; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; background: radial-gradient(circle at 36% 30%,rgba(156,219,169,.19),rgba(113,167,147,.045) 70%); }
.balance-orb svg { width: 55px; fill: none; stroke: rgba(172,222,183,.75); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.balance-orb svg circle { stroke: rgba(172,222,183,.17); }
.balance-divider { position: relative; z-index: 1; height: 1px; margin: 17px 0 12px; background: var(--line-strong); }
.balance-bottom { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text-soft); font-size: 10px; }
.balance-bottom strong { color: var(--text); font-size: 12px; font-weight: 620; font-variant-numeric: tabular-nums; }
.balance-mini-icon { margin-right: 4px; color: var(--green); font-size: 13px; }
.stat-card { min-height: 197px; padding: 19px 19px 15px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { color: var(--text-soft); font-size: 10px; font-weight: 540; }
.stat-icon { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 9px; font-size: 15px; }
.income-icon { background: rgba(117,193,143,.11); color: var(--green); }
.expense-icon { background: rgba(233,140,144,.1); color: var(--red); }
.neutral-icon { background: rgba(143,157,186,.1); color: var(--blue); }
.forecast-icon { background: rgba(168,145,237,.12); color: var(--purple); }
.stat-number { display: block; margin-top: 21px; overflow: hidden; font-size: clamp(21px,2vw,27px); font-weight: 630; letter-spacing: -.8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat-foot { display: flex; min-height: 15px; align-items: center; gap: 7px; margin-top: 11px; color: var(--muted); font-size: 9px; }
.stat-bullet { width: 6px; height: 6px; border-radius: 50%; }
.income-bullet { background: var(--green); }
.expense-bullet { background: var(--red); }
.dashboard-row { display: grid; grid-template-columns: minmax(0,1.85fr) minmax(230px,.95fr); gap: 14px; margin-top: 14px; }
.chart-card, .categories-card, .recent-card, .ledger-card, .allowance-ledger-card, .forecast-chart-card { padding: 19px 21px 15px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.card-heading h2, .ledger-toolbar h2, .settings-heading h2 { margin: 6px 0 0; font-size: 14px; font-weight: 630; letter-spacing: -.2px; }
.card-heading p, .settings-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.chart-chip, .assumption-pill { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text-soft); font-size: 9px; }
.chart-chip-dot, .assumption-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.chart-container { width: 100%; height: 224px; margin-top: 7px; }
.chart-container svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-empty { position: relative; z-index: 1; width: fit-content; max-width: 82%; margin: -139px auto 0; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: color-mix(in srgb,var(--surface) 88%,transparent); color: var(--muted); font-size: 9px; line-height: 1.5; text-align: center; backdrop-filter: blur(8px); }
.chart-grid-line { stroke: var(--line); stroke-width: 1; }
.chart-axis-label { fill: var(--muted); font-family: inherit; font-size: 9px; }
.chart-area { fill: url(#cash-gradient); }
.chart-line { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-point { fill: var(--surface); stroke: var(--green); stroke-width: 2; }
.chart-point.current { fill: var(--green); stroke: var(--surface); stroke-width: 3; }
.chart-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 5px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.chart-footer strong { color: var(--text-soft); font-weight: 580; }
.more-mark { color: var(--muted); font-size: 19px; letter-spacing: 1px; line-height: .6; }
.category-list { display: grid; gap: 13px; max-height: 226px; margin-top: 21px; overflow: auto; padding-right: 2px; }
.category-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 5px 10px; }
.category-name { overflow: hidden; color: var(--text-soft); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.category-amount { color: var(--text); font-size: 10px; font-weight: 560; font-variant-numeric: tabular-nums; }
.category-track { grid-column: 1 / -1; height: 4px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.category-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg,#61b77d,#a1d7a7); }
.category-total { display: flex; justify-content: space-between; margin-top: 17px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.category-total strong { color: var(--text); font-weight: 600; }
.recent-card { margin-top: 14px; }
.recent-heading { align-items: center; margin-bottom: 8px; }
.text-button { border: 0; background: transparent; color: var(--green); font-size: 10px; font-weight: 590; cursor: pointer; }
.text-button span { margin-left: 4px; font-size: 13px; }
.recent-list { display: grid; }
.recent-row { display: grid; grid-template-columns: minmax(140px,1fr) minmax(90px,.65fr) minmax(78px,.5fr) 95px; align-items: center; gap: 12px; min-height: 54px; border-top: 1px solid var(--line); }
.recent-item { display: flex; min-width: 0; align-items: center; gap: 10px; }
.transaction-symbol { display: grid; flex: 0 0 auto; width: 30px; height: 30px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text-soft); font-size: 13px; }
.transaction-symbol.income { background: var(--green-muted); color: var(--green); }
.transaction-symbol.expense { color: var(--red); }
.recent-item strong, .recent-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item strong { font-size: 10px; font-weight: 590; }
.recent-item small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.recent-category, .recent-date { overflow: hidden; color: var(--text-soft); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.recent-date { color: var(--muted); }
.recent-amount { text-align: right; font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.positive { color: var(--green); }
.negative { color: var(--text); }
.app-footer { display: flex; justify-content: space-between; gap: 14px; padding: 19px clamp(24px,4vw,57px) 17px; color: var(--muted); font-size: 9px; }

.compact-stats { grid-template-columns: repeat(3,minmax(0,1fr)); margin: 18px 0 14px; }
.compact-stats .stat-card { min-height: 126px; padding: 16px 18px; }
.compact-stats .stat-number { margin-top: 13px; font-size: 23px; }
.compact-stats .stat-foot { margin-top: 6px; }
.ledger-card { padding-bottom: 13px; }
.ledger-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.ledger-filters { display: flex; align-items: center; gap: 8px; }
.search-field { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.search-field span { font-size: 17px; }
.search-field input { width: 132px; border: 0; outline: none; background: transparent; color: var(--text); font-size: 10px; }
.search-field input::placeholder, input::placeholder { color: var(--muted); }
.ledger-filters select { height: 34px; padding: 0 28px 0 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--text-soft); font-size: 10px; }
.table-scroll { overflow-x: auto; }
.ledger-table { width: 100%; border-collapse: collapse; text-align: left; }
.ledger-table th { padding: 9px 9px; border-bottom: 1px solid var(--line-strong); color: var(--muted); font-size: 8px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.ledger-table td { padding: 11px 9px; border-bottom: 1px solid var(--line); color: var(--text-soft); font-size: 10px; white-space: nowrap; }
.ledger-table td:first-child { min-width: 175px; color: var(--text); }
.ledger-table .amount-column { text-align: right; }
.ledger-table td.amount-column { color: var(--text); text-align: right; font-weight: 590; font-variant-numeric: tabular-nums; }
.entry-main { display: block; max-width: 250px; overflow: hidden; text-overflow: ellipsis; font-weight: 570; }
.entry-note { display: block; max-width: 245px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; }
.type-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-soft); font-size: 8px; }
.type-pill.income { background: var(--green-muted); color: var(--green); }
.type-pill.allowance { background: rgba(145,169,247,.12); color: var(--blue); }
.table-actions { display: flex; justify-content: flex-end; gap: 4px; }
.mini-action { display: grid; width: 27px; height: 27px; place-items: center; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.mini-action:hover { border-color: var(--line); background: var(--surface-2); color: var(--text); }
.mini-action.delete:hover { color: var(--red); }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 185px; gap: 7px; color: var(--muted); text-align: center; font-size: 10px; }
.empty-state strong { color: var(--text-soft); font-size: 12px; font-weight: 580; }
.empty-icon { margin-bottom: 2px; color: var(--green); font-size: 24px; }
.ledger-note { display: flex; gap: 8px; margin-top: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--muted); font-size: 9px; line-height: 1.5; }
.info-icon { display: inline-grid; flex: 0 0 auto; width: 15px; height: 15px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--text-soft); font-family: Georgia,serif; font-size: 10px; font-style: italic; }

.allowance-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; margin: 18px 0 14px; }
.allowance-card { position: relative; min-height: 193px; overflow: hidden; padding: 17px; }
.allowance-card::after { position: absolute; top: -47px; right: -48px; width: 118px; height: 118px; border: 1px solid var(--line); border-radius: 50%; content: ""; }
.allowance-person { display: flex; align-items: center; gap: 9px; }
.person-avatar { display: grid; width: 35px; height: 35px; place-items: center; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface-2); color: var(--green); font-size: 14px; font-weight: 630; }
.allowance-person strong { display: block; font-size: 11px; font-weight: 600; }
.allowance-person small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.allowance-left { margin-top: 19px; font-size: 24px; font-weight: 640; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.allowance-left-label { margin-top: 1px; color: var(--muted); font-size: 9px; }
.allowance-progress-track { height: 5px; margin-top: 14px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.allowance-progress { height: 100%; border-radius: inherit; background: linear-gradient(90deg,#63b982,#b2d9a8); transition: width .25s ease; }
.allowance-meta { display: flex; justify-content: space-between; margin-top: 9px; color: var(--muted); font-size: 8px; }
.allowance-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 11px; }
.allowance-actions button { border: 0; background: transparent; color: var(--green); font-size: 9px; font-weight: 580; cursor: pointer; }
.allowance-not-set { color: var(--amber); }
.allowance-ledger-card { min-height: 184px; }
.muted-label { color: var(--muted); font-size: 9px; }
.pocket-list { display: grid; }
.pocket-row { display: grid; grid-template-columns: 1fr 1fr 90px 90px 50px; align-items: center; gap: 12px; min-height: 52px; border-top: 1px solid var(--line); }
.pocket-row strong { display: block; overflow: hidden; font-size: 10px; font-weight: 570; text-overflow: ellipsis; white-space: nowrap; }
.pocket-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.pocket-person { display: flex; align-items: center; gap: 8px; color: var(--text-soft); font-size: 9px; }
.pocket-person .person-avatar { width: 24px; height: 24px; border-radius: 8px; font-size: 10px; }
.pocket-amount { text-align: right; font-size: 10px; font-weight: 590; font-variant-numeric: tabular-nums; }
.pocket-category { color: var(--text-soft); font-size: 9px; }

.forecast-summary { margin: 18px 0 14px; }
.forecast-summary .stat-card { min-height: 126px; padding: 16px 18px; }
.forecast-summary .stat-number { margin-top: 13px; font-size: 23px; }
.forecast-summary .stat-foot { margin-top: 6px; }
.forecast-chart-card { padding-bottom: 13px; }
.forecast-chart { height: 278px; margin-top: 11px; }
.forecast-chart .chart-line { stroke: var(--purple); }
.forecast-chart .chart-area { fill: url(#forecast-gradient); }
.forecast-chart .chart-point { stroke: var(--purple); }
.forecast-chart .chart-point.current { fill: var(--purple); }
.assumption-pill { background: rgba(167,146,237,.08); color: var(--purple); }
.assumption-dot { background: var(--purple); }
.forecast-disclaimer { display: flex; align-items: center; gap: 8px; margin-top: 5px; padding: 11px 0 1px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; line-height: 1.5; }
.forecast-note-grid { display: flex; gap: 13px; margin: 13px 2px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.note-icon { color: var(--amber); font-size: 17px; }
.forecast-note-grid strong { font-size: 10px; font-weight: 590; }
.forecast-note-grid p { max-width: 760px; margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.6; }

.settings-layout { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(270px,.85fr); align-items: start; gap: 14px; margin-top: 18px; }
.settings-main, .settings-side { display: grid; gap: 14px; }
.settings-card { padding: 19px; }
.settings-heading { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 17px; }
.settings-icon { display: grid; flex: 0 0 auto; width: 33px; height: 33px; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--green); font-size: 15px; }
.settings-heading .eyebrow { margin-top: 2px; }
.settings-heading h2 { margin-top: 5px; font-size: 13px; }
.settings-heading p { max-width: 470px; font-size: 9px; }
.green-setting { color: var(--green); }
.violet-setting { color: var(--purple); }
.blue-setting { color: var(--blue); }
.amber-setting { color: var(--amber); }
.data-setting { color: var(--blue); }
.field-label { display: block; margin: 13px 0 7px; color: var(--text-soft); font-size: 10px; font-weight: 570; }
.input-with-unit { display: flex; align-items: center; height: 39px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface-2); }
.input-with-unit input { width: 100%; height: 100%; padding: 0 11px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 11px; font-variant-numeric: tabular-nums; }
.input-with-unit span { padding: 0 11px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.save-setting { min-height: 33px; margin-top: 12px; font-size: 10px; }
.settings-fields { display: grid; grid-template-columns: 1fr minmax(150px,.68fr); align-items: center; gap: 9px 18px; }
.settings-fields .field-label { margin: 0; }
.settings-fields .input-with-unit { height: 35px; }
.field-hint { grid-column: 1 / -1; margin: -3px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.settings-list { display: grid; gap: 5px; }
.setting-row { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 3px 4px; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row input[type="text"] { flex: 1; min-width: 40px; height: 29px; padding: 0 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--text-soft); font-size: 10px; }
.setting-row input[type="text"]:focus { border-color: var(--line-strong); outline: none; background: var(--surface-2); color: var(--text); }
.setting-row select { height: 28px; padding: 0 20px 0 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--text-soft); font-size: 9px; }
.setting-row .category-indicator { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--green); }
.setting-row .category-indicator.expense { background: var(--red); }
.setting-row .category-indicator.allowance { background: var(--blue); }
.archived-row { opacity: .55; }
.small-action { min-width: 27px; height: 27px; padding: 0 7px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; }
.small-action:hover { background: var(--surface-2); color: var(--text); }
.small-action.archive:hover { color: var(--amber); }
.add-inline-form { display: flex; gap: 7px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.add-inline-form input, .add-inline-form select, .add-person-form input { min-width: 0; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 10px; }
.add-inline-form input { flex: 1; }
.add-inline-form select { width: 113px; }
.add-inline-form .button { min-height: 34px; padding: 0 10px; font-size: 9px; }
.people-settings-list { max-height: 200px; overflow: auto; }
.people-settings-list .setting-row input { padding-left: 3px; }
.add-person-form { display: flex; gap: 7px; margin-top: 10px; padding-top: 11px; border-top: 1px solid var(--line); }
.add-person-form input { flex: 1; }
.add-person-form .button { width: 36px; min-height: 34px; padding: 0; font-size: 15px; }
.data-card { padding: 17px; }
.data-card > .eyebrow { margin-top: 14px; }
.data-card h2 { margin: 5px 0 0; font-size: 13px; font-weight: 610; }
.data-card > p { margin: 6px 0 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.data-actions { display: flex; gap: 7px; margin-top: 13px; }
.data-actions .button { min-height: 31px; font-size: 9px; }
.data-card .field-hint { margin-top: 10px; }
.file-button { position: relative; }
.security-note { display: flex; gap: 10px; padding: 15px; border: 1px solid rgba(135,204,156,.15); border-radius: 13px; background: rgba(91,159,108,.07); }
.security-shield { color: var(--green); font-size: 16px; }
.security-note strong { color: var(--text-soft); font-size: 10px; font-weight: 590; }
.security-note p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.55; }

.login-screen { position: relative; display: grid; min-height: 100vh; overflow: hidden; place-items: center; padding: 26px; background: radial-gradient(ellipse at 55% 0%,rgba(79,123,95,.14),transparent 44%),var(--bg); }
.login-card { position: relative; z-index: 1; width: min(100%,410px); padding: 29px; border: 1px solid var(--line-strong); border-radius: 22px; background: color-mix(in srgb,var(--surface) 92%,transparent); box-shadow: 0 24px 80px rgba(0,0,0,.28); backdrop-filter: blur(22px); }
.login-brand { margin-bottom: 38px; }
.login-copy .eyebrow { color: var(--green); }
.login-copy h1 { margin: 11px 0 8px; font-size: 25px; font-weight: 640; letter-spacing: -.7px; }
.login-copy p { margin: 0; color: var(--text-soft); font-size: 11px; line-height: 1.65; }
.login-form { margin-top: 27px; }
.login-form > label { display: block; margin-bottom: 7px; color: var(--text-soft); font-size: 10px; font-weight: 560; }
.password-field { display: flex; align-items: center; height: 43px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); }
.password-field input { width: 100%; height: 100%; padding: 0 12px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 11px; }
.password-field input:focus-visible { outline: 0; }
.password-field:focus-within { border-color: var(--green); box-shadow: 0 0 0 2px rgba(117,193,143,.12); }
.password-toggle { height: 100%; padding: 0 11px; border: 0; background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; }
.login-submit { width: 100%; min-height: 41px; justify-content: space-between; margin-top: 12px; padding: 0 13px; }
.form-message { min-height: 14px; margin: 9px 0 0; color: var(--red); font-size: 9px; line-height: 1.5; }
.login-privacy { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.privacy-dot { width: 5px; height: 5px; }
.login-orbit { position: absolute; width: 480px; height: 480px; border: 1px solid rgba(147,206,157,.045); border-radius: 50%; pointer-events: none; }
.orbit-one { top: -330px; left: -120px; }
.orbit-two { right: -300px; bottom: -330px; width: 630px; height: 630px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; overflow-y: auto; place-items: center; padding: 18px; background: rgba(3,5,8,.68); backdrop-filter: blur(7px); animation: appear .15s ease both; }
.modal-card { width: min(100%,460px); padding: 21px; border: 1px solid var(--line-strong); border-radius: 17px; background: var(--surface); box-shadow: 0 25px 90px rgba(0,0,0,.45); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.modal-header h2 { margin: 5px 0 0; font-size: 16px; font-weight: 630; letter-spacing: -.3px; }
.modal-close { display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--text-soft); font-size: 17px; cursor: pointer; }
.transaction-form { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 12px; }
.form-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { color: var(--text-soft); font-size: 9px; font-weight: 560; }
.form-field input, .form-field select, .form-field textarea { width: 100%; min-height: 37px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 10px; }
.form-field textarea { min-height: 65px; padding-top: 9px; resize: vertical; }
.form-field input[type="date"] { color-scheme: inherit; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--green); outline: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); }
.modal-actions .button { min-height: 34px; }
.toast { position: fixed; right: 23px; bottom: 22px; z-index: 40; max-width: min(360px,calc(100vw - 30px)); padding: 11px 14px; transform: translateY(14px); border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-3); color: var(--text); box-shadow: var(--shadow); opacity: 0; pointer-events: none; font-size: 10px; transition: opacity .18s ease, transform .18s ease; }
.toast.visible { transform: translateY(0); opacity: 1; }
.toast.error-toast { border-color: rgba(236,141,145,.35); color: var(--red); }

@media (min-width: 1500px) { .content-wrap { padding-top: 39px; } }
@media (max-width: 1150px) {
  .sidebar { width: 220px; padding-right: 13px; padding-left: 13px; }
  .main-content { width: calc(100% - 220px); margin-left: 220px; }
  .overview-grid { grid-template-columns: minmax(0,1.4fr) minmax(155px,.8fr) minmax(155px,.8fr); gap: 10px; }
  .balance-card { padding-right: 17px; padding-left: 18px; }
  .balance-orb { width: 60px; height: 60px; margin-right: 2px; }
  .balance-orb svg { width: 45px; }
  .stat-card { padding-right: 14px; padding-left: 14px; }
  .allowance-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 850px) {
  .sidebar { position: fixed; inset: auto 0 0; z-index: 8; display: block; width: 100%; height: calc(61px + env(safe-area-inset-bottom)); padding: 5px 5px env(safe-area-inset-bottom); border-top: 1px solid var(--line-strong); border-right: 0; background: color-mix(in srgb,var(--sidebar) 94%,transparent); backdrop-filter: blur(22px); }
  .sidebar-brand, .sidebar-label, .sidebar-spacer, .sidebar-footer, .settings-nav { display: none; }
  .primary-nav { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 1px; height: 100%; }
  .nav-item { min-width: 0; min-height: 50px; flex-direction: column; justify-content: center; gap: 3px; padding: 3px 2px; border-radius: 8px; font-size: 8px; text-align: center; }
  .nav-item.active::before { inset: 0 auto auto 50%; width: 20px; height: 2px; transform: translateX(-50%); border-radius: 0 0 4px 4px; }
  .nav-icon { width: 18px; height: 18px; }
  .nav-icon svg { width: 17px; height: 17px; }
  .mobile-settings-nav { display: flex; }
  .main-content { width: 100%; margin-left: 0; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .topbar { min-height: 72px; padding-right: 22px; padding-left: 22px; }
  .content-wrap { padding: 25px 22px 0; }
  .app-footer { padding-right: 22px; padding-bottom: 13px; padding-left: 22px; }
  .overview-grid { grid-template-columns: minmax(0,1.2fr) minmax(0,.8fr); }
  .balance-card { grid-column: 1 / -1; min-height: 176px; }
  .stat-card { min-height: 136px; }
  .dashboard-row { grid-template-columns: minmax(0,1.45fr) minmax(210px,.8fr); }
  .settings-layout { grid-template-columns: minmax(0,1.1fr) minmax(240px,.9fr); }
}
@media (max-width: 650px) {
  body { font-size: 13px; }
  .topbar { min-height: 68px; padding: 11px 16px; }
  .topbar h1 { font-size: 17px; }
  .topbar-title .eyebrow { font-size: 8px; }
  .topbar-actions { gap: 6px; }
  .month-select-wrap { height: 33px; gap: 5px; padding: 0 7px; }
  .month-select-wrap input { width: 108px; font-size: 10px; }
  .calendar-icon { font-size: 14px; }
  .icon-button { width: 33px; height: 33px; border-radius: 9px; }
  .content-wrap { padding: 20px 14px 0; }
  .welcome-row, .page-toolbar { align-items: flex-start; margin-bottom: 16px; }
  .page-intro { max-width: 430px; font-size: 10px; }
  .add-button { min-height: 33px; padding: 0 9px; font-size: 9px; }
  .overview-grid { gap: 9px; }
  .balance-card { min-height: 165px; padding: 17px 16px 13px; }
  .hero-balance { font-size: 33px; }
  .balance-orb { width: 49px; height: 49px; margin: 0; }
  .balance-orb svg { width: 37px; }
  .balance-divider { margin: 13px 0 10px; }
  .balance-bottom { font-size: 9px; }
  .balance-bottom strong { font-size: 10px; }
  .stat-card { min-height: 122px; padding: 14px 12px 12px; border-radius: 13px; }
  .stat-label { font-size: 9px; }
  .stat-icon { width: 23px; height: 23px; }
  .stat-number { margin-top: 15px; font-size: 20px; }
  .stat-foot { margin-top: 6px; font-size: 8px; }
  .dashboard-row { grid-template-columns: 1fr; gap: 9px; margin-top: 9px; }
  .chart-card, .categories-card, .recent-card, .ledger-card, .allowance-ledger-card, .forecast-chart-card { padding: 15px 14px 12px; border-radius: 14px; }
  .card-heading h2, .ledger-toolbar h2 { font-size: 12px; }
  .card-heading p { font-size: 9px; }
  .chart-container { height: 204px; }
  .chart-chip { padding: 5px 6px; font-size: 8px; }
  .category-list { max-height: 185px; margin-top: 15px; }
  .category-row { gap: 5px 9px; }
  .category-name, .category-amount { font-size: 9px; }
  .category-total { margin-top: 13px; }
  .recent-card { margin-top: 9px; }
  .recent-row { grid-template-columns: minmax(130px,1fr) minmax(72px,.5fr) 85px; gap: 8px; min-height: 49px; }
  .recent-category { display: none; }
  .app-footer { padding: 15px 14px 10px; font-size: 8px; }
  .compact-stats { gap: 8px; }
  .compact-stats .stat-card, .forecast-summary .stat-card { min-height: 108px; padding: 12px 10px; }
  .compact-stats .stat-number, .forecast-summary .stat-number { font-size: 17px; }
  .ledger-toolbar { align-items: flex-start; flex-direction: column; gap: 10px; }
  .ledger-filters { width: 100%; }
  .search-field { flex: 1; }
  .search-field input { width: 100%; }
  .ledger-filters select { flex: 0 0 auto; }
  .ledger-table { min-width: 625px; }
  .ledger-note { font-size: 8px; }
  .allowance-grid { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
  .allowance-card { min-height: 177px; padding: 13px 12px; border-radius: 13px; }
  .allowance-person { gap: 7px; }
  .person-avatar { width: 30px; height: 30px; border-radius: 10px; font-size: 12px; }
  .allowance-person strong { font-size: 10px; }
  .allowance-person small { font-size: 8px; }
  .allowance-left { margin-top: 16px; font-size: 20px; }
  .allowance-meta { font-size: 7px; }
  .pocket-row { grid-template-columns: 1fr 75px 75px 30px; gap: 7px; }
  .pocket-category { display: none; }
  .pocket-amount { font-size: 9px; }
  .forecast-summary { gap: 8px; }
  .forecast-chart { height: 225px; }
  .assumption-pill { padding: 5px 6px; font-size: 8px; }
  .forecast-disclaimer { align-items: flex-start; font-size: 8px; }
  .forecast-note-grid { margin-right: 0; margin-left: 0; }
  .settings-layout { grid-template-columns: 1fr; gap: 10px; margin-top: 14px; }
  .settings-main, .settings-side { gap: 10px; }
  .settings-card { padding: 15px; }
  .settings-heading { margin-bottom: 13px; }
  .settings-fields { grid-template-columns: 1fr minmax(120px,.72fr); gap: 8px 12px; }
  .field-label { font-size: 9px; }
  .add-inline-form input { width: 50px; }
  .add-inline-form select { width: 100px; }
  .login-card { padding: 24px 20px; }
  .login-brand { margin-bottom: 31px; }
  .login-copy h1 { font-size: 22px; }
  .modal-card { padding: 17px; }
  .toast { right: 12px; bottom: calc(75px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  .topbar-actions { gap: 4px; }
  .month-select-wrap input { width: 93px; }
  .logout-button { display: none; }
  .overview-grid { grid-template-columns: 1fr 1fr; }
  .stat-number { font-size: 18px; }
  .forecast-summary .stat-number { font-size: 15px; }
  .nav-item { font-size: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
