:root {
  color-scheme: light;
  --ink: #0b1220;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --canvas: #f3f6f9;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #ccfbf1;
  --income: #047857;
  --income-soft: #d1fae5;
  --danger: #b91c1c;
  --shadow: 0 16px 42px rgb(15 23 42 / 7%);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); font-size: 16px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; min-height: 70px; padding: 0 5vw; border-bottom: 1px solid rgb(226 232 240 / 85%);
  background: rgb(255 255 255 / 92%); backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; font-size: 1.08rem; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { display: block; width: 36px; height: 36px; border-radius: 10px; }
.desktop-nav { display: flex; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.desktop-nav a { padding: 7px 14px; border-radius: 9px; color: var(--muted); font-size: .9rem; font-weight: 700; }
.desktop-nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: 0 2px 7px rgb(15 23 42 / 9%); }
.account-menu { position: relative; justify-self: end; }
.account-menu summary { display: flex; align-items: center; gap: 9px; color: #334155; cursor: pointer; font-size: .88rem; font-weight: 750; list-style: none; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: #fff; background: var(--ink); font-weight: 850; }
.account-popover { position: absolute; top: calc(100% + 12px); right: 0; display: grid; min-width: 210px; overflow: hidden; padding: 7px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 18px 50px rgb(15 23 42 / 18%); }
.account-popover a, .account-popover button { display: block; width: 100%; padding: 11px 12px; border: 0; border-radius: 9px; color: #334155; background: transparent; cursor: pointer; text-align: left; font-weight: 700; }
.account-popover a:hover, .account-popover button:hover { color: var(--ink); background: #f1f5f9; }
.account-popover form { margin: 0; border-top: 1px solid var(--line); }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 44px 0 72px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading h1 { margin: 0; font-size: clamp(1.85rem, 3vw, 2.55rem); line-height: 1.1; letter-spacing: -.045em; }
.eyebrow { margin: 0 0 5px; color: var(--brand); font-size: .75rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.muted { color: var(--muted); }
.month-switcher { display: flex; align-items: center; gap: 14px; }
.month-switcher a { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: var(--surface); }
.month-switcher a:hover { color: var(--ink); border-color: #94a3b8; }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 10px 17px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; font-weight: 800; line-height: 1.2; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--brand); box-shadow: 0 7px 18px rgb(15 118 110 / 22%); }
.button-primary:hover { background: var(--brand-dark); }
.button-income { color: #fff; background: var(--income); box-shadow: 0 7px 18px rgb(4 120 87 / 20%); }
.button-income:hover { background: #065f46; }
.button-secondary { color: var(--ink); border-color: var(--line); background: #fff; }
.button-quiet { color: var(--muted); background: transparent; }
.button-danger { color: #fff; background: var(--danger); }
.button-full { width: 100%; }
.danger-link { color: var(--danger); font-weight: 750; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 24px 18px; }
.panel-heading h2 { margin: 0; font-size: 1.2rem; letter-spacing: -.025em; }
.panel-heading a { color: var(--brand-dark); font-size: .9rem; font-weight: 800; }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.summary-card { min-height: 144px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.summary-card span { display: block; color: var(--muted); font-size: .84rem; font-weight: 700; }
.summary-card strong { display: block; margin: 13px 0 9px; font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1; letter-spacing: -.05em; }
.summary-card small { color: var(--muted); font-size: .76rem; }
.summary-main { color: #fff; border-color: #0b1220; background: var(--ink); }
.summary-main span, .summary-main small { color: #cbd5e1; }
.summary-main strong { color: #5eead4; }
.summary-main strong.balance-negative { color: #fca5a5; }
.summary-income strong, .amount-positive { color: var(--income) !important; }
.summary-empty strong { color: #94a3b8; }
.trend-up { color: #fca5a5 !important; }
.trend-down { color: #5eead4 !important; }
.quick-actions { display: flex; gap: 9px; }
.savings-callout { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 15px; margin-bottom: 18px; padding: 17px 20px; }
.savings-callout:hover { border-color: #94a3b8; transform: translateY(-1px); }
.savings-symbol { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 14px; color: var(--brand-dark); background: var(--brand-soft); font-size: 1.45rem; font-weight: 900; }
.savings-callout > span:nth-child(2) { min-width: 0; }
.savings-callout small, .savings-callout strong, .savings-callout > span:nth-child(2) > span { display: block; }
.savings-callout small, .savings-callout > span:nth-child(2) > span { color: var(--muted); font-size: .77rem; }
.savings-callout strong { margin: 2px 0; font-size: 1.02rem; }
.savings-callout b { color: var(--brand-dark); font-size: .84rem; }
.budget-callout { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 20px; margin-bottom: 14px; padding: 17px 20px; }
.budget-callout:hover { border-color: #94a3b8; transform: translateY(-1px); }
.budget-callout-copy { min-width: 0; }
.budget-callout-copy small, .budget-callout-copy strong, .budget-callout-copy > span { display: block; }
.budget-callout-copy small, .budget-callout-copy > span { color: var(--muted); font-size: .79rem; }
.budget-callout-copy strong { margin: 2px 0; font-size: 1.04rem; }
.budget-callout b { color: var(--brand-dark); font-size: .84rem; }
.budget-callout > .budget-track { grid-column: 1 / -1; }
.budget-intro { margin: -8px 0 20px; font-size: .9rem; }
.budget-overall { margin-bottom: 30px; padding: 24px; }
.budget-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.budget-card-top h2, .budget-card-top h3 { margin: 4px 0 0; font-size: clamp(1.55rem, 3vw, 2rem); letter-spacing: -.04em; }
.budget-card-top a { flex: none; color: var(--brand-dark); font-size: .85rem; font-weight: 800; }
.budget-figures { display: flex; justify-content: space-between; gap: 20px; margin: 22px 0 11px; }
.budget-figures span { display: grid; color: var(--muted); font-size: .78rem; }
.budget-figures span:last-child { text-align: right; }
.budget-figures strong { color: var(--ink); font-size: 1.12rem; }
.budget-over .budget-figures span:last-child strong { color: var(--danger); }
.budget-track { display: block; height: 11px; overflow: hidden; border-radius: 99px; background: #e2e8f0; }
.budget-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2dd4bf, #0f766e); }
.budget-fill.is-over { background: #dc2626; }
.budget-overall > small, .budget-category > small { display: block; margin-top: 9px; color: var(--muted); font-size: .76rem; }
.budget-empty-total { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; padding: 24px; }
.budget-empty-total strong, .budget-empty-total span { display: block; }
.budget-empty-total span { margin-top: 4px; color: var(--muted); font-size: .85rem; }
.budget-empty-total .button { flex: none; }
.budget-section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.budget-section-title h2 { margin: 0; font-size: 1.3rem; letter-spacing: -.03em; }
.budget-section-title > span { font-size: .8rem; }
.budget-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.budget-category { min-width: 0; padding: 20px; }
.budget-category-name { display: flex; align-items: center; gap: 8px; color: #475569; font-size: .82rem; font-weight: 800; }
.budget-category-name i { display: block; width: 10px; height: 10px; border-radius: 50%; background: var(--dot); }
.budget-empty { min-height: 220px; }
.budget-delete-action { margin: 18px 4px; text-align: right; }
.budget-tabs { display: inline-flex; gap: 4px; margin-bottom: 24px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: #eaf0f4; }
.budget-tabs a { min-width: 110px; padding: 9px 16px; border-radius: 9px; color: var(--muted); text-align: center; font-size: .86rem; font-weight: 800; }
.budget-tabs a[aria-current="page"] { color: var(--brand-dark); background: #fff; box-shadow: 0 2px 6px rgb(15 23 42 / 8%); }
.trip-card { display: block; min-width: 0; padding: 22px; }
.trip-card:hover { border-color: #94a3b8; }
.trip-card-heading { display: flex; align-items: center; justify-content: space-between; }
.trip-symbol { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: var(--brand-dark); background: var(--brand-soft); font-size: 1.5rem; }
.trip-card h2 { margin: 15px 0 3px; overflow-wrap: anywhere; font-size: 1.2rem; letter-spacing: -.03em; }
.trip-dates { margin: 7px 0 0; color: var(--muted); font-size: .8rem; }
.trip-card > small { display: block; margin-top: 9px; color: var(--muted); font-size: .77rem; }
.trip-card > b { display: block; margin-top: 17px; color: var(--brand-dark); font-size: .84rem; }
.trip-empty { min-height: 280px; }
.trip-empty > span:not(.trip-symbol) { max-width: 520px; }
.trip-detail-heading > div { min-width: 0; }
.trip-detail-heading h1 { overflow-wrap: anywhere; }
.trip-detail-heading .heading-action { flex: none; }
.trip-budget-note, .trip-breakdown { margin-bottom: 20px; }
.trip-breakdown .bar-label span { min-width: 0; overflow-wrap: anywhere; }
.trip-breakdown .bar-label strong { flex: none; }
.trip-toggle { display: flex; min-height: 72px; align-items: center; gap: 13px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #f8fafc; cursor: pointer; }
.trip-toggle:has(input:checked) { border-color: #5eead4; background: #f0fdfa; }
.trip-exclusion:has(input:checked) { border-color: #fcd34d; background: #fffbeb; }
.trip-auto-notice { display: flex; align-items: flex-start; gap: 12px; padding: 15px; border: 1px solid #99f6e4; border-radius: 13px; background: #f0fdfa; }
.trip-auto-notice > div { min-width: 0; }
.trip-auto-notice strong { display: block; color: var(--brand-dark); font-size: .88rem; }
.trip-auto-notice p { margin: 5px 0 0; color: #475569; font-size: .8rem; overflow-wrap: anywhere; }
.trip-toggle > input { flex: none; }
.trip-toggle > span:nth-child(2) { min-width: 0; flex: 1; }
.trip-toggle strong, .trip-toggle small { display: block; }
.trip-toggle strong { color: #334155; font-size: .88rem; }
.trip-toggle small { margin-top: 2px; color: var(--muted); font-size: .76rem; }
.trip-toggle-symbol { color: var(--brand); font-size: 1.5rem; }
.trip-open-toggle { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; }
.inline-link { color: var(--brand-dark); text-decoration: underline; font-weight: 750; }
.install-link { display: block; margin: 16px auto 0; color: var(--brand-dark); font-size: .83rem; font-weight: 800; text-align: center; }
.install-card { display: grid; gap: 22px; padding: 26px; }
.install-lead { display: flex; align-items: flex-start; gap: 16px; }
.install-lead img { width: 62px; height: 62px; flex: none; border-radius: 15px; }
.install-lead strong { display: block; font-size: 1.05rem; }
.install-lead p { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }
.install-steps { display: grid; gap: 15px; margin: 0; padding-left: 24px; }
.install-steps li { padding-left: 5px; }
.install-card > .button { justify-self: start; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); gap: 18px; margin-bottom: 18px; }
.category-bars { display: grid; gap: 20px; padding: 5px 24px 26px; }
.bar-label { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 8px; font-size: .87rem; }
.bar-label span { display: flex; align-items: center; gap: 9px; color: #334155; }
.bar-label i { width: 9px; height: 9px; border-radius: 50%; background: var(--dot); }
.category-bar-link { display: block; min-width: 0; margin: -8px; padding: 8px; border-radius: 10px; }
.category-bar-link:hover { background: #f1f5f9; }
.category-bar-link:focus-visible, .category-expenses-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }
.category-bar-link .bar-label span { min-width: 0; overflow-wrap: anywhere; }
.category-bar-link .bar-label strong { flex: none; }
.category-back-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 20px; color: var(--brand-dark); font-size: .84rem; font-weight: 800; }
.category-detail-heading h1 { overflow-wrap: anywhere; }
.category-month-switcher { margin-bottom: 24px; }
.category-month-switcher h2 { margin: 0; font-size: clamp(1.15rem, 3vw, 1.55rem); letter-spacing: -.035em; }
.bar-track { height: 8px; overflow: hidden; border-radius: 99px; background: #eef2f6; }
.bar-fill { min-width: 5px; height: 100%; border-radius: inherit; background: var(--bar); }
.month-chart { display: flex; height: 250px; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 40px 24px 24px; }
.month-column { position: relative; display: flex; height: 100%; flex: 1; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; }
.chart-bar { width: min(34px, 75%); min-height: 5px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, #2dd4bf, var(--brand)); }
.chart-value { position: absolute; top: -27px; display: none; padding: 4px 6px; border-radius: 6px; color: #fff; background: var(--ink); white-space: nowrap; text-transform: none; }
.month-column:hover .chart-value { display: block; }

.expense-rows { display: grid; }
.expense-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 76px; padding: 13px 24px; border-top: 1px solid var(--line); }
.expense-row:hover { background: #f8fafc; }
.category-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: var(--category); background: color-mix(in srgb, var(--category) 13%, white); font-size: .9rem; font-weight: 900; }
.movement-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; font-size: 1.15rem; font-weight: 900; }
.income-icon { color: var(--income); background: var(--income-soft); }
.expense-icon { color: #b91c1c; background: #fee2e2; }
.expense-main { min-width: 0; }
.expense-main strong, .expense-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expense-main strong { font-size: .94rem; }
.expense-main small { margin-top: 3px; color: var(--muted); font-size: .77rem; }
.expense-amount { font-size: .98rem; font-weight: 850; letter-spacing: -.02em; }
.recent-panel { overflow: hidden; }
.empty-state { display: grid; min-height: 190px; place-items: center; align-content: center; gap: 7px; padding: 26px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); }
.empty-state .button { margin-top: 10px; }

.filters { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)) auto; align-items: end; gap: 14px; padding: 18px; margin-bottom: 14px; }
.expense-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.filter-disclosure { margin-bottom: 14px; }
.filter-disclosure > summary { display: block; width: fit-content; padding: 10px 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--brand-dark); background: #fff; cursor: pointer; font-size: .84rem; font-weight: 800; }
.filter-disclosure[open] > summary { margin-bottom: 8px; }
.field { display: grid; min-width: 0; gap: 7px; }
.field label { color: #334155; font-size: .82rem; font-weight: 800; }
input, select, textarea { display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; color: var(--ink); background: #fff; outline: none; }
input[type="date"] { width: 100%; min-width: 0; -webkit-appearance: none; appearance: none; }
input[type="date"]::-webkit-date-and-time-value { min-height: 1.5em; margin: 0; text-align: left; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgb(15 118 110 / 13%); }
input[type="color"] { width: 72px; padding: 4px; }
input[type="checkbox"] { width: 20px; min-height: 20px; accent-color: var(--brand); }
.filter-actions { display: flex; gap: 5px; }
.list-summary { display: flex; align-items: center; justify-content: space-between; padding: 10px 5px; color: var(--muted); font-size: .9rem; }
.list-summary strong { color: var(--ink); font-size: 1.08rem; }
.expense-list-panel { overflow: hidden; }
.list-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 5px; color: var(--muted); font-size: .86rem; }
.pagination { display: flex; gap: 18px; }
.pagination a, .export-link { color: var(--brand-dark); font-weight: 800; }

.narrow-page { width: min(720px, 100%); margin: 0 auto; }
.stack-form { display: grid; gap: 20px; padding: 26px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field-wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.errorlist { margin: 0; padding: 0; color: var(--danger); font-size: .78rem; list-style: none; }
.form-errors { padding: 12px 14px; border: 1px solid #fecaca; border-radius: 10px; color: #991b1b; background: #fef2f2; }
.help-text { color: var(--muted); font-size: .75rem; }
.form-note { margin: -4px 0 0; padding: 12px 14px; border-radius: 10px; color: #475569; background: #f1f5f9; font-size: .8rem; }
.dialog-card { width: min(480px, 100%); margin: 8vh auto 0; padding: 34px; text-align: center; }
.dialog-card h1 { margin: 14px 0 8px; font-size: 1.65rem; }
.dialog-card p { margin: 0 0 26px; color: var(--muted); }
.danger-icon { display: grid; width: 54px; height: 54px; margin: 0 auto; place-items: center; border-radius: 50%; color: var(--danger); background: #fee2e2; font-size: 1.4rem; font-weight: 900; }
.dialog-actions { display: flex; justify-content: center; gap: 8px; }

.category-list { overflow: hidden; }
.category-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.category-item:last-child { border-bottom: 0; }
.category-item:hover { background: #f8fafc; }
.category-item strong, .category-item small { display: block; }
.category-item small { margin-top: 2px; color: var(--muted); font-size: .78rem; }
.category-expenses-link { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-width: 0; }
.category-expenses-link strong { overflow-wrap: anywhere; }
.category-total { color: var(--ink); font-size: .88rem; font-weight: 800; white-space: nowrap; }
.category-edit-link { color: var(--brand-dark); font-size: .8rem; font-weight: 800; }
.status-pill { padding: 5px 9px; border-radius: 99px; color: #64748b; background: #f1f5f9; font-size: .72rem; font-weight: 800; }
.status-pill.active { color: #047857; background: #d1fae5; }
.checkbox-field:has(input[type="checkbox"]) { grid-template-columns: 1fr auto; align-items: center; }
.checkbox-field:has(input[type="checkbox"]) .errorlist { grid-column: 1 / -1; }
.recurring-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.recurring-card { display: grid; gap: 16px; padding: 20px; }
.recurring-card:hover { transform: translateY(-1px); border-color: #94a3b8; }
.recurring-card.is-inactive { opacity: .65; }
.recurring-card-top { display: flex; align-items: center; justify-content: space-between; }
.recurring-card h2 { margin: 0 0 5px; font-size: 1rem; }
.recurring-card strong { font-size: 1.4rem; letter-spacing: -.035em; }
.recurring-card p, .recurring-card small { margin: 0; color: var(--muted); font-size: .8rem; }
.empty-actions { display: flex; gap: 8px; margin-top: 10px; }

.summary-saved strong { color: var(--income); }
.savings-explanation { margin: 0 0 18px; }
.finance-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.cash-flow-panel { margin-bottom: 20px; }
.cash-flow { margin: 0; padding: 0 24px 16px; }
.cash-flow > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 10px 0; }
.cash-flow dt { color: var(--muted); font-size: .88rem; }
.cash-flow dt small { display: block; }
.cash-flow dd { margin: 0; flex: none; font-weight: 800; }
.cash-flow-total { border-top: 1px solid var(--line); margin-top: 7px; }
.cash-flow-total dt { color: var(--ink); font-weight: 800; }
.cash-flow-total dd { color: var(--brand-dark); font-size: 1.2rem; }
.balance-negative, .cash-flow-total dd.balance-negative { color: var(--danger); }
.finance-panel-note { margin: 0; padding: 0 24px 20px; color: var(--muted); font-size: .8rem; }
.capital-summary strong { overflow-wrap: anywhere; }
.checkbox-field .help-text { grid-column: 1 / -1; }
.savings-history { overflow: hidden; }
.saving-rows { display: grid; }
.saving-row { display: grid; grid-template-columns: minmax(200px, 1fr) repeat(3, minmax(100px, auto)) auto; align-items: center; gap: 20px; min-height: 82px; padding: 15px 22px; border-top: 1px solid var(--line); }
.saving-row:hover { background: #f8fafc; }
.saving-row span strong, .saving-row span small { display: block; }
.saving-row span small { color: var(--muted); font-size: .75rem; }
.saving-row > span:not(.saving-month) strong { margin-top: 2px; font-size: .94rem; }
.saving-row > b { color: var(--brand-dark); font-size: .82rem; }
.saving-month strong { margin-bottom: 3px; font-size: .94rem; }
.savings-empty { min-height: 300px; }
.savings-empty > span:last-child { max-width: 560px; }
.saving-close-summary .summary-card { min-height: 120px; padding: 18px; }

.auth-body { display: grid; min-height: 100vh; place-items: center; background: var(--ink); }
.auth-body::before { position: fixed; inset: 0; content: ""; pointer-events: none; background: radial-gradient(circle at 15% 15%, rgb(45 212 191 / 20%), transparent 32%), radial-gradient(circle at 90% 85%, rgb(37 99 235 / 15%), transparent 35%); }
.auth-shell { position: relative; width: min(440px, calc(100% - 32px)); padding: 30px 0; }
.login-card { padding: 38px; border: 1px solid rgb(255 255 255 / 13%); border-radius: 24px; background: #fff; box-shadow: 0 30px 80px rgb(0 0 0 / 32%); }
.login-card h1 { margin: 20px 0 28px; font-size: 1.8rem; letter-spacing: -.04em; }
.login-logo { display: block; width: 52px; height: 52px; border-radius: 12px; }
.messages { position: fixed; top: 82px; right: 20px; z-index: 50; display: grid; width: min(380px, calc(100% - 40px)); gap: 8px; pointer-events: none; }
.message { padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; color: #334155; background: #fff; box-shadow: var(--shadow); font-size: .88rem; }
.message-success { border-color: #99f6e4; }
.message-error { border-color: #fecaca; }
.mobile-nav { display: none; }

@media (max-width: 900px) {
  body:not(.auth-body) { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  .topbar { grid-template-columns: 1fr auto; padding: 0 24px; }
  .desktop-nav { display: none; }
  .mobile-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; min-height: calc(68px + env(safe-area-inset-bottom)); padding: 7px 5px env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgb(255 255 255 / 97%); backdrop-filter: blur(14px); }
  .mobile-nav > a { display: grid; min-width: 0; place-items: center; gap: 2px; padding: 4px 1px; color: var(--muted); font-size: .72rem; font-weight: 750; }
  .mobile-nav > a span { font-size: 1.25rem; line-height: 1; }
  .mobile-nav a[aria-current="page"] { color: var(--brand-dark); }
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(2, 1fr); }
  .filter-actions { grid-column: 1 / -1; }
  .recurring-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .topbar { --top-safe-area: env(safe-area-inset-top, 0px); min-height: calc(62px + var(--top-safe-area)); padding: var(--top-safe-area) 16px 0; }
  .brand-mark { width: 33px; height: 33px; }
  .brand > span:last-child, .account-name { display: none; }
  .account-menu summary > span:last-child { display: none; }
  .account-popover { position: fixed; top: calc(64px + var(--top-safe-area)); right: 14px; min-width: 220px; }
  .shell { width: min(100% - 28px, 1180px); padding: 28px 0 36px; }
  .page-heading { align-items: stretch; flex-direction: column; margin-bottom: 19px; }
  .page-heading h1 { font-size: 1.75rem; }
  .dashboard-heading { align-items: stretch; }
  .quick-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .quick-actions .button, .heading-action { width: 100%; }
  .month-switcher { gap: 9px; }
  .month-switcher a { width: 32px; height: 32px; }
  .summary-grid { grid-template-columns: 1fr; gap: 10px; }
  .summary-card { min-height: 0; padding: 18px; border-radius: 15px; }
  .summary-card strong { margin: 9px 0 7px; font-size: 1.65rem; }
  .summary-card small { line-height: 1.3; }
  .panel { border-radius: 15px; }
  .panel-heading { padding: 20px 18px 15px; }
  .category-bars { padding: 5px 18px 22px; }
  .month-chart { height: 220px; padding: 34px 14px 19px; }
  .expense-row { grid-template-columns: 42px minmax(0, 1fr); min-height: 80px; gap: 5px 11px; padding: 12px 14px; }
  .category-icon { width: 39px; height: 39px; border-radius: 12px; }
  .movement-icon { width: 39px; height: 39px; border-radius: 12px; }
  .expense-main small { max-width: none; white-space: normal; }
  .expense-amount { grid-column: 2; font-size: .91rem; }
  .filter-disclosure > summary { width: 100%; padding: 12px 14px; border-radius: 12px; font-size: .88rem; }
  .filters { grid-template-columns: 1fr; padding: 14px; margin-bottom: 0; }
  .filters .field { grid-column: 1; }
  .filter-actions .button { flex: 1; }
  .list-footer { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .stack-form { padding: 20px 17px; }
  .form-actions { position: static; padding: 8px 0 0; background: none; }
  .form-actions .button { flex: 1; }
  .category-item { padding: 14px; grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .category-edit-link { justify-self: end; padding: 5px 0; }
  .status-pill { font-size: .66rem; }
  .recurring-grid { grid-template-columns: 1fr; }
  .recurring-card { gap: 13px; padding: 17px; }
  .savings-callout { grid-template-columns: auto minmax(0, 1fr); padding: 15px; }
  .savings-callout > b { grid-column: 2; }
  .saving-row { grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 16px 17px; }
  .saving-month, .saving-row > b { grid-column: 1 / -1; }
  .saving-row > b { justify-self: end; }
  .saving-close-summary { grid-template-columns: 1fr; }
  .finance-actions { display: grid; grid-template-columns: 1fr; }
  .cash-flow { padding: 0 18px 15px; }
  .finance-panel-note { padding: 0 18px 18px; }
  .budget-grid { grid-template-columns: 1fr; }
  .budget-tabs { display: flex; }
  .budget-tabs a { min-width: 0; flex: 1; }
  .trip-card { padding: 18px; }
  .budget-empty-total { align-items: stretch; flex-direction: column; padding: 18px; }
  .budget-section-title { align-items: flex-start; flex-direction: column; gap: 4px; }
  .budget-overall { padding: 18px; }
  .budget-callout { padding: 15px; }
  .install-card { padding: 19px; }
  .login-card { padding: 30px 24px; border-radius: 20px; }
  .messages { top: 70px; right: 14px; width: calc(100% - 28px); }
  .desktop-only { display: none; }
  .mobile-nav > a { font-size: .68rem; }
}

@media (max-width: 400px) {
  .empty-actions { width: 100%; flex-direction: column; }
  .mobile-nav > a { font-size: .62rem; }
  .budget-callout { grid-template-columns: 1fr; }
  .budget-callout b { justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
