/* Fides — estilos de la interfaz v1 (encargo 03).
   Dirección B · Marino y Oro (D31). Todos los colores salen de los tokens de :root.
   El bloque [data-tema="oscuro"] (A · Noche Neón) queda preparado y sin activar. */

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('manrope.woff2') format('woff2');
}

:root {
  --fondo: #EEF2F7;
  --superficie: #FFFFFF;
  --superficie-2: #F7F9FC;
  --linea: #E3E8EF;
  --texto: #0B1F3A;
  --texto-2: #5B6B82;
  --marca: #0B1F3A;
  --texto-sobre-marca: #FFFFFF;
  --acento: #E8B931;
  --texto-sobre-acento: #0B1F3A;
  --ok: #1B7F4B;
  --ok-fondo: #E6F4EC;
  --alerta: #8A5A00;
  --alerta-barra: #D9A400;
  --alerta-fondo: #FFF6DB;
  --peligro: #B42318;
  --peligro-barra: #C62828;
  --peligro-fondo: #FDECEA;
  --sombra: 0 1px 2px rgba(11, 31, 58, .06), 0 4px 12px rgba(11, 31, 58, .06);
  --radio: 16px;
  --radio-chico: 12px;
  --radio-grande: 20px;
  --toque: 48px;
}

/* Modo oscuro A · Noche Neón: listo para una versión posterior, no se activa todavía. */
:root[data-tema="oscuro"] {
  --fondo: #0A0D12;
  --superficie: #131922;
  --superficie-2: #1A222D;
  --linea: #263140;
  --texto: #F3F6F9;
  --texto-2: #94A3B8;
  --marca: #0A0D12;
  --texto-sobre-marca: #F3F6F9;
  --acento: #C6F432;
  --texto-sobre-acento: #0A0D12;
  --ok: #3DDC97;
  --ok-fondo: #12261D;
  --alerta: #FFB547;
  --alerta-barra: #FFB547;
  --alerta-fondo: #2A2112;
  --peligro: #FF6B6F;
  --peligro-barra: #FF6B6F;
  --peligro-fondo: #2B1517;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--fondo);
  color: var(--texto);
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}
button, input, select, textarea { font: inherit; color: inherit; }
.cifra, .monto, .monto-grande, input[inputmode="decimal"], input[inputmode="numeric"] { font-variant-numeric: tabular-nums; }
.oculto { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Barra superior ---------- */
.barra-sup {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  min-height: 56px; padding: 8px 16px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--marca); color: var(--texto-sobre-marca);
}
.barra-titulo { font-weight: 800; font-size: 20px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.boton-atras {
  min-width: var(--toque); min-height: var(--toque); margin-left: -12px;
  border: 0; background: transparent; color: var(--texto-sobre-marca); font-size: 26px; cursor: pointer;
}
.aviso-version {
  position: sticky; top: 56px; z-index: 19;
  background: var(--alerta-fondo); color: var(--alerta); font-weight: 700; font-size: 14px;
  padding: 10px 16px; border-bottom: 1px solid var(--alerta-barra);
}
.chip-red {
  font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--alerta-fondo); color: var(--alerta);
}

/* ---------- Contenido ---------- */
.contenido { padding: 16px; max-width: 560px; margin: 0 auto; padding-bottom: 112px; }
.contenido.con-boton-fijo { padding-bottom: 180px; }
.cargando { color: var(--texto-2); text-align: center; padding: 32px 0; }
.titulo-seccion { font-size: 14px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--texto-2); margin: 20px 4px 8px; }
h1, h2, h3 { margin: 0; }
.nota { color: var(--texto-2); font-size: 14px; }
.vacio { text-align: center; color: var(--texto-2); padding: 24px 8px; }
.datos-guardados { font-size: 13px; color: var(--alerta); background: var(--alerta-fondo); border-radius: var(--radio-chico); padding: 8px 12px; margin-bottom: 12px; }

/* ---------- Franja marino (Inicio) ---------- */
.franja {
  background: var(--marca); color: var(--texto-sobre-marca);
  margin: -16px -16px 0; padding: 8px 20px 28px;
}
.franja .etiqueta { color: var(--acento); font-weight: 700; font-size: 14px; }
.franja .monto-grande { font-size: 40px; font-weight: 800; line-height: 1.1; margin: 4px 0; overflow-wrap: anywhere; }
.franja .nota { color: #C9D3E0; }
.indicadores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: -16px; }
.indicador {
  background: var(--superficie); border-radius: var(--radio); box-shadow: var(--sombra);
  padding: 12px 10px; min-width: 0;
}
.indicadores.dos { grid-template-columns: 1fr 1fr; margin-top: 0; margin-bottom: 12px; }
.indicador .etiqueta { font-size: 12px; font-weight: 700; color: var(--texto-2); }
.indicador .valor { font-size: 20px; font-weight: 800; margin: 2px 0; overflow-wrap: anywhere; }
.indicador .detalle { font-size: 12px; color: var(--texto-2); overflow-wrap: anywhere; }

/* ---------- Tarjetas y listas ---------- */
.tarjeta {
  background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--sombra);
}
.lista { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); }
.fila {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 64px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--linea);
  background: transparent; text-align: left; cursor: pointer; color: var(--texto); text-decoration: none;
}
.fila:last-child { border-bottom: 0; }
.fila:active { background: var(--superficie-2); }
.fila .principal { flex: 1; min-width: 0; }
.fila .nombre { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila .sub { font-size: 13px; color: var(--texto-2); }
.fila .derecha { text-align: right; flex-shrink: 0; }
.fila .monto { font-weight: 800; }
.fila.con-acciones { flex-wrap: wrap; }
.fila.con-acciones .principal { flex-basis: 100%; }
.fila.con-acciones .nombre { white-space: normal; }
.fila.con-acciones .derecha { display: flex; gap: 16px; text-align: left; margin-top: -4px; }
.fila.con-botones { flex-wrap: wrap; }
.fila.con-wa { cursor: default; }
.fila.con-wa .principal { color: var(--texto); text-decoration: none; min-width: 0; }
.boton-wa {
  flex-shrink: 0; min-width: 96px; min-height: var(--toque); padding: 0 12px; border: 0; border-radius: var(--radio-chico);
  background: var(--ok); color: #FFFFFF; font-weight: 800; cursor: pointer;
}
.boton-wa[data-enviado] { background: var(--ok-fondo); color: var(--ok); }
.boton-wa:disabled { opacity: .6; }
/* Barras del tablero: una sola serie y el valor siempre escrito. */
.barras { display: grid; gap: 12px; margin: 8px 0 12px; }
.barra-etiqueta { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 700; }
.barra-etiqueta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.barra-pista { height: 12px; background: var(--superficie-2); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.barra-relleno { height: 100%; width: 0; background: var(--marca); border-radius: 0 4px 4px 0; }
.barra-detalle { font-size: 12px; color: var(--texto-2); margin-top: 2px; }
.boton-csv { font-size: 14px; }
/* Portal del cliente */
.tarjeta-enlace { display: block; color: var(--texto); text-decoration: none; }
.ver-mas { margin-top: 8px; font-weight: 800; }
.comportamiento { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.corte { border-radius: var(--radio-chico); padding: 8px 6px; text-align: center; background: var(--superficie); border: 1px solid var(--linea); }
.corte .mes { font-size: 13px; color: var(--texto-2); font-weight: 700; }
.corte .estado-corte { font-size: 13px; font-weight: 800; }
.corte.a_tiempo { background: var(--ok-fondo); color: var(--ok); border-color: transparent; }
.corte.tarde { background: var(--alerta-fondo); color: var(--alerta); border-color: transparent; }
.corte.pendiente { background: var(--peligro-fondo); color: var(--peligro); border-color: transparent; }
.corte.a_tiempo .mes, .corte.tarde .mes, .corte.pendiente .mes { color: inherit; }
.pausa { flex-shrink: 0; font-size: 13px; font-weight: 700; color: var(--texto-2); max-width: 96px; text-align: right; }
.acciones-recibo { display: flex; flex-wrap: wrap; gap: 4px 14px; flex-basis: 100%; margin-top: -6px; }
.acciones-recibo .enlace { white-space: nowrap; }
.par { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--linea); }
.par:last-child { border-bottom: 0; }
.par .clave { color: var(--texto-2); }
.par .valor { font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.grande { font-size: 30px; font-weight: 800; }
.dos-columnas { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dos-columnas > div { min-width: 0; }

/* ---------- Semáforo: siempre con texto ---------- */
.semaforo {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.semaforo::before { content: ''; width: 10px; height: 10px; border-radius: 50%; }
.semaforo.verde { background: var(--ok-fondo); color: var(--ok); }
.semaforo.verde::before { background: var(--ok); }
.semaforo.amarillo { background: var(--alerta-fondo); color: var(--alerta); }
.semaforo.amarillo::before { background: var(--alerta-barra); }
.semaforo.rojo { background: var(--peligro-fondo); color: var(--peligro); }
.semaforo.rojo::before { background: var(--peligro-barra); }
.atraso { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--alerta-fondo); color: var(--alerta); white-space: nowrap; }
.etiqueta-estado { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--superficie-2); color: var(--texto-2); }
.etiqueta-estado.pagado { background: var(--ok-fondo); color: var(--ok); }

/* ---------- Pestañas ---------- */
.pestanas { display: flex; gap: 8px; margin: 20px 0 12px; overflow-x: auto; }
.pestana {
  min-height: var(--toque); padding: 8px 12px; border-radius: 999px; border: 1px solid var(--linea);
  background: var(--superficie); color: var(--texto); font-weight: 700; font-size: 15px; white-space: nowrap; cursor: pointer;
}
.pestanas.tres { display: grid; grid-template-columns: repeat(3, 1fr); overflow: visible; }
.pestanas.tres .pestana { white-space: normal; padding: 6px 4px; font-size: 14px; line-height: 1.15; }
.pestana[aria-selected="true"] { background: var(--marca); color: var(--texto-sobre-marca); border-color: var(--marca); }
.pestana:disabled { color: var(--texto-2); cursor: default; }

/* ---------- Botones ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 12px 16px; border: 0; border-radius: var(--radio-chico);
  background: var(--acento); color: var(--texto-sobre-acento); font-weight: 800; font-size: 17px;
  cursor: pointer; text-decoration: none;
}
.boton:disabled { opacity: .55; cursor: default; }
.boton.secundario { background: var(--superficie); color: var(--texto); border: 1px solid var(--linea); }
.boton.marino { background: var(--marca); color: var(--texto-sobre-marca); margin-bottom: 12px; }
.boton.peligro { background: var(--peligro-barra); color: #FFFFFF; }
.boton.chico { width: auto; min-height: var(--toque); font-size: 15px; padding: 8px 14px; }
.boton + .boton { margin-top: 10px; }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.acciones .boton { flex: 1 1 140px; margin-top: 0; }
.enlace {
  display: inline-flex; align-items: center; min-height: var(--toque); padding: 0 4px;
  border: 0; background: transparent; color: var(--texto); font-weight: 700; text-decoration: underline; cursor: pointer;
}
.boton-fijo {
  position: fixed; left: 0; right: 0; bottom: 72px; z-index: 15;
  padding: 12px 16px; background: linear-gradient(to top, var(--fondo) 75%, transparent);
}
.boton-fijo .boton { max-width: 528px; margin: 0 auto; display: flex; }

/* ---------- Formularios ---------- */
.campo { display: block; margin-bottom: 14px; }
.campo > span { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.campo input, .campo select, .campo textarea {
  width: 100%; min-height: var(--toque); padding: 10px 12px;
  border: 1px solid var(--linea); border-radius: var(--radio-chico); background: var(--superficie); font-size: 17px;
}
.campo textarea { min-height: 88px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus, .boton:focus-visible, .fila:focus-visible, .tecla:focus-visible, .pestana:focus-visible {
  outline: 3px solid var(--acento); outline-offset: 2px;
}
.campo .ayuda { font-size: 13px; color: var(--texto-2); margin-top: 4px; }
.monto-entrada { display: flex; align-items: center; gap: 8px; }
.monto-entrada input { flex: 1; width: auto; min-width: 0; font-size: 34px; font-weight: 800; min-height: 64px; }
.monto-entrada .segmentado { flex-shrink: 0; }
.segmentado { display: flex; border: 1px solid var(--linea); border-radius: var(--radio-chico); overflow: hidden; background: var(--superficie); }
.segmentado button { flex: 1; min-height: var(--toque); border: 0; background: transparent; font-weight: 700; cursor: pointer; padding: 0 10px; }
.segmentado button[aria-pressed="true"] { background: var(--marca); color: var(--texto-sobre-marca); }
.segmentado.cuatro { display: grid; grid-template-columns: 1fr 1fr; }
.segmentado.cuatro button { border-bottom: 1px solid var(--linea); }
.error { background: var(--peligro-fondo); color: var(--peligro); border-radius: var(--radio-chico); padding: 12px; margin: 12px 0; font-weight: 600; }
.exito { background: var(--ok-fondo); color: var(--ok); border-radius: var(--radio-chico); padding: 12px; margin: 12px 0; font-weight: 600; }
.aviso { background: var(--alerta-fondo); color: var(--alerta); border-radius: var(--radio-chico); padding: 12px; margin: 12px 0; font-weight: 600; }

/* ---------- Ingreso y teclado de PIN ---------- */
.ingreso { max-width: 400px; margin: 0 auto; }
.ingreso .marca-ingreso { text-align: center; margin: 12px 0 20px; }
.ingreso .marca-ingreso .nombre-app { font-size: 36px; font-weight: 800; }
.ingreso .marca-ingreso .lema { color: var(--texto-2); }
.puntos { display: flex; justify-content: center; gap: 14px; margin: 12px 0 16px; }
.punto { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--texto-2); }
.punto.lleno { background: var(--texto); border-color: var(--texto); }
.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.tecla {
  min-height: 60px; border: 1px solid var(--linea); border-radius: var(--radio-chico);
  background: var(--superficie); font-size: 26px; font-weight: 700; cursor: pointer; box-shadow: var(--sombra);
}
.tecla:active { background: var(--superficie-2); }
.tecla.funcion { font-size: 16px; color: var(--texto-2); }
.paso { text-align: center; font-weight: 700; margin-top: 4px; }

/* ---------- Línea de tiempo ---------- */
.tiempo { list-style: none; margin: 0; padding: 0; }
.evento { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--linea); scroll-margin-top: 72px; }
.evento:last-child { border-bottom: 0; }
.evento .fecha { width: 64px; flex-shrink: 0; font-size: 13px; color: var(--texto-2); }
.evento .cuerpo { flex: 1; min-width: 0; }
.evento .tipo { font-weight: 700; }
.evento .detalle { font-size: 13px; color: var(--texto-2); overflow-wrap: anywhere; }
.evento .monto { font-weight: 800; text-align: right; flex-shrink: 0; }
.evento.reversado .tipo, .evento.reversado .monto { text-decoration: line-through; color: var(--texto-2); }
.evento.resaltado { background: var(--alerta-fondo); }
.evento .enlace { min-height: 32px; font-size: 13px; padding: 0; }

/* ---------- Barra inferior ---------- */
.barra-inf {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  background: var(--superficie); border-top: 1px solid var(--linea);
  padding-bottom: env(safe-area-inset-bottom); min-height: 72px;
}
.barra-inf a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 64px; color: var(--texto-2); text-decoration: none; font-size: 12px; font-weight: 700;
  text-align: center; line-height: 1.15;
}
.barra-inf a .icono { font-size: 20px; line-height: 1; }
.barra-inf a[aria-current="page"] { color: var(--texto); }
.barra-inf a[aria-current="page"] .icono { color: var(--marca); }
.barra-inf a.mas-grande .icono {
  width: 52px; height: 52px; margin-top: -22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--acento); color: var(--texto-sobre-acento); font-size: 30px; font-weight: 800; box-shadow: var(--sombra);
}

/* ---------- Ventana modal y avisos ---------- */
.velo {
  position: fixed; inset: 0; z-index: 40; background: rgba(11, 31, 58, .55);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--superficie); border-radius: var(--radio-grande) var(--radio-grande) 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
.modal h2 { font-size: 20px; margin-bottom: 12px; }
.pin-mostrado { font-size: 40px; font-weight: 800; letter-spacing: 6px; text-align: center; padding: 12px; background: var(--superficie-2); border-radius: var(--radio-chico); margin: 12px 0; font-variant-numeric: tabular-nums; }
.brindis {
  position: fixed; left: 16px; right: 16px; bottom: 88px; z-index: 50; max-width: 528px; margin: 0 auto;
  background: var(--marca); color: var(--texto-sobre-marca); padding: 14px 16px; border-radius: var(--radio-chico);
  font-weight: 700; box-shadow: var(--sombra);
}

/* Fotos de prendas y cédula (D50) */
.foto-grande { margin-bottom: 12px; text-align: center; }
.foto-grande img { max-width: 100%; max-height: 60vh; border-radius: var(--radio-chico); border: 1px solid var(--linea); }
