/* Mis Finanzas · estilos (azul marino y dorado) */
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(../fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(../fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(../fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-weight: 700; font-display: swap; src: url(../fonts/inter-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 500; font-display: swap; src: url(../fonts/space-grotesk-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 600; font-display: swap; src: url(../fonts/space-grotesk-latin-600-normal.woff2) format('woff2'); }

:root {
  color-scheme: light;
  --bg: #F4F2EE; --sup: #FFFFFF; --linea: #E6E2DA; --linea2: #EFECE6; --barra: #EFECE6;
  --tinta: #16181D; --tinta2: #3C4048; --suave: #5F6368;
  --navy: #14284B; --navy2: #1D3560; --navy3: #27406E; --sobre-navy: #C3CDE0;
  --azul: #1F4E9C; --azul-o: #173A7A; --azul-c: #E8EEF8; --azul-b: #BCCDEA;
  --oro: #E2B65A; --oro-c: #FDF6E6; --oro-o: #6E4E0C;
  --ambar: #B45309; --ambar-c: #FEF3E2; --ambar-o: #8A3C05; --ambar-b: #F3D5A8;
  --rojo: #B42318; --rojo-c: #FDECEA; --rojo-o: #8F1C13;
  --radio: 16px; --sombra: 0 6px 18px rgba(20, 40, 75, .18);
  --f-titulo: 'Space Grotesk', Inter, system-ui, sans-serif;
  --nav-h: 68px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--tinta); font: 400 15px/1.45 Inter, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
body { min-height: 100dvh; overscroll-behavior-y: contain; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--azul); }
h1, h2, h3 { margin: 0; }
.oculto-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; }

/* ---------- Estructura ---------- */
.shell { min-height: 100dvh; display: flex; }
.lateral { display: none; }
.vista { flex: 1; min-width: 0; padding: 0 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
.inferior {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 6px 4px env(safe-area-inset-bottom);
  background: var(--sup); border-top: 1px solid var(--linea);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
}
.inferior a, .lateral a { text-decoration: none; color: var(--suave); }
.inferior a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 500; min-height: 48px; border-radius: 12px; }
.inferior a[aria-current="page"] { color: var(--azul); font-weight: 600; }

@media (min-width: 900px) {
  .inferior { display: none; }
  .lateral {
    display: flex; flex-direction: column; gap: 4px; width: 232px; flex: 0 0 232px;
    position: sticky; top: 0; height: 100dvh; padding: 28px 14px; background: var(--navy); color: #fff;
  }
  .lateral .marca { font: 600 20px var(--f-titulo); padding: 0 12px 22px; color: #fff; display: flex; gap: 10px; align-items: center; }
  .lateral a { display: flex; gap: 12px; align-items: center; padding: 11px 12px; border-radius: 10px; color: var(--sobre-navy); font-size: 14px; }
  .lateral a[aria-current="page"] { background: var(--navy3); color: #fff; font-weight: 600; }
  .lateral .pie { margin-top: auto; font-size: 12px; color: var(--sobre-navy); padding: 0 12px; }
  .vista { max-width: 1120px; padding: 8px 32px 40px; }
  .rejilla { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .rejilla > .col { display: flex; flex-direction: column; gap: 12px; }
}

/* ---------- Cabecera de vista ---------- */
.cab { display: flex; align-items: center; gap: 8px; padding: 22px 0 10px; }
.cab .titulos { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cab h1 { font: 600 22px var(--f-titulo); }
.cab .sub { font-size: 13px; color: var(--suave); }
.cab .acciones { display: flex; gap: 8px; }
.icono {
  width: 44px; height: 44px; border-radius: 22px; border: 1px solid #DEDAD2; background: var(--sup);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; flex: 0 0 44px;
}
.icono.plano { border: none; background: transparent; }
.icono .burbuja { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--ambar); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* ---------- Bloques ---------- */
.pila { display: flex; flex-direction: column; gap: 12px; }
.tarjeta { background: var(--sup); border: 1px solid var(--linea); border-radius: var(--radio); padding: 16px; }
.tarjeta.sin-relleno { padding: 0; overflow: hidden; }
.tarjeta h2, .seccion-titulo { font-size: 14px; font-weight: 600; }
.seccion-titulo { padding: 6px 4px 0; color: var(--tinta2); font-size: 13px; }
.oscura { background: var(--navy); color: #fff; border: none; }
.oscura .etq { color: var(--sobre-navy); }
.dorada { background: var(--oro-c); border: 1px solid var(--oro); color: var(--oro-o); }
.ambar { background: var(--ambar-c); border: 1px solid var(--ambar-b); color: var(--ambar-o); }
.etq { font-size: 12px; color: var(--suave); }
.cifra { font: 600 20px var(--f-titulo); }
.cifra.grande { font-size: 30px; letter-spacing: -.3px; }
.dos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tres { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cuatro { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.oro { color: var(--oro); }
.positivo { color: var(--azul-o); }
.negativo { color: var(--rojo); }
.texto { margin: 0; color: var(--tinta2); }
.nota { font-size: 12px; color: var(--suave); line-height: 1.45; }
.vacio { padding: 18px 16px; color: var(--suave); font-size: 14px; text-align: center; }
a.tarjeta, button.tarjeta { display: block; text-decoration: none; color: inherit; text-align: left; width: 100%; cursor: pointer; }
a.tarjeta.fila-enlace, a.tarjeta.dos { display: flex; }
a.tarjeta.dos { display: grid; }
.fila-enlace { display: flex; align-items: center; gap: 10px; }
.fila-enlace > :first-child { flex: 1; min-width: 0; }

/* ---------- Botones ---------- */
.btn {
  min-height: 48px; padding: 0 16px; border-radius: 14px; border: 1px solid #DEDAD2; background: var(--sup);
  font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; color: var(--tinta);
}
.btn.primario { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn.dorado { background: var(--oro-c); border-color: var(--oro); color: var(--oro-o); }
.btn.peligro { background: #fff; border-color: #F0C8C3; color: var(--rojo); }
.btn.punteado { border: 1.5px dashed #9AA0A6; background: transparent; color: var(--tinta2); }
.btn.bloque { width: 100%; }
.btn.chico { min-height: 38px; font-size: 13px; padding: 0 12px; border-radius: 10px; }
.btn:disabled { opacity: .6; cursor: default; }
.fila-botones { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 12px; }
.fila-botones.iguales { grid-template-columns: 1fr 1fr; }

/* ---------- Listas ---------- */
.lista { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--linea2); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; color: inherit; text-decoration: none; min-height: 56px; }
.item:first-child { border-top: none; }
.item .medio { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .t { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .d { font-size: 12px; color: var(--suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .m { font-size: 14px; font-weight: 600; white-space: nowrap; }
.sigla { width: 36px; height: 36px; border-radius: 11px; flex: 0 0 36px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; }
.s-gasto { background: #F1EFEA; color: var(--tinta2); }
.s-voz { background: var(--azul-c); color: var(--azul-o); }
.s-auto { background: #EEEAF7; color: #4A3290; }
.s-ing { background: var(--oro-c); color: var(--oro-o); }
.s-mov { background: #F1EFEA; color: var(--tinta2); }
.chip { padding: 2px 9px; border-radius: 9px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.c-ok { background: var(--azul-c); color: var(--azul-o); }
.c-ambar { background: var(--ambar-c); color: var(--ambar-o); }
.c-rojo { background: var(--rojo-c); color: var(--rojo-o); }
.c-gris { background: #F1EFEA; color: var(--tinta2); }
.c-oro { background: var(--oro-c); color: var(--oro-o); }

/* ---------- Barras ---------- */
.barra { height: 8px; border-radius: 4px; background: var(--barra); overflow: hidden; }
.barra > i { display: block; height: 100%; border-radius: 4px; background: var(--azul); }
.barra.ambar > i { background: var(--ambar); }
.barra.rojo > i { background: var(--rojo); }
.oscura .barra { background: var(--navy3); }
.oscura .barra > i { background: var(--oro); }
.grafico { display: grid; gap: 10px; align-items: end; height: 150px; }
.grafico .col-g { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.grafico .valor { font-size: 10px; color: var(--tinta2); }
.grafico .mes { font-size: 11px; color: var(--suave); }
.grafico .pilas { width: 100%; display: flex; gap: 3px; align-items: flex-end; flex: 1; }
.grafico .pilas > i { flex: 1; border-radius: 5px 5px 0 0; display: block; min-height: 2px; }
.leyenda { display: flex; gap: 16px; font-size: 12px; color: var(--tinta2); flex-wrap: wrap; }
.leyenda i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }

/* ---------- Formularios ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > label, .campo > .etq-campo { font-size: 13px; color: var(--suave); }
.entrada, select.entrada, textarea.entrada {
  min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid #DEDAD2; background: var(--sup); width: 100%;
}
textarea.entrada { padding: 12px 14px; min-height: 80px; resize: vertical; }
.entrada:focus { border-color: var(--azul); outline: none; box-shadow: 0 0 0 3px var(--azul-c); }
.monto-grande { text-align: center; font: 600 40px var(--f-titulo); border: none; background: transparent; width: 100%; padding: 4px 0; }
.monto-grande:focus { outline: none; }
.segmentos { padding: 4px; border-radius: 14px; background: #E8E4DC; display: grid; gap: 4px; }
.segmentos button { min-height: 42px; border-radius: 10px; border: none; background: transparent; font-size: 14px; font-weight: 500; color: #4A4E55; cursor: pointer; }
.segmentos button[aria-pressed="true"] { background: var(--sup); color: var(--tinta); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.opciones { display: flex; flex-wrap: wrap; gap: 8px; }
.opciones button { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid #DEDAD2; background: var(--sup); font-size: 13px; font-weight: 500; color: var(--tinta2); cursor: pointer; }
.opciones button[aria-pressed="true"] { border-color: var(--azul); background: var(--azul-c); color: var(--azul-o); font-weight: 600; }
.casilla { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; font-size: 14px; }
.casilla input { width: 22px; height: 22px; accent-color: var(--azul); flex: 0 0 22px; }
.formulario { display: flex; flex-direction: column; gap: 14px; }
.error-campo { color: var(--rojo); font-size: 13px; }

/* ---------- Hojas modales ---------- */
.capa { position: fixed; inset: 0; z-index: 50; background: rgba(20, 40, 75, .55); display: flex; flex-direction: column; justify-content: flex-end; animation: aparecer .15s ease-out; }
.hoja { background: var(--sup); border-radius: 24px 24px 0 0; max-height: 92dvh; overflow-y: auto; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); width: 100%; max-width: 640px; margin: 0 auto; animation: subir .2s ease-out; }
.hoja.ancha { max-width: 760px; }
.tirador { width: 40px; height: 5px; border-radius: 3px; background: #DEDAD2; margin: 0 auto 6px; }
.hoja-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.hoja-cab h2 { font: 600 20px var(--f-titulo); }
.hoja-cab .icono { border: none; }
@media (min-width: 900px) { .capa { justify-content: center; } .hoja { border-radius: 24px; } }
@keyframes subir { from { transform: translateY(30px); opacity: .5; } }
@keyframes aparecer { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .capa, .hoja { animation: none; } }

/* ---------- Aviso breve ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60; background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 500; transition: .2s; max-width: calc(100% - 32px); box-shadow: var(--sombra); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--rojo); }

/* ---------- Acceso (entrada, bloqueo) ---------- */
.acceso { min-height: 100dvh; background: #1A3563; color: #fff; display: flex; flex-direction: column; align-items: center; padding: 0 28px; position: relative; overflow: hidden; }
.acceso::before, .acceso::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; }
.acceso::before { left: -150px; top: -170px; width: 460px; height: 460px; border: 1px solid rgba(226,182,90,.28); }
.acceso::after { right: -180px; bottom: -140px; width: 420px; height: 420px; background: var(--navy); }
.acceso > * { position: relative; z-index: 1; }
.monograma { width: 84px; height: 84px; border-radius: 42px; background: var(--navy); border: 2px solid var(--oro); display: flex; align-items: center; justify-content: center; font: 700 30px var(--f-titulo); color: var(--oro); letter-spacing: -1px; }
.acceso h1 { font: 600 30px var(--f-titulo); margin: 20px 0 6px; }
.acceso .sub { color: var(--sobre-navy); font-size: 15px; text-align: center; }
.acceso .formulario { width: 100%; max-width: 380px; }
.acceso label { color: var(--sobre-navy); font-size: 13px; }
.acceso .entrada { background: #fff; color: var(--tinta); border: none; }
.btn.oro { background: var(--oro); border-color: var(--oro); color: var(--navy); }
.btn.contorno-oro { background: transparent; border: 1px solid rgba(226,182,90,.7); color: var(--oro); }
.huella { width: 112px; height: 112px; border-radius: 56px; background: rgba(226,182,90,.12); border: 2px solid var(--oro); color: var(--oro); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.acceso a, .acceso .enlace { color: var(--oro); background: none; border: none; font-weight: 600; font-size: 14px; cursor: pointer; min-height: 44px; }

/* ---------- Calendario ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .dsem { text-align: center; font-size: 11px; font-weight: 600; color: var(--suave); padding: 4px 0; }
.cal button { aspect-ratio: 1 / 1; min-height: 44px; border-radius: 12px; border: 1px solid transparent; background: var(--sup); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 14px; cursor: pointer; padding: 0; }
.cal button.fuera { visibility: hidden; }
.cal button.hoy { border-color: var(--azul); font-weight: 700; color: var(--azul-o); }
.cal button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.cal .puntos { display: flex; gap: 3px; height: 6px; }
.cal .puntos i { width: 6px; height: 6px; border-radius: 3px; display: block; }
.p-pagado { background: var(--azul); } .p-pendiente { background: var(--oro); } .p-vencido { background: var(--rojo); } .p-mov { background: #9AA0A6; }

/* ---------- Voz ---------- */
.ondas { width: 96px; height: 96px; border-radius: 48px; background: var(--oro-c); display: flex; align-items: center; justify-content: center; margin: 8px auto; }
.ondas > span { width: 68px; height: 68px; border-radius: 34px; background: var(--azul); color: #fff; display: flex; align-items: center; justify-content: center; }
.ondas.activa { animation: latir 1.2s ease-in-out infinite; }
@keyframes latir { 50% { transform: scale(1.06); } }
.transcripcion { font-size: 18px; font-weight: 500; text-align: center; min-height: 54px; line-height: 1.4; }

.item .envuelve { white-space: normal; }
.fila-enlace > .icono { flex: none; }
