:root {
  color-scheme: dark;
  --bg: #10131d;
  --panel: #181d2a;
  --panel-2: #202638;
  --panel-3: #252c40;
  --text: #f2f4fb;
  --muted: #99a1b8;
  --line: rgba(232, 237, 255, .09);
  --accent: #b7f36a;
  --accent-ink: #15210a;
  --green: #9ee16a;
  --red: #ff8e9b;
  --blue: #91b5ff;
  --purple: #c3a5ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, .22);
  --radius: 22px;
  --radius-sm: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f8;
  --panel: #ffffff;
  --panel-2: #f0f2f7;
  --panel-3: #e7ebf4;
  --text: #171b28;
  --muted: #697184;
  --line: rgba(24, 32, 53, .1);
  --accent: #b7ed72;
  --accent-ink: #1b2a11;
  --green: #27834c;
  --red: #cc485b;
  --blue: #426ec4;
  --purple: #7652b8;
  --shadow: 0 18px 45px rgba(24, 32, 53, .08);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
input, select, textarea { color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 13px; padding: 13px 14px; width: 100%; outline: none; min-height: 46px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .78; }
label { font-size: 12px; font-weight: 700; letter-spacing: .025em; color: var(--muted); margin-bottom: -5px; }
textarea { resize: vertical; min-height: 80px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.login-shell { min-height: 100svh; display: grid; place-items: center; padding: 28px 18px; overflow: hidden; position: relative; background: radial-gradient(ellipse at 50% 12%, rgba(137, 168, 92, .13), transparent 38%), var(--bg); }
.login-orb { position: absolute; width: 230px; height: 230px; border-radius: 999px; filter: blur(65px); opacity: .15; pointer-events: none; }
.orb-one { background: #b7f36a; top: -110px; right: -100px; }
.orb-two { background: #8c75fa; left: -130px; bottom: -90px; }
.login-card { z-index: 1; width: min(100%, 420px); border: 1px solid var(--line); border-radius: 28px; padding: 32px 24px 24px; background: color-mix(in srgb, var(--panel) 92%, transparent); box-shadow: var(--shadow); }
.brand-lockup { display: flex; align-items: center; gap: 14px; }
.brand-lockup.centered { justify-content: center; }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; font-weight: 900; font-size: 32px; border-radius: 18px; color: var(--accent-ink); background: var(--accent); box-shadow: 0 8px 30px color-mix(in srgb, var(--accent) 20%, transparent); }
.brand-mark.small { width: 38px; height: 38px; font-size: 24px; border-radius: 13px; flex: 0 0 auto; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; margin: 0 0 2px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 0; font-size: 32px; letter-spacing: -.06em; line-height: 1.05; }
.brand-dot { color: var(--accent); }
.login-intro { text-align: center; color: var(--muted); margin: 20px 0 26px; }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.stack-form label:not(:first-child) { margin-top: 4px; }
.button { border: 1px solid var(--line); background: var(--panel-2); padding: 12px 16px; border-radius: 13px; font-weight: 750; transition: transform .15s ease, filter .15s ease, background .15s ease; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; text-decoration: none; }
.button:active { transform: scale(.985); }
.button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.button.secondary { background: var(--panel-2); }
.button.ghost { background: transparent; }
.button.danger { background: color-mix(in srgb, var(--red) 14%, var(--panel)); color: var(--red); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.button.full { width: 100%; margin-top: 8px; }
.button.small { min-height: 36px; padding: 8px 11px; font-size: 12px; border-radius: 10px; }
.form-error { min-height: 18px; margin: 0; font-size: 12px; color: var(--red); text-align: center; }
.login-footer { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); display: flex; gap: 8px; justify-content: center; align-items: center; font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.app-shell { min-height: 100svh; padding-bottom: calc(94px + var(--safe-bottom)); }
.topbar { max-width: 980px; margin: auto; padding: calc(16px + env(safe-area-inset-top, 0px)) 18px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; position: sticky; top: 0; z-index: 15; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(18px); }
.brand-small { display: flex; align-items: center; gap: 10px; }
.brand-small strong { display: block; font-size: 18px; letter-spacing: -.045em; line-height: 1.05; }
.topbar-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-button, .avatar-button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); font-size: 20px; }
.avatar-button { background: var(--panel-2); border-radius: 50%; font-size: 16px; transform: rotate(0deg); }
.main-content { width: min(100%, 980px); margin: 0 auto; padding: 12px 16px 34px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 3px 0 18px; }
.page-heading h2 { margin: 0; font-size: clamp(22px, 5vw, 28px); letter-spacing: -.055em; line-height: 1.15; }
.page-heading p { margin: 7px 0 0; font-size: 13px; color: var(--muted); }
.eyebrow-line { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .12em; margin: 0 0 7px; text-transform: uppercase; }
.month-chip, .pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; border: 1px solid var(--line); padding: 7px 10px; color: var(--muted); font-size: 11px; background: var(--panel); }
.hero-card { background: linear-gradient(140deg, #252d3d 0%, #1d2630 56%, #26362b 100%); border: 1px solid rgba(192, 226, 152, .15); border-radius: var(--radius); padding: 22px; position: relative; overflow: hidden; margin-bottom: 14px; box-shadow: var(--shadow); }
:root[data-theme="light"] .hero-card { background: linear-gradient(140deg, #26333d 0%, #1f2933 56%, #314332 100%); color: #f6f8fc; }
.hero-card:after { content: ""; position: absolute; width: 230px; height: 230px; border-radius: 50%; border: 1px solid rgba(183, 243, 106, .12); right: -90px; top: -126px; box-shadow: 0 0 0 25px rgba(183, 243, 106, .025), 0 0 0 56px rgba(183, 243, 106, .02); pointer-events: none; }
.hero-top { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hero-label { color: #c2cbd7; font-size: 12px; }
.hero-value { margin: 10px 0 20px; font-weight: 750; font-size: clamp(31px, 8vw, 42px); line-height: 1; letter-spacing: -.055em; position: relative; z-index: 1; overflow-wrap: anywhere; }
.hero-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; position: relative; z-index: 1; }
.hero-stat { padding-top: 14px; border-top: 1px solid rgba(255,255,255,.13); }
.hero-stat .small-label { color: #c2cbd7; font-size: 11px; display: flex; gap: 6px; align-items: center; }
.hero-stat strong { display: block; margin-top: 5px; font-size: 17px; letter-spacing: -.02em; }
.income-dot, .expense-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.income-dot { background: var(--green); } .expense-dot { background: var(--red); }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.metric-card { background: var(--panel); border: 1px solid var(--line); border-radius: 17px; padding: 15px; min-width: 0; }
.metric-heading { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; gap: 8px; }
.metric-symbol { width: 28px; height: 28px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-3); font-size: 15px; }
.metric-value { margin: 10px 0 2px; font-weight: 750; font-size: clamp(19px, 4.5vw, 24px); letter-spacing: -.04em; overflow-wrap: anywhere; }
.metric-foot { color: var(--muted); font-size: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 23px 0 12px; }
.section-head h3 { font-size: 16px; letter-spacing: -.025em; margin: 0; }
.text-button { border: 0; background: transparent; color: var(--accent); font-weight: 750; font-size: 12px; padding: 8px 0 8px 8px; }
.surface { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.empty-state { padding: 26px 18px; text-align: center; color: var(--muted); }
.empty-icon { display: grid; place-items: center; margin: 0 auto 12px; width: 48px; height: 48px; border-radius: 16px; background: var(--panel-2); color: var(--accent); font-size: 23px; }
.empty-state h3 { margin: 0 0 6px; color: var(--text); font-size: 15px; }
.empty-state p { font-size: 12px; margin: 0 auto 15px; max-width: 280px; }
.transaction-list { display: flex; flex-direction: column; gap: 8px; }
.transaction-row { padding: 12px; display: flex; align-items: center; gap: 11px; background: var(--panel); border: 1px solid var(--line); border-radius: 15px; min-width: 0; }
.tx-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 13px; display: grid; place-items: center; background: var(--panel-2); font-size: 17px; }
.tx-content { flex: 1; min-width: 0; }
.tx-title { font-weight: 750; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-sub { color: var(--muted); font-size: 10px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-right { text-align: right; flex: 0 0 auto; }
.tx-amount { font-weight: 800; font-size: 13px; white-space: nowrap; }
.tx-amount.income { color: var(--green); } .tx-amount.expense { color: var(--red); }
.tx-date { color: var(--muted); font-size: 10px; margin-top: 4px; }
.tx-row-actions { display: flex; gap: 4px; margin-top: 5px; justify-content: flex-end; }
.mini-action { border: 0; background: transparent; color: var(--muted); padding: 2px 4px; font-size: 11px; }
.mini-action:hover { color: var(--accent); }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.filter-row input, .filter-row select { min-height: 42px; padding: 10px 12px; font-size: 12px; }
.report-card { padding: 17px; margin-bottom: 12px; }
.report-summary { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin: 12px 0 18px; }
.report-sum-item { background: var(--panel-2); padding: 12px 9px; border-radius: 12px; min-width: 0; }
.report-sum-item span { display: block; font-size: 10px; color: var(--muted); }
.report-sum-item strong { display: block; margin-top: 5px; font-size: 13px; overflow-wrap: anywhere; }
.category-bars { display: flex; flex-direction: column; gap: 15px; }
.category-bar-header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 12px; margin-bottom: 7px; }
.category-bar-header strong { font-size: 12px; }
.bar-track { width: 100%; height: 7px; background: var(--panel-3); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #86d7b7); min-width: 2px; }
.insight-card { display: flex; gap: 12px; align-items: flex-start; padding: 15px; border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line)); background: color-mix(in srgb, var(--accent) 5%, var(--panel)); border-radius: 16px; margin-top: 12px; }
.insight-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; background: color-mix(in srgb, var(--accent) 14%, transparent); }
.insight-card h3 { font-size: 13px; margin: 0 0 5px; }
.insight-card p { font-size: 11px; color: var(--muted); margin: 0; }
.settings-group { margin: 15px 0 22px; }
.settings-group h3 { font-size: 14px; margin: 0 0 10px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: 0; }
.settings-row-main { min-width: 0; flex: 1; }
.settings-row-main strong { display: block; font-size: 13px; }
.settings-row-main span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.settings-row-actions { display: flex; gap: 5px; flex: 0 0 auto; }
.category-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); padding: 4px 8px; border-radius: 999px; font-size: 10px; margin: 3px 3px 0 0; }
.inline-form { padding: 15px; display: grid; gap: 11px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; gap: 8px; }
.form-actions > * { flex: 1; }
.field-hint { color: var(--muted); font-size: 10px; margin: -3px 0 0; }
.archive-callout { display: flex; gap: 13px; padding: 16px; margin-bottom: 12px; }
.archive-callout .callout-icon { width: 43px; height: 43px; border-radius: 14px; display: grid; place-items: center; background: var(--panel-2); color: var(--accent); font-size: 20px; flex: 0 0 auto; }
.archive-callout h3 { font-size: 13px; margin: 0 0 5px; }
.archive-callout p { color: var(--muted); font-size: 11px; margin: 0; }
.archive-list { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.archive-file { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--panel); padding: 13px; border-radius: 14px; }
.archive-file .file-icon { width: 37px; height: 37px; display: grid; place-items: center; background: var(--panel-2); border-radius: 11px; flex: 0 0 auto; }
.archive-file-main { min-width: 0; flex: 1; }
.archive-file-main strong { display: block; font-size: 12px; overflow-wrap: anywhere; }
.archive-file-main span { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.archive-report-head { background: linear-gradient(135deg, color-mix(in srgb, var(--purple) 15%, var(--panel)), var(--panel)); border: 1px solid color-mix(in srgb, var(--purple) 25%, var(--line)); border-radius: 20px; padding: 18px; margin-bottom: 12px; }
.archive-report-head .archive-lock { color: var(--purple); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.archive-report-head h2 { margin: 7px 0; font-size: 25px; letter-spacing: -.05em; }
.archive-report-head p { color: var(--muted); font-size: 11px; margin: 0; }
.warning-box { display: flex; gap: 10px; padding: 12px; background: color-mix(in srgb, var(--red) 7%, var(--panel)); border: 1px solid color-mix(in srgb, var(--red) 24%, var(--line)); border-radius: 13px; color: var(--muted); font-size: 11px; }
.warning-box strong { color: var(--red); }
.floating-add { position: fixed; z-index: 20; right: 18px; bottom: calc(90px + var(--safe-bottom)); border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 13px 17px; box-shadow: 0 8px 30px color-mix(in srgb, var(--accent) 18%, transparent); display: inline-flex; align-items: center; gap: 8px; font-weight: 850; }
.floating-add span:first-child { font-size: 20px; line-height: 15px; }
.bottom-nav { position: fixed; z-index: 18; left: 0; right: 0; bottom: 0; padding: 8px 8px calc(8px + var(--safe-bottom)); display: grid; grid-template-columns: repeat(5, 1fr); background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.nav-item { border: 0; background: transparent; color: var(--muted); border-radius: 13px; padding: 6px 2px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 9px; font-weight: 650; min-width: 0; }
.nav-icon { display: grid; place-items: center; width: 30px; height: 25px; font-size: 20px; line-height: 1; border-radius: 9px; }
.nav-item.active { color: var(--accent); }
.nav-item.active .nav-icon { background: color-mix(in srgb, var(--accent) 13%, transparent); }
.modal-backdrop { position: fixed; z-index: 50; inset: 0; padding: 16px; display: grid; place-items: end center; background: rgba(3, 5, 10, .65); backdrop-filter: blur(8px); }
.modal { width: min(100%, 540px); max-height: min(90svh, 850px); overflow-y: auto; border-radius: 24px 24px 18px 18px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); padding: 20px; animation: modal-in .18s ease-out; }
@keyframes modal-in { from { transform: translateY(16px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 21px; letter-spacing: -.045em; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.modal-close { border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; width: 34px; height: 34px; flex: 0 0 auto; }
.modal-form { display: flex; flex-direction: column; gap: 11px; }
.modal-form .form-actions { margin-top: 5px; }
.step-list { display: flex; flex-direction: column; gap: 10px; margin: 15px 0; }
.step { display: flex; align-items: flex-start; gap: 10px; font-size: 12px; color: var(--muted); }
.step-number { display: grid; place-items: center; background: var(--panel-3); color: var(--accent); border-radius: 9px; width: 25px; height: 25px; flex: 0 0 auto; font-weight: 800; }
.verified-panel { padding: 13px; border-radius: 13px; background: color-mix(in srgb, var(--green) 9%, var(--panel)); border: 1px solid color-mix(in srgb, var(--green) 25%, var(--line)); font-size: 12px; color: var(--green); }
.verified-panel.error { color: var(--red); background: color-mix(in srgb, var(--red) 8%, var(--panel)); border-color: color-mix(in srgb, var(--red) 25%, var(--line)); }
.toast { position: fixed; z-index: 80; left: 16px; right: 16px; bottom: calc(102px + var(--safe-bottom)); margin: auto; width: max-content; max-width: min(460px, calc(100vw - 32px)); background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 13px; font-size: 12px; font-weight: 700; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.page-spacer { height: 8px; }
.small-muted { color: var(--muted); font-size: 11px; }
.inline-amount { max-width: 140px; text-align: right; }
.balance-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.balance-line + .balance-line { border-top: 1px solid var(--line); }
.balance-line span { font-size: 12px; color: var(--muted); }
.balance-line strong { font-size: 13px; }
#mainView:focus { outline: none; }
@media (min-width: 700px) {
  .main-content { padding: 18px 26px 45px; }
  .topbar { padding-left: 26px; padding-right: 26px; }
  .bottom-nav { left: 50%; right: auto; transform: translateX(-50%); width: min(620px, calc(100% - 32px)); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; }
  .floating-add { right: max(26px, calc((100vw - 928px) / 2)); bottom: 100px; }
  .hero-card { padding: 27px; }
  .metric-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .overview-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; align-items: start; }
  .overview-grid .section-head:first-child { margin-top: 0; }
  .modal-backdrop { place-items: center; }
  .modal { border-radius: 24px; }
  .report-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
}
@media (max-width: 365px) {
  .main-content { padding-left: 12px; padding-right: 12px; }
  .metric-card { padding: 12px; }
  .metric-value { font-size: 19px; }
  .hero-card { padding: 18px; }
  .fab-label { display: none; }
  .floating-add { width: 52px; height: 52px; justify-content: center; padding: 0; }
  .floating-add span:first-child { font-size: 25px; }
}
