/* CeluFácil — Portal de Asociados.
   Identidad visual de celufaciluy.com: azul marino #111b54 + magenta #e20074,
   tipografía Montserrat, fondo gris claro y tarjetas blancas. El navy es la
   estructura/marca; el magenta es la acción (igual que los CTA del sitio). */

:root {
  --navy: #111b54;
  --navy-light: #1a236b;
  --navy-dark: #0c1240;
  --magenta: #e20074;
  --magenta-dark: #c60064;
  --magenta-soft: #fdebf4;
  --ink: #333333;
  --muted: #6b7280;
  --bg: #f2f2f2;
  --card: #ffffff;
  --danger: #dc2626;
  --ok: #15803d;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(17, 27, 84, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}

/* ── Hero marketinero (azul marino, como el header de celufaciluy) ── */
.hero {
  background: linear-gradient(150deg, var(--navy-light) 0%, var(--navy) 55%, var(--navy-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}
/* halo magenta sutil, el único toque de color de marca (como los CTA) */
.hero::after {
  content: "";
  position: absolute;
  right: -90px; bottom: -90px;
  width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(226, 0, 116, 0.35) 0%, rgba(226, 0, 116, 0) 70%);
  border-radius: 50%;
}
.hero-inner { max-width: 460px; position: relative; z-index: 1; }
/* Logo real de CeluFácil sobre respaldo blanco (es oscuro/transparente, no
   se leería sobre el azul). Mismo gesto que el header de celufaciluy.com. */
.brand { display: inline-flex; }
.brand-logo {
  display: block; height: 92px; width: auto;
  background: #fff; padding: 14px 20px; border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.hero-title {
  font-size: 38px; line-height: 1.12; font-weight: 800;
  letter-spacing: -0.02em; margin: 24px 0 16px;
}
.hero-sub { font-size: 16px; line-height: 1.6; opacity: 0.9; margin: 0 0 28px; font-weight: 400; }
.hero-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.hero-points li {
  font-size: 15px; font-weight: 500;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 12px 16px; border-radius: 12px;
}

/* ── Columna de acceso ── */
.auth {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 48px 24px; gap: 16px;
}
.card {
  background: var(--card);
  width: 100%; max-width: 400px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
}
.card-title { font-size: 23px; font-weight: 700; color: var(--navy); letter-spacing: -0.01em; margin: 0 0 8px; }
.card-sub { font-size: 14px; color: var(--muted); line-height: 1.55; margin: 0 0 24px; font-weight: 400; }

/* Utility class — debe ganar sobre cualquier `display` específico (ej.
   .review-photos{display:grid} que viene después en el archivo). Sin el
   !important, el orden de fuente hacía que .hidden NO ocultara esos bloques. */
.step.hidden, .hidden { display: none !important; }

.field { display: block; margin-bottom: 18px; }
.field-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--navy); margin-bottom: 6px;
}
input {
  width: 100%; font-size: 16px; padding: 13px 14px;
  border: 1.5px solid #d9dbe4; border-radius: 9px;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit; color: var(--ink);
}
input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(17, 27, 84, 0.12); }
.code-input {
  text-align: center; font-size: 30px; letter-spacing: 14px;
  font-weight: 700; padding-left: 14px;
}

.btn {
  width: 100%; font-size: 15px; font-weight: 700;
  padding: 13px 16px; border-radius: 9px; border: none;
  cursor: pointer; font-family: inherit;
  transition: background 0.15s, opacity 0.15s, transform 0.05s;
  margin-top: 4px;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--magenta); color: #fff; }
.btn-primary:hover { background: var(--magenta-dark); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--muted); font-weight: 600; margin-top: 10px; }
.btn-ghost:hover { background: #f1f1f4; }
.btn-link {
  background: transparent; color: var(--magenta);
  margin-top: 6px; text-decoration: underline; font-weight: 600;
}
.btn-link:disabled { color: var(--muted); text-decoration: none; cursor: not-allowed; }

.msg { font-size: 14px; line-height: 1.5; margin: 18px 0 0; min-height: 1em; text-align: center; font-weight: 500; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

.welcome-badge {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--magenta-soft); border: 2px solid #f7c6e0;
  color: var(--magenta); font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.next-box {
  background: #f5f6fb; border: 1px solid #dfe2f0;
  border-radius: 12px; padding: 16px; margin: 20px 0; font-size: 14px;
}
.next-box strong { color: var(--navy); }
.next-box p { margin: 6px 0 0; color: var(--muted); }

.legal { font-size: 12px; color: #9ca3af; text-align: center; margin: 0; font-weight: 400; }

/* ── Responsive: una sola columna en mobile ── */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .hero { padding: 36px 28px; }
  .hero-title { font-size: 30px; }
  .hero-points { display: none; }
  .auth { padding: 28px 20px 40px; }
}

/* ════════════ Paso 2 — Asistente Identificar Cliente ════════════ */
body.intake-open { overflow: hidden; }

.intake {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.intake.hidden { display: none; }

.intake-top {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px; background: var(--navy);
  box-shadow: 0 2px 12px rgba(17, 27, 84, 0.18);
}
.intake-logo { height: 34px; width: auto; background: #fff; padding: 5px 9px; border-radius: 9px; }
.intake-progress {
  color: #fff; font-size: 13px; font-weight: 600;
  background: rgba(255, 255, 255, 0.14); padding: 6px 14px; border-radius: 999px;
}
/* Asociado + tienda, alineado a la derecha, presente en cada pantalla. */
.intake-who {
  margin-left: auto; text-align: right; line-height: 1.25;
  display: flex; flex-direction: column; max-width: 45%;
}
.intake-who .who-name { color: #fff; font-size: 13px; font-weight: 700; }
.intake-who .who-store { color: #c7cbe6; font-size: 11px; font-weight: 500; }
.btn-exit {
  background: rgba(255, 255, 255, 0.12); color: #fff; border: none;
  width: 34px; height: 34px; border-radius: 9px; font-size: 16px; cursor: pointer;
  margin-left: 8px;
}
.btn-exit:hover { background: rgba(255, 255, 255, 0.22); }

/* ── Mapa de etapas (stepper navegable) ── */
/* Sticky justo debajo del header navy (header ≈ 62px). Muestra TODAS las etapas
   del flujo; las visitadas son clickeables (ir y volver). */
.stepmap {
  position: sticky; top: 62px; z-index: 1;
  display: flex; align-items: center; gap: 2px;
  padding: 11px 16px; background: #fff;
  border-bottom: 1px solid #e6e8f2;
  box-shadow: 0 1px 6px rgba(17, 27, 84, 0.05);
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.stepmap::-webkit-scrollbar { display: none; }
.stepnode {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: none; padding: 6px 8px; border-radius: 10px;
  font-family: inherit; cursor: default; color: var(--muted);
  transition: background 0.15s;
}
.stepnode.nav { cursor: pointer; }
.stepnode.nav:hover { background: #f5f6fb; }
.stepnode:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.stepdot {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: #e3e6f0; color: var(--muted);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.steplabel { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.stepnode.done .stepdot { background: var(--ok); color: #fff; }
.stepnode.done .steplabel { color: var(--navy); }
.stepnode.current .stepdot { background: var(--magenta); color: #fff; box-shadow: 0 0 0 3px var(--magenta-soft); }
.stepnode.current .steplabel { color: var(--navy); font-weight: 800; }
.stepline { flex: 0 0 14px; height: 2px; background: #d9dde9; border-radius: 2px; }

.intake-body {
  flex: 1; width: 100%; max-width: 560px; margin: 0 auto;
  padding: 28px 20px 48px;
}

.iv.hidden { display: none; }
.iv-title { font-size: 23px; font-weight: 800; color: var(--navy); margin: 0 0 6px; letter-spacing: -0.01em; }
.iv-title .accent { color: var(--magenta); }
.iv-sub { font-size: 14px; color: var(--muted); margin: 0 0 22px; line-height: 1.5; }
.iv-msg { font-size: 14px; line-height: 1.5; margin: 14px 0 0; min-height: 1em; text-align: center; font-weight: 500; }
.iv-msg.error { color: var(--danger); }
.iv-msg.ok { color: var(--ok); }

/* ── Barra de progreso indeterminada (búsqueda de cliente, puede tardar ~30s) ── */
.progress {
  margin-top: 14px; height: 6px; border-radius: 999px;
  background: #e3e6f0; overflow: hidden; position: relative;
}
.progress.hidden { display: none; }
.progress-bar {
  position: absolute; top: 0; left: 0; height: 100%; width: 40%;
  border-radius: 999px; background: var(--magenta);
  animation: progress-slide 1.3s ease-in-out infinite;
}
@keyframes progress-slide {
  0%   { left: -40%; width: 40%; }
  50%  { width: 55%; }
  100% { left: 100%; width: 40%; }
}

/* ── Cámara ── */
.cam {
  position: relative; width: 100%; aspect-ratio: 4 / 3;
  background: #0b1020; border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.cam[data-cam="selfie"], .cam[data-cam="audit"] { aspect-ratio: 3 / 4; max-height: 60vh; margin: 0 auto; }
.cam-video, .cam-preview { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-video.hidden, .cam-preview.hidden { display: none; }
/* Overlay inicial (estado idle): invita a abrir la cámara. */
.cam-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  color: rgba(255, 255, 255, 0.85); text-align: center; padding: 20px;
}
.cam-overlay.hidden { display: none; }
.cam-overlay span { font-size: 44px; }
.cam-overlay p { margin: 0; font-size: 13px; font-weight: 500; }
.cam-frame {
  position: absolute; pointer-events: none;
  border: 3px dashed rgba(255, 255, 255, 0.7); border-radius: 12px;
}
.cam-frame.doc { inset: 12% 8%; }
.cam-frame.face { inset: 8% 18%; border-radius: 50%; }

.cam-actions {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px;
  justify-content: center;
}
.cam-actions .btn { width: auto; flex: 1 1 auto; min-width: 130px; margin-top: 0; }

/* ── Revisión ── */
.review-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.review-photos figure { margin: 0; text-align: center; }
.review-photos img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px;
  background: #e9ebf3; border: 1px solid #dfe2f0;
}
.review-photos figcaption { font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 600; }

/* ── Verificación de identidad (cliente existente): caras lado a lado ── */
.face-compare {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 14px; margin-bottom: 18px;
}
.face { margin: 0; text-align: center; }
.face-img-wrap {
  position: relative; width: 148px; height: 148px; max-width: 100%;
  margin: 0 auto; border-radius: 50%; overflow: hidden;
  border: 4px solid #e6e8f2; background: #e9ebf3;
  box-shadow: 0 6px 18px rgba(17, 27, 84, 0.10);
}
.face-img-wrap.is-registered { border-color: #c7cbe6; }
.face-img-wrap.is-live { border-color: #f7c6e0; }
.face-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face-cap { font-size: 12.5px; font-weight: 700; color: var(--navy); margin-top: 10px; }
.face-cap small { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.face-link {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; font-size: 18px; font-weight: 800;
  background: #eef0f7; color: var(--muted); border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(17, 27, 84, 0.12);
}
.face-link.ok { background: #ecfdf3; color: var(--ok); }
.face-link.warn { background: #fffbeb; color: #b45309; }
.face-link.bad { background: #fef2f2; color: var(--danger); }

.verdict {
  text-align: center; border-radius: 12px; padding: 16px 14px; margin-bottom: 6px;
  border: 1px solid #e6e8f2; background: #f7f8fc;
}
.verdict.ok { background: #ecfdf3; border-color: #bbf7d0; }
.verdict.warn { background: #fffbeb; border-color: #fde68a; }
.verdict.bad { background: #fef2f2; border-color: #fecaca; }
.verdict-pct { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; color: var(--navy); }
.verdict.ok .verdict-pct { color: var(--ok); }
.verdict.warn .verdict-pct { color: #b45309; }
.verdict.bad .verdict-pct { color: var(--danger); }
.verdict-label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 4px 0 12px; letter-spacing: 0.03em; text-transform: uppercase; }
.verdict .biometrics { justify-content: center; margin-bottom: 0; }
.verdict-note { font-size: 12px; line-height: 1.5; color: var(--muted); font-weight: 500; margin: 14px auto 0; max-width: 380px; }
.verdict-note strong { color: var(--navy); }

.hr { height: 1px; background: #eef0f7; border: 0; margin: 20px 0; }
.who-name-big { font-size: 18px; font-weight: 800; color: var(--navy); margin: 0; letter-spacing: -0.01em; }
.who-ced { font-size: 13.5px; color: var(--muted); margin: 3px 0 12px; font-weight: 600; }
.who-ced b { color: var(--ink); font-weight: 700; }
.pill-flags { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 16px; }
.actions { margin-top: 18px; }

.biometrics { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  border: 1px solid transparent;
}
.chip-ok { background: #ecfdf3; color: #15803d; border-color: #bbf7d0; }
.chip-warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.chip-bad { background: #fef2f2; color: var(--danger); border-color: #fecaca; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid2-span { grid-column: 1 / -1; }
.field-hint { display: block; font-size: 11.5px; color: var(--muted); margin-top: 5px; font-weight: 500; }
.field input[readonly] { background: #f5f6fb; color: var(--muted); }
select {
  width: 100%; font-size: 16px; padding: 13px 14px;
  border: 1.5px solid #d9dbe4; border-radius: 9px; outline: none;
  font-family: inherit; color: var(--ink); background: #fff;
}
select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(17, 27, 84, 0.12); }

/* ── Cliente existente (found) ── */
.found-badge {
  display: inline-block; background: #ecfdf3; color: #15803d; border: 1px solid #bbf7d0;
  font-size: 12.5px; font-weight: 700; padding: 6px 14px; border-radius: 999px; margin-bottom: 12px;
}
.contracts { margin: 4px 0 22px; }
.contracts-head { font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 10px; }
.contract-row {
  background: var(--card); border: 1px solid #e6e8f2; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px;
}
.contract-prod { font-size: 15px; font-weight: 700; color: var(--ink); }
.contract-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.contract-meta .paid { color: #15803d; font-weight: 600; }
.contract-meta .pend { color: #b45309; font-weight: 600; }

/* ── Paso 3 — Selección de equipo y plan ── */
.equipo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 4px 0 8px; }
.equipo-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: var(--card); border: 1.5px solid #e6e8f2; border-radius: 12px;
  padding: 14px; cursor: pointer; font-family: inherit; text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.equipo-card:hover { border-color: #c7cbe6; }
.equipo-card:active { transform: translateY(1px); }
.equipo-card.selected { border-color: var(--magenta); box-shadow: 0 0 0 3px var(--magenta-soft); }
.equipo-emoji { font-size: 26px; }
.equipo-marca { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.equipo-modelo { font-size: 14.5px; font-weight: 700; color: var(--navy); }
.equipo-precio { font-size: 14px; font-weight: 800; color: var(--magenta); margin-top: 4px; }

.plan-box { margin-top: 22px; }
.plan-title { font-size: 15px; font-weight: 700; color: var(--navy); margin: 0 0 12px; }
.plan-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.plan-option {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--card); border: 1.5px solid #e6e8f2; border-radius: 12px;
  padding: 14px 8px; cursor: pointer; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.plan-option:hover { border-color: #c7cbe6; }
.plan-option.selected { border-color: var(--magenta); box-shadow: 0 0 0 3px var(--magenta-soft); }
.plan-n { font-size: 12px; font-weight: 700; color: var(--navy); }
.plan-cuota { font-size: 17px; font-weight: 800; color: var(--magenta); line-height: 1.1; }
.plan-cuota small { font-size: 11px; font-weight: 600; color: var(--muted); }
.plan-entrega { font-size: 10.5px; font-weight: 600; color: var(--muted); text-align: center; }

.venta-resumen {
  margin-top: 18px; background: #f5f6fb; border: 1px solid #dfe2f0;
  border-radius: 12px; padding: 12px 16px;
}
.resumen-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; padding: 4px 0; }
.resumen-row span { color: var(--muted); }
.resumen-row b { color: var(--navy); font-weight: 700; }
.resumen-row.total { border-top: 1px solid #dfe2f0; margin-top: 6px; padding-top: 10px; }
.resumen-row.total b { font-size: 19px; color: var(--magenta); font-weight: 800; }
#btn-venta-continuar { margin-top: 18px; }

/* Filtros del catálogo (Categoría / Marca / Entrega) */
.filtros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 4px 0 16px; }
.filtro { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.filtro > span { font-size: 11px; font-weight: 600; color: var(--navy); }
.filtro select { padding: 9px 10px; font-size: 13px; }
/* Imagen real del equipo + línea de plan (entrega · 6 cuotas) */
.equipo-img { width: 100%; height: 88px; object-fit: contain; background: #fff; border-radius: 8px; margin-bottom: 2px; }
.equipo-plan { font-size: 10.5px; font-weight: 600; color: var(--muted); margin-top: 4px; line-height: 1.3; }
@media (max-width: 560px) { .filtros { grid-template-columns: 1fr; gap: 8px; } }

@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .cam-actions .btn { min-width: 110px; }
  /* En pantallas chicas, priorizar el contexto (asociado+tienda) sobre el pill. */
  .intake-progress { display: none; }
  .intake-who { max-width: 60%; }
  /* Stepper: sólo dots numerados; la etiqueta queda en la etapa actual. */
  .stepmap { padding: 9px 12px; }
  .steplabel { display: none; }
  .stepnode.current .steplabel { display: inline; }
  .stepline { flex-basis: 9px; }
  .face-img-wrap { width: 128px; height: 128px; }
  .face-compare { gap: 8px; }
}
@media (max-width: 380px) {
  .face-img-wrap { width: 104px; height: 104px; }
  .face-link { width: 32px; height: 32px; font-size: 15px; }
}
