:root {
  --ink: #18312f;
  --muted: #6f7e7b;
  --paper: #f7f5ef;
  --card: #fffdfa;
  --line: #e6e4dc;
  --green: #153f3b;
  --green-2: #246a61;
  --mint: #d9eee7;
  --coral: #ef8067;
  --gold: #e5b859;
  --blue: #6e9fc1;
  --violet: #937fb2;
  --shadow: 0 18px 60px rgba(31, 57, 52, .09);
  --radius: 22px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 0, rgba(217, 238, 231, .7), transparent 27rem),
    radial-gradient(circle at 0 58%, rgba(239, 128, 103, .07), transparent 25rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(36, 106, 97, .2); outline-offset: 2px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.app-shell { max-width: 1240px; margin: 0 auto; padding: 0 32px 64px; }

.gate-view { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.gate-card, .onboarding-card { width: min(470px, 100%); padding: 38px; border: 1px solid rgba(24,49,47,.09); border-radius: 28px; background: rgba(255,253,250,.96); box-shadow: var(--shadow); }
.gate-logo { display: inline-grid; place-items: center; width: 52px; height: 52px; margin-bottom: 23px; border-radius: 17px; overflow: hidden; }
.gate-logo img { width: 100%; height: 100%; }
.setup-card h1, .onboarding-card h1 { margin: 0 0 13px; font: 500 36px/1 Georgia, serif; letter-spacing: -1px; }
.setup-card > p:not(.eyebrow), .onboarding-card > p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.65; }
.setup-card code { padding: 2px 6px; border-radius: 5px; background: #edf2ef; }
.gate-help { padding: 11px 13px; border-radius: 10px; color: #805137 !important; background: #fff0df; font-size: 11px !important; }
.loading-card { display: grid; justify-items: center; text-align: center; background: transparent; border: 0; box-shadow: none; }
.loading-card .gate-logo { margin-bottom: 18px; }
.loading-card p { color: var(--muted); font-size: 12px; }
.loading-spinner { width: 24px; height: 24px; border: 3px solid #d7dfdc; border-top-color: var(--green-2); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-layout { width: min(1000px, 100%); display: grid; grid-template-columns: 1.05fr .95fr; overflow: hidden; border: 1px solid rgba(24,49,47,.09); border-radius: 30px; background: var(--card); box-shadow: 0 25px 100px rgba(31,57,52,.12); }
.auth-story { min-height: 600px; padding: 55px; color: white; background: radial-gradient(circle at 20% 100%, rgba(239,128,103,.22), transparent 22rem), var(--green); }
.auth-story .eyebrow { margin-top: 54px; color: #9ad2c5; }
.auth-story h1 { margin: 0; font: 500 48px/1.05 Georgia, serif; letter-spacing: -1.8px; }
.auth-story h1 em { color: var(--coral); }
.auth-story > p:not(.eyebrow) { max-width: 390px; margin-top: 20px; color: rgba(255,255,255,.65); font-size: 14px; line-height: 1.7; }
.security-note { display: flex; gap: 12px; align-items: flex-start; margin-top: 70px; padding-top: 25px; border-top: 1px solid rgba(255,255,255,.12); }
.security-note > span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--green); background: #9ad2c5; font-weight: 900; }
.security-note strong, .security-note small { display: block; }
.security-note strong { font-size: 12px; }
.security-note small { max-width: 310px; margin-top: 5px; color: rgba(255,255,255,.57); font-size: 10px; line-height: 1.5; }
.auth-card { align-self: center; padding: 50px; }
.auth-tabs, .onboarding-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; margin-bottom: 30px; border-radius: 13px; background: #eeeee8; }
.auth-tabs button, .onboarding-tabs button { min-height: 38px; padding: 0 10px; color: var(--muted); border: 0; border-radius: 10px; background: transparent; font-size: 11px; font-weight: 750; }
.auth-tabs button.active, .onboarding-tabs button.active { color: var(--ink); background: white; box-shadow: 0 3px 12px rgba(31,57,52,.07); }
.auth-heading h2 { margin: 0 0 7px; font: 500 30px Georgia, serif; }
.auth-heading p { margin: 0 0 24px; color: var(--muted); font-size: 12px; }
.auth-card form label, .onboarding-card form label { display: block; margin-top: 14px; }
.auth-card form label > span, .onboarding-card form label > span { display: block; margin-bottom: 6px; color: #425552; font-size: 11px; font-weight: 750; }
.auth-card input, .onboarding-card input { width: 100%; height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: white; font-size: 13px; }
.auth-submit { width: 100%; margin-top: 18px; }
.form-message { min-height: 17px; margin: 12px 0 0; color: #ad4335; font-size: 11px; line-height: 1.5; }
.form-message.success { color: var(--green-2); }
.onboarding-card { text-align: center; }
.onboarding-card form { text-align: left; }
.onboarding-tabs { margin-top: 27px; }
.code-input { text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.text-button { margin-top: 18px; padding: 5px; color: var(--muted); border: 0; background: transparent; font-size: 11px; text-decoration: underline; }
.account-pill { max-width: 180px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.migration-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 20px 0 0; padding: 16px 18px; border: 1px solid #edd4a9; border-radius: 16px; background: #fff7e8; }
.migration-banner strong { display: block; font-size: 12px; }
.migration-banner p { margin: 4px 0 0; color: #796c55; font-size: 11px; }
.migration-banner > div:last-child { display: flex; gap: 8px; flex: 0 0 auto; }
.migration-banner button { min-height: 38px; font-size: 11px; }

.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(24,49,47,.1); }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: white; background: var(--green); }
.brand-mark svg { width: 28px; }
.brand-mark svg path:first-child { fill: var(--coral); stroke: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, serif; font-size: 19px; letter-spacing: -.2px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.privacy-pill, .count-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.55); font-size: 12px; font-weight: 600; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #50a978; box-shadow: 0 0 0 4px rgba(80,169,120,.12); }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: rgba(255,255,255,.65); }
.icon-button:hover { background: white; }
.icon-button svg { width: 20px; }

.welcome-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding: 54px 4px 34px; }
.eyebrow { margin: 0 0 9px; color: var(--green-2); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.welcome-row h1 { margin: 0; font: 500 clamp(38px, 5vw, 66px)/.99 Georgia, serif; letter-spacing: -2.5px; }
.welcome-row h1 span { color: var(--coral); font-style: italic; }
.intro { max-width: 550px; margin: 17px 0 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.primary-button, .secondary-button, .danger-button { min-height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 750; border: 1px solid transparent; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: white; background: var(--green); box-shadow: 0 8px 22px rgba(21,63,59,.18); }
.primary-button:hover { background: #0d322f; transform: translateY(-1px); }
.primary-button svg { width: 18px; }
.secondary-button { color: var(--ink); background: #fff; border-color: var(--line); }
.secondary-button:hover { border-color: #bdc7c3; }
.danger-button { color: white; background: #b84738; }
.desktop-entry-actions { display: flex; gap: 10px; flex: 0 0 auto; }
.desktop-add { height: 50px; padding: 0 22px; flex: 0 0 auto; }
.desktop-add svg { width: 19px; }
.income-add { color: var(--green); background: #fffdf9; }

.summary-card { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr); overflow: hidden; color: white; background: var(--green); border-radius: var(--radius); box-shadow: var(--shadow); }
.summary-main { display: flex; flex-direction: column; justify-content: center; padding: 30px 34px 27px; }
.summary-main .summary-topline { width: 100%; }
.summary-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.summary-topline p { margin: 0 0 7px; color: rgba(255,255,255,.65); font-size: 12px; font-weight: 650; }
.summary-topline h2 { margin: 0; font: 500 clamp(35px, 5vw, 50px)/1 Georgia, serif; letter-spacing: -1.4px; }
.summary-topline h2.negative { color: #ffc0b1; }
.summary-controls { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.month-picker input, .balance-person-picker select { height: 40px; padding: 0 10px; color: white; color-scheme: dark; border: 1px solid rgba(255,255,255,.17); border-radius: 11px; background: rgba(255,255,255,.08); font-size: 12px; }
.month-picker input { width: 145px; }
.balance-person-picker select { width: 160px; padding-right: 28px; }
.balance-breakdown { display: flex; gap: 9px; margin-top: 22px; }
.balance-breakdown div { min-width: 130px; padding: 10px 13px; border: 1px solid rgba(255,255,255,.1); border-radius: 11px; background: rgba(255,255,255,.06); }
.balance-breakdown span, .balance-breakdown strong { display: block; }
.balance-breakdown span { margin-bottom: 3px; color: rgba(255,255,255,.6); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.balance-breakdown strong { font-size: 14px; }
.person-totals { display: grid; background: rgba(255,255,255,.07); border-left: 1px solid rgba(255,255,255,.1); }
.person-totals article { display: flex; align-items: center; gap: 14px; padding: 22px 28px; }
.person-totals article + article { border-top: 1px solid rgba(255,255,255,.1); }
.person-totals p { margin: 0 0 4px; color: rgba(255,255,255,.64); font-size: 11px; }
.person-totals strong { font-size: 18px; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 12px; font-family: Georgia, serif; font-weight: 700; }
.avatar-one { color: var(--green); background: var(--mint); }
.avatar-two { color: #743e33; background: #f6c6ba; }
.avatar-joint { color: #67501e; background: #f5dda5; }

.dashboard-grid { display: grid; grid-template-columns: minmax(300px, .72fr) minmax(470px, 1.28fr); gap: 22px; margin-top: 22px; }
.panel { min-width: 0; border: 1px solid rgba(24,49,47,.08); border-radius: var(--radius); background: rgba(255,253,250,.92); box-shadow: 0 10px 40px rgba(31,57,52,.055); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 26px 26px 0; }
.panel-heading h2 { margin: 0; font: 500 25px/1.15 Georgia, serif; letter-spacing: -.4px; }
.analysis-select { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 750; }
.analysis-select select { height: 36px; max-width: 155px; padding: 0 28px 0 10px; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: white; font-size: 10px; }
.category-content { min-height: 390px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 25px 28px 28px; }
.donut-wrap { display: grid; place-items: center; width: 100%; }
.donut { display: grid; place-items: center; width: 188px; aspect-ratio: 1; border-radius: 50%; background: conic-gradient(var(--mint) 0 100%); transition: background .35s ease; }
.donut::before { content: ""; grid-area: 1/1; width: 126px; aspect-ratio: 1; border-radius: 50%; background: var(--card); box-shadow: inset 0 0 0 1px rgba(24,49,47,.04); }
.donut > div { z-index: 1; grid-area: 1/1; text-align: center; }
.donut strong, .donut span { display: block; }
.donut strong { font: 500 22px/1.1 Georgia, serif; }
.donut span { margin-top: 4px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.category-list { width: 100%; margin-top: 28px; }
.category-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; margin-top: 13px; font-size: 12px; }
.category-name { display: flex; align-items: center; min-width: 0; gap: 9px; }
.category-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; }
.category-amount { font-weight: 750; }
.empty-chart { text-align: center; color: var(--muted); font-size: 13px; line-height: 1.55; }

.transactions-heading { padding-bottom: 18px; }
.activity-tabs { display: flex; gap: 5px; width: fit-content; margin: 0 22px 14px; padding: 4px; border-radius: 11px; background: #f0f1ed; }
.activity-tabs button { min-height: 31px; padding: 0 15px; color: var(--muted); border: 0; border-radius: 8px; background: transparent; font-size: 10px; font-weight: 750; }
.activity-tabs button.active { color: var(--green); background: white; box-shadow: 0 2px 8px rgba(29,52,48,.08); }
.filters { display: grid; grid-template-columns: minmax(135px, 1fr) auto auto minmax(120px, auto) minmax(145px, auto); gap: 8px; padding: 0 22px 15px; }
.filters input, .filters select { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: white; font-size: 11px; }
.filters select { padding: 0 28px 0 10px; }
.search-field { position: relative; }
.search-field svg { position: absolute; top: 10px; left: 11px; width: 17px; color: #899693; }
.search-field input { padding: 0 10px 0 35px; }
.compact-filter { display: flex; align-items: center; height: 38px; padding-left: 9px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.compact-filter > span { flex: 0 0 auto; color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.compact-filter input, .compact-filter select { height: 34px; min-width: 0; padding: 0 7px; border: 0; background: transparent; font-size: 10px; }
.compact-filter input { width: 110px; }
.compact-filter select { width: 145px; }
.transaction-list { min-height: 330px; padding: 0 10px 12px; }
.transaction-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 13px; padding: 14px 12px; border-top: 1px solid var(--line); }
.category-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; font-size: 18px; }
.transaction-copy { min-width: 0; }
.transaction-copy h3 { overflow: hidden; margin: 0 0 4px; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.transaction-copy p { overflow: hidden; margin: 0; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.transaction-value { text-align: right; }
.transaction-value strong, .transaction-value span { display: block; }
.transaction-value strong { font-size: 13px; }
.transaction-value span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.transaction-item.income-record .category-icon { color: #18594d; background: #dcf2e9 !important; }
.transaction-item.income-record .transaction-value strong { color: #16705f; }
.more-button { display: grid; place-items: center; width: 31px; height: 31px; padding: 0; border: 0; border-radius: 9px; color: var(--muted); background: transparent; }
.more-button:hover { color: var(--ink); background: #f1f0eb; }
.more-button svg { width: 18px; }
.empty-state { display: grid; place-items: center; min-height: 285px; padding: 30px; text-align: center; }
.empty-state .empty-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 19px; color: var(--green-2); background: var(--mint); font-size: 27px; }
.empty-state h3 { margin: 0 0 7px; font: 500 20px Georgia, serif; }
.empty-state p { max-width: 300px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.filtered-total { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 16px 16px; padding: 14px 16px; border-top: 1px solid var(--line); border-radius: 12px; color: var(--green); background: #edf5f1; }
.filtered-total span { color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.filtered-total strong { font-size: 17px; }
.floating-add, .floating-income { display: none; }

.app-dialog, .confirm-dialog { width: min(590px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; color: var(--ink); border: 0; border-radius: 24px; background: var(--card); box-shadow: 0 25px 100px rgba(15,37,34,.3); }
.app-dialog::backdrop, .confirm-dialog::backdrop { background: rgba(14,31,29,.56); backdrop-filter: blur(5px); }
.app-dialog form { padding: 26px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.dialog-heading h2 { margin: 0; font: 500 28px Georgia, serif; }
.dialog-close { width: 38px; height: 38px; }
.amount-field { display: block; padding: 15px 18px; margin-bottom: 18px; border-radius: 16px; background: #edf5f1; }
.amount-field > span { display: block; margin-bottom: 5px; color: var(--green-2); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.amount-field div { display: flex; align-items: center; }
.amount-field b { margin-right: 8px; font: 500 28px Georgia, serif; }
.amount-field input { width: 100%; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font: 500 34px Georgia, serif; }
.income-amount-field { background: #e5f3ed; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label > span { display: flex; justify-content: space-between; margin-bottom: 6px; color: #425552; font-size: 11px; font-weight: 750; }
.form-grid label > span small { color: var(--muted); font-weight: 500; }
.full-width { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: white; font-size: 13px; }
.form-grid textarea { resize: vertical; }
.receipt-field > span { display: flex; justify-content: space-between; margin-bottom: 6px; color: #425552; font-size: 11px; font-weight: 750; }
.receipt-field > span small { color: var(--muted); font-weight: 500; }
.receipt-picker { display: flex; align-items: center; gap: 12px; min-height: 66px; padding: 11px 13px; border: 1px dashed #a8b7b2; border-radius: 12px; color: var(--ink); background: #f5f8f6; cursor: pointer; }
.receipt-picker:hover { border-color: var(--green-2); background: #eff6f3; }
.receipt-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.receipt-camera { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 auto; border-radius: 12px; background: var(--mint); font-size: 19px; }
.receipt-picker strong, .receipt-picker small { display: block; }
.receipt-picker strong { font-size: 12px; }
.receipt-picker small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.receipt-preview { display: grid; grid-template-columns: 54px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 9px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.receipt-preview img { width: 54px; height: 54px; border-radius: 9px; object-fit: cover; background: #eef1ef; }
.receipt-preview strong, .receipt-preview small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-preview strong { font-size: 11px; }
.receipt-preview small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.receipt-preview button { min-height: 35px; padding: 0 11px; font-size: 10px; }
.receipt-chip { display: inline; padding: 0; color: var(--green-2); border: 0; background: transparent; font: inherit; font-weight: 750; }
.receipt-chip:hover { text-decoration: underline; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.dialog-actions .action-spacer { flex: 1; }
.dialog-actions [hidden] { display: none; }
.settings-dialog hr { height: 1px; margin: 25px 0; border: 0; background: var(--line); }
.data-tools h3 { margin: 0 0 5px; font-size: 13px; }
.data-tools p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.household-tools { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.household-tools h3 { margin: 0 0 5px; font-size: 13px; }
.household-tools p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.invite-code-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.invite-code-row code { flex: 1; padding: 11px 13px; border: 1px dashed #aab8b4; border-radius: 10px; color: var(--green); background: #eef5f2; font-size: 15px; font-weight: 800; letter-spacing: .11em; }
.invite-code-row button { min-height: 40px; }
.account-tools { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.account-tools h3 { margin: 0 0 4px; font-size: 13px; }
.account-tools p { margin: 0; color: var(--muted); font-size: 11px; }
.account-tools button { min-height: 38px; }
.tool-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.tool-buttons .secondary-button { min-height: 38px; font-size: 11px; }
.file-button { display: inline-flex; align-items: center; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.confirm-dialog { width: min(380px, calc(100% - 28px)); text-align: center; }
.confirm-dialog form { padding: 30px; }
.warning-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 18px; color: #a74336; background: #fbe5e1; }
.warning-icon svg { width: 25px; }
.confirm-dialog h2 { margin: 0 0 8px; font: 500 24px Georgia, serif; }
.confirm-dialog p { margin: 0; color: var(--muted); font-size: 12px; }
.confirm-dialog .dialog-actions { justify-content: center; }
.receipt-dialog { width: min(760px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; color: var(--ink); border: 0; border-radius: 22px; background: #161d1c; box-shadow: 0 25px 100px rgba(15,37,34,.4); }
.receipt-dialog::backdrop { background: rgba(14,31,29,.72); backdrop-filter: blur(5px); }
.receipt-dialog-heading { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; color: white; }
.receipt-dialog-heading h2 { margin: 0; font: 500 20px Georgia, serif; }
.receipt-dialog-heading .icon-button { color: white; border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.08); }
.receipt-viewer { min-height: 300px; max-height: calc(100vh - 170px); display: grid; place-items: center; overflow: auto; background: #0e1312; }
.receipt-viewer img { max-width: 100%; max-height: calc(100vh - 180px); object-fit: contain; }
.receipt-dialog-actions { display: flex; justify-content: flex-end; padding: 12px 16px; }
.receipt-dialog-actions a { display: inline-flex; align-items: center; color: white; background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.16); text-decoration: none; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; padding: 12px 17px; border-radius: 12px; color: white; background: var(--ink); box-shadow: var(--shadow); font-size: 12px; font-weight: 700; opacity: 0; pointer-events: none; transform: translateY(10px); transition: .25s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 840px) {
  .auth-layout { grid-template-columns: 1fr; max-width: 520px; }
  .auth-story { min-height: 0; padding: 32px; }
  .auth-story .eyebrow { margin-top: 12px; }
  .auth-story h1 { font-size: 37px; }
  .auth-story > p:not(.eyebrow), .security-note { display: none; }
  .auth-card { padding: 35px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .category-content { min-height: 0; flex-direction: row; gap: 35px; }
  .category-list { margin-top: 0; }
  .summary-card { grid-template-columns: 1fr; }
  .person-totals { grid-template-columns: repeat(3, 1fr); border-top: 1px solid rgba(255,255,255,.1); border-left: 0; }
  .person-totals article + article { border-top: 0; border-left: 1px solid rgba(255,255,255,.1); }
}

@media (max-width: 600px) {
  .gate-view { padding: 14px; }
  .gate-card, .onboarding-card { padding: 26px 21px; border-radius: 22px; }
  .auth-layout { border-radius: 22px; }
  .auth-story { padding: 25px 22px; }
  .auth-story .gate-logo { width: 43px; height: 43px; margin-bottom: 5px; }
  .auth-story h1 { font-size: 32px; }
  .auth-card { padding: 28px 22px; }
  .account-pill { display: none; }
  .migration-banner { align-items: stretch; flex-direction: column; }
  .migration-banner > div:last-child button { flex: 1; }
  body { background: var(--paper); }
  .app-shell { padding: 0 15px 92px; }
  .topbar { height: 72px; }
  .brand small, .privacy-pill { display: none; }
  .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
  .welcome-row { padding: 32px 3px 24px; }
  .welcome-row h1 { font-size: 42px; letter-spacing: -1.8px; }
  .intro { font-size: 13px; }
  .desktop-entry-actions { display: none; }
  .summary-main { padding: 24px 21px; }
  .summary-topline { flex-direction: column-reverse; gap: 17px; }
  .summary-topline h2 { font-size: 40px; }
  .summary-controls { width: 100%; }
  .month-picker, .balance-person-picker { min-width: 0; flex: 1; }
  .month-picker input, .balance-person-picker select { width: 100%; }
  .person-totals article { padding: 18px 15px; }
  .person-totals strong { font-size: 14px; }
  .avatar { width: 34px; height: 34px; }
  .person-totals { grid-template-columns: 1fr 1fr; }
  .person-totals .joint-total-card { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,.1); border-left: 0; }
  .dashboard-grid { gap: 15px; margin-top: 15px; }
  .panel-heading { padding: 22px 20px 0; }
  .category-content { flex-direction: column; gap: 0; padding: 22px 22px 25px; }
  .category-panel .panel-heading { align-items: flex-end; gap: 10px; }
  .analysis-select { display: block; }
  .analysis-select > span { display: block; margin-bottom: 4px; }
  .analysis-select select { max-width: 135px; }
  .category-list { margin-top: 24px; }
  .donut { width: 170px; }
  .donut::before { width: 114px; }
  .filters { grid-template-columns: 1fr 1fr; padding: 0 14px 14px; }
  .search-field { grid-column: 1 / -1; }
  .compact-filter { min-width: 0; }
  .compact-filter input, .compact-filter select { width: 100%; }
  .transaction-list { padding: 0 5px 8px; }
  .transaction-item { grid-template-columns: auto minmax(0,1fr) auto; gap: 10px; padding: 13px 9px; }
  .transaction-item .more-button { grid-column: 3; grid-row: 2; display: none; }
  .transaction-value { grid-column: 3; grid-row: 1; }
  .floating-add { position: fixed; z-index: 10; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); display: grid; place-items: center; width: 58px; height: 58px; padding: 0; border: 0; border-radius: 19px; color: white; background: var(--coral); box-shadow: 0 12px 28px rgba(199,87,64,.35); }
  .floating-add svg { width: 25px; }
  .floating-income { position: fixed; z-index: 10; right: 88px; bottom: calc(25px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 5px; min-height: 46px; padding: 0 14px; color: white; border: 0; border-radius: 15px; background: var(--green); box-shadow: 0 10px 25px rgba(21,63,59,.25); font-size: 10px; font-weight: 800; }
  .floating-income svg { width: 16px; }
  .app-dialog { width: 100%; max-height: calc(100vh - 20px); margin: auto 0 0; border-radius: 24px 24px 0 0; }
  .app-dialog form { padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
  .form-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .dialog-actions { position: sticky; bottom: 0; padding-top: 12px; background: var(--card); }
  .dialog-actions button:not(.delete-expense-button):not(.delete-income-button) { flex: 1; }
  .toast { right: 15px; bottom: 90px; left: 15px; text-align: center; }
}

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