[hidden] { display: none !important; }
:root {
  --fondo: #f4f6f5; --tarjeta: #fff; --texto: #17201e; --suave: #5f6b68; --borde: #e2e7e5;
  --marca: #0f766e; --marca-suave: #d7efec; --gasto: #c2410c; --gasto-suave: #fde8dc;
  --ingreso: #15803d; --ingreso-suave: #dcf3e3; --ahorro: #6d28d9; --ahorro-suave: #ece4fb;
  --sombra: 0 1px 2px rgb(0 0 0 / .06), 0 4px 14px rgb(0 0 0 / .05);
  --radio: 16px; --nav: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0f1413; --tarjeta: #182120; --texto: #e8eeec; --suave: #9aa8a4; --borde: #2a3533;
    --marca: #2dd4bf; --marca-suave: #123a36; --gasto: #fb923c; --gasto-suave: #3a2216;
    --ingreso: #4ade80; --ingreso-suave: #15301f; --ahorro: #a78bfa; --ahorro-suave: #261d3d;
    --sombra: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fondo); color: var(--texto); }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.cargando { display: grid; place-items: center; min-height: 100vh; color: var(--suave); }

/* Estructura */
.pantalla { max-width: 640px; margin: 0 auto; padding: 12px 16px calc(var(--nav) + 90px + env(safe-area-inset-bottom)); }
.cabecera { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 0 8px; }
.cabecera h1 { font-size: 22px; margin: 0; flex: 1; }
.icono-btn { border: 0; background: var(--tarjeta); width: 42px; height: 42px; border-radius: 50%; box-shadow: var(--sombra); font-size: 20px; display: grid; place-items: center; }
.selector-mes { display: flex; align-items: center; justify-content: space-between; background: var(--tarjeta); border-radius: 999px; padding: 4px; box-shadow: var(--sombra); margin-bottom: 14px; }
.selector-mes button { border: 0; background: none; width: 44px; height: 40px; border-radius: 999px; font-size: 22px; }
.selector-mes button:active { background: var(--fondo); }
.selector-mes strong { font-weight: 700; }

.tarjeta { background: var(--tarjeta); border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra); margin-bottom: 14px; }
.tarjeta h2 { font-size: 15px; margin: 0 0 12px; color: var(--suave); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.tarjeta h2 a, .enlace { color: var(--marca); text-decoration: none; font-weight: 600; font-size: 14px; background: none; border: 0; padding: 0; }

.saldo { text-align: center; padding: 20px 16px; }
.saldo .etiqueta { color: var(--suave); font-size: 14px; }
.saldo .numero { font-size: 36px; font-weight: 750; letter-spacing: -.5px; margin: 2px 0 14px; }
.tres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini { border-radius: 12px; padding: 10px 6px; }
.mini span { display: block; font-size: 12px; color: var(--suave); }
.mini b { font-size: 15px; }
.mini.ingreso { background: var(--ingreso-suave); } .mini.ingreso b { color: var(--ingreso); }
.mini.gasto { background: var(--gasto-suave); } .mini.gasto b { color: var(--gasto); }
.mini.ahorro { background: var(--ahorro-suave); } .mini.ahorro b { color: var(--ahorro); }
.negativo { color: var(--gasto); } .positivo { color: var(--ingreso); }

/* Listas */
.lista { list-style: none; margin: 0; padding: 0; }
.fila { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--borde); }
.fila:last-child { border-bottom: 0; }
.fila.tocable { cursor: pointer; }
.fila .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--fondo); display: grid; place-items: center; font-size: 20px; flex: none; }
.fila .medio { flex: 1; min-width: 0; }
.fila .medio b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila .medio small { color: var(--suave); font-size: 13px; }
.fila .monto { font-weight: 700; white-space: nowrap; }
.monto.gasto { color: var(--texto); } .monto.ingreso { color: var(--ingreso); } .monto.ahorro { color: var(--ahorro); }
.dia { font-size: 13px; color: var(--suave); font-weight: 600; margin: 16px 4px 4px; text-transform: capitalize; }
.vacio { color: var(--suave); text-align: center; padding: 18px 8px; }
.pagar { border: 0; background: var(--marca-suave); color: var(--marca); font-weight: 700; border-radius: 999px; padding: 8px 14px; font-size: 14px; }
.pagado { color: var(--ingreso); font-weight: 700; font-size: 14px; }

/* Barras */
.barra-fila { margin-bottom: 10px; }
.barra-fila .arriba { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 4px; }
.barra { height: 8px; background: var(--fondo); border-radius: 99px; overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--marca); border-radius: 99px; }
.barra.ahorro i { background: var(--ahorro); }
.grafico { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 8px; }
.grafico .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.grafico .pares { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.grafico .pares i { width: 40%; max-width: 16px; border-radius: 4px 4px 0 0; min-height: 2px; }
.grafico .pares i.ing { background: var(--ingreso); } .grafico .pares i.gas { background: var(--gasto); }
.grafico small { font-size: 12px; color: var(--suave); text-transform: capitalize; }
.grafico .col.actual small { color: var(--texto); font-weight: 700; }
.leyenda { display: flex; gap: 14px; font-size: 13px; color: var(--suave); margin-top: 8px; }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }

/* Chips y filtros */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.desliza { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
.chip { border: 1px solid var(--borde); background: var(--tarjeta); border-radius: 999px; padding: 8px 14px; font-size: 14px; white-space: nowrap; }
.chip.activo { background: var(--marca); border-color: var(--marca); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.activo { color: #062320; } }
.buscador { width: 100%; border: 1px solid var(--borde); background: var(--tarjeta); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }

/* Navegación */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--tarjeta); border-top: 1px solid var(--borde); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.nav-in { display: flex; width: 100%; max-width: 640px; }
.nav button { flex: 1; border: 0; background: none; height: var(--nav); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--suave); }
.nav button span { font-size: 22px; line-height: 1; filter: grayscale(1); opacity: .7; }
.nav button.activo { color: var(--marca); font-weight: 700; }
.nav button.activo span { filter: none; opacity: 1; }
.fab { position: fixed; right: max(18px, calc(50% - 302px)); bottom: calc(var(--nav) + 16px + env(safe-area-inset-bottom)); width: 62px; height: 62px; border-radius: 50%; border: 0; background: var(--marca); color: #fff; font-size: 34px; line-height: 1; box-shadow: 0 6px 20px rgb(15 118 110 / .4); z-index: 6; }
@media (prefers-color-scheme: dark) { .fab { color: #062320; } }

/* Hoja (formularios) */
.hoja-fondo { position: fixed; inset: 0; background: rgb(0 0 0 / .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.hoja { background: var(--tarjeta); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); animation: sube .18s ease-out; }
@keyframes sube { from { transform: translateY(40px); opacity: .4; } }
.hoja .asa { width: 40px; height: 5px; background: var(--borde); border-radius: 9px; margin: 0 auto 12px; }
.hoja h3 { margin: 0 0 14px; font-size: 19px; }
.tipo-toggle { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--fondo); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.tipo-toggle button { border: 0; background: none; padding: 10px; border-radius: 9px; font-weight: 600; color: var(--suave); }
.tipo-toggle button.activo[data-tipo=gasto] { background: var(--gasto); color: #fff; }
.tipo-toggle button.activo[data-tipo=ingreso] { background: var(--ingreso); color: #fff; }
.tipo-toggle button.activo[data-tipo=ahorro] { background: var(--ahorro); color: #fff; }
.monto-grande { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 4px 0 16px; }
.monto-grande span { font-size: 30px; color: var(--suave); }
.monto-grande input { border: 0; background: none; font-size: 42px; font-weight: 750; width: 100%; max-width: 320px; text-align: center; outline: none; }
.campo { margin-bottom: 14px; }
.campo > label { display: block; font-size: 13px; font-weight: 600; color: var(--suave); margin-bottom: 6px; }
.campo input, .campo select { width: 100%; border: 1px solid var(--borde); background: var(--fondo); border-radius: 12px; padding: 12px 14px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.boton { width: 100%; border: 0; background: var(--marca); color: #fff; border-radius: 14px; padding: 15px; font-weight: 700; font-size: 17px; }
@media (prefers-color-scheme: dark) { .boton { color: #062320; } }
.boton.secundario { background: var(--fondo); color: var(--texto); }
.boton.peligro { background: none; color: var(--gasto); }
.boton + .boton { margin-top: 8px; }
.boton:disabled { opacity: .5; }

/* Bienvenida */
.bienvenida { max-width: 420px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 16px; text-align: center; }
.bienvenida .logo { font-size: 64px; }
.bienvenida h1 { margin: 8px 0 6px; font-size: 28px; }
.bienvenida p { color: var(--suave); margin: 0 0 22px; }
.bienvenida .tarjeta { text-align: left; }
.nota { font-size: 13px; color: var(--suave); background: var(--marca-suave); padding: 10px 12px; border-radius: 12px; margin-bottom: 14px; }
.codigo { font-size: 28px; font-weight: 800; letter-spacing: 4px; text-align: center; padding: 10px; background: var(--fondo); border-radius: 12px; margin: 6px 0 10px; }

.aviso { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav) + 92px + env(safe-area-inset-bottom)); background: var(--texto); color: var(--fondo); padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 30; max-width: calc(100% - 32px); text-align: center; }
.dos .boton + .boton { margin-top: 0; }
