/* =========================================================
   Asistente virtual — Consultorías Carmiol
   ========================================================= */
/* El botón de WhatsApp sube para dejar espacio al del chat */
.has-chatbot .wa-float { bottom: 96px; width: 52px; height: 52px; }
.has-chatbot .wa-float svg { width: 25px; height: 25px; }
.has-chatbot .footer-bottom { padding-right: 90px; }

.cb-launcher {
  position: fixed; right: 22px; bottom: 22px; z-index: 55;
  width: 62px; height: 62px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center;
  background: var(--teal-800); color: var(--sand);
  box-shadow: 0 14px 30px -10px rgba(7, 31, 37, .55);
  transition: transform .2s ease, background .2s ease;
}
.cb-launcher:hover { transform: scale(1.05); background: var(--teal-700); }
.cb-launcher svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cb-launcher .cb-ico-close { display: none; }
.cb-open .cb-launcher .cb-ico-chat { display: none; }
.cb-open .cb-launcher .cb-ico-close { display: block; }
.cb-launcher::after {
  content: ""; position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--river); border: 2px solid var(--teal-800);
}
.cb-open .cb-launcher::after, .cb-seen .cb-launcher::after { display: none; }

.cb-teaser {
  position: fixed; right: 96px; bottom: 32px; z-index: 54; max-width: 240px;
  padding: 12px 34px 12px 16px; border-radius: 14px 14px 4px 14px;
  background: #fff; color: var(--ink); font-size: 14.5px; line-height: 1.45;
  box-shadow: var(--shadow); border: 1px solid var(--line);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
}
.cb-teaser.show { opacity: 1; transform: none; pointer-events: auto; cursor: pointer; }
.cb-teaser button {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer;
}
.cb-teaser button:hover { background: var(--sand-50); color: var(--ink); }

.cb-panel {
  position: fixed; right: 22px; bottom: 98px; z-index: 60;
  width: 390px; height: min(640px, calc(100vh - 130px));
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 20px; border: 1px solid var(--line);
  box-shadow: 0 28px 60px -20px rgba(7, 31, 37, .45);
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(.98); transform-origin: bottom right;
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.cb-open .cb-panel { opacity: 1; visibility: visible; transform: none; }

.cb-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 16px 16px 18px;
  background: linear-gradient(150deg, var(--teal-800), var(--teal-950)); color: #fff;
}
.cb-head img { width: 42px; height: 42px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(233,220,188,.35); }
.cb-head strong { display: block; font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.1; }
.cb-head span { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #a9bfc0; margin-top: 2px; }
.cb-head span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4cd08a; }
.cb-head-actions { margin-left: auto; display: flex; gap: 4px; }
.cb-icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 0; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: #c9d8d8;
  transition: background .15s ease, color .15s ease;
}
.cb-icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.cb-icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.cb-log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; background: var(--sand-50); scroll-behavior: smooth; }
.cb-msg { display: flex; margin-bottom: 12px; }
.cb-msg.user { justify-content: flex-end; }
.cb-bubble {
  max-width: 86%; padding: 11px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.55;
  overflow-wrap: anywhere;
}
.cb-msg.bot .cb-bubble { background: #fff; color: var(--text); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.cb-msg.user .cb-bubble { background: var(--teal-800); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.cb-bubble p + p, .cb-bubble p + ul, .cb-bubble ul + p, .cb-bubble p + ol, .cb-bubble ol + p { margin-top: 8px; }
.cb-bubble ul, .cb-bubble ol { margin: 6px 0 0; padding-left: 20px; }
.cb-bubble li + li { margin-top: 3px; }
.cb-bubble strong { color: var(--ink); }
.cb-bubble a { color: var(--teal-700); font-weight: 600; }
.cb-msg.error .cb-bubble { background: #fbeceb; color: #9b2c22; border-color: #f0c4bf; }

.cb-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.cb-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .4; animation: cbDot 1.2s infinite ease-in-out; }
.cb-typing i:nth-child(2) { animation-delay: .15s; }
.cb-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes cbDot { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

.cb-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 14px; }
.cb-chip {
  padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer;
  font: 500 13.5px/1.3 var(--sans); color: var(--teal-700); text-align: left;
  transition: border-color .15s ease, background .15s ease;
}
.cb-chip:hover { border-color: var(--river); background: #f3fbfa; }

.cb-card {
  margin: 0 0 14px; padding: 16px; border-radius: 14px; background: #fff; border: 1px solid var(--river);
  box-shadow: 0 8px 20px -14px rgba(10,42,49,.4);
}
.cb-card h4 { margin: 0; font-size: 14.5px; color: var(--ink); }
.cb-card > p { margin-top: 4px; font-size: 13.5px; color: var(--muted); }
.cb-card .cb-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.cb-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; text-decoration: none;
  font: 600 13.5px/1.2 var(--sans); transition: background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.cb-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cb-btn-primary { background: var(--teal-800); color: #fff; }
.cb-btn-primary:hover { background: var(--teal-700); }
.cb-btn-wa { background: #1f9d55; color: #fff; }
.cb-btn-wa:hover { background: #18864a; }
.cb-btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.cb-btn-ghost:hover { border-color: var(--teal-700); }
.cb-btn:disabled { opacity: .7; cursor: wait; }

.cb-form { display: grid; gap: 10px; margin-top: 12px; }
.cb-form label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.cb-form label small { font-weight: 400; color: var(--muted); }
.cb-form input, .cb-form textarea {
  width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--sand-50);
  font: 14px/1.4 var(--sans); color: var(--ink);
}
.cb-form textarea { min-height: 62px; resize: vertical; }
.cb-form input:focus, .cb-form textarea:focus { outline: none; border-color: var(--river); background: #fff; box-shadow: 0 0 0 3px rgba(47,154,148,.14); }
.cb-form .invalid input { border-color: #c0392b; }
.cb-form .cb-err { display: none; font-size: 12px; font-weight: 400; color: #c0392b; }
.cb-form .invalid .cb-err { display: block; }
.cb-form .cb-status { font-size: 13px; color: #9b2c22; }
.cb-form .cb-status:empty { display: none; }
.cb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.cb-compose { border-top: 1px solid var(--line); padding: 12px 12px 8px; background: #fff; }
.cb-input-row { display: flex; align-items: flex-end; gap: 8px; }
.cb-input {
  flex: 1; min-height: 44px; max-height: 120px; padding: 11px 14px; border-radius: 14px; resize: none;
  border: 1px solid var(--line); background: var(--sand-50); font: 14.5px/1.4 var(--sans); color: var(--ink);
}
.cb-input:focus { outline: none; border-color: var(--river); background: #fff; box-shadow: 0 0 0 3px rgba(47,154,148,.14); }
.cb-send {
  width: 44px; height: 44px; flex: none; border-radius: 12px; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--teal-800); color: #fff; transition: background .15s ease;
}
.cb-send:hover { background: var(--teal-700); }
.cb-send:disabled { background: #9bb0b2; cursor: default; }
.cb-send svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cb-note { margin-top: 7px; font-size: 11.5px; line-height: 1.4; color: var(--muted); text-align: center; }
.cb-note button { border: 0; background: none; padding: 0; font: inherit; color: var(--teal-700); text-decoration: underline; cursor: pointer; }

@media (max-width: 640px) {
  .cb-launcher { right: 16px; bottom: 16px; width: 58px; height: 58px; }
  .has-chatbot .wa-float { right: 19px; bottom: 86px; }
  .cb-teaser { right: 84px; bottom: 24px; max-width: 200px; }
  .cb-panel {
    right: 0; bottom: 0; left: 0; top: 0; width: auto; height: auto; border-radius: 0; border: 0;
    height: 100dvh;
  }
  .cb-open .cb-launcher, .cb-open .wa-float { display: none; }
  .cb-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .cb-panel, .cb-teaser { transition: none; }
  .cb-typing i { animation: none; opacity: .6; }
}
