/* Chat del sitio web (23 nov 2026): el asistente del laboratorio, gratis y en el servidor. */
.cs {
  --cs-marca: var(--marca, #05ADEC);
  --cs-honda: var(--marca-honda, #04689A);
  --cs-texto: #10222E; --cs-suave: #5B7080; --cs-borde: #E1ECF3; --cs-fondo: #F5F9FC;
  font-family: var(--letra-texto, 'Segoe UI', system-ui, sans-serif);
  position: fixed; right: 20px; bottom: 20px; z-index: 60; color: var(--cs-texto);
}
.cs *, .cs *::before, .cs *::after { box-sizing: border-box }
.cs div, .cs form, .cs p, .cs button { margin: 0 }       /* nada del sitio se cuela en el chat */
.cs-cab, .cs-mensajes, .cs-escribir { position: relative }
.cs-oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0) }

/* ── Botón flotante ─────────────────────────────────────────────────────────── */
.cs-lanzador {
  display: flex; align-items: center; gap: 10px; margin-left: auto; height: 58px; padding: 0 22px 0 18px;
  border: 0; border-radius: 100px; cursor: pointer; color: #fff; font: 700 15px/1 inherit;
  background: linear-gradient(135deg, var(--cs-marca), var(--cs-honda));
  box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--cs-honda) 70%, transparent), 0 2px 6px rgba(16,34,46,.18);
  transition: transform .18s ease, box-shadow .18s ease; position: relative;
}
.cs-lanzador:hover { transform: translateY(-2px) }
.cs-lanzador:focus-visible { outline: 3px solid color-mix(in srgb, var(--cs-marca) 45%, #fff); outline-offset: 3px }
.cs-lanzador svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none }
.cs-lanzador .cs-ico-x { display: none }
.cs-lanzador::after {                                   /* un latido suave, solo al llegar */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--cs-marca) 55%, transparent);
  animation: cs-latido 2.4s ease-out 1.2s 2;
}
@keyframes cs-latido { to { box-shadow: 0 0 0 16px transparent } }
.cs.abierto .cs-lanzador { width: 58px; padding: 0; justify-content: center }
.cs.abierto .cs-lanzador-txt, .cs.abierto .cs-ico-chat { display: none }
.cs.abierto .cs-lanzador .cs-ico-x { display: block }

/* ── Aviso de bienvenida ────────────────────────────────────────────────────── */
.cs-aviso {
  position: absolute; right: 0; bottom: 72px; width: 250px; padding: 14px 34px 14px 16px; border-radius: 16px 16px 4px 16px;
  background: #fff; box-shadow: 0 18px 40px -18px rgba(16,34,46,.45), 0 0 0 1px var(--cs-borde);
  font-size: 13.5px; line-height: 1.45; animation: cs-sube .35s ease both;
}
.cs-aviso b { display: block; font-size: 14px; margin-bottom: 2px }
.cs-aviso span { color: var(--cs-suave) }
.cs-aviso-x { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 20px; line-height: 1;
              color: var(--cs-suave); cursor: pointer; padding: 4px }
.cs-aviso { cursor: pointer }

/* ── Panel ──────────────────────────────────────────────────────────────────── */
.cs .cs-panel {
  position: absolute; padding: 0; right: 0; bottom: 74px; width: 390px; height: min(640px, calc(100vh - 120px));
  display: flex; flex-direction: column; overflow: hidden; border-radius: 22px; background: var(--cs-fondo);
  box-shadow: 0 30px 70px -24px rgba(16,34,46,.5), 0 0 0 1px rgba(16,34,46,.06);
  animation: cs-sube .28s cubic-bezier(.2,.8,.2,1) both; transform-origin: bottom right;
}
.cs-panel[hidden], .cs-aviso[hidden] { display: none }
@keyframes cs-sube { from { opacity: 0; transform: translateY(14px) scale(.98) } to { opacity: 1; transform: none } }

.cs-cab { display: flex; align-items: center; gap: 12px; padding: 16px 16px 16px 18px; color: #fff;
          background: linear-gradient(135deg, var(--cs-honda), var(--cs-marca)) }
.cs-avatar { width: 42px; height: 42px; border-radius: 50%; background: #fff; display: flex; align-items: center;
             justify-content: center; flex: none; box-shadow: 0 0 0 3px rgba(255,255,255,.25) }
.cs-avatar svg, .cs-avatar .cs-logo { width: 27px; height: auto }
.cs-cab-txt { min-width: 0; flex: 1 }
.cs-cab-txt b { display: block; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.cs-cab-txt small { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .92 }
.cs-punto { width: 7px; height: 7px; border-radius: 50%; background: #5BF08C; box-shadow: 0 0 0 3px rgba(91,240,140,.25) }
.cs-cerrar { border: 0; background: rgba(255,255,255,.16); width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
             display: flex; align-items: center; justify-content: center; flex: none }
.cs-cerrar:hover { background: rgba(255,255,255,.28) }
.cs-cerrar svg, .cs-panel .cs-enviar svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round }

.cs-mensajes { flex: 1; overflow-y: auto; padding: 18px 14px 8px; display: flex; flex-direction: column; gap: 10px;
               scroll-behavior: smooth; overscroll-behavior: contain }
.cs-msg { max-width: 88%; font-size: 14px; line-height: 1.5; animation: cs-aparece .22s ease both }
@keyframes cs-aparece { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
.cs-msg.bot { align-self: flex-start }
.cs-msg.yo { align-self: flex-end }
.cs-burbuja { padding: 11px 14px; border-radius: 18px; word-wrap: break-word; overflow-wrap: anywhere }
.cs-msg.bot .cs-burbuja { background: #fff; border-top-left-radius: 6px; box-shadow: 0 1px 2px rgba(16,34,46,.06), 0 0 0 1px var(--cs-borde) }
.cs-msg.yo .cs-burbuja { background: linear-gradient(135deg, var(--cs-marca), var(--cs-honda)); color: #fff; border-top-right-radius: 6px }
.cs-burbuja a { color: var(--cs-honda); font-weight: 600; word-break: break-all }
.cs-pie { font-size: 11.5px; color: var(--cs-suave); margin: 6px 4px 0 }

/* Botones de respuesta, filas de lista y enlaces */
.cs-opciones { display: flex; flex-direction: column; gap: 6px; margin-top: 8px }
.cs-op, .cs-fila, .cs-accion {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer; font: inherit;
  border-radius: 14px; transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.cs-op { justify-content: center; padding: 10px 14px; font-weight: 600; font-size: 13.5px; color: var(--cs-honda);
         background: #fff; border: 1.5px solid color-mix(in srgb, var(--cs-marca) 40%, var(--cs-borde)) }
.cs-op:hover, .cs-fila:hover { background: color-mix(in srgb, var(--cs-marca) 8%, #fff); border-color: var(--cs-marca) }
.cs-op:active, .cs-fila:active, .cs-accion:active { transform: scale(.985) }
.cs-lista { background: #fff; border-radius: 16px; padding: 6px; box-shadow: 0 0 0 1px var(--cs-borde) }
.cs-sec { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--cs-suave); padding: 8px 10px 4px }
.cs-fila { padding: 10px; background: #fff; border: 1.5px solid transparent }
.cs-fila b { display: block; font-size: 13.5px; font-weight: 600; color: var(--cs-texto) }
.cs-fila small { display: block; font-size: 12px; color: var(--cs-suave); line-height: 1.35; margin-top: 1px }
.cs-fila .cs-flecha { margin-left: auto; color: color-mix(in srgb, var(--cs-marca) 70%, var(--cs-suave)); font-size: 18px; flex: none }
.cs-accion { justify-content: center; padding: 11px 14px; font-weight: 700; font-size: 13.5px; color: #fff; text-decoration: none;
             background: linear-gradient(135deg, var(--cs-marca), var(--cs-honda)); border: 0 }
.cs-accion.ubicacion { background: #10222E }
.cs-usado .cs-op, .cs-usado .cs-fila { opacity: .5; pointer-events: none }
.cs-usado .cs-elegida { opacity: 1; background: color-mix(in srgb, var(--cs-marca) 12%, #fff); border-color: var(--cs-marca) }

/* Escribiendo… */
.cs-escribiendo .cs-burbuja { display: flex; gap: 4px; padding: 14px 16px }
.cs-escribiendo i { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--cs-marca) 60%, #9FB3C2);
                    animation: cs-punto 1s ease-in-out infinite }
.cs-escribiendo i:nth-child(2) { animation-delay: .15s } .cs-escribiendo i:nth-child(3) { animation-delay: .3s }
@keyframes cs-punto { 0%, 60%, 100% { transform: translateY(0); opacity: .5 } 30% { transform: translateY(-4px); opacity: 1 } }

/* Escribir */
.cs-escribir { display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid var(--cs-borde) }
.cs-escribir input { flex: 1; min-width: 0; border: 1.5px solid var(--cs-borde); border-radius: 100px; padding: 11px 16px;
                     font: 14px inherit; color: var(--cs-texto); background: var(--cs-fondo); outline: none }
.cs-escribir input:focus { border-color: var(--cs-marca); background: #fff }
.cs-enviar { width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; flex: none; display: flex;
             align-items: center; justify-content: center; background: linear-gradient(135deg, var(--cs-marca), var(--cs-honda)) }
.cs-enviar:disabled { opacity: .45; cursor: default }
.cs-legal { margin: 0; padding: 0 14px 10px; background: #fff; font-size: 11px; color: var(--cs-suave); text-align: center }
.cs-legal a { color: var(--cs-suave) }

/* ── Celular: pantalla completa ─────────────────────────────────────────────── */
@media (max-width: 560px) {
  .cs { right: 14px; bottom: 14px }
  /* 27 nov 2026: en el celular el botón es solo el ícono, para no tapar los botones de la página. */
  .cs-lanzador { width: 54px; height: 54px; padding: 0; justify-content: center }
  .cs-lanzador-txt { display: none }
  .cs.abierto .cs-lanzador { display: none }
  .cs .cs-panel { position: fixed; inset: 0; width: auto; height: 100%; height: 100dvh; border-radius: 0; animation: cs-sube .22s ease both }
  .cs-aviso { width: min(250px, calc(100vw - 40px)) }
  .cs-escribir input { font-size: 16px }                 /* sin zoom automático en iPhone */
}
@media (prefers-reduced-motion: reduce) { .cs *, .cs *::after { animation: none !important; transition: none !important } }
@media print { .cs { display: none } }
