/* ==========================================================================
   Portal de Afiliaciones EVANG x inDrive
   Sistema de diseño. Modo claro exclusivo.

   Co-branding:
     - Portal FFVV (campo): manda inDrive (lima #C1F11D sobre negro #141414).
       El vendedor debe sentir que trabaja DENTRO del producto que vende.
     - Portal administrativo: manda EVANG (navy #0B3D62 + amarillo #FEDC00).
       Aquí el dueño de la operación es la BPO.
     - Dashboard del cliente: inDrive corporativo, sobrio, sin ruido.

   Sin emojis en ninguna parte. Toda la iconografía es SVG inline.
   ========================================================================== */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  /* Marca inDrive */
  --in-lima:        #C1F11D;
  --in-lima-oscuro: #A8D617;
  --in-lima-suave:  #F2FCD4;
  --in-negro:       #141414;

  /* Marca EVANG */
  --ev-navy:        #0B3D62;
  --ev-navy-claro:  #14568A;
  --ev-navy-suave:  #E8F0F6;
  --ev-amarillo:    #FEDC00;
  --ev-rojo:        #DB233D;

  /* Neutros. Base cálida, no gris azulado: la interfaz debe verse amable. */
  --blanco:   #FFFFFF;
  --fondo:    #F7F8F6;
  --superficie: #FFFFFF;
  --linea:    #E6E8E3;
  --linea-fuerte: #D2D5CD;
  --texto:    #1A1D19;
  --texto-2:  #5B6159;
  --texto-3:  #8B918A;

  /* Semánticos */
  --ok:        #167C3C;
  --ok-suave:  #E7F5EC;
  --alerta:    #B4690E;
  --alerta-suave: #FDF3E3;
  --error:     #C1272D;
  --error-suave: #FBEAEA;
  --info:      #14568A;
  --info-suave: #E8F0F6;

  /* Marca activa del portal. La sobreescribe .portal-* */
  --brand:        var(--ev-navy);
  --brand-texto:  #FFFFFF;
  --brand-suave:  var(--ev-navy-suave);
  --brand-acento: var(--ev-amarillo);

  --radio:    12px;
  --radio-sm: 8px;
  --radio-lg: 18px;
  --radio-full: 999px;

  --sombra-1: 0 1px 2px rgba(20, 20, 20, .05);
  --sombra-2: 0 2px 8px rgba(20, 20, 20, .06), 0 1px 2px rgba(20, 20, 20, .04);
  --sombra-3: 0 8px 24px rgba(20, 20, 20, .10), 0 2px 6px rgba(20, 20, 20, .05);

  --fuente: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  /* Altura de la barra inferior de la PWA, para que nada quede tapado. */
  --nav-alto: 64px;
}

/* El portal de campo se viste de inDrive. */
.portal-ffvv {
  --brand:        var(--in-negro);
  --brand-texto:  var(--in-lima);
  --brand-suave:  var(--in-lima-suave);
  --brand-acento: var(--in-lima);
}

/* El portal administrativo se viste de EVANG. */
.portal-admin {
  --brand:        var(--ev-navy);
  --brand-texto:  #FFFFFF;
  --brand-suave:  var(--ev-navy-suave);
  --brand-acento: var(--ev-amarillo);
}

/* El dashboard del cliente: inDrive, sobrio. */
.portal-cliente {
  --brand:        var(--in-negro);
  --brand-texto:  var(--in-lima);
  --brand-suave:  var(--in-lima-suave);
  --brand-acento: var(--in-lima);
}

/* ── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--fuente);
  font-size: 15px;
  line-height: 1.55;
  color: var(--texto);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  /* En campo se toca mucho y rápido: el resaltado azul del navegador estorba. */
  -webkit-tap-highlight-color: transparent;
}

/* Safari en iOS pinta el texto de los <button> con su propio color de sistema y no
   con el heredado. Cualquier texto dentro de un botón al que no le fijemos color
   explícitamente sale invisible o casi, y el usuario no ve la mitad de la pantalla.
   No es hipotético: pasó en el login, donde el nombre de cada persona desaparecía
   en iPhone y solo se veía su cargo. Se fuerza la herencia. */
button, input, select, textarea {
  font: inherit;
  color: inherit;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }
p  { margin: 0 0 12px; }
a  { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Foco visible siempre: hay gente que navega con teclado y hay auditorías de accesibilidad. */
:focus-visible {
  outline: 3px solid var(--in-lima);
  outline-offset: 2px;
  border-radius: 4px;
}

.oculto { display: none !important; }
.solo-lectores {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Iconos ─────────────────────────────────────────────────────────────── */
.ico {
  width: 20px; height: 20px;
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -.2em;
}
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 26px; height: 26px; }
.ico-xl { width: 40px; height: 40px; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.contenedor { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 20px; }
.contenedor-angosto { max-width: 760px; }

.pila { display: flex; flex-direction: column; }
.pila-8  > * + * { margin-top: 8px; }
.pila-12 > * + * { margin-top: 12px; }
.pila-16 > * + * { margin-top: 16px; }
.pila-24 > * + * { margin-top: 24px; }

.fila { display: flex; align-items: center; gap: 12px; }
.fila-entre { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fila-wrap { flex-wrap: wrap; }
.crece { flex: 1 1 auto; min-width: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .contenedor { padding: 0 14px; }
}

/* ── Tarjetas ───────────────────────────────────────────────────────────── */
.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  box-shadow: var(--sombra-1);
}
.tarjeta-cuerpo { padding: 18px; }
.tarjeta-cabecera {
  padding: 16px 18px;
  border-bottom: 1px solid var(--linea);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.tarjeta-cabecera h3 { display: flex; align-items: center; gap: 9px; }
.tarjeta-pie {
  padding: 12px 18px;
  border-top: 1px solid var(--linea);
  background: var(--fondo);
  border-radius: 0 0 var(--radio) var(--radio);
}

/* ── Métricas ───────────────────────────────────────────────────────────── */
.metrica { padding: 18px; }
.metrica-etiqueta {
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--texto-3);
  display: flex; align-items: center; gap: 6px;
}
.metrica-valor {
  font-size: 34px; font-weight: 800; line-height: 1.1;
  letter-spacing: -.02em; margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.metrica-pie { font-size: 13px; color: var(--texto-2); margin-top: 4px; }
.metrica-delta { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.metrica-delta.sube { color: var(--ok); }
.metrica-delta.baja { color: var(--error); }

/* ── Barras de progreso ─────────────────────────────────────────────────── */
.progreso {
  height: 8px; border-radius: var(--radio-full);
  background: var(--linea); overflow: hidden;
}
.progreso-barra {
  height: 100%; border-radius: var(--radio-full);
  background: var(--brand-acento);
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.progreso.alto { height: 12px; }
.progreso-barra.verde { background: var(--ok); }
.progreso-barra.ambar { background: var(--alerta); }
.progreso-barra.rojo  { background: var(--error); }
.progreso-barra.lima  { background: var(--in-lima); }

/* Marca del ritmo esperado: dónde DEBERÍAMOS estar hoy. Un avance de 40% no
   significa nada si no sabes que a estas alturas del mes deberías ir en 60%. */
.progreso-marco { position: relative; }
.progreso-meta {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--texto); border-radius: 1px;
}
.progreso-meta::after {
  content: ''; position: absolute; top: -3px; left: -2px;
  border-left: 3px solid transparent; border-right: 3px solid transparent;
  border-top: 4px solid var(--texto);
}

/* ── Los 5 envíos: el medidor central del negocio ───────────────────────── */
/* Un comercio está activado solo al 5º envío efectivo. Este control lo hace
   literal: cinco casillas que se van llenando. El hunter ve de un vistazo
   cuánto le falta para cobrar esa afiliación. */
.envios { display: flex; gap: 5px; align-items: center; }
.envio-punto {
  width: 22px; height: 22px; border-radius: 7px;
  border: 2px solid var(--linea-fuerte);
  background: var(--blanco);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--texto-3);
}
.envio-punto.hecho {
  background: var(--in-lima); border-color: var(--in-lima-oscuro); color: var(--in-negro);
}
.envio-punto.activador {
  background: var(--ok); border-color: var(--ok); color: #fff;
  box-shadow: 0 0 0 3px var(--ok-suave);
}
.envios-sm .envio-punto { width: 16px; height: 16px; border-radius: 5px; font-size: 9px; }

/* ── Etiquetas de estado ────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--radio-full);
  font-size: 12px; font-weight: 600; line-height: 1.6;
  white-space: nowrap;
}
.chip-neutro  { background: var(--fondo); color: var(--texto-2); border: 1px solid var(--linea); }
.chip-ok      { background: var(--ok-suave); color: var(--ok); }
.chip-alerta  { background: var(--alerta-suave); color: var(--alerta); }
.chip-error   { background: var(--error-suave); color: var(--error); }
.chip-info    { background: var(--info-suave); color: var(--info); }
.chip-lima    { background: var(--in-lima-suave); color: #4A5E08; }
.chip-marca   { background: var(--brand); color: var(--brand-texto); }
.chip-punto::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: 0 0 auto;
}

/* ── Botones ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radio-sm);
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
  text-decoration: none;
  /* En campo se toca con el pulgar: menos de 44px es una fuente de errores. */
  min-height: 44px;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primario {
  background: var(--in-lima); color: var(--in-negro);
  box-shadow: 0 1px 2px rgba(20,20,20,.08);
}
.btn-primario:hover { background: var(--in-lima-oscuro); }

.btn-marca { background: var(--brand); color: var(--brand-texto); }
.btn-marca:hover { filter: brightness(1.12); }

.btn-secundario {
  background: var(--superficie); color: var(--texto);
  border-color: var(--linea-fuerte);
}
.btn-secundario:hover { background: var(--fondo); }

.btn-fantasma { background: transparent; color: var(--texto-2); }
.btn-fantasma:hover { background: var(--fondo); color: var(--texto); }

.btn-peligro { background: var(--error); color: #fff; }
.btn-peligro:hover { filter: brightness(1.08); }

.btn-bloque { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 16px; min-height: 52px; border-radius: var(--radio); }
.btn-sm { padding: 6px 12px; font-size: 13px; min-height: 34px; }
.btn-icono { padding: 9px; min-height: 40px; width: 40px; }

/* ── Formularios ────────────────────────────────────────────────────────── */
.campo { display: block; margin-bottom: 16px; }
.campo-etiqueta {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--texto);
  margin-bottom: 6px;
}
.campo-obligatorio { color: var(--error); font-weight: 700; }
.campo-ayuda { font-size: 12px; color: var(--texto-2); margin-top: 5px; line-height: 1.45; }
.campo-error { font-size: 12px; color: var(--error); margin-top: 5px; font-weight: 500; }

.control {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--linea-fuerte);
  border-radius: var(--radio-sm);
  font-family: inherit;
  /* 16px evita que iOS haga zoom al enfocar el campo. En campo eso desorienta. */
  font-size: 16px;
  color: var(--texto);
  background: var(--superficie);
  transition: border-color .15s ease, box-shadow .15s ease;
  min-height: 46px;
}
.control:focus {
  outline: none;
  border-color: var(--in-lima-oscuro);
  box-shadow: 0 0 0 3px var(--in-lima-suave);
}
.control[aria-invalid="true"] { border-color: var(--error); }
.control[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--error-suave); }
.control::placeholder { color: var(--texto-3); }
textarea.control { min-height: 90px; resize: vertical; line-height: 1.5; }
select.control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235B6159' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}

/* Grupo de campo con botón pegado (ej. RUC + Consultar SUNAT) */
.campo-grupo { display: flex; gap: 8px; }
.campo-grupo .control { flex: 1 1 auto; }

/* Opciones grandes, tocables: es como el hunter elige el resultado de la visita. */
.opciones { display: grid; gap: 8px; }
.opcion {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px;
  border: 2px solid var(--linea);
  border-radius: var(--radio);
  cursor: pointer;
  background: var(--superficie);
  transition: all .12s ease;
  min-height: 54px;
}
.opcion:hover { border-color: var(--linea-fuerte); background: var(--fondo); }
.opcion input { position: absolute; opacity: 0; pointer-events: none; }
.opcion-marca {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--linea-fuerte);
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s ease;
}
.opcion input:checked ~ .opcion-marca {
  border-color: var(--in-negro);
  background: var(--in-lima);
}
.opcion input:checked ~ .opcion-marca::after {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--in-negro);
}
.opcion:has(input:checked) {
  border-color: var(--in-negro);
  background: var(--in-lima-suave);
}
.opcion input:focus-visible ~ .opcion-marca { outline: 3px solid var(--in-lima); outline-offset: 2px; }
.opcion-texto { flex: 1 1 auto; }
.opcion-titulo { font-weight: 600; font-size: 15px; }
.opcion-desc { font-size: 12.5px; color: var(--texto-2); }

/* Casilla de consentimiento. Tiene peso legal: se ve distinta a propósito. */
.consentimiento {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 15px;
  background: var(--alerta-suave);
  border: 1px solid #F0DDB8;
  border-radius: var(--radio);
}
.consentimiento input[type="checkbox"] {
  width: 22px; height: 22px; margin: 1px 0 0; flex: 0 0 auto;
  accent-color: var(--ev-navy); cursor: pointer;
}
.consentimiento-texto { font-size: 12.5px; line-height: 1.5; color: #6B4E14; }
.consentimiento-texto strong { color: #4A3609; }

/* ── Tablas ─────────────────────────────────────────────────────────────── */
.tabla-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th {
  text-align: left; padding: 11px 14px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--texto-3);
  border-bottom: 1px solid var(--linea);
  white-space: nowrap;
  background: var(--fondo);
}
.tabla td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--linea);
  vertical-align: middle;
}
.tabla tbody tr:last-child td { border-bottom: none; }
.tabla tbody tr:hover { background: var(--fondo); }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla-compacta td, .tabla-compacta th { padding: 8px 12px; }

/* ── Avatar ─────────────────────────────────────────────────────────────── */
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand); color: var(--brand-texto);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex: 0 0 auto;
  letter-spacing: .02em;
}
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 19px; }

/* ── Avisos ─────────────────────────────────────────────────────────────── */
.aviso {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radio);
  border: 1px solid;
  font-size: 14px;
  line-height: 1.5;
}
.aviso .ico { margin-top: 1px; }
.aviso-titulo { font-weight: 700; margin-bottom: 2px; }
.aviso-ok     { background: var(--ok-suave); border-color: #C2E3CE; color: #0E5228; }
.aviso-alerta { background: var(--alerta-suave); border-color: #F0DDB8; color: #6B4E14; }
.aviso-error  { background: var(--error-suave); border-color: #F0C7C7; color: #8A1B20; }
.aviso-info   { background: var(--info-suave); border-color: #C5D9E8; color: #0B3D62; }

/* ── Estado vacío ───────────────────────────────────────────────────────── */
.vacio {
  text-align: center;
  padding: 44px 24px;
  color: var(--texto-2);
}
.vacio .ico-xl { color: var(--texto-3); margin-bottom: 12px; }
.vacio h3 { color: var(--texto); margin-bottom: 6px; }
.vacio p { font-size: 14px; max-width: 380px; margin: 0 auto 16px; }

/* ── Pestañas ───────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--linea);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 11px 16px;
  font-size: 14px; font-weight: 600;
  color: var(--texto-2);
  border-bottom: 2.5px solid transparent;
  cursor: pointer; white-space: nowrap;
  background: none; border-top: 0; border-left: 0; border-right: 0;
  font-family: inherit;
  display: inline-flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--texto); text-decoration: none; }
.tab.activo { color: var(--texto); border-bottom-color: var(--in-lima); }

/* ── Utilidades ─────────────────────────────────────────────────────────── */
.t-xs { font-size: 12px; }
.t-sm { font-size: 13px; }
.t-2  { color: var(--texto-2); }
.t-3  { color: var(--texto-3); }
.t-bold { font-weight: 700; }
.t-semi { font-weight: 600; }
.t-num { font-variant-numeric: tabular-nums; }
.t-mono { font-family: var(--mono); font-size: .92em; }
.t-centro { text-align: center; }
.t-derecha { text-align: right; }
.t-ok { color: var(--ok); }
.t-alerta { color: var(--alerta); }
.t-error { color: var(--error); }
.t-truncado { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.sep { height: 1px; background: var(--linea); border: 0; margin: 16px 0; }

@media (max-width: 640px) {
  .ocultar-movil { display: none !important; }
}
@media (min-width: 641px) {
  .solo-movil { display: none !important; }
}

/* ── Impresión: los reportes de conformidad se firman en papel ──────────── */
@media print {
  .no-imprimir, .nav-inferior, .barra-superior, .lateral { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .tarjeta { border: 1px solid #999; box-shadow: none; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}
