/* =====================================================================
   Burbuja de chat — usa la misma paleta y tipografía de la página
   ===================================================================== */

.cb { --cb-deep: var(--deep, #052b2f); --cb-deep-2: var(--deep-2, #0a3d42); --cb-mint: var(--mint, #6ee7c8); --cb-mint-soft: var(--mint-soft, #dff8f0); --cb-ink: var(--ink, #0b2226); --cb-soft: var(--ink-soft, #4b6266); --cb-line: rgba(5, 43, 47, .12); font-family: var(--sans, "Manrope", system-ui, sans-serif); }
.cb *, .cb *::before, .cb *::after { box-sizing: border-box; }

/* ---------- Botón que abre el chat (encima del de WhatsApp) ---------- */
.cb-launcher {
  position: fixed; z-index: 95;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 70px);
  display: flex; align-items: center; gap: 10px;
  height: 58px; padding: 0 8px 0 8px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--cb-deep); color: #fff;
  box-shadow: 0 14px 34px -12px rgba(5, 43, 47, .8), 0 0 0 3px rgba(110, 231, 200, .35);
  font: 700 15px/1 var(--sans, "Manrope", system-ui, sans-serif);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s;
  animation: cbIn .6s cubic-bezier(.2, .8, .2, 1) 1.2s both;
}
.cb-launcher:hover { transform: translateY(-3px); }
.cb-launcher__ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--cb-mint); color: var(--cb-deep); flex: none; }
.cb-launcher__ico svg { width: 24px; height: 24px; }
.cb-launcher__txt { display: none; padding-right: 12px; }
.cb-launcher__dot { position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; border-radius: 50%; background: #ff7a59; border: 2px solid var(--cb-deep); }
.cb-launcher[aria-expanded="true"] { opacity: 0; pointer-events: none; transform: scale(.8); }
@keyframes cbIn { from { opacity: 0; transform: translateY(16px) scale(.9); } to { opacity: 1; transform: none; } }

/* ---------- Ventana ---------- */
.cb-panel {
  position: fixed; z-index: 150; inset: 0;
  display: flex; flex-direction: column;
  background: #f4f8f6; color: var(--cb-ink);
  height: 100vh; height: 100dvh;
  animation: cbOpen .35s cubic-bezier(.2, .8, .2, 1);
}
.cb-panel[hidden] { display: none; }
@keyframes cbOpen { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.cb-head {
  display: flex; align-items: center; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 14px 14px 16px;
  background: radial-gradient(120% 140% at 100% 0%, var(--cb-deep-2), var(--cb-deep) 70%); color: #fff;
}
.cb-head__mark { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--cb-mint); color: var(--cb-deep); flex: none; }
.cb-head__mark svg { width: 24px; height: 24px; }
.cb-head__mark::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; background: #3ee08f; border: 2px solid var(--cb-deep); }
.cb-head__txt { flex: 1; min-width: 0; }
.cb-head__title { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.cb-head__sub { margin: 2px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, .7); line-height: 1.3; }
.cb-close { display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; flex: none; }
.cb-close:hover { background: rgba(255, 255, 255, .18); }
.cb-close svg { width: 20px; height: 20px; }

/* ---------- Mensajes ---------- */
.cb-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 14px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.cb-msg { max-width: 86%; padding: 11px 14px; border-radius: 18px; font-size: 15.5px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; animation: cbMsg .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes cbMsg { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cb-msg--bot { align-self: flex-start; background: #fff; border: 1px solid var(--cb-line); border-bottom-left-radius: 6px; }
.cb-msg--user { align-self: flex-end; background: var(--cb-deep); color: #fff; border-bottom-right-radius: 6px; }
.cb-msg--note { align-self: stretch; max-width: none; background: var(--cb-mint-soft); color: var(--cb-deep); font-size: 13.5px; border-radius: 14px; }
.cb-msg--note a { color: var(--cb-deep); font-weight: 700; }
.cb-msg--error { background: #fff4ef; border-color: #ffd5c4; }

.cb-wa-inline {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 999px; margin-top: -2px;
  background: #1fa855; color: #fff; font-weight: 700; font-size: 14px; text-decoration: none;
}
.cb-wa-inline svg { width: 18px; height: 18px; }

.cb-typing { align-self: flex-start; display: flex; gap: 5px; padding: 14px 16px; background: #fff; border: 1px solid var(--cb-line); border-radius: 18px; border-bottom-left-radius: 6px; }
.cb-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--cb-soft); opacity: .4; animation: cbDot 1.2s infinite; }
.cb-typing span:nth-child(2) { animation-delay: .15s; }
.cb-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes cbDot { 30% { opacity: 1; transform: translateY(-3px); } 60% { opacity: .4; transform: none; } }

/* ---------- Edad y sexo ---------- */
.cb-profile { align-self: stretch; background: #fff; border: 1px solid var(--cb-line); border-radius: 18px; padding: 16px; display: grid; gap: 14px; animation: cbMsg .3s cubic-bezier(.2, .8, .2, 1); }
.cb-profile label, .cb-profile legend { display: block; font-size: 13px; font-weight: 700; color: var(--cb-soft); margin-bottom: 6px; padding: 0; }
.cb-profile fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.cb-age { width: 100%; height: 48px; padding: 0 14px; border: 1.5px solid var(--cb-line); border-radius: 12px; font: 600 17px/1 var(--sans, "Manrope", system-ui, sans-serif); color: var(--cb-ink); background: #f8fbfa; }
.cb-age:focus { outline: none; border-color: var(--cb-deep); background: #fff; }
.cb-sex { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cb-sex button { height: 48px; border: 1.5px solid var(--cb-line); border-radius: 12px; background: #f8fbfa; font: 700 15px/1 var(--sans, "Manrope", system-ui, sans-serif); color: var(--cb-ink); cursor: pointer; transition: background-color .2s, border-color .2s, color .2s; }
.cb-sex button[aria-pressed="true"] { background: var(--cb-deep); border-color: var(--cb-deep); color: #fff; }
.cb-start { height: 50px; border: 0; border-radius: 999px; background: var(--cb-mint); color: var(--cb-deep); font: 700 16px/1 var(--sans, "Manrope", system-ui, sans-serif); cursor: pointer; }
.cb-start:disabled { opacity: .45; cursor: not-allowed; }
.cb-profile__err { margin: -4px 0 0; font-size: 13px; color: #b42318; min-height: 1em; }

/* ---------- Sugerencias ---------- */
.cb-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 14px 10px; scrollbar-width: none; }
.cb-chips::-webkit-scrollbar { display: none; }
.cb-chips[hidden] { display: none; }
.cb-chips button { flex: none; height: 36px; padding: 0 14px; border: 1px solid var(--cb-line); border-radius: 999px; background: #fff; color: var(--cb-deep); font: 600 13.5px/1 var(--sans, "Manrope", system-ui, sans-serif); cursor: pointer; white-space: nowrap; }
.cb-chips button:hover { border-color: var(--cb-deep); }

/* ---------- Escribir ---------- */
.cb-foot { background: #fff; border-top: 1px solid var(--cb-line); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); display: grid; gap: 8px; }
.cb-form { display: flex; align-items: flex-end; gap: 8px; }
.cb-input {
  flex: 1; min-height: 46px; max-height: 120px; resize: none;
  padding: 12px 14px; border: 1.5px solid var(--cb-line); border-radius: 16px; background: #f8fbfa;
  font: 400 16px/1.35 var(--sans, "Manrope", system-ui, sans-serif); color: var(--cb-ink);
}
.cb-input:focus { outline: none; border-color: var(--cb-deep); background: #fff; }
.cb-input:disabled { opacity: .55; }
.cb-send { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border: 0; border-radius: 50%; background: var(--cb-deep); color: var(--cb-mint); cursor: pointer; }
.cb-send:disabled { opacity: .35; cursor: not-allowed; }
.cb-send svg { width: 20px; height: 20px; }
.cb-foot__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cb-wa { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border-radius: 999px; background: #1fa855; color: #fff; font-weight: 700; font-size: 13.5px; text-decoration: none; }
.cb-wa svg { width: 17px; height: 17px; }
.cb-legal { font-size: 11.5px; color: var(--cb-soft); text-align: right; line-height: 1.3; }
.cb-legal a { color: inherit; }

html.cb-lock, html.cb-lock body { overflow: hidden; }

/* ---------- Escritorio: ventana flotante ---------- */
@media (min-width: 640px) {
  .cb-launcher { padding: 0 8px; }
  .cb-launcher__txt { display: inline; }
  .cb-panel {
    inset: auto max(24px, env(safe-area-inset-right)) 24px auto;
    width: 390px; height: min(640px, calc(100vh - 48px));
    border-radius: 24px; overflow: hidden;
    box-shadow: 0 30px 80px -20px rgba(5, 43, 47, .55), 0 0 0 1px rgba(5, 43, 47, .08);
  }
  .cb-head { padding-top: 14px; }
  .cb-foot { padding-bottom: 12px; }
  html.cb-lock, html.cb-lock body { overflow: visible; }
}

/* ---------- Agendar cita (sección de Cal.com) ---------- */
.cb-foot__row { justify-content: flex-start; gap: 8px; }
.cb-agenda, .cb-agenda-inline {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--cb-mint); color: var(--cb-deep); font-weight: 700; font-size: 13.5px; text-decoration: none;
}
.cb-agenda svg, .cb-agenda-inline svg { width: 17px; height: 17px; }
.cb-agenda:hover, .cb-agenda-inline:hover { background: #8af0d6; }
.cb-legal { text-align: left; }
.cb-actions { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 8px; margin-top: -2px; }
.cb-actions .cb-wa-inline { margin-top: 0; }
.cb-agenda-inline { min-height: 42px; padding: 0 16px; font-size: 14px; }
