:root {
  --bg: #ECF0F2; --surface: #FFFFFF; --surface-2: #F3F6F7; --ink: #0F1B26; --muted: #5A6A77; --line: #DBE2E7;
  --brand: #0D5C63; --brand-ink: #FFFFFF; --brand-soft: #DCEEEF;
  --income: #1B7F52; --expense: #BF3743; --warn: #B8700E;
  --ok-soft: #DAF0E4; --warn-soft: #FAE9CB; --bad-soft: #F8DDE0;
  --hero: #0D5C63; --hero-ink: #FFFFFF; --hero-dim: rgba(255, 255, 255, .72); --hero-track: rgba(255, 255, 255, .2);
  --hero-fill: #E6F5F5; --hero-over: #F6B756;
  --focus: #1F7AD9;
  --font-ui: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  --nav-h: 66px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #091117; --surface: #111C24; --surface-2: #172530; --ink: #E6EEF2; --muted: #8DA1AF; --line: #22333F;
    --brand: #5CBAC1; --brand-ink: #06242A; --brand-soft: #15363B;
    --income: #4CC38A; --expense: #F27C86; --warn: #F0B04F;
    --ok-soft: #14352A; --warn-soft: #3A2D12; --bad-soft: #3B1A1F;
    --hero: #0F4047; --hero-fill: #D9F1F2; --hero-over: #F0B04F;
    --focus: #6DB3F2;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.4 var(--font-ui); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
body.has-sheet { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { flex: none; display: block; }
.muted { color: var(--muted); } .sm { font-size: 13px; } .pad { padding: 16px; }
.inc { color: var(--income); } .exp { color: var(--expense); }

#app { max-width: 560px; margin: 0 auto; }
.screen { padding: 0 16px calc(var(--nav-h) + 96px + env(safe-area-inset-bottom)); }

/* ---------- Cabecera ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 0 12px; position: sticky; top: 0; z-index: 5; background: var(--bg); }
.monthnav { display: flex; align-items: center; gap: 2px; min-width: 0; }
.top h1 { font: 700 22px/1.1 var(--font-display); letter-spacing: -.01em; min-width: 132px; text-align: center; }
.top h1.solo { text-align: left; min-width: 0; padding-left: 4px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); }
.icon-btn:active { background: var(--line); }
.icon-btn.avatar { background: var(--surface); border: 1px solid var(--line); }

/* ---------- Tarjeta principal ---------- */
.hero { background: var(--hero); color: var(--hero-ink); border-radius: 26px; padding: 22px 20px 18px; }
.hero-label { color: var(--hero-dim); font-size: 14px; font-weight: 500; }
.hero-amount { font-family: var(--font-display); font-weight: 700; letter-spacing: -.03em; line-height: 1; margin: 6px 0 20px; font-variant-numeric: tabular-nums; }
.hero-amount .int { font-size: clamp(44px, 14vw, 64px); }
.hero-amount .dec { font-size: clamp(22px, 6.5vw, 30px); font-weight: 600; color: var(--hero-dim); margin-left: 1px; }
.flow { position: relative; height: 14px; border-radius: 99px; background: var(--hero-track); }
.flow-fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--hero-fill); min-width: 0; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.flow-fill.over { background: var(--hero-over); }
.flow-goal { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; border-radius: 3px; background: var(--hero-ink); box-shadow: 0 0 0 2px var(--hero); }
.flow-cap { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 13px; color: var(--hero-dim); }
.hero.sav .hero-amount { margin-bottom: 8px; }
.hero.sav .flow-cap { margin-top: 0; }

/* ---------- Bloques ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.tiles.two { grid-template-columns: 1fr 1fr; margin-top: 0; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 12px 11px; min-width: 0; }
.tile-name { font-size: 13px; color: var(--muted); }
.tile-val { font: 700 clamp(14px, 4.1vw, 17px)/1.2 var(--font-display); margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; white-space: nowrap; }
.tiles.two .tile-val { font-size: 20px; }
.tile-sub { font-size: 12px; color: var(--muted); margin-top: 2px; min-height: 1.3em; }
.block { margin-top: 24px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; padding: 0 2px; }
.block-head h2 { font: 700 18px/1.2 var(--font-display); letter-spacing: -.01em; }
.block-note { font-size: 13px; color: var(--muted); margin: -4px 2px 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.card.pad { padding: 16px; }
.link { color: var(--brand); font-weight: 600; padding: 6px 4px; }
.link.sm { font-size: 14px; }

/* ---------- Chips de categoría ---------- */
.chip { width: 40px; height: 40px; flex: none; border-radius: 13px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }

/* ---------- Presupuesto ---------- */
.brow { display: flex; gap: 12px; align-items: center; width: 100%; padding: 13px 14px; text-align: left; }
button.brow:active, .tx:active { background: var(--surface-2); }
.brow + .brow { border-top: 1px solid var(--line); }
.brow-main { flex: 1; min-width: 0; display: grid; gap: 7px; }
.brow-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.brow-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow-amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.brow-amt small { font-weight: 400; color: var(--muted); font-size: 13px; }
.brow-state { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); }
.bar { display: block; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.bar.lg { height: 12px; margin: 10px 0; }
.bar.thin { height: 6px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.bar.ok i { background: var(--income); }
.bar.near i { background: var(--warn); }
.bar.over i { background: var(--expense); }
.bar.none i { background: var(--muted); }
.bar.brand i { background: var(--brand); }
.pill { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; }
.pill.ok { background: var(--ok-soft); color: var(--income); }
.pill.near { background: var(--warn-soft); color: var(--warn); }
.pill.over { background: var(--bad-soft); color: var(--expense); }
.pill.none { background: var(--surface-2); color: var(--muted); }
.sum-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.sum-big { font: 700 28px/1.1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------- Movimientos ---------- */
.tx { display: flex; gap: 12px; align-items: center; width: 100%; padding: 12px 14px; text-align: left; }
.list .tx + .tx { border-top: 1px solid var(--line); }
.tx-main { flex: 1; min-width: 0; display: grid; }
.tx-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-amt.ingreso { color: var(--income); }
.day { margin-top: 16px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px 6px; }
.day-head h3 { font-size: 14px; font-weight: 600; color: var(--muted); }
.day-head span { font-size: 13px; font-variant-numeric: tabular-nums; }
.searchbar { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; color: var(--muted); }
.searchbar input { flex: 1; min-width: 0; border: 0; background: none; padding: 12px 0; outline: none; color: var(--ink); }
.searchbar:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; }
.fchips { display: flex; gap: 8px; margin: 12px 0 2px; }
.fchip { padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 500; }
.fchip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.empty { padding: 28px 20px; text-align: center; display: grid; gap: 6px; justify-items: center; color: var(--muted); }
.empty-title { font: 700 18px var(--font-display); color: var(--ink); }
.empty .btn { margin-top: 10px; }

/* ---------- Análisis ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 9.5px; font-family: var(--font-ui); }
.chart .axis.on { fill: var(--ink); font-weight: 700; }
.chart .sel { fill: var(--surface-2); }
.chart .b-inc { fill: var(--income); }
.chart .b-exp { fill: var(--expense); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:focus-visible { stroke: var(--focus); stroke-width: 2; }
.chart .ln { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--brand); opacity: .12; }
.chart .dot { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.sw.inc { background: var(--income); } .sw.exp { background: var(--expense); }
.readout { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; }
.readout b { font-family: var(--font-display); flex-basis: 100%; }
.readout span { color: var(--muted); } .readout em { font-style: normal; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.readout em.inc { color: var(--income); } .readout em.exp { color: var(--expense); }
.cats { display: grid; gap: 14px; }
.crow { display: flex; gap: 12px; align-items: center; }
.crow-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.crow-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 15px; }
.crow-top span:last-child { font-variant-numeric: tabular-nums; }
.crow-top small { font-weight: 400; color: var(--muted); margin-left: 4px; }

/* ---------- Navegación ---------- */
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(560px, 100%); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); z-index: 10; }
.nav button { display: grid; justify-items: center; align-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.nav button.on { color: var(--brand); font-weight: 700; }
.fab { position: fixed; z-index: 11; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); right: max(16px, calc(50% - 280px + 16px)); width: 58px; height: 58px; border-radius: 20px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--brand) 70%, #000); }
.fab:active { transform: scale(.95); }

/* ---------- Botones y campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px; font-weight: 600; border: 1px solid transparent; }
.btn.block { width: 100%; }
.btn.grow { flex: 1; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.danger { background: var(--bad-soft); color: var(--expense); }
.btn.danger-ghost { background: none; border-color: var(--bad-soft); color: var(--expense); }
.btn.armed { background: var(--expense); color: #fff; border-color: var(--expense); }
.btn:disabled { opacity: .55; }
.btn:active:not(:disabled) { filter: brightness(.94); }
section > .btn.block { margin-top: 18px; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 500; color: var(--muted); }
.field input { min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; color: var(--ink); font-size: 16px; width: 100%; min-width: 0; }
.field input:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: transparent; }
.row2 { display: flex; gap: 10px; } .row2 .grow { flex: 1; min-width: 0; }
.actions { display: flex; gap: 10px; margin-top: 4px; }
.form-err { color: var(--expense); font-size: 14px; min-height: 0; }
.form-err:empty { display: none; }
.form-err.big { font-size: 16px; text-align: center; }
.form-ok { color: var(--income); font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); margin-top: -4px; }

/* ---------- Hoja inferior ---------- */
#sheet-root { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
#sheet-root.open { pointer-events: auto; }
.scrim { position: absolute; inset: 0; background: rgba(5, 12, 18, .5); opacity: 0; transition: opacity .22s; }
.open .scrim { opacity: 1; }
.sheet { position: absolute; left: 50%; bottom: 0; width: min(560px, 100%); max-height: 92dvh; display: flex; flex-direction: column; background: var(--bg); border-radius: 26px 26px 0 0; transform: translate(-50%, 100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); padding-bottom: env(safe-area-inset-bottom); }
.open .sheet { transform: translate(-50%, 0); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 4px 20px; }
.sheet-head h2 { font: 700 20px var(--font-display); }
.sheet-body { overflow-y: auto; padding: 8px 20px 20px; display: grid; gap: 14px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.seg button { min-height: 40px; border-radius: 10px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
#txform { display: grid; gap: 14px; }
#txform[data-kind=ingreso] .seg button.on { color: var(--income); }
#txform[data-kind=gasto] .seg button.on { color: var(--expense); }
.amount { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 6px 0; }
.amount input { width: 7ch; min-width: 3ch; max-width: 60%; border: 0; background: none; outline: none; text-align: right; font: 700 48px/1.1 var(--font-display); letter-spacing: -.02em; field-sizing: content; }
.amount input::placeholder { color: var(--line); }
.amount b { font: 600 30px var(--font-display); color: var(--muted); }
.cats { border: 0; margin: 0; padding: 0; min-width: 0; }
.cats legend { font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 8px; padding: 0; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.cat-opt { position: relative; display: grid; justify-items: center; gap: 6px; padding: 10px 4px 8px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; text-align: center; }
#txform[data-kind=gasto] .cat-opt[data-kind=ingreso], #txform[data-kind=ingreso] .cat-opt[data-kind=gasto] { display: none; }
.cat-opt input { position: absolute; opacity: 0; inset: 0; }
.cat-opt:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.cat-opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.cat-name { font-size: 12.5px; font-weight: 500; line-height: 1.15; overflow-wrap: anywhere; }
.budget-field { display: grid; }
#catform[data-kind=ingreso] .budget-field { display: none; }
.sep { height: 1px; background: var(--line); margin: 2px 0; }
.stack { display: grid; gap: 10px; }
.acct-line { display: flex; align-items: center; gap: 12px; }

/* ---------- Acceso y estados ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); display: grid; gap: 14px; justify-items: stretch; }
.auth-card .logo { color: var(--brand); justify-self: start; }
.auth-card h1 { font: 700 34px/1.05 var(--font-display); letter-spacing: -.02em; }
.auth-sub { color: var(--muted); margin-top: -6px; }
.auth-card form { display: grid; gap: 14px; margin-top: 6px; }
.auth-card .link { justify-self: start; }
.center-screen { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 90px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 40; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* ---------- Registro, enlaces y documentos legales ---------- */
a.btn { text-decoration: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); line-height: 1.4; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--brand); flex: none; }
.check a, .doc a { color: var(--brand); font-weight: 600; }
a.link { text-decoration: none; }
.auth-card .legal { margin-top: 6px; color: var(--muted); font-weight: 500; }
.doc { max-width: 680px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 20px 72px; line-height: 1.6; }
.doc h1 { font: 700 30px/1.1 var(--font-display); letter-spacing: -.02em; margin-bottom: 6px; }
.doc h2 { font: 700 19px/1.25 var(--font-display); margin: 30px 0 8px; }
.doc p, .doc li { color: var(--ink); }
.doc ul, .doc ol { padding-left: 20px; margin: 8px 0; }
.doc .meta { color: var(--muted); font-size: 14px; }
.doc .back { display: inline-block; margin-bottom: 18px; }
.doc .warn { background: var(--warn-soft); color: var(--warn); border-radius: 14px; padding: 12px 14px; font-weight: 600; margin: 16px 0; }

/* ---------- Donut de gastos ---------- */
.donut-card { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; align-items: center; padding: 16px; }
.donut { position: relative; width: 150px; height: 150px; }
.donut svg { width: 100%; height: 100%; display: block; overflow: visible; }
.donut .seg { fill: none; stroke-width: 5; cursor: pointer; outline: none; transition: opacity .2s, stroke-width .2s; }
.donut.has-sel .seg:not(.on) { opacity: .3; }
.donut .seg.on, .donut .seg:focus-visible { stroke-width: 6.4; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; padding: 0 28px; pointer-events: none; line-height: 1.2; }
.donut-center small { font-size: 12px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-center b { font: 700 17px/1.25 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dleg { display: grid; gap: 1px; min-width: 0; }
.dleg button { display: flex; gap: 9px; align-items: center; min-width: 0; text-align: left; padding: 5px 7px; margin: 0 -7px; border-radius: 10px; }
.dleg button.on { background: var(--surface-2); }
.dleg .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--c); }
.dleg .lg { display: grid; min-width: 0; }
.dleg .nm { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dleg .sub { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Hoy y previsión ---------- */
.ol { margin-top: 10px; display: grid; gap: 4px; }
.ol-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.ol-amt { font: 700 clamp(30px, 9.5vw, 40px)/1.05 var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--brand); }
.ol-amt.neg { color: var(--expense); }
.ol-amt.warn { color: var(--warn); font-size: clamp(24px, 7vw, 30px); }
.ol-sub { font-size: 13.5px; color: var(--muted); }
.ol-note { font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 6px 10px; margin-top: 4px; }
.ol-fc { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 6px; font-size: 14px; }
.ol-fc.muted { font-size: 13px; }
.ol-fc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ol-fc-title { font-weight: 700; font-family: var(--font-display); font-size: 15px; }
.ol-fc b { font-variant-numeric: tabular-nums; }
.ol-warn { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.ol-warn li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 8px 10px; }
.ol-warn li .ico { margin-top: 2px; }
.ol-warn li span { color: var(--ink); }

/* ---------- Gastos fijos y objetivos ---------- */
.tx.paused { opacity: .55; }
.goals .goal + .goal { border-top: 1px solid var(--line); }
.goal { padding: 4px 0 12px; }
.goal-main { display: flex; gap: 12px; align-items: center; width: 100%; padding: 13px 14px 6px; text-align: left; }
.goal-main:active { background: var(--surface-2); }
.goal-need { padding: 0 14px 0 66px; font-size: 13.5px; color: var(--muted); }
.goal-need b { color: var(--ink); font-variant-numeric: tabular-nums; }
.goal-add { margin: 10px 14px 0 66px; min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.icon-pick { border: 0; margin: 0; padding: 0; min-width: 0; }
.icon-pick legend { font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 8px; padding: 0; }
.icon-pick > div { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-pick label { position: relative; cursor: pointer; }
.icon-pick input { position: absolute; opacity: 0; inset: 0; }
.icon-pick span { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); }
.icon-pick input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.icon-pick input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.check.rep { margin-top: -2px; }
#recform { display: grid; gap: 14px; }
#recform[data-kind=ingreso] .seg button.on { color: var(--income); }
#recform[data-kind=gasto] .seg button.on { color: var(--expense); }
#recform[data-kind=gasto] .cat-opt[data-kind=ingreso], #recform[data-kind=ingreso] .cat-opt[data-kind=gasto] { display: none; }
#goalform, #contribform { display: grid; gap: 14px; }

/* ---------- Comparativa con el mes anterior ---------- */
.cmp-total { font-size: 14.5px; color: var(--muted); margin-bottom: 14px; line-height: 1.5; }
.cmp-total b { color: var(--ink); font-variant-numeric: tabular-nums; }
.delta { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }
.cmp-total .delta { margin-left: 6px; }
.delta.up { color: var(--expense); } .delta.down { color: var(--income); }
.cmp-bars { display: grid; gap: 3px; }
.cmp-vals { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Importar extracto ---------- */
.fchips { align-items: center; }
.fchip.imp { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--brand); border-color: var(--brand-soft); background: var(--brand-soft); font-weight: 600; }
.filebtn { cursor: pointer; position: relative; }
.filebtn:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.imp-sum { font-size: 15px; line-height: 1.5; }
.imp-sum b { font-size: 18px; }
.imp-cols { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px 14px; }
.imp-cols summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 14px; }
.imp-colgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 12px; }
.imp-cols .check { margin-bottom: 10px; }
select { font: inherit; color: var(--ink); min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 10px; width: 100%; min-width: 0; }
select:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }
.imp-list { display: block; }
.imp-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 10px 14px; position: relative; }
.imp-row + .imp-row { border-top: 1px solid var(--line); }
.imp-row.off { opacity: .45; }
.imp-row.unsure { background: var(--warn-soft); }
.imp-chk input { width: 22px; height: 22px; accent-color: var(--brand); margin: 0; }
.imp-main { display: grid; min-width: 0; }
.imp-desc { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-sub { font-size: 12.5px; color: var(--muted); }
.imp-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.imp-amt.ingreso { color: var(--income); }
.imp-row select { grid-column: 2 / 4; min-height: 38px; font-size: 14px; }
.imp-q { position: absolute; left: 14px; bottom: 16px; width: 22px; text-align: center; font-weight: 800; color: var(--warn); font-size: 14px; pointer-events: none; }
.sticky-cta { position: sticky; bottom: 0; box-shadow: 0 0 0 10px var(--bg); }

/* ---------- Marca Aroxi ---------- */
.brand-btn { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; margin-left: -4px; }
.brand-btn:active { background: var(--line); }
.brand-btn img { display: block; width: 34px; height: auto; }
.titlenav { display: flex; align-items: center; gap: 6px; min-width: 0; }
.top { gap: 2px; }
.auth-logo { justify-self: center; width: 190px; height: auto; margin: 2px 0 0; }
.auth-mark { justify-self: center; height: auto; }
.auth-card h1, .auth-sub { text-align: center; }
.auth-card .link { justify-self: center; }
.splash-mark { width: 96px; height: auto; }
.brand-foot { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 13px; padding-top: 4px; }

/* ---------- Bienvenida, punto de partida y deslizamiento ---------- */
.onb{position:fixed;inset:0;z-index:100;background:var(--bg,#F4F7F7);display:flex;flex-direction:column;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}
.onb-skip{align-self:flex-end;margin:12px 16px 0;background:none;border:0;color:var(--muted,#5A6E72);font:inherit;font-weight:600;padding:8px 10px}
.onb-track{flex:1;display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.onb-track::-webkit-scrollbar{display:none}
.onb-slide{flex:0 0 100%;scroll-snap-align:start;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:16px 32px}
.onb-art{width:120px;height:120px;border-radius:32px;background:#0D5C63;color:#fff;display:grid;place-items:center;margin-bottom:28px;box-shadow:0 12px 28px rgba(13,92,99,.25)}
.onb-art img{background:#fff;border-radius:14px;padding:8px;width:84px;height:auto}
.onb-slide h2{font-size:1.6rem;margin:0 0 12px;line-height:1.2}
.onb-p{font-size:1.05rem;color:var(--muted,#5A6E72);margin:0 0 8px;max-width:340px}
.onb-slide ul{list-style:none;padding:0;margin:8px 0 0;text-align:left;max-width:340px}
.onb-slide li{position:relative;padding:8px 0 8px 28px;line-height:1.4}
.onb-slide li:before{content:'';position:absolute;left:4px;top:15px;width:10px;height:10px;border-radius:50%;background:#F0801A}
.onb-foot{padding:8px 24px 24px;display:flex;flex-direction:column;gap:16px}
.onb-dots{display:flex;gap:8px;justify-content:center}
.onb-dots i{width:8px;height:8px;border-radius:99px;background:#B9C8CA;transition:all .25s}
.onb-dots i.on{width:24px;background:#0D5C63}
.start-h{font-size:1rem;margin:18px 0 6px}
.start-row{display:flex;align-items:center;gap:8px;margin:8px 0}
.start-row .start-name{flex:1;min-width:0;font-weight:600}
.start-row input{width:104px;flex:none;min-width:0;padding:10px 12px;border:1px solid var(--line,#DCE5E6);border-radius:12px;font:inherit;background:var(--surface);color:inherit;text-align:right}
.start-row input.start-name{flex:1 1 0;width:auto;text-align:left;font-weight:400}
.start-row input.day{width:56px;text-align:center}
.start-row small{color:var(--muted,#5A6E72)}
.chips-row{display:flex;flex-wrap:wrap;gap:8px;margin:6px 0 4px}
.screen.slide-next{animation:slnext .28s ease-out}.screen.slide-prev{animation:slprev .28s ease-out}
@keyframes slnext{from{opacity:.4;transform:translateX(36px)}to{opacity:1;transform:none}}
@keyframes slprev{from{opacity:.4;transform:translateX(-36px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.screen.slide-next,.screen.slide-prev{animation:none}}
.start-row .start-name{overflow-wrap:anywhere}#startform{overflow-x:hidden}
.start-row input.day{padding:10px 2px;-moz-appearance:textfield}.start-row input.day::-webkit-inner-spin-button{display:none}

/* ==========================================================================
   Tema "glassy" (Grafito + verde-azul Aroxi)
   Cristal oscuro y ahumado sobre un fondo grafito desenfocado. Siempre oscuro.
   Va al final para sobrescribir los colores claros y oscuros de arriba.
   ========================================================================== */
:root {
  --bg: #141518; --surface: rgba(28, 30, 34, .55); --surface-2: rgba(255, 255, 255, .06);
  --ink: #F2F4F6; --muted: rgba(228, 233, 238, .6); --line: rgba(255, 255, 255, .09);
  --brand: #34D399; --brand-ink: #062419; --brand-soft: rgba(52, 211, 153, .14);
  --acc1: #2FCF8F; --acc2: #2A6FD6;
  --income: #6FD9A2; --expense: #F28B8B; --warn: #F2C36B;
  --ok-soft: rgba(111, 217, 162, .14); --warn-soft: rgba(242, 195, 107, .14); --bad-soft: rgba(242, 139, 139, .14);
  --hero: transparent; --hero-ink: #FFFFFF; --hero-dim: rgba(255, 255, 255, .78); --hero-track: rgba(255, 255, 255, .22);
  --hero-fill: #FFFFFF; --hero-over: #F2C36B;
  --focus: #7CC4FF;
  --glass-blur: blur(26px) saturate(140%);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .1);
  --glass-shadow: 0 12px 28px rgba(0, 0, 0, .32);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141518; --surface: rgba(28, 30, 34, .55); --surface-2: rgba(255, 255, 255, .06);
    --ink: #F2F4F6; --muted: rgba(228, 233, 238, .6); --line: rgba(255, 255, 255, .09);
    --brand: #34D399; --brand-ink: #062419; --brand-soft: rgba(52, 211, 153, .14);
    --income: #6FD9A2; --expense: #F28B8B; --warn: #F2C36B;
    --ok-soft: rgba(111, 217, 162, .14); --warn-soft: rgba(242, 195, 107, .14); --bad-soft: rgba(242, 139, 139, .14);
    --hero: transparent; --hero-fill: #FFFFFF; --hero-over: #F2C36B; --focus: #7CC4FF;
  }
}

/* Fondo grafito: luces suaves y desenfocadas, fijas detrás de todo */
html { background: var(--bg); }
body { background: transparent; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vmax 45vmax at 85% 6%, rgba(214, 220, 230, .22), transparent 60%),
    radial-gradient(40vmax 60vmax at 6% 30%, rgba(110, 118, 128, .28), transparent 65%),
    radial-gradient(55vmax 40vmax at 50% 72%, rgba(74, 78, 84, .55), transparent 70%),
    radial-gradient(35vmax 30vmax at 92% 62%, rgba(61, 90, 72, .35), transparent 70%),
    radial-gradient(30vmax 30vmax at 20% 100%, rgba(42, 111, 214, .14), transparent 70%),
    linear-gradient(180deg, #2B2C30 0%, #1F2023 50%, #141518 100%);
}

/* Superficies de cristal */
.card, .tile, .searchbar, .fchip, .btn.ghost, .icon-btn.avatar, .cat-opt, .imp-cols, .icon-pick span, .seg {
  background: var(--surface);
  border-color: var(--line);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.card, .tile { box-shadow: var(--glass-shadow), var(--glass-hi); }
.card { border-radius: 22px; }
.tile { border-radius: 18px; }
.field input, select { background: rgba(255, 255, 255, .05); border-color: var(--line); }
.seg button.on { background: rgba(255, 255, 255, .12); box-shadow: none; }
.fchip.on { background: rgba(255, 255, 255, .9); color: #141518; border-color: transparent; }
.fchip.imp { background: var(--brand-soft); border-color: transparent; }
.bar { background: rgba(255, 255, 255, .08); box-shadow: none; }
.bar.brand i, .bar i { background: linear-gradient(90deg, var(--acc1), var(--acc2)); }
.bar.ok i { background: var(--income); }
.chip { background: color-mix(in srgb, var(--c) 18%, transparent); }
.cat-opt:has(input:checked) { background: color-mix(in srgb, var(--c) 18%, transparent); }
.icon-pick input:checked + span { background: var(--brand-soft); }

/* Cabecera translúcida */
.top {
  background: color-mix(in srgb, #141518 55%, transparent);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  margin: 0 -16px; padding-left: 16px; padding-right: 16px;
}

/* Tarjeta principal: cristal de color verde-azul */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(140deg, rgba(47, 207, 143, .72), rgba(42, 111, 214, .5));
  border: 1px solid rgba(255, 255, 255, .2);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: 0 16px 36px rgba(47, 180, 200, .28), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.flow-goal { box-shadow: 0 0 0 2px rgba(20, 60, 70, .6); }
.ol-amt { background: linear-gradient(90deg, var(--acc1), #4FA3F7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ol-amt.neg { background: none; color: var(--expense); }
.ol-amt.warn { background: none; color: var(--warn); }

/* Barra de pestañas flotante */
.nav {
  left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); width: min(536px, calc(100% - 24px));
  height: var(--nav-h); padding-bottom: 0; border-radius: 26px;
  background: rgba(28, 30, 34, .6); border: 1px solid var(--line); border-top-color: rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45);
  padding-inline: 6px;
}
.nav button { border-radius: 18px; margin: 7px 0; min-width: 0; }
.nav button.on { color: var(--ink); background: rgba(255, 255, 255, .1); }
.fab {
  bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); border-radius: 50%;
  background: linear-gradient(140deg, var(--acc1), var(--acc2)); color: #fff;
  border: 1px solid rgba(255, 255, 255, .35);
  box-shadow: 0 10px 26px rgba(47, 180, 200, .45);
}
.screen { padding-bottom: calc(var(--nav-h) + 110px + env(safe-area-inset-bottom)); }
#toast { bottom: calc(var(--nav-h) + 100px + env(safe-area-inset-bottom)); background: rgba(240, 244, 248, .92); color: #141518; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }

/* Hoja inferior */
.sheet {
  background: rgba(30, 32, 36, .82); border: 1px solid var(--line); border-bottom: 0;
  -webkit-backdrop-filter: blur(30px) saturate(140%); backdrop-filter: blur(30px) saturate(140%);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .45), var(--glass-hi);
}
.scrim { background: rgba(5, 6, 8, .55); }
.sticky-cta { box-shadow: none; }

/* Gráficos */
.chart .sel { fill: rgba(255, 255, 255, .07); }
.chart .ln { stroke: var(--acc1); }
.chart .area { fill: var(--acc1); opacity: .16; }
.chart .dot { fill: var(--acc1); stroke: #1c1e22; }
.chart .b-inc { fill: var(--income); }
.chart .b-exp { fill: var(--expense); }

/* Pantallas de acceso e introducción */
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 26px 20px; -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: var(--glass-shadow), var(--glass-hi); }
.onb { background: var(--bg); }
.onb-art { background: linear-gradient(140deg, var(--acc1), var(--acc2)); box-shadow: 0 12px 28px rgba(47, 180, 200, .3); }
.onb-slide li:before { background: var(--acc1); }
.onb-dots i { background: rgba(255, 255, 255, .25); }
.onb-dots i.on { background: var(--acc1); }
.start-row input { background: rgba(255, 255, 255, .05); border-color: var(--line); }
.doc .warn { background: var(--warn-soft); }

/* Móviles sin desenfoque: cristal más opaco para que se siga leyendo */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --surface: rgba(34, 36, 40, .94); }
  .nav { background: rgba(34, 36, 40, .97); }
  .sheet { background: #1E2024; }
}
