﻿:root {
  color-scheme: light;
  --bg: #fff; --surface: #fff; --subtle: #f7f8fc; --text: #18243d;
  --muted: #617089; --border: #e4e8f1; --blue: #365cdb; --purple: #7550ce;
  --soft-blue: #edf2ff; --soft-purple: #f3edff; --shadow: 0 16px 50px #283a6410; --error: #b4233c;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101522; --surface: #192132; --subtle: #141c2b; --text: #edf1ff;
  --muted: #aebbd2; --border: #303c53; --blue: #9ab3ff; --purple: #c1a5ff;
  --soft-blue: #233252; --soft-purple: #332849; --shadow: 0 16px 50px #0002; --error: #ff9caf;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.6; }
a { color: var(--blue); }
button, input, select { font: inherit; }
a, button { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled, fieldset:disabled button { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }
.shell { width: min(1160px, calc(100% - 64px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--border); }
.nav { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; text-decoration: none; font-size: 22px; font-weight: 750; letter-spacing: -.7px; color: var(--text); }
.brand-light { font-weight: 400; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #365cdb, #8656d7); color: #fff; width: 38px; height: 38px; margin-right: 11px; border-radius: 12px; font-size: 29px; line-height: 1; }
.brand-mark span { color: #c3b4ff; font-size: 22px; align-self: flex-end; margin-bottom: 6px; }
.nav-actions { display: flex; align-items: center; gap: 16px; }
.nav-actions form { margin: 0; }
.user-name { max-width: 160px; overflow-wrap: anywhere; font-size: 14px; color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 11px 21px; border-radius: 9px; border: 1px solid transparent; font-weight: 650; font-size: 14px; text-decoration: none; transition: background .15s, box-shadow .15s; }
.button-primary { background: #365cdb; color: #fff; box-shadow: 0 4px 10px #365cdb18; }
.button-primary:hover { background: #284ac4; }
.button-purple { background: #7550ce; color: #fff; }
.button-purple:hover { background: #6240b6; }
.button-outline { border-color: var(--border); color: var(--text); background: var(--surface); }
.button-quiet { color: var(--muted); background: transparent; padding-inline: 10px; }
.button-quiet:hover, .button-outline:hover { background: var(--subtle); }
.nav-actions a[aria-current="page"] { color: var(--blue); background: var(--soft-blue); border-color: var(--blue); font-weight: 750; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.hero { display: grid; grid-template-columns: 1.3fr 1fr; align-items: center; gap: 70px; padding: 76px 0 64px; }
.eyebrow { font-size: 12px; font-weight: 750; letter-spacing: 1.8px; color: var(--blue); margin: 0 0 15px; }
.eyebrow span { margin-right: 6px; font-size: 17px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(36px, 4.4vw, 53px); line-height: 1.13; letter-spacing: -2px; font-weight: 750; margin-bottom: 22px; }
h1 > span { color: var(--purple); }
.hero-description { font-size: 16px; line-height: 1.8; color: var(--muted); margin-bottom: 27px; }
.hero-note { display: block; font-size: 12px; color: var(--muted); margin-top: 14px; }
.overview { position: relative; border: 1px solid var(--border); border-radius: 18px; background: linear-gradient(145deg, var(--surface) 50%, var(--soft-purple)); padding: 28px 30px; box-shadow: var(--shadow); overflow: hidden; }
.overview:before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, #365cdb, #9a6be5); }
.overview-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 28px; }
.overview-heading .eyebrow { margin: 0; font-size: 12px; letter-spacing: 1.4px; }
.badge { font-size: 12px; background: var(--soft-purple); color: var(--purple); border-radius: 20px; padding: 3px 10px; }
.overview-label { font-size: 14px; color: var(--muted); margin-bottom: 2px; }
.total { font-size: 46px; font-weight: 750; letter-spacing: -2px; line-height: 1.3; margin-bottom: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.overview-caption { font-size: 12px; color: var(--muted); margin-bottom: 23px; }
.overview-stats { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); padding-top: 18px; gap: 20px; }
.overview-stats > div { display: flex; flex-direction: column; }
.overview-stats strong { font-size: 23px; line-height: 1.4; }
.overview-stats span { color: var(--muted); font-size: 14px; }
.overview-foot { font-size: 12px; color: var(--muted); margin-top: 24px; }
.overview-foot > span { color: var(--purple); margin-right: 5px; }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--soft-blue); border: 1px solid var(--border); padding: 17px 22px; border-radius: 10px; font-size: 14px; margin-bottom: 34px; }
.notice a { white-space: nowrap; font-weight: 650; }
.success { border-color: var(--blue); }
.setup { padding-top: 4px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.section-heading .eyebrow { font-size: 12px; margin-bottom: 8px; }
.section-heading h2 { font-size: 28px; letter-spacing: -.8px; line-height: 1.25; margin: 0; }
.section-heading > p { font-size: 14px; color: var(--muted); margin: 0 0 2px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: start; }
.form-grid.single-form { grid-template-columns: minmax(0, 1fr); max-width: 620px; }
.panel { border: 1px solid var(--border); border-radius: 14px; padding: 28px; background: var(--surface); box-shadow: 0 4px 20px #283a6405; }
.panel-heading { display: flex; align-items: center; gap: 14px; padding-bottom: 24px; margin-bottom: 23px; border-bottom: 1px solid var(--border); }
.panel-icon { display: inline-flex; justify-content: center; align-items: center; width: 44px; height: 44px; border-radius: 12px; font-size: 25px; flex-shrink: 0; }
.blue { background: var(--soft-blue); color: var(--blue); }
.purple { background: var(--soft-purple); color: var(--purple); }
h3 { font-size: 18px; font-weight: 650; letter-spacing: -.3px; margin-bottom: 2px; }
.panel-heading p { font-size: 14px; color: var(--muted); margin: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.field { margin-bottom: 19px; min-width: 0; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 7px; }
input, select { display: block; width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); font-size: 16px; }
input[type="hidden"] { display: none; }
select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23808da5' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input::placeholder { color: var(--muted); opacity: .8; }
input:disabled, select:disabled { background-color: var(--subtle); }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--error); }
.help-text { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.errorlist { color: var(--error); font-size: 14px; padding-left: 19px; margin: 7px 0; }
.form-tip { display: flex; align-items: center; gap: 8px; background: var(--subtle); padding: 15px; border-radius: 8px; margin: 26px 0 23px; font-size: 13px; color: var(--muted); }
.form-tip span { color: var(--blue); font-size: 21px; }
.full-width { width: 100%; }
.expense-fields { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
.field-name, .field-category, .field-account { grid-column: 1/-1; }
.inline-note { color: var(--purple); background: var(--soft-purple); padding: 10px 13px; border-radius: 7px; font-size: 14px; }
.records { margin-top: 48px; }
.checking-cashflow { margin-bottom: 26px; }
.checking-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; }
.checking-heading .field { margin-bottom: 0; max-width: 100%; }
.checking-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr)); gap: 10px; margin: 16px 0; }
.checking-totals > div { padding: 12px; border-radius: 8px; background: var(--subtle); }
.checking-totals dt { color: var(--muted); font-size: 13px; }
.checking-totals dd { margin: 0; font-size: clamp(17px, 2.2vw, 24px); font-weight: 700; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.checking-deficit { color: var(--error); }
.checking-cashflow summary { width: fit-content; cursor: pointer; font-weight: 650; padding-block: 6px; }
.checking-table { max-height: 360px; margin-top: 8px; }
.checking-table :is(th, td) { padding: 8px 11px; }
.checking-table thead th { position: sticky; top: 0; background: var(--subtle); }
.account-chips { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.account-chip { display: flex; flex-direction: column; gap: 3px; padding: 13px 20px; border: 1px solid var(--border); border-radius: 10px; overflow-wrap: anywhere; }
.account-chip strong { font-size: 14px; }
.account-chip span { font-size: 12px; color: var(--muted); }
.account-name-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.account-name-line .primary-account-badge { background: var(--soft-blue); color: var(--blue); font-weight: 650; }
.field .account-name-line { margin-bottom: 6px; }
.field .account-name-line label { margin: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; font-size: 14px; }
th, td { padding: 16px 20px; border-bottom: 1px solid var(--border); }
thead { background: var(--subtle); color: var(--muted); font-size: 14px; }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { font-weight: 600; }
.amount { text-align: right; font-variant-numeric: tabular-nums; }
.expense-actions { width: 1%; text-align: right; }
td.expense-actions .button { padding-block: 8px; }
.expense-actions .remove-expense, #reset-budget { color: var(--error); }
.empty-state { text-align: center; padding: 36px 20px; border: 1px dashed var(--border); border-radius: 12px; background: var(--subtle); }
.empty-state .panel-icon { margin-bottom: 12px; }
.empty-state p { font-size: 14px; color: var(--muted); margin-bottom: 0; }
.footer { border-top: 1px solid var(--border); margin-top: 64px; padding: 24px 0 30px; display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 12px; }
.footer > span:first-child { font-weight: 650; }
.login-panel { max-width: 460px; margin: 70px auto; }
.login-panel h1 { font-size: 32px; letter-spacing: -1px; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link:focus { display: block; padding: 12px; }
.login-panel .button { margin-top: 10px; }
@media (max-width: 900px) {
  .hero { gap: 32px; }
  .desktop-break { display: none; }
  .section-heading { align-items: start; flex-direction: column; gap: 12px; }
  .panel { padding: 22px; }
  .hero h1 { font-size: 42px; }
}
@media (max-width: 680px) {
  .shell { width: calc(100% - 36px); }
  .nav { min-height: 78px; gap: 12px; flex-wrap: wrap; padding-block: 14px; }
  .brand { font-size: 19px; }
  .brand-mark { width: 32px; height: 32px; font-size: 25px; }
  .nav-actions { gap: 4px; }
  .nav-actions .button { padding: 8px 10px; font-size: 14px; }
  .user-name { display: none; }
  .hero { grid-template-columns: 1fr; gap: 30px; padding: 40px 0; }
  .hero h1 { font-size: 42px; }
  .overview { padding: 24px; }
  .form-grid { grid-template-columns: 1fr; gap: 20px; }
  .section-heading h2 { font-size: 25px; }
  .notice { padding: 15px; align-items: flex-start; }
  .panel-heading { gap: 12px; }
  .panel-heading h3 { font-size: 17px; }
  .footer { flex-direction: column; gap: 4px; margin-top: 40px; }
  .login-panel { margin: 40px auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
/* Device-local budget controls. */
.profile-panel { margin-bottom: 26px; }
.profile-panel .help-text { font-size: 14px; margin-bottom: 18px; }
.profile-fields { display: flex; gap: 16px; align-items: end; }
.profile-fields .field { flex: 1; margin: 0; }
.owner-picker { margin-bottom: 23px; }
.owner-picker legend { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.owner-choice { display: inline-flex; align-items: center; gap: 8px; margin: 0 16px 8px 0; font-size: 14px; }
.owner-choice input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--blue); }
#account-primary-field .owner-choice { display: inline-flex; margin: 0; }
.document-status { min-width: 0; max-width: min(100%, 410px); flex: 1; line-height: 1.4; }
.document-link { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 700; }
.document-link:hover { color: var(--blue); text-decoration: underline; }
.document-link svg { flex: none; color: var(--blue); }
#document-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-status-details { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--muted); font-size: 12px; }
#document-local[data-state="saved"] { color: var(--document-saved, #21613f); }
#document-local[data-state="error"] { color: var(--error); font-weight: 700; }
#document-dirty { color: var(--document-unsaved, #805407); font-weight: 650; }
[data-theme="dark"] { --document-saved: #a2dfb8; --document-unsaved: #f7c977; }
.budget-files-panel { margin-top: 32px; }
.budget-files-panel h2, .budget-file-dialog h2 { margin-bottom: 8px; font-size: 23px; }
.budget-files-panel > p, .budget-file-privacy p, .budget-file-dialog p { font-size: 14px; }
.budget-files-panel .field { max-width: 480px; }
.budget-file-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.budget-file-actions .button { gap: 7px; }
.budget-file-management, .budget-file-privacy { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 16px; }
.budget-file-privacy p { color: var(--muted); margin-bottom: 6px; }
#budget-file-feedback { margin: 12px 0 0; }
.budget-file-dialog { width: min(540px, calc(100% - 32px)); border: 1px solid var(--border); border-radius: 14px; padding: 22px; background: var(--surface); color: var(--text); }
.budget-file-dialog::backdrop { background: #10152288; }
@media (max-width: 680px) { .document-status { flex: 1 0 100%; max-width: 100%; order: 1; padding-top: 7px; border-top: 1px solid var(--border); } }
.notice.error { border-color: var(--error); color: var(--error); }
@media (max-width: 480px) { .profile-fields { flex-direction: column; align-items: stretch; } }
.nav-actions { flex-wrap: wrap; }
