/* =========================================================
   Encuesta de satisfacción por WhatsApp · Nissan Gran Auto
   Pantalla dividida: a la izquierda lo que ve la agencia (papel),
   a la derecha lo que ve el cliente (teléfono sobre negro).
   ========================================================= */

/* Tipografía oficial Nissan Brand (archivos en assets/fonts) */
@font-face {
  font-family: "Nissan Brand";
  src: url("../assets/fonts/NissanBrand-Light.woff") format("woff"),
       url("../assets/fonts/NissanBrand-Light.ttf") format("truetype");
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Nissan Brand";
  src: url("../assets/fonts/NissanBrand-Regular.woff") format("woff"),
       url("../assets/fonts/NissanBrand-Regular.ttf") format("truetype");
  font-weight: 400 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Nissan Brand";
  src: url("../assets/fonts/NissanBrand-Bold.woff") format("woff"),
       url("../assets/fonts/NissanBrand-Bold.ttf") format("truetype");
  font-weight: 600 900; font-style: normal; font-display: swap;
}

:root {
  /* Marca */
  --paper: #FFFFFF;
  --ink: #111111;
  --ink-2: #3A3A3A;
  --muted: #6E6E6E;
  --rule: #E3E3E3;
  --stage: #0B0B0C;
  --accent: #C3002F;      /* rojo Nissan */

  /* Semáforo tenue: solo para identificar el escenario */
  --ok: #2E9E5B;   --ok-ink: #1C7442;
  --mid: #E0A800;  --mid-ink: #8A6100;
  --bad: #C3002F;  --bad-ink: #A8002A;

  /* WhatsApp (solo dentro del teléfono) */
  --wa-bg: #EFEAE2;
  --wa-in: #FFFFFF;
  --wa-out: #D9FDD3;
  --wa-text: #111B21;
  --wa-meta: #5E6E78;
  --wa-tick: #2B9FD9;
  --wa-link: #0A7CBF;
  --wa-btn: #008069;
  --wa-green: #008069;
  --wa-bar: #F0F2F5;

  --t-xs: 15px;
  --pad: clamp(20px, 3.6vw, 64px);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --font: "Nissan Brand", "Helvetica Neue", Arial, sans-serif;
  --font-phone: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, p, dl, dd, fieldset, legend, ul, table { margin: 0; padding: 0; }
ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
svg { display: block; }
i { font-style: normal; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
::selection { background: var(--ink); color: #fff; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =========================================================
   Portada
   ========================================================= */
@property --tg { syntax: "<color>"; inherits: false; initial-value: #E8203F; }

.portada {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  column-gap: var(--pad);
  padding: clamp(28px, 5svh, 56px) var(--pad);
  background: var(--stage); color: #fff;
}
.portada > :not(.portada-luz) { position: relative; z-index: 1; }

/* Luz de temperatura: sigue al mouse (main.js pone --x/--y en px)
   y pasa lento de verde a ámbar y a rojo. Sin JS queda abajo a la derecha. */
.portada-luz {
  position: absolute; left: 0; top: 0; z-index: 0;
  width: min(52vh, 500px); aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--tg) 55%, transparent) 0%,
    color-mix(in srgb, var(--tg) 24%, transparent) 40%,
    color-mix(in srgb, var(--tg) 7%, transparent) 70%,
    transparent 100%); /* taste-skill-ignore: luz de temperatura */
  transform: translate3d(calc(var(--x, 78vw) - 50%), calc(var(--y, 82vh) - 50%), 0);
  animation: temperatura 15s ease-in-out infinite;
  pointer-events: none;
  will-change: transform;
}

/* Bloque de marcas a la derecha, con un ligero desplazamiento contrario al mouse */
.portada-logos {
  grid-column: 2; grid-row: 1;
  align-self: center; justify-self: center;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(28px, 5svh, 56px);
  transform: translate3d(calc(var(--px, 0) * -28px), calc(var(--py, 0) * -28px), 0);
}
.pl-nissan { display: block; width: auto; height: clamp(150px, 27svh, 290px); filter: brightness(0) invert(1); }
.pl-fila { display: flex; align-items: center; gap: clamp(20px, 2.4vw, 40px); }
.pl-ga { display: block; width: auto; height: clamp(34px, 5.2svh, 54px); filter: brightness(0) invert(1); }
.pl-ai { display: block; width: auto; height: clamp(30px, 4.6svh, 48px); filter: invert(1); }
.pl-sep { width: 1.5px; align-self: stretch; background: #fff; opacity: 0.3; }
@keyframes temperatura {
  0%, 100% { --tg: #34C26E; }
  33%      { --tg: #F2B50F; }
  66%      { --tg: #E8203F; }
}

.portada-main { grid-column: 1; grid-row: 1; align-self: center; padding: clamp(24px, 6svh, 72px) 0; }
.portada-titulo {
  max-width: 16ch;
  font-size: clamp(46px, 5.2vw, 104px);
  font-weight: 300; line-height: 0.98; letter-spacing: -0.035em;
}
.portada-sub {
  margin-top: clamp(18px, 3svh, 32px); max-width: 38ch;
  font-size: clamp(18px, 1.5vw, 25px); line-height: 1.4;
  color: rgba(255, 255, 255, 0.82);
}
.portada-fecha { margin-top: 14px; font-size: 15px; color: rgba(255, 255, 255, 0.55); }

.portada-pie { grid-column: 1 / -1; grid-row: 2; display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; }
.portada-datos { display: flex; gap: clamp(28px, 5vw, 88px); }
.portada-datos dt {
  font-size: clamp(36px, 3.6vw, 64px); font-weight: 300; line-height: 1;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.portada-datos dd { margin-top: 8px; font-size: 15px; color: rgba(255, 255, 255, 0.7); }
.portada-baja {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; color: #fff; text-decoration: none;
  font-size: 16px; font-weight: 700;
}
.portada-baja svg { transition: transform 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .portada-baja:hover svg { transform: translateY(4px); }
}

/* =========================================================
   Así funciona: cuatro campos, la misma tarjeta avanzando
   ========================================================= */
.proceso {
  --p-grey: #C4C4C4;
  --p-black: #0E0E0E;
  --p-muted: #4A4A4A;
  --p-pad: clamp(24px, 2.2vw, 44px);
  --p-t: clamp(24px, 2.2vw, 42px);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  /* Filas compartidas por los cuatro campos: título | tarjeta | paso */
  grid-template-rows: clamp(56px, 9svh, 110px) 1fr auto;
  min-height: 100svh;
}
/* Cada campo usa las filas del contenedor (subgrid): las cuatro tarjetas
   quedan a la misma altura aunque las frases tengan distinto largo. */
.field {
  position: relative;
  grid-row: 1 / span 3;
  display: grid;
  grid-template-rows: subgrid;
  padding: var(--p-pad);
}
.field h2 {
  grid-row: 1; align-self: start; margin: 0;
  font-size: var(--p-t); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em;
}
.field--1 { background: #fff; color: var(--ink); }
.field--2 { background: var(--p-grey); color: var(--ink); }
.field--3 { background: var(--accent); color: #fff; }
.field--4 { background: var(--p-black); color: #fff; }

.field .card { grid-row: 2; align-self: start; justify-self: center; margin-top: clamp(12px, 7svh, 96px); }
.step { grid-row: 3; align-self: end; padding-top: 24px; }
.clause {
  max-width: 16ch;
  font-size: var(--p-t); font-weight: 700; line-height: 1.1; letter-spacing: -0.015em;
}
.step-detail {
  margin-top: 14px; max-width: 30ch;
  font-size: clamp(15px, 0.95vw, 19px); line-height: 1.45;
  color: #3A3A3A;
}
.field--3 .step-detail, .field--4 .step-detail { color: rgba(255, 255, 255, 0.82); }

/* La tarjeta crece con la pantalla: todo va en em a partir de su tamaño base */
/* Ficha de registro: mismo lenguaje que el reporte de escenarios
   (título con línea negra, filas con líneas finas, texto plano; sin etiquetas de color) */
.card {
  --c-rule: #E2E2E2;
  width: 19em; max-width: 100%;
  padding: 1.5em 1.5em 1.3em;
  border-radius: 4px;
  background: #fff; color: var(--ink);
  font-size: clamp(14px, 1vw, 19px); line-height: 1.35;
  transition: transform 150ms var(--ease-out);
}
.field--1 .card { --c-rule: #D9D9D9; background: #F1F1F1; }
.card-name { font-size: 1.3em; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.card-car { margin-top: 0.2em; color: var(--p-muted); }
.card-h {
  margin-top: 1.4em; padding-bottom: 0.5em;
  border-bottom: 2px solid var(--ink);
  font-size: 0.85em; font-weight: 700;
}
.card-ans div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.8em;
  padding: 0.6em 0;
  border-bottom: 1px solid var(--c-rule); /* taste-skill-ignore: filas de registro */
}
.card-ans dt { color: var(--p-muted); }
.card-ans dd { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-ans dd span { margin-left: 0.35em; font-weight: 400; color: var(--p-muted); }
.card-ans dd.vacio { color: #B5B5B5; font-weight: 400; }
.card-estado {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.8em;
  margin-top: 0.9em; font-weight: 700;
}
.card-hora { font-weight: 400; color: var(--p-muted); font-variant-numeric: tabular-nums; }
.card-estado--fin { font-weight: 400; color: var(--p-muted); }

/* Último paso: la temperatura como cifra */
.card-temp {
  display: flex; align-items: flex-end; gap: 0.6em;
  padding: 0.7em 0 0.8em;
  border-bottom: 1px solid var(--c-rule); /* taste-skill-ignore: fila de registro */
}
.card-temp b {
  font-size: 3.4em; font-weight: 300; line-height: 0.85; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.card-temp span { display: flex; flex-direction: column; padding-bottom: 0.15em; color: var(--p-muted); font-size: 0.9em; font-variant-numeric: tabular-nums; }
.card-temp strong { font-size: 1.1em; color: var(--ok-ink); }

@media (hover: hover) and (pointer: fine) {
  .field:hover .card { transform: translateY(-6px); }
}
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}
@media (max-width: 1100px) {
  .proceso { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; min-height: 0; }
  .field { grid-row: auto; grid-template-rows: clamp(56px, 9svh, 110px) 1fr auto; min-height: 80svh; }
  .card { font-size: 15px; }
}
@media (max-width: 699px) {
  .proceso { grid-template-columns: 1fr; }
  .field { display: flex; flex-direction: column; min-height: 0; padding: 32px 20px 40px; }
  .field h2 { margin-bottom: 16px; }
  .step { order: 1; padding-top: 0; }
  .clause { font-size: 26px; max-width: 18ch; }
  .field .card { order: 2; margin: 28px 0 0; align-self: flex-start; }
}

/* =========================================================
   Composición: dos mitades
   ========================================================= */
.esc {
  min-height: 100svh;
  display: grid;
  /* 50/50: la orilla blanco/negro coincide con la división gris/rojo de "Así funciona" */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* ---------- Izquierda: la agencia ---------- */
/* Color de la temperatura del escenario activo (lo usan la pestaña, el estado y la luz) */
@property --glow { syntax: "<color>"; inherits: true; initial-value: #34C26E; }
.esc {
  --state-ink: var(--ok-ink);
  --glow: #34C26E;
  transition: --glow 600ms var(--ease-out);
}
.esc[data-state="mid"] { --state-ink: var(--mid-ink); --glow: #F2B50F; }
.esc[data-state="bad"] { --state-ink: var(--bad-ink); --glow: #E8203F; }

.esc-copy {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column;
  padding: clamp(28px, 5svh, 56px) var(--pad) clamp(28px, 5svh, 56px);
  background: var(--paper); color: var(--ink);
}
.esc-copy > :not(.glow) { position: relative; z-index: 1; }

.brand { display: flex; align-items: center; gap: 20px; }
.logo { display: block; width: auto; filter: brightness(0); }
.logo--nissan { height: 46px; }
.logo--ga { height: 27px; }
.brand-sep { width: 1.5px; align-self: stretch; margin: 6px 0; background: currentColor; opacity: 0.25; }
/* Auto Insights: arriba a la derecha del lado blanco */
.logo-ai { display: block; width: auto; height: 32px; margin-left: auto; }

.esc-copy .esc-title {
  margin-top: clamp(28px, 7svh, 88px);
  max-width: 22ch;
  font-size: clamp(34px, 3.3vw, 54px);
  font-weight: 700; line-height: 1.04; letter-spacing: -0.015em;
}
.esc-lead { margin-top: 16px; max-width: 44ch; color: var(--ink-2); font-size: clamp(18px, 1.35vw, 20px); }

/* Pestañas de escenario */
.tabs {
  display: flex; gap: clamp(22px, 2.6vw, 40px);
  margin-top: clamp(28px, 5svh, 60px);
}
.tabs label {
  position: relative;
  padding-bottom: 12px;
  color: var(--muted);
  font-size: clamp(17px, 1.3vw, 20px); font-weight: 700;
  cursor: pointer;
  transition: color 160ms var(--ease-out);
}
.tabs input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
/* Cada pestaña lleva su color de semáforo: tenue si no está activa, completo si lo está */
.tabs label[data-tone="ok"] { --tone: var(--ok); }
.tabs label[data-tone="mid"] { --tone: var(--mid); }
.tabs label[data-tone="bad"] { --tone: var(--bad); }
.tabs label::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  background: var(--tone);
  opacity: 0.28;
  transform: scaleY(0.67); transform-origin: bottom center;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}
.tabs label:has(input:checked) { color: var(--ink); }
.tabs label:has(input:checked)::after { opacity: 1; transform: none; }
.tabs label:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 6px; }

/* Ficha del cliente */
.ficha { margin-top: clamp(20px, 3.6svh, 40px); }
/* En pantallas altas el bloque se centra en vertical; los logos se quedan arriba */
.esc-copy > .brand { margin-bottom: auto; }
.esc-copy > .ficha { margin-bottom: auto; }
.ficha-cliente { margin-top: 2px; color: var(--muted); font-size: 15px; }

.ficha-temp { display: flex; align-items: flex-end; gap: clamp(18px, 2vw, 28px); margin-top: 6px; }
.ficha-num {
  font-size: clamp(88px, 15svh, 152px);
  font-weight: 300; line-height: 0.8; letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}
.ficha-temp-txt { padding-bottom: 0.25em; }
.ficha-estado { font-size: clamp(20px, 1.7vw, 26px); font-weight: 700; line-height: 1.1; color: var(--state-ink); }
.ficha-formula { margin-top: 6px; color: var(--muted); font-size: 15px; }
.ficha-formula span { color: var(--ink); font-variant-numeric: tabular-nums; }
.ficha-temp.swap { animation: swap 420ms var(--ease-out) both; }
@keyframes swap { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Dos bloques tipo reporte: Respuestas | Seguimiento */
.ficha-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(24px, 3.2vw, 52px);
  margin-top: clamp(22px, 4svh, 44px);
}
.ficha-h {
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
  font-size: 15px; font-weight: 700; line-height: 1.2;
}

.resp { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 1.3; }
.resp th, .resp td {
  padding: clamp(8px, 1.4svh, 13px) 0;
  border-bottom: 1px solid var(--rule);
  text-align: left; vertical-align: baseline;
}
.resp th { padding-right: 12px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.resp-n {
  width: 2.2ch; padding-right: 12px;
  font-weight: 700; text-align: right; font-variant-numeric: tabular-nums;
}
.resp-txt { color: var(--ink-2); }

.seg-accion { margin-top: 14px; font-size: clamp(17px, 1.3vw, 19px); font-weight: 700; line-height: 1.35; }
.seg-quien { margin-top: 10px; color: var(--muted); font-size: 15px; }
.seg-quien b { color: var(--ink); }

/* Quién da seguimiento, junto a la cifra */
.ficha-seg { margin-top: 6px; font-size: 15px; color: var(--ink-2); }

/* Comentario del cliente procesado por el clasificador de IA */
.ia-resumen {
  margin-top: 12px;
  font-size: clamp(15px, 1.05vw, 17px); font-weight: 700; line-height: 1.35;
}
.ia-resumen::before { content: "“"; }
.ia-resumen::after { content: "”"; }
.ia-datos { margin-top: 8px; font-size: 14px; }
.ia-datos div {
  display: grid; grid-template-columns: 5.6em 1fr; gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--rule); /* taste-skill-ignore: filas de reporte */
}
.ia-datos dt { color: var(--muted); }
.ia-datos dd { font-weight: 700; }
.ia-codigo { font-size: 12.5px; letter-spacing: 0.01em; overflow-wrap: anywhere; }

/* ---------- Derecha: el cliente ---------- */
/* =========================================================
   Teléfono
   ========================================================= */
.esc-phone { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.phone {
  position: relative;
  height: min(calc(100svh - 112px), 860px);
  min-height: 560px;
  min-width: 0; /* sin esto, aspect-ratio deja que el contenido ensanche el teléfono */
  aspect-ratio: 9 / 19.2;
  padding: 11px;
  border-radius: 56px;
  background: #08090A;
  box-shadow: inset 0 0 0 1.5px #3A3F46, 0 40px 80px -24px rgba(0, 0, 0, 0.75); /* taste-skill-ignore: marco del teléfono */
}
/* Botones laterales */
.phone::before, .phone::after {
  content: ""; position: absolute; width: 4px; border-radius: 2px; background: #2C3036;
}
.phone::before { right: -3px; top: 24%; height: 11%; }
.phone::after { left: -3px; top: 18%; height: 16%; box-shadow: 0 calc(100% + 18px) 0 #121212; } /* taste-skill-ignore: botón de volumen */

.phone-screen {
  position: relative;
  height: 100%;
  display: flex; flex-direction: column;
  border-radius: 46px; overflow: hidden;
  background: var(--wa-bg); color: var(--wa-text);
  font-family: var(--font-phone);
  font-size: 15px; line-height: 1.38; text-align: left;
}
.phone-island {
  position: absolute; top: 11px; left: 50%; z-index: 3;
  width: 31%; height: 30px; border-radius: 20px;
  background: #000; transform: translateX(-50%);
}
.phone-status {
  flex: none;
  display: flex; justify-content: space-between; align-items: center;
  height: 52px; padding: 8px 9% 0 11%;
  background: #fff; color: #000;
  font-size: 14px; font-size: clamp(11px, 5cqi, 15px); font-weight: 700; font-variant-numeric: tabular-nums;
}
.phone-icons { display: flex; align-items: center; gap: 0.4em; }
.phone-icons svg { width: auto; height: 0.82em; fill: currentColor; }

/* WhatsApp */
/* El encabezado escala con el ancho del celular (unidades cqi) para que el nombre
   y los iconos quepan igual en un celular grande o en uno chico */
.phone-screen { container-type: inline-size; }
.wa-head {
  flex: none;
  display: flex; align-items: center; gap: 0.5em;
  padding: 0.4em 0.7em 0.6em 0.55em; background: #fff;
  font-size: 14px; font-size: clamp(10px, 5cqi, 15px);
  /* Línea bajo el encabezado: separa el chat para que los mensajes no se confundan con él */
  position: relative; z-index: 2;
  box-shadow: 0 1px 0 #E1E4E6, 0 2px 6px rgba(11, 20, 26, 0.07); /* taste-skill-ignore: separador del encabezado de WhatsApp */
}
.wa-back { flex: none; width: 0.7em; height: 1.15em; color: var(--wa-text); }
.wa-avatar {
  flex: none; width: 2.25em; height: 2.25em; border-radius: 50%;
  display: grid; place-items: center;
  background: #000;
}
.wa-avatar img { width: 70%; height: auto; filter: brightness(0) invert(1); }
.wa-who { flex: 1; min-width: 0; }
.wa-who b { display: block; font-size: 1em; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-who small { display: block; font-size: 0.84em; color: var(--wa-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Videollamada, llamada y menú, como en WhatsApp */
.wa-acc { flex: none; display: flex; align-items: center; gap: 0.85em; margin-left: 0.25em; color: var(--wa-text); }
.wa-acc svg { display: block; width: 1.2em; height: 1.2em; }

.wa-body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 10px 16px;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: none;
}
.wa-body::-webkit-scrollbar { display: none; }
.wa-day {
  align-self: center; margin-bottom: 4px;
  padding: 4px 12px; border-radius: 8px;
  background: #fff; color: var(--wa-meta); font-size: 13px;
}

.msg { position: relative; max-width: 86%; }
.msg p { margin: 0; }
.msg .meta { font-size: 13px; line-height: 1; color: var(--wa-meta); white-space: nowrap; }

/* Cola de burbuja (como WhatsApp) */
.msg.in::before, .msg.out::before {
  content: ""; position: absolute; top: 0; width: 8px; height: 13px;
}
.msg.in::before { left: -7px; background: var(--wa-in); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.msg.out::before { right: -7px; background: var(--wa-out); clip-path: polygon(0 0, 100% 0, 0 100%); }

/* Respuesta del cliente */
.msg.out {
  align-self: flex-end;
  display: flex; align-items: flex-end; gap: 8px;
  margin-right: 7px;
  padding: 6px 8px 6px 10px;
  border-radius: 8px; border-top-right-radius: 0;
  background: var(--wa-out);
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13); /* taste-skill-ignore: burbuja de WhatsApp */
}
.msg.out p { font-variant-numeric: tabular-nums; }
.msg.out .meta { display: flex; align-items: center; gap: 3px; padding-bottom: 1px; }
.msg.out .meta svg { color: var(--wa-tick); }
/* Mensaje largo: la hora va debajo, alineada a la derecha */
.msg.out.msg-largo { display: block; }
.msg.out.msg-largo .meta { justify-content: flex-end; margin-top: 3px; }

/* Plantilla de la agencia: contenido + botones en la misma burbuja */
.tpl {
  align-self: flex-start;
  width: calc(88% - 7px); margin-left: 7px;
  border-radius: 8px; border-top-left-radius: 0;
  background: var(--wa-in);
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13); /* taste-skill-ignore: burbuja de WhatsApp */
}
.tpl-content { padding: 7px 10px 6px; }
.tpl-head { font-weight: 700; margin-bottom: 3px; }
.tpl-body { white-space: pre-line; }
.tpl-body + .tpl-body { margin-top: 8px; }
.tpl-foot {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 10px;
  margin-top: 6px; font-size: 13px; line-height: 1.25; color: var(--wa-meta);
}
.tpl-btns { display: grid; }
.tpl-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 12px;
  border: 0; border-top: 1px solid #E9EDEF; /* taste-skill-ignore: divisor de botones de WhatsApp */
  background: transparent; color: var(--wa-btn);
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; text-align: center;
  font-variant-numeric: tabular-nums;
  transition: background-color 180ms var(--ease-out), color 200ms var(--ease-out);
}
.tpl-btn.is-chosen { color: #8696A0; }
.tpl-btns .tpl-btn:last-child { border-radius: 0 0 8px 8px; }
.tpl-btn svg { flex: none; }
.tpl-btn.is-tapped { background: #E9EDEF; }
button.tpl-btn { width: 100%; cursor: pointer; }

/* Hoja inferior: todas las opciones */
.sheet-backdrop {
  position: absolute; inset: 0; z-index: 5;
  background: rgba(11, 20, 26, 0.4);
  opacity: 0; transition: opacity 260ms var(--ease-out);
}
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: 8px 0 26px;
  border-radius: 18px 18px 0 0;
  background: #fff; color: var(--wa-text);
  transform: translateY(100%);
  transition: transform 320ms var(--ease-out);
}
.sheet.is-open { transform: translateY(0); }
.sheet-backdrop.is-open { opacity: 1; }
.sheet-grab { display: block; width: 36px; height: 4px; margin: 0 auto 6px; border-radius: 2px; background: #D1D7DB; }
.sheet-top { display: flex; align-items: center; gap: 6px; padding: 0 12px; }
.sheet-close {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: transparent; color: var(--wa-meta); cursor: pointer;
}
.sheet-title { font-size: 17px; font-weight: 700; }
.sheet-q { padding: 4px 20px 10px; font-size: 14px; color: var(--wa-meta); }
.sheet-list { display: grid; }
.sheet-opt {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 52px; padding: 0 20px;
  border: 0; background: transparent; color: var(--wa-text);
  font: inherit; font-size: 16px; text-align: left; cursor: pointer;
  transition: background-color 160ms var(--ease-out);
}
.sheet-opt svg { flex: none; color: var(--wa-link); }
.sheet-opt .opt-txt {
  flex: 1; display: flex; align-items: center; min-height: 52px;
  border-bottom: 1px solid #E9EDEF; /* taste-skill-ignore: divisor de lista de WhatsApp */
  color: var(--wa-link); font-weight: 600; font-variant-numeric: tabular-nums;
}
.sheet-list li:last-child .opt-txt { border-bottom: 0; }
.sheet-opt.is-tapped { background: #E9EDEF; }

.typing {
  align-self: flex-start; display: flex; gap: 4px;
  margin-left: 7px;
  padding: 12px 14px; border-radius: 8px; border-top-left-radius: 0;
  background: var(--wa-in);
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13); /* taste-skill-ignore: burbuja de WhatsApp */
}
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #9AA6AD;
  animation: typing 1s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.msg-new { animation: msg-in 280ms var(--ease-out) both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

.wa-foot {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 22px; background: var(--wa-bar);
}
.wa-field {
  flex: 1; min-width: 0; padding: 9px 16px; border-radius: 20px;
  background: #fff; color: var(--wa-meta); font-size: 15px;
  white-space: nowrap; overflow: hidden;
}
.wa-field.escribiendo { color: var(--wa-text); }
.wa-send {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--wa-green); color: #fff;
}

.replay {
  min-height: 44px; margin-top: 10px; padding: 0 12px;
  background: transparent; color: #fff; border: 0;
  font: inherit; font-size: var(--t-xs); font-weight: 700;
  text-decoration: underline; text-underline-offset: 4px; cursor: pointer;
}


/* Escenario del teléfono (va después del bloque del teléfono para ajustarlo) */
.esc-phone {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: clamp(24px, 4svh, 48px) var(--pad);
  background: var(--stage); color: #fff;
}
.esc-phone > :not(.glow) { position: relative; z-index: 1; }

/* Luz del color de la temperatura: sale de la orilla izquierda del negro
   y abarca toda la altura (elipse alargada centrada en la orilla) */
.glow {
  position: absolute; left: 0; top: 50%; z-index: 0;
  width: min(46vw, 620px); height: 135%;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--glow) 60%, transparent) 0%,
    color-mix(in srgb, var(--glow) 28%, transparent) 40%,
    color-mix(in srgb, var(--glow) 9%, transparent) 70%,
    transparent 100%); /* taste-skill-ignore: luz pedida por el usuario */
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: breathe 7s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 0.85; transform: translate(-50%, -50%) scale(0.94); }
  50%      { opacity: 1;    transform: translate(-50%, -50%) scale(1.04); }
}
.phone { height: min(calc(100svh - 140px), 860px); min-height: 0; }
.phone-caption {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center;
  margin-top: 16px; color: #B5B5B5; font-size: var(--t-xs);
}
.replay {
  min-height: 44px; margin: 0; padding: 0 4px;
  background: transparent; color: #fff; border: 0;
  font: inherit; font-size: var(--t-xs); font-weight: 700;
  text-decoration: underline; text-underline-offset: 4px; cursor: pointer;
}

/* Hover solo con puntero fino */
@media (hover: hover) and (pointer: fine) {
  .tabs label:hover { color: var(--ink); }
  .replay:hover { text-decoration-thickness: 2px; }
}

/* =========================================================
   Así le llega al asesor y al gerente (clasificador de IA)
   ========================================================= */
.iasec {
  --tono: var(--mid);
  --tono-claro: #F2C14E;
  --tono-osc: rgba(242, 181, 15, 0.34);
  position: relative;
  min-height: 100svh;
  display: grid; grid-template-rows: auto 1fr;
  gap: clamp(18px, 3svh, 36px);
  padding: clamp(28px, 5svh, 56px) var(--pad);
  background: #F3F3F3; color: var(--ink);
}
.iasec[data-tono="bad"] { --tono: var(--bad); --tono-claro: #FF5C75; --tono-osc: rgba(229, 54, 75, 0.42); }
.iasec-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; }
.iasec-title { font-size: clamp(30px, 2.6vw, 48px); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.iasec-lead { margin-top: 10px; max-width: 70ch; color: var(--ink-2); font-size: clamp(16px, 1.15vw, 19px); }
.iasec-lead b { color: var(--ink); }
.iasec-ctrl { display: flex; align-items: flex-end; gap: 24px; flex: none; }
.iasec-tabs { margin-top: 0; }
.iasec-replay {
  min-height: 40px; padding: 0 16px;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out), transform 120ms var(--ease-out);
}
.iasec-replay:active { transform: scale(0.97); }

/* Tres etapas: cliente → IA → responsable (mismo alto, títulos alineados) */
.iasec-etapas {
  display: grid;
  grid-template-columns: auto 36px minmax(0, 780px) 36px auto;
  justify-content: center;
  align-items: stretch;
  gap: clamp(10px, 1.2vw, 22px);
}
.iae { min-width: 0; display: flex; flex-direction: column; }
.iae-h {
  display: flex; align-items: center;
  margin-bottom: 14px; font-size: clamp(17px, 1.2vw, 21px); font-weight: 700; line-height: 1.2;
}
.iae-flecha {
  align-self: center; width: 36px; margin-top: 34px;
  color: #A3A3A3; transition: color 300ms var(--ease-out);
}
.iae-flecha.on { color: var(--ink); }

/* Logo de la IA */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.gem-ico { display: inline-block; flex: none; width: 1em; height: 1em; margin-right: 0.4em; vertical-align: -0.12em; }

/* 2 · Panel de la IA: lee, clasifica y redacta */
.iap {
  position: relative; overflow: hidden;
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  padding: clamp(14px, 1.8svh, 22px) clamp(16px, 1.4vw, 26px);
  border-radius: 6px;
  background: #0E0E0E; color: #EDEDED;
  font-size: clamp(13px, 0.86vw, 16px); line-height: 1.45;
}
.iap-top {
  flex: none; display: flex; align-items: center; gap: 14px;
  padding-bottom: 12px; border-bottom: 1px solid #262626;
}
.iap-marca { display: flex; align-items: center; font-weight: 700; color: #fff; white-space: nowrap; }
.iap-marca .gem-ico { width: 1.3em; height: 1.3em; margin-right: 0.5em; }
.iap-estado {
  margin-left: auto; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  color: #B0B0B0; font-size: 0.92em; white-space: nowrap;
}
.iap-estado::before {
  content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #5E5E5E;
  transition: background-color 200ms var(--ease-out);
}
.iap.procesando .iap-estado::before { background: var(--tono-claro); animation: latido 900ms ease-in-out infinite; }
.iap.listo .iap-estado::before { background: var(--ok); }
@keyframes latido { 50% { opacity: 0.35; } }
.iap-json-btn {
  flex: none; min-height: 28px; padding: 0 9px;
  border: 1px solid #3A3A3A; border-radius: 4px;
  background: transparent; color: #BDBDBD;
  font: inherit; font-size: 0.78em; font-weight: 700; cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out), transform 120ms var(--ease-out);
}
.iap-json-btn:active { transform: scale(0.97); }
.iap-json-btn[aria-pressed="true"] { background: #fff; border-color: #fff; color: #0E0E0E; }
.iap-json-btn:disabled { opacity: 0.35; cursor: default; }
/* Barrido de lectura mientras procesa */
.iap::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent); /* taste-skill-ignore: barrido de procesamiento */
  opacity: 0; pointer-events: none;
}
.iap.procesando::after { opacity: 1; animation: barrido 1.2s linear infinite; }
@keyframes barrido { to { transform: translateX(350%); } }

.iap-vista {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  padding-top: 14px;
}
.iap-vista[hidden] { display: none; }
.iap-paso { transition: opacity 600ms var(--ease-out); }
.iap.corriendo .iap-paso:not(.on) { opacity: 0.3; }
.iap-h {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 7px; font-size: 0.86em; font-weight: 700; color: #9C9C9C;
  transition: color 250ms var(--ease-out);
}
.iap-n { color: #6E6E6E; font-variant-numeric: tabular-nums; transition: color 250ms var(--ease-out); }
.iap-paso.on .iap-n { color: var(--tono-claro); }
.iap-paso.actual .iap-h { color: #fff; }

/* Paso 1: el comentario con las frases que detecta */
.iap-cita { min-height: 2.9em; font-size: 1.1em; color: #fff; }
.iap-cita.entra { animation: fade-in 700ms var(--ease-out) both; }
.iap-cita mark {
  padding: 0 2px; border-radius: 2px; color: inherit;
  background: linear-gradient(var(--tono-osc), var(--tono-osc)) no-repeat 0 100% / 0% 100%; /* taste-skill-ignore: resaltado que se dibuja */
  transition: background-size 900ms var(--ease-out);
}
.iap-cita mark.on { background-size: 100% 100%; }
.iap-meta { margin-top: 4px; color: #8C8C8C; font-size: 0.86em; }

/* Paso 2 y 3: filas tipo reporte */
.iap-datos > div,
.iap-redacta p { display: grid; grid-template-columns: 10.5em minmax(0, 1fr); gap: 12px; }
.iap-datos > div { padding: 5px 0; border-top: 1px solid #232323; }
.iap-datos > div:first-child { padding-top: 0; border-top: 0; }
.iap-datos dt,
.iap-redacta b { color: #9C9C9C; font-weight: 400; }
.iap-datos dd { color: #fff; }
.iap-datos dd.sev { color: var(--tono-claro); font-weight: 700; }
.iap-datos dd.vacio { color: #4C4C4C; font-weight: 400; }
.iap-datos dd.entra { animation: fade-in 600ms var(--ease-out) both; }
.iap-redacta { display: grid; gap: 8px; }
.iap-redacta .tw { color: #fff; }
.iap-redacta .tw.escribe::after { content: "▍"; color: var(--tono-claro); animation: latido 700ms steps(1) infinite; }

/* Vista técnica (JSON) */
.iae-json {
  flex: 1; min-height: 0; overflow: auto;
  margin: 14px 0 0; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: clamp(12px, 0.74vw, 13.5px); line-height: 1.55;
}
.iae-json .k { color: #8FB3FF; }
.iae-json .v { color: #E8E8E8; }
.iae-json .ln { display: block; }
.iae-json .ln.clave .v { color: #FFD27A; }
.iae-json .p { color: #7A7A7A; }

/* Lo que "viaja" entre etapas */
.vuela { position: absolute; z-index: 30; margin: 0; pointer-events: none; will-change: transform, opacity; }
.vuela--burbuja {
  padding: 6px 9px; border-radius: 8px; border-top-right-radius: 0;
  background: var(--wa-out); color: var(--wa-text);
  font-family: var(--font-phone); line-height: 1.38;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22); /* taste-skill-ignore: burbuja en movimiento */
}
.vuela--frase {
  padding: 0 4px; border-radius: 3px;
  background: var(--tono); color: #111; font-weight: 700; white-space: nowrap;
}
.iasec[data-tono="bad"] .vuela--frase { color: #fff; }
.vuela--nota {
  padding: 10px 12px; border-radius: 6px; transform-origin: 0 0;
  background: #1C1C1C; color: #fff; line-height: 1.45;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3); /* taste-skill-ignore: tarjeta en movimiento */
}
.vuela--nota p + p { margin-top: 6px; }
.vuela--nota b { display: block; color: #9C9C9C; font-weight: 400; }

/* 1 y 3 · Celulares (cliente y responsable) */
.iasec .phone--mini { align-self: flex-start; height: min(calc(100svh - 330px), 590px); min-height: 0; }
.phone--mini .phone-screen { font-size: 14px; }
.phone--mini .wa-body { padding-bottom: 12px; }
.phone--mini .wa-foot { padding: 6px 8px 16px; }
.phone--mini .wa-field { padding: 7px 12px; font-size: 13.5px; }
.phone--mini .wa-send { width: 34px; height: 34px; }
.phone--mini .wa-send svg { width: 17px; height: 17px; }
.ia-alerta .tpl-body b { font-weight: 700; }

@media (hover: hover) and (pointer: fine) {
  .iasec-replay:hover { background: var(--ink); color: #fff; }
  .iap-json-btn:not(:disabled):hover { border-color: #8A8A8A; color: #fff; }
}
@media (prefers-reduced-motion: reduce) {
  .iap-cita mark, .iae-flecha, .iap-paso { transition: none; }
  .iap.procesando::after, .iap.procesando .iap-estado::before, .iap-redacta .tw.escribe::after { animation: none; }
}
@media (min-width: 900px) and (max-height: 820px) {
  .iasec { gap: 14px; padding-top: 22px; padding-bottom: 18px; }
  .iasec-title { font-size: 30px; }
  .iasec-lead { margin-top: 6px; font-size: 15px; }
  .iae-h { margin-bottom: 8px; font-size: 16px; }
  .iae-flecha { margin-top: 24px; }
  .iap { padding: 12px 14px; font-size: 13px; }
  .iap-top { padding-bottom: 9px; }
  .iap-vista { gap: 8px; padding-top: 10px; }
  .iap-h { margin-bottom: 4px; }
  .iap-datos > div { padding: 3px 0; }
  .iae-json { font-size: 11.5px; line-height: 1.45; }
  .iasec .phone--mini { height: calc(100svh - 210px); }
  .iasec .phone--mini .phone-screen { font-size: 13px; }
  .iasec .phone--mini .tpl-btn { min-height: 38px; padding: 8px 10px; font-size: 13.5px; }
}
@media (max-width: 1099px) {
  .iasec { min-height: 0; display: block; padding: 40px 20px 48px; }
  .iasec-top { display: block; }
  .iasec-ctrl { margin-top: 20px; justify-content: space-between; }
  .iasec-etapas { grid-template-columns: 1fr; margin-top: 28px; gap: 16px; }
  .iae-flecha { transform: rotate(90deg); justify-self: center; margin-top: 0; }
  .iasec .phone--mini { height: auto; width: min(100%, 340px); aspect-ratio: 9 / 19.2; margin: 0 auto; }
  .iae--cliente .iae-h, .iae--destino .iae-h { justify-content: center; }
  .iap { flex: none; }
  .iap-vista { gap: 16px; }
}
@media (max-width: 560px) {
  .iap-datos > div, .iap-redacta p { grid-template-columns: 1fr; gap: 0; }
  .iap-json-btn { display: none; }
}

/* =========================================================
   Todos los escenarios: diagrama de flujo interactivo
   ========================================================= */
.flujo {
  --f-rule: #D6D6D6;
  --f-dim: 0.28;
  min-height: 100svh;
  display: grid; grid-template-rows: auto 1fr auto;
  gap: clamp(16px, 2.6svh, 28px);
  padding: clamp(28px, 5svh, 56px) var(--pad);
  background: #fff; color: var(--ink);
}
.flujo-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.flujo-title { font-size: clamp(30px, 2.6vw, 48px); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.flujo-lead { margin-top: 8px; color: var(--ink-2); font-size: clamp(16px, 1.1vw, 19px); }
.flujo-reset {
  min-height: 44px; padding: 0 18px;
  border: 1.5px solid var(--ink); border-radius: 0; background: #fff; color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out), transform 120ms var(--ease-out);
}
.flujo-reset:active { transform: scale(0.97); }

/* Rejilla del diagrama: 7 columnas (etapas) x 5 filas (carriles) */
.flujo-mapa {
  position: relative;
  min-height: 420px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  column-gap: clamp(28px, 3vw, 56px);
  row-gap: clamp(10px, 1.6svh, 20px);
}
.flujo-lineas { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 0; }

.fn {
  position: relative; z-index: 1;
  align-self: center;
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  min-height: 62px; padding: 10px 12px;
  border-radius: 4px;
  background: #fff; color: var(--ink);
  font: inherit; font-size: clamp(12.5px, 0.78vw, 15px); line-height: 1.25; text-align: left;
  transition: opacity 220ms var(--ease-out), background-color 220ms var(--ease-out), color 220ms var(--ease-out), border-color 220ms var(--ease-out);
}
.fn b { font-weight: 700; }
.fn small { font-size: 0.9em; color: var(--muted); }
.fn--inicio { background: var(--ink); color: #fff; border-radius: 999px; padding: 12px 18px; min-height: 0; }
.fn--inicio small { color: rgba(255, 255, 255, 0.7); }
.fn--paso { border: 1px solid var(--f-rule); } /* taste-skill-ignore: borde de nodo del diagrama */
.fn--decision { border: 2px solid var(--ink); } /* taste-skill-ignore: borde de decisión del diagrama */
/* Resultados: fondo oscuro con franja de color de la temperatura (gris si es del proceso) */
.fn--resultado {
  --tono: #8A8A8A;
  border: 0; background: #151515; color: #fff; cursor: pointer;
  box-shadow: inset 0 4px 0 var(--tono); /* taste-skill-ignore: franja de color del resultado */
  padding-top: 14px;
}
.fn--resultado small { color: rgba(255, 255, 255, 0.72); }
.fn--resultado[data-tono="ok"] { --tono: var(--ok); }
.fn--resultado[data-tono="mid"] { --tono: var(--mid); }
.fn--resultado[data-tono="bad"] { --tono: var(--bad); }
.fn--resultado:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.fn--resultado.es-sel { background: #000; }

/* Conexiones */
.fl-edge { fill: none; stroke: #9C9C9C; stroke-width: 1.5; transition: stroke 220ms var(--ease-out), opacity 220ms var(--ease-out), stroke-width 220ms var(--ease-out); }
.fl-label {
  font-family: var(--font); font-size: 12px; font-weight: 700; fill: var(--muted);
  paint-order: stroke; stroke: #fff; stroke-width: 5px; stroke-linejoin: round;
  transition: opacity 220ms var(--ease-out), fill 220ms var(--ease-out);
}

/* Camino resaltado */
.flujo.hay-sel .fn:not(.en-camino) { opacity: var(--f-dim); }
.flujo.hay-sel .fl-edge:not(.en-camino) { opacity: 0.25; }
.flujo.hay-sel .fl-label:not(.en-camino) { opacity: 0.25; }
.fl-edge.en-camino { stroke: var(--ink); stroke-width: 2.5; }
.fl-label.en-camino { fill: var(--ink); }
.fn--paso.en-camino { border-color: var(--ink); }

/* Detalle */
.flujo-detalle {
  min-height: 108px;
  display: grid; grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(0, 1fr)); gap: clamp(20px, 2.4vw, 40px);
  padding-top: 16px;
  border-top: 2px solid var(--ink); /* taste-skill-ignore: línea de reporte */
}
.fd-vacio { grid-column: 1 / -1; color: var(--muted); }
.fd-titulo { font-size: clamp(20px, 1.6vw, 28px); font-weight: 700; line-height: 1.15; }
.fd-titulo small { display: block; margin-top: 4px; font-size: 15px; font-weight: 400; color: var(--ink-2); }
.fd-prop { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--mid-ink); }
.fd-dato dt { font-size: 13px; color: var(--muted); }
.fd-dato dd { margin-top: 4px; font-size: 16px; font-weight: 700; line-height: 1.3; }
.flujo-detalle.cambia > * { animation: fade-up 380ms var(--ease-out) backwards; }

/* Lista para celular */
.flujo-lista { display: none; }
.fl-item { border-bottom: 1px solid var(--f-rule); } /* taste-skill-ignore: filas de lista */
.fl-item summary {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 56px; padding: 10px 0; cursor: pointer; list-style: none;
  font-weight: 700; font-size: 17px;
}
.fl-item summary::-webkit-details-marker { display: none; }
.fl-item summary i { flex: none; width: 10px; height: 10px; border-radius: 2px; background: var(--tono, #8A8A8A); }
.fl-item summary span { flex: 1; }
.fl-item summary::after { content: "+"; font-weight: 400; font-size: 22px; color: var(--muted); }
.fl-item[open] summary::after { content: "–"; }
.fl-item ol { margin: 0 0 16px; padding-left: 20px; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.fl-item ol li + li { margin-top: 4px; }
.fl-item ol em { font-style: normal; font-weight: 700; color: var(--ink); }
.fl-item .fl-res { margin: 0 0 18px; font-size: 15px; }

@media (hover: hover) and (pointer: fine) {
  .fn--resultado:hover { background: #000; }
  .flujo-reset:hover { background: var(--ink); color: #fff; }
}
@media (prefers-reduced-motion: reduce) {
  .fn, .fl-edge, .fl-label, .flujo-reset { transition: none; }
  .flujo-detalle.cambia > * { animation: none; }
}

/* Pantallas bajas: más compacto */
@media (min-width: 900px) and (max-height: 820px) {
  .flujo { gap: 12px; padding-top: 22px; padding-bottom: 18px; }
  .flujo-title { font-size: 30px; }
  .flujo-lead { margin-top: 4px; font-size: 15px; }
  .flujo-mapa { min-height: 380px; row-gap: 8px; }
  .fn { min-height: 54px; padding: 8px 10px; font-size: 12.5px; }
  .flujo-detalle { min-height: 92px; padding-top: 10px; }
  .fd-titulo { font-size: 20px; }
  .fd-dato dd { font-size: 15px; }
}

/* Celular y tableta vertical: lista en lugar de diagrama */
@media (max-width: 1099px) {
  .flujo { min-height: 0; display: block; padding: 40px 20px 48px; }
  .flujo-top { display: block; }
  .flujo-reset, .flujo-mapa, .flujo-detalle { display: none !important; }
  .flujo-lista { display: block; margin-top: 24px; border-top: 2px solid var(--ink); } /* taste-skill-ignore: línea de reporte */
}

/* =========================================================
   Transición entre secciones
   ========================================================= */
/* Botones para cambiar de sección: discretos en la orilla derecha.
   Sin caja; "difference" los vuelve oscuros sobre fondo claro y claros sobre negro.
   Se aclaran al pasar el mouse o al usarlos (clase .activo un momento). */
.navsec {
  position: fixed; right: 6px; top: 50%; z-index: 50;
  display: flex; flex-direction: column; align-items: center;
  color: #fff; mix-blend-mode: difference;
  opacity: 0.3;
  transform: translateY(-50%);
  transition: opacity 300ms var(--ease-out);
}
.navsec:hover, .navsec:has(:focus-visible), .navsec.activo { opacity: 0.9; }
.navsec-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer;
  transition: opacity 150ms var(--ease-out), transform 120ms var(--ease-out);
}
.navsec-btn svg { width: 18px; height: 18px; }
.navsec-btn:active:not(:disabled) { transform: scale(0.9); }
.navsec-btn:disabled { opacity: 0.25; cursor: default; }
.navsec-btn:focus-visible { outline: 1.5px solid #fff; outline-offset: -3px; }
.navsec-cuenta { font-size: 10px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
@media (max-width: 899px) {
  .navsec { top: auto; bottom: 10px; right: 6px; transform: none; opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .navsec, .navsec-btn { transition: none; }
}

/* En computadora cada sección es una "diapositiva": el scroll se acomoda solo */
@media (min-width: 900px) {
  html { scroll-snap-type: y proximity; }
  .portada, .proceso, .esc, .iasec, .flujo { scroll-snap-align: start; }
}

/* Entradas: cada sección anima su contenido cuando aparece en pantalla.
   La clase .io solo existe si hay IntersectionObserver y no se pidió reducir movimiento. */
@keyframes fade-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.io .portada:not(.is-in) .portada-main > *,
.io .portada:not(.is-in) .portada-pie,
.io .proceso:not(.is-in) .card,
.io .proceso:not(.is-in) .step,
.io .proceso:not(.is-in) .field h2,
.io .esc:not(.is-in) .esc-copy > :not(.glow),
.io .esc:not(.is-in) .phone,
.io .esc:not(.is-in) .phone-caption { opacity: 0; }

/* Portada: el título sube por partes al abrir */
.io .portada.is-in .portada-main > * { animation: fade-up 900ms var(--ease-out) backwards; }
.io .portada.is-in .portada-main > :nth-child(2) { animation-delay: 120ms; }
.io .portada.is-in .portada-main > :nth-child(3) { animation-delay: 220ms; }
.io .portada.is-in .portada-pie { animation: fade-up 900ms var(--ease-out) 360ms backwards; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.io .portada:not(.is-in) .portada-logos { opacity: 0; }
.io .portada.is-in .portada-logos { animation: fade-in 1200ms var(--ease-out) 200ms backwards; }

.field--1 { --n: 0; } .field--2 { --n: 1; } .field--3 { --n: 2; } .field--4 { --n: 3; }
.io .proceso.is-in .field h2 { animation: fade-up 700ms var(--ease-out) backwards; }
.io .proceso.is-in .card { animation: fade-up 800ms var(--ease-out) backwards; animation-delay: calc(120ms + var(--n) * 140ms); }
.io .proceso.is-in .step { animation: fade-up 800ms var(--ease-out) backwards; animation-delay: calc(220ms + var(--n) * 140ms); }

.io .esc.is-in .esc-copy > :not(.glow) { animation: fade-up 700ms var(--ease-out) backwards; }
.io .esc.is-in .esc-copy > :nth-child(2) { animation-delay: 70ms; }
.io .esc.is-in .esc-copy > :nth-child(3) { animation-delay: 140ms; }
.io .esc.is-in .esc-copy > :nth-child(4) { animation-delay: 210ms; }
.io .esc.is-in .esc-copy > :nth-child(5) { animation-delay: 280ms; }
.io .esc.is-in .phone { animation: fade-up 900ms var(--ease-out) 120ms backwards; }
.io .esc.is-in .phone-caption { animation: fade-up 700ms var(--ease-out) 400ms backwards; }

@media (prefers-reduced-motion: reduce) {
  .msg-new, .typing span, .ficha-temp.swap, .glow, .portada-luz { animation: none; }
  html { scroll-snap-type: none; }
  .esc { transition: none; }
  .tabs label, .tabs label::after, .tpl-btn, .sheet, .sheet-backdrop, .sheet-opt { transition: none; }
}

/* =========================================================
   Laptop / proyector con poca altura: todo en una pantalla
   ========================================================= */
@media (min-width: 900px) and (max-height: 820px) {
  .logo--nissan { height: 38px; }
  .logo--ga { height: 22px; }
  .logo-ai { height: 27px; }
  .esc-copy { padding-top: 24px; padding-bottom: 20px; }
  .esc-copy .esc-title { margin-top: 22px; font-size: 36px; }
  .esc-lead { margin-top: 8px; font-size: 17px; }
  .tabs { margin-top: 20px; }
  .tabs label { padding-bottom: 8px; font-size: 17px; }
  .ficha { margin-top: 16px; }
  .ficha-num { font-size: 84px; }
  .ficha-cols { margin-top: 18px; }
  .ficha-h { padding-bottom: 7px; }
  .resp { font-size: 15px; }
  .resp th, .resp td { padding-top: 7px; padding-bottom: 7px; }
  .seg-accion { margin-top: 10px; font-size: 16px; }
  .phone { height: calc(100svh - 128px); }
}

/* =========================================================
   Celular y tableta vertical
   ========================================================= */
@media (max-width: 899px) {
  .esc { grid-template-columns: 1fr; }
  .esc-copy { padding: 24px 20px 40px; }
  .brand { gap: 14px; }
  .logo--nissan { height: 34px; }
  .logo--ga { height: 20px; }
  .logo-ai { height: 20px; }
  .esc-copy .esc-title { margin-top: 36px; }
  /* Portada en celular */
  .portada { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; padding: 24px 20px 32px; }
  .portada-logos {
    grid-column: 1; grid-row: 1; justify-self: start;
    flex-direction: row; gap: 14px; transform: none;
  }
  .pl-nissan { height: 40px; }
  .pl-fila { gap: 14px; }
  .pl-ga { height: 20px; }
  .pl-ai { height: 20px; }
  .portada-main { grid-row: 2; }
  .portada-titulo { font-size: 46px; }
  .portada-pie { grid-row: 3; flex-direction: column; align-items: flex-start; gap: 24px; }
  .portada-datos { flex-wrap: wrap; gap: 20px 32px; }
  .portada-luz { width: 90vw; }
  .tabs { gap: 20px; }
  .ficha-num { font-size: 96px; }
  .ficha-cols { grid-template-columns: 1fr; gap: 28px; }
  .esc-phone { padding: 36px 20px 40px; }
  /* En celular la orilla del negro está arriba: la luz sale de ahí a todo lo ancho */
  .glow { left: 50%; top: 0; width: 150vw; height: 420px; }
  .phone { height: auto; width: min(100%, 380px); aspect-ratio: 9 / 19.2; }
}
