/* =============================================================
   Portal Cliente MomentiaAPP — design tokens compartidos con la
   app Flutter (ver app/lib/core/theme.dart QzColors). Fase R2 del
   plan de reestructuración: portal web con la MISMA identidad
   visual que la app, no un estilo aparte.
   ============================================================= */

:root {
  /* Paleta oficial del Manual de Marca (pág. 22) */
  --principal: #36A4BA;
  --sec-oscuro: #175363;
  --sec-claro: #79C2D1;
  --sec-crema: #E6DED0;
  --acento-claro: #CAA8F5;
  --acento-oscuro: #4A306D;

  --gradiente-marca: linear-gradient(135deg, var(--sec-oscuro), var(--principal));

  --fondo: #F7F5F1;
  --crema-bg: #F6F1E9;
  --tinta-primaria: #1F2937;
  --tinta-secundaria: #6B7280;
  --borde: #ECECEC;

  /* Semántica financiera universal (no de marca) */
  --exito-bg: #DCFCE7;
  --exito-fg: #15803D;
  --alerta-bg: #FEE2E2;
  --alerta-fg: #B91C1C;
  --ambar-bg: #FEF3C7;
  --ambar-fg: #B45309;

  --radio: 18px;
  --radio-chico: 12px;
  --sombra: 0 12px 28px rgba(23, 83, 99, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Montserrat', system-ui, sans-serif;
  background: var(--fondo);
  color: var(--tinta-primaria);
  -webkit-font-smoothing: antialiased;
}

.portal-shell {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Hero de marca (login / encabezado) ---- */
.portal-hero {
  background: var(--gradiente-marca);
  color: #fff;
  padding: 44px 28px 34px;
  text-align: center;
}
/* El PNG monocromo tiene mucho margen transparente alrededor del glifo real
   (~46% de la altura del canvas) — height grande a propósito para que el
   logo se vea prominente, no un logo real "en miniatura" (mismo ajuste ya
   aplicado en la app Flutter, ver p1_bienvenida.dart). */
.portal-hero img.logo { height: 190px; margin-bottom: -34px; margin-top: -30px; }
.portal-hero h1 { font-size: 22px; font-weight: 800; margin: 0 0 6px; line-height: 1.25; }
.portal-hero p { font-size: 13px; margin: 0; opacity: .88; }

/* ---- Tarjetas / contenedores ---- */
.portal-body { flex: 1; padding: 24px 20px 40px; }
.card {
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 20px;
  margin-bottom: 16px;
}
.card-cream { background: var(--crema-bg); border: none; }

/* ---- Formularios ---- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--tinta-secundaria); margin-bottom: 5px; }
.field input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 28px;
  border: 1px solid var(--borde);
  font-size: 15px;
  font-family: inherit;
  background: #fff;
}
.field input:focus { outline: none; border-color: var(--principal); border-width: 1.6px; }
.field .error { color: var(--alerta-fg); font-size: 12px; margin-top: 5px; }
.field small { display: block; color: var(--tinta-secundaria); font-size: 11.5px; margin-top: 6px; line-height: 1.35; }

/* ---- Botones ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border-radius: 999px;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-primario { background: var(--principal); color: #fff; }
.btn-primario:disabled { opacity: .55; cursor: default; }
.btn-outline { background: rgba(54,164,186,.08); color: var(--sec-oscuro); }
.btn-texto { background: none; color: var(--sec-oscuro); font-weight: 600; padding: 8px; }

/* ---- Anillo de protección ---- */
.anillo-wrap { text-align: center; padding: 22px 16px; border-radius: 24px; }
.anillo-wrap.protegido { background: #EAF7FA; }
.anillo-wrap.pausa { background: #F1E6FC; }
.anillo-svg { width: 140px; height: 140px; margin: 0 auto; position: relative; }
.anillo-svg .centro {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px;
}
.anillo-svg .centro .icono { font-size: 13px; line-height: 1; }
.anillo-svg .centro .num { font-size: 22px; font-weight: 800; line-height: 1; }
.anillo-svg .centro .lbl {
  font-size: 9.5px; color: var(--tinta-secundaria); text-align: center;
  line-height: 1.15; max-width: 72px; margin: 0 auto;
}
.anillo-titulo { font-size: 19px; font-weight: 700; margin: 14px 0 4px; }
.anillo-sub { font-size: 12.5px; color: var(--tinta-secundaria); margin: 0; }

/* ---- Barra de meta (gradiente de meta) ---- */
.barra-meta-txt { font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.barra-meta-track { background: var(--sec-crema); border-radius: 99px; height: 8px; overflow: hidden; }
.barra-meta-fill { background: var(--acento-oscuro); height: 100%; border-radius: 99px; transition: width .4s ease; }

/* ---- Chips de estado ---- */
.chip { display: inline-block; padding: 4px 12px; border-radius: 99px; font-size: 11.5px; font-weight: 600; }
.chip-exito { background: var(--exito-bg); color: var(--exito-fg); }
.chip-alerta { background: var(--alerta-bg); color: var(--alerta-fg); }

/* ---- Fila etiqueta -> valor ---- */
.fila-dato { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--borde); font-size: 13px; }
.fila-dato:last-child { border-bottom: none; }
.fila-dato .et { color: var(--tinta-secundaria); }
.fila-dato .val { font-weight: 600; text-align: right; }

/* ---- Formularios: select / textarea (los inputs de texto ya usan .field input, en píldora) ---- */
.field select, .field textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--borde);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  resize: vertical;
}
.field select:focus, .field textarea:focus { outline: none; border-color: var(--principal); border-width: 1.6px; }

/* ---- Encabezado de sección con acción "Ver todo" ---- */
.seccion-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.seccion-header h3 { font-size: 15px; font-weight: 700; margin: 0; }
.seccion-header a { font-size: 12.5px; color: var(--principal); text-decoration: none; font-weight: 600; }

/* ---- Fila de evento genérica (historial: facturas, recibos, PQRFS, renovaciones) ---- */
.evento-fila { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--borde); }
.evento-fila:last-child { border-bottom: none; }
.evento-icono {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 17px; flex-shrink: 0;
}
.evento-icono.tipo-factura, .evento-icono.tipo-recibo { background: var(--exito-bg); color: var(--exito-fg); }
.evento-icono.tipo-renovacion, .evento-icono.tipo-contrato_inicial { background: rgba(54,164,186,.16); color: var(--principal); }
.evento-icono.tipo-pqrfs { background: var(--ambar-bg); color: var(--ambar-fg); }
.evento-info { flex: 1; min-width: 0; }
.evento-info .titulo { font-weight: 600; font-size: 13px; }
.evento-info .fecha { font-size: 12px; color: var(--tinta-secundaria); }
.evento-valor { font-weight: 700; font-size: 13px; white-space: nowrap; }

/* ---- Línea de tiempo (Fechas del contrato) ---- */
.timeline-item { display: flex; gap: 14px; }
.timeline-marker { display: flex; flex-direction: column; align-items: center; }
.timeline-dot {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 14px; border: 2px solid var(--borde); background: #fff;
  color: var(--tinta-secundaria); flex-shrink: 0;
}
.timeline-dot.cumplido { background: var(--sec-oscuro); border-color: var(--sec-oscuro); color: #fff; }
.timeline-dot.siguiente { background: var(--acento-oscuro); border-color: var(--acento-oscuro); color: #fff; }
.timeline-connector { width: 2px; flex: 1; background: var(--borde); margin: 2px 0; min-height: 16px; }
.timeline-body { padding-bottom: 22px; flex: 1; }
.timeline-titulo { font-size: 14px; font-weight: 600; }
.timeline-titulo.siguiente { color: var(--acento-oscuro); font-weight: 800; }
.timeline-fecha { font-size: 12.5px; color: var(--tinta-secundaria); margin-top: 2px; }
.timeline-tag { font-size: 11px; color: var(--acento-oscuro); font-weight: 700; margin-top: 3px; }

/* ---- Lista simple con ícono + chevron (Datos de contacto / Mi información) ---- */
.lista-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 4px; border: none; border-bottom: 1px solid var(--borde);
  text-decoration: none; color: inherit; cursor: pointer; background: none;
  width: 100%; text-align: left; font-family: inherit; font-size: 14px;
}
.lista-item:last-child { border-bottom: none; }
.lista-item .li-icono { width: 20px; text-align: center; flex-shrink: 0; font-size: 16px; }
.lista-item .li-texto { flex: 1; }
.lista-item .li-chevron { color: var(--tinta-secundaria); }
.lista-item.peligro { color: var(--alerta-fg); }

/* ---- Avatar circular de iniciales ---- */
.avatar-circulo {
  width: 60px; height: 60px; border-radius: 50%; background: var(--principal); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px;
  margin: 0 auto;
}

/* ---- Carnet ---- */
.carnet-tarjeta {
  background: var(--gradiente-marca);
  color: #fff;
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--sombra);
}
.carnet-tarjeta .marca { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: 1px; opacity: .95; }
.carnet-tarjeta .marca img { height: 20px; }
.carnet-tarjeta .nombre { font-size: 18px; font-weight: 700; margin-top: 22px; }
.carnet-tarjeta .cedula { font-size: 12px; opacity: .75; }
.carnet-qr-box { background: #fff; border-radius: 12px; padding: 8px; display: inline-block; margin-top: 16px; }
.carnet-footer-nota { text-align: center; font-size: 12px; color: var(--tinta-secundaria); padding: 12px 8px; }

/* ---- Utilidades ---- */
.centrado { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.oculto { display: none !important; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--sec-crema); border-top-color: var(--principal);
  animation: girar .8s linear infinite; margin: 40px auto;
}
@keyframes girar { to { transform: rotate(360deg); } }
