/* Menú "Contactanos": chat con IA y llamada por la página (ver contacto.js). Usa las variables de index.html. */
.fab__opt {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink, #0B1824);
  font: inherit;
  font-weight: 600;
  font-size: 0.94rem;
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.fab__opt[hidden] { display: none; }
.fab__opt:hover { background: var(--paper, #F3F5F7); }
.fab__opt:disabled { opacity: .55; cursor: default; }
.fab__opt small { display: block; font-weight: 400; font-size: 0.79rem; color: var(--ink-soft, #4F606F); }
.fab__opt:focus-visible, .cx button:focus-visible, .cx textarea:focus-visible, .cx a:focus-visible, .cx-call button:focus-visible {
  outline: 3px solid var(--or, #054068); outline-offset: 2px;
}

/* Ventana del chat */
.cx {
  position: fixed; right: 18px; bottom: 84px; z-index: 70;
  width: min(380px, calc(100vw - 36px)); height: min(560px, calc(100dvh - 120px));
  display: flex; flex-direction: column;
  background: var(--bg-panel, #fff); color: var(--ink, #0B1824);
  border: 1px solid var(--border-strong, #D4DCE3); border-radius: 12px; overflow: hidden;
  box-shadow: 0 28px 60px -16px rgba(11, 24, 36, .38);
  font-family: var(--font, system-ui, sans-serif);
}
.cx[hidden] { display: none; }
.cx__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 14px 14px 18px; background: var(--navy, #0B1824); color: #fff;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--or, #3d93d6) 0 25%, var(--gr, #2e8b57) 25% 50%, var(--bl, #1f5f99) 50% 75%, var(--br, #6f8fab) 75%) 1;
}
.cx__who b { display: block; font-family: var(--display, inherit); font-weight: 400; font-size: 1.35rem; letter-spacing: -.01em; }
.cx__who small { display: block; font-size: .78rem; opacity: .72; margin-top: 2px; }
.cx__who small.cx__cod { width: max-content; margin-top: 6px; padding: 2px 8px; opacity: 1; border: 1px solid currentColor; border-radius: 3px; font-family: JetBrains Mono, ui-monospace, monospace; font-size: .68rem; letter-spacing: .08em; user-select: all; }
.cx__who small.cx__cod[hidden] { display: none; }
.cx__x { width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.cx__x:hover { background: rgba(255,255,255,.12); }
.cx__log { flex: 1; overflow-y: auto; padding: 16px; background: var(--paper, #F3F5F7); display: flex; flex-direction: column; gap: 8px; }
.cx__m { max-width: 84%; padding: 9px 13px; border-radius: 14px; font-size: .93rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.cx__m--ia { align-self: flex-start; background: var(--bg-panel, #fff); border: 1px solid var(--line, #D4DCE3); border-bottom-left-radius: 4px; }
.cx__m--yo { align-self: flex-end; background: var(--navy, #0B1824); color: #fff; border-bottom-right-radius: 4px; }
.cx__m a { color: inherit; font-weight: 600; text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
.cx__typing { align-self: flex-start; display: flex; gap: 4px; padding: 11px 14px; background: var(--bg-panel, #fff); border: 1px solid var(--line, #D4DCE3); border-radius: 14px; }
.cx__typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-soft, #4F606F); animation: cxDot 1s infinite; }
.cx__typing i:nth-child(2) { animation-delay: .15s; } .cx__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes cxDot { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }
.cx__err { margin: 0; padding: 8px 16px; font-size: .82rem; color: #A3261B; background: #FFF4F2; }
.cx__err[hidden], .cx__fin[hidden], .cx__form[hidden] { display: none; }
.cx__form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line, #D4DCE3); background: var(--bg-panel, #fff); }
.cx__form textarea { flex: 1; resize: none; height: 42px; max-height: 120px; padding: 10px 12px; border: 1px solid var(--line, #D4DCE3); border-radius: 10px; font: inherit; font-size: .93rem; color: inherit; }
.cx__send { border: 0; border-radius: 10px; padding: 0 16px; background: var(--wa, #1A8449); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.cx__send:disabled { opacity: .5; cursor: default; }
.cx__fin { margin: 0; padding: 12px 16px; font-size: .88rem; text-align: center; border-top: 1px solid var(--line, #D4DCE3); }
.cx__otra { margin-left: 6px; border: 0; border-radius: 999px; padding: 7px 14px; background: var(--navy, #0B1824); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.cx__legal { margin: 0; padding: 0 14px 10px; font-size: .74rem; color: var(--ink-soft, #4F606F); background: var(--bg-panel, #fff); text-align: center; }
.cx__legal a { color: var(--wa-hover, #146E3C); font-weight: 600; }
/* Tarjeta de derivación a WhatsApp (client tool derivar_whatsapp): placa de rack con cinta de rotuladora. */
.cx__wa { align-self: stretch; display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--bg-panel, #fff); border: 1px solid var(--line, #D4DCE3); border-left: 4px solid var(--wa, #1A8449); border-radius: 10px; box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 1px 2px rgba(11,24,36,.08); }
.cx__wa-tape { align-self: flex-start; padding: 2px 8px; background: var(--navy, #0B1824); color: #fff; font-family: JetBrains Mono, ui-monospace, monospace; font-size: .68rem; letter-spacing: .08em; border-radius: 3px; }
.cx__wa-res { margin: 0; font-size: .88rem; line-height: 1.4; color: var(--ink-soft, #4F606F); overflow-wrap: anywhere; }
.cx__wa-btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 10px; background: var(--wa, #1A8449); color: #fff; font-weight: 700; font-size: 1rem; text-decoration: none; }
.cx__wa-btn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #7CF29B; box-shadow: 0 0 6px #7CF29B; }
.cx__wa-btn:hover { background: var(--wa-hover, #146E3C); }
.cx__wa-btn:focus-visible { outline: 3px solid var(--navy, #0B1824); outline-offset: 2px; }
.cx__wa-nota { font-size: .74rem; color: var(--ink-soft, #4F606F); }
.cx__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Barra de la llamada por la página */
.cx-call {
  position: fixed; right: 18px; bottom: 84px; z-index: 71;
  width: min(360px, calc(100vw - 36px));
  display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px;
  background: var(--navy, #0B1824); color: #fff; border-radius: 14px;
  box-shadow: 0 24px 50px -14px rgba(11, 24, 36, .45);
  font-family: var(--font, system-ui, sans-serif);
}
.cx-call[hidden] { display: none; }
.cx-call__st { flex: 1; min-width: 0; }
.cx-call__st b { display: block; font-size: .95rem; }
.cx-call__st small { display: block; font-size: .78rem; opacity: .75; margin-top: 2px; }
.cx-call button { border: 0; border-radius: 999px; padding: 9px 14px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; min-height: 40px; }
.cx-call button[hidden] { display: none; }
.cx-call__mute { background: rgba(255,255,255,.12); color: #fff; }
.cx-call__mute[aria-pressed="true"] { background: #fff; color: var(--navy, #0B1824); }
.cx-call__hang { background: #B3261E; color: #fff; }
.cx-call audio { display: none; }

@media (max-width: 520px) {
  .cx { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .cx__form textarea { font-size: 16px; }
  .cx-call { right: 12px; left: 12px; width: auto; bottom: 82px; }
}
@media (prefers-reduced-motion: reduce) { .cx__typing i { animation: none; opacity: .7; } }
