:root {
  --azul: #0147FF;
  --azul-osc: #0034BD;
  --azul-claro: #E8EEFF;
  --fondo: #F3F5FA;
  --carta: #FFFFFF;
  --texto: #0D1530;
  --suave: #5B6480;
  --linea: #E2E6F0;
  --verde: #16A34A;
  --rojo: #DC2626;
  --amarillo: #F59E0B;
  --radio: 16px;
  --sombra: 0 1px 2px rgba(13, 21, 48, .06), 0 4px 16px rgba(13, 21, 48, .05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'Arimo', system-ui, sans-serif; background: var(--fondo); color: var(--texto); -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
.ic { font-family: 'Material Symbols Rounded'; font-size: 22px; line-height: 1; font-weight: normal; font-style: normal; display: inline-block; vertical-align: middle; font-variation-settings: 'FILL' 1; }
h1, h2, h3, .num { font-family: 'Oswald', sans-serif; letter-spacing: .2px; }

/* Login */
.login { display: none; min-height: 100%; align-items: center; justify-content: center; padding: 24px 16px; background: linear-gradient(160deg, var(--azul) 0%, var(--azul-osc) 100%); }
.login.activo { display: flex; }
.login-caja { width: 100%; max-width: 380px; background: var(--carta); border-radius: 22px; padding: 28px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.login-logo { width: 56px; height: 56px; border-radius: 16px; background: var(--azul); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.login-logo img { height: 34px; }
.login h1 { font-size: 30px; margin-bottom: 6px; }
.login p { color: var(--suave); font-size: 14.5px; margin-bottom: 20px; line-height: 1.45; }
.login input { width: 100%; padding: 13px 14px; border: 1.5px solid var(--linea); border-radius: 12px; margin-bottom: 10px; font-size: 16px; }
.login input:focus { outline: none; border-color: var(--azul); }

/* App */
.app { display: none; min-height: 100%; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.app.activo { display: block; }
.barra { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); background: var(--azul); color: #fff; }
.barra-logo { height: 26px; }
.barra-titulo { font-family: 'Oswald'; font-size: 20px; font-weight: 600; flex: 1; }
.barra-quien { display: flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .16); padding: 7px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600; }
.barra-quien .punto { width: 9px; height: 9px; border-radius: 50%; }
main { max-width: 760px; margin: 0 auto; padding: 16px; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--carta); border-top: 1px solid var(--linea); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 10px; font-size: 11px; font-weight: 600; color: var(--suave); position: relative; }
.tabs button.activo { color: var(--azul); }
.tabs b { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rojo); color: #fff; font-size: 11px; display: none; align-items: center; justify-content: center; }
.tabs b.ver { display: flex; }

/* Bloques */
.carta { background: var(--carta); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; margin-bottom: 14px; }
.titulo-seccion { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 22px 2px 10px; }
.titulo-seccion h2 { font-size: 19px; }
.titulo-seccion small { color: var(--suave); font-size: 13px; }
.etiqueta { font-size: 12.5px; color: var(--suave); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.vacio { text-align: center; color: var(--suave); padding: 28px 12px; font-size: 14.5px; line-height: 1.5; }
.vacio .ic { font-size: 40px; color: #B9C2DA; display: block; margin: 0 auto 8px; }

.hero { background: linear-gradient(150deg, var(--azul) 0%, var(--azul-osc) 100%); color: #fff; border-radius: 20px; padding: 20px 18px; box-shadow: 0 10px 30px rgba(1, 71, 255, .28); margin-bottom: 14px; }
.hero .etiqueta { color: rgba(255, 255, 255, .78); }
.hero .grande { font-family: 'Oswald'; font-size: 42px; font-weight: 600; margin: 4px 0 2px; line-height: 1.1; }
.hero .sub { font-size: 13px; color: rgba(255, 255, 255, .8); }
.hero-fila { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.hero-fila div { background: rgba(255, 255, 255, .12); border-radius: 12px; padding: 10px; }
.hero-fila span { display: block; font-size: 11.5px; color: rgba(255, 255, 255, .8); margin-bottom: 3px; }
.hero-fila strong { font-family: 'Oswald'; font-size: 17px; font-weight: 600; }

.personas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.persona { background: var(--carta); border-radius: 14px; box-shadow: var(--sombra); padding: 12px; border-top: 4px solid var(--c); }
.persona .nom { font-weight: 700; font-size: 14px; }
.persona .monto { font-family: 'Oswald'; font-size: 19px; font-weight: 600; margin: 6px 0 2px; }
.persona .estado { font-size: 11.5px; color: var(--suave); }
.persona .estado.mal { color: var(--rojo); }

.alerta { display: flex; align-items: center; gap: 12px; background: #FFF4E5; border: 1.5px solid #FDD9A6; color: #7A4300; border-radius: 14px; padding: 13px 14px; margin-bottom: 14px; width: 100%; text-align: left; }
.alerta .ic { font-size: 26px; color: var(--amarillo); }
.alerta strong { display: block; font-size: 15px; }
.alerta span { font-size: 13px; }

.bolsa { margin-bottom: 14px; }
.bolsa:last-child { margin-bottom: 0; }
.bolsa-cab { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; margin-bottom: 6px; }
.bolsa-cab b { font-weight: 700; }
.bolsa-cab small { color: var(--suave); font-size: 12.5px; }
.barra-prog { height: 10px; border-radius: 6px; background: var(--fondo); overflow: hidden; }
.barra-prog i { display: block; height: 100%; border-radius: 6px; }

.meta { position: relative; }
.meta-cab { display: flex; gap: 12px; align-items: flex-start; }
.meta-ic { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.meta h3 { font-size: 18px; line-height: 1.2; }
.meta .porque { font-size: 13.5px; color: var(--suave); margin-top: 6px; line-height: 1.45; }
.meta .porque b { color: var(--texto); }
.meta-nums { display: flex; justify-content: space-between; align-items: baseline; margin: 12px 0 6px; }
.meta-nums .num { font-size: 22px; font-weight: 600; }
.meta-nums small { color: var(--suave); font-size: 13px; }
.meta-acc { display: flex; gap: 8px; margin-top: 12px; }

.filtros { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; padding: 8px 13px; border-radius: 999px; background: var(--carta); border: 1.5px solid var(--linea); font-size: 13.5px; font-weight: 600; color: var(--suave); display: inline-flex; align-items: center; gap: 6px; }
.chip.activo { background: var(--azul); border-color: var(--azul); color: #fff; }
.chip .punto { width: 8px; height: 8px; border-radius: 50%; }

.dia { font-size: 12.5px; font-weight: 700; color: var(--suave); text-transform: uppercase; letter-spacing: .5px; margin: 16px 4px 6px; }
.mov { display: flex; align-items: center; gap: 12px; background: var(--carta); padding: 12px 14px; border-radius: 14px; box-shadow: var(--sombra); margin-bottom: 8px; width: 100%; text-align: left; }
.mov-av { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; flex-shrink: 0; font-size: 14px; }
.mov-cuerpo { flex: 1; min-width: 0; }
.mov-desc { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mov-just { font-size: 12.5px; color: var(--suave); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mov-just.falta { color: var(--amarillo); font-weight: 700; }
.mov-monto { font-family: 'Oswald'; font-size: 16.5px; font-weight: 600; white-space: nowrap; }
.mas { color: var(--verde); }
.menos { color: var(--texto); }

.grafico { width: 100%; height: auto; display: block; }
.leyenda { display: flex; gap: 14px; font-size: 12.5px; color: var(--suave); margin-top: 8px; }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.tabla-mes { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla-mes td { padding: 9px 4px; border-bottom: 1px solid var(--linea); }
.tabla-mes td:last-child { text-align: right; font-family: 'Oswald'; font-size: 16px; }

.paso { display: flex; gap: 12px; margin-bottom: 12px; font-size: 14px; line-height: 1.5; }
.paso b.n { width: 26px; height: 26px; border-radius: 50%; background: var(--azul-claro); color: var(--azul); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 13px; }
.paso a { color: var(--azul); font-weight: 700; }
.cuenta-fila { display: flex; align-items: center; gap: 12px; }
.cuenta-fila .mov-cuerpo small { display: block; color: var(--suave); font-size: 12.5px; margin-top: 2px; }

/* Botones y formularios */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 16px; border-radius: 12px; font-weight: 700; font-size: 14.5px; }
.btn-primario { background: var(--azul); color: #fff; }
.btn-suave { background: var(--azul-claro); color: var(--azul); }
.btn-gris { background: var(--fondo); color: var(--texto); }
.btn-ancho { width: 100%; }
.btn-chico { padding: 8px 12px; font-size: 13.5px; border-radius: 10px; }
.campo { margin-bottom: 14px; }
.campo label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.campo label small { font-weight: 400; color: var(--suave); }
.campo input, .campo textarea, .campo select { width: 100%; padding: 12px 13px; border: 1.5px solid var(--linea); border-radius: 12px; font-size: 16px; background: #fff; }
.campo textarea { resize: vertical; min-height: 64px; }
.campo input:focus, .campo textarea:focus { outline: none; border-color: var(--azul); }
.chips-elegir { display: flex; flex-wrap: wrap; gap: 8px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(13, 21, 48, .5); display: none; align-items: flex-end; justify-content: center; }
.modal.activo { display: flex; }
.modal-caja { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--carta); border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
.modal-caja h2 { font-size: 22px; margin-bottom: 4px; }
.modal-caja .sub { color: var(--suave); font-size: 14px; margin-bottom: 16px; }
.modal-monto { font-family: 'Oswald'; font-size: 34px; font-weight: 600; margin: 4px 0 2px; }
.modal-acc { display: flex; gap: 10px; margin-top: 6px; }
.modal-acc .btn { flex: 1; }
@media (min-width: 640px) { .modal { align-items: center; } .modal-caja { border-radius: 22px; } }

#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--texto); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; opacity: 0; transition: .25s; z-index: 60; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
#toast.ver { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 380px) { .hero .grande { font-size: 36px; } .persona .monto { font-size: 17px; } }
