/* CHAT-001 · asistente virtual del cliente («¿Ayuda?»). Usa los colores del portal (portal.css). */
.ch[hidden], .ch-panel[hidden], .ch-fab[hidden] { display: none !important; }
/* CHAT-003 · botón animado: un «orbe» con un globo de chat que escribe (tres puntos), anillo de colores que gira y
   que al cargar la página CRECE y se transforma en el botón «¿Necesitas ayuda?». Colores rosa-violeta-naranja para que
   destaque sobre las promociones azules y naranjas. Sin movimiento si el teléfono lo pide (prefers-reduced-motion). */
.ch-fab { position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 55;
  display: inline-flex; align-items: center; gap: 0; border: 0; border-radius: 999px; padding: 5px; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 16px; color: #fff; -webkit-tap-highlight-color: transparent;
  background: linear-gradient(120deg, #ff3d81, #8b3dff 55%, #ff8a3d); background-size: 200% 200%;
  box-shadow: 0 14px 30px -10px rgba(139, 61, 255, .7), 0 0 0 3px #fff;
  animation: ch-pop .55s cubic-bezier(.2, 1.6, .4, 1) both, ch-sheen 6s ease-in-out infinite; }
.ch-fab:focus-visible { outline: 3px solid #ffd23d; outline-offset: 3px; }
.ch-orb { position: relative; width: 50px; height: 50px; border-radius: 50%; flex: none; display: inline-flex;
  align-items: center; justify-content: center; background: radial-gradient(circle at 30% 25%, #ff7aa8, #8b3dff 70%); }
.ch-orb::before { content: ''; position: absolute; inset: -3px; border-radius: 50%; z-index: -1;
  background: conic-gradient(#ffd23d, #ff3d81, #8b3dff, #3dd6ff, #ffd23d); animation: ch-spin 3.5s linear infinite; }
.ch-orb::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(255, 61, 129, .55);
  animation: ch-ring 2.6s ease-out infinite; }
.ch-bub { width: 30px; height: 30px; animation: ch-wave 8s ease-in-out 2s infinite; transform-origin: 50% 80%; }
.ch-bub circle { animation: ch-dot 1.3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.ch-bub circle:nth-of-type(2) { animation-delay: .18s; } .ch-bub circle:nth-of-type(3) { animation-delay: .36s; }
/* CHAT-008 · casi siempre es solo el círculo; el texto se despliega unos segundos de vez en cuando (chat.js pone
   .ch-fab--x) y se recoge al llegar al final de la página. */
.ch-fab-t { display: inline-block; overflow: hidden; white-space: nowrap; max-width: 0; opacity: 0; padding: 0;
  transition: max-width .55s ease, opacity .35s ease, padding .55s ease; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.ch-fab--x .ch-fab-t { max-width: 260px; opacity: 1; padding: 0 14px 0 10px; }
body.ch-on { padding-bottom: 84px; } /* lo último de la página no queda debajo del círculo */
@keyframes ch-pop { from { transform: scale(.2) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ch-spin { to { transform: rotate(360deg); } }
@keyframes ch-ring { 0% { transform: scale(.95); opacity: .9; } 100% { transform: scale(1.45); opacity: 0; } }
@keyframes ch-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .55; } 30% { transform: translateY(-2.5px); opacity: 1; } }
@keyframes ch-wave { 0%, 88%, 100% { transform: none; } 91% { transform: rotate(-14deg) scale(1.1); } 94% { transform: rotate(12deg) scale(1.1); } 97% { transform: rotate(-6deg); } }
@keyframes ch-sheen { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@media (prefers-reduced-motion: reduce) {
  .ch-fab, .ch-orb::before, .ch-orb::after, .ch-bub, .ch-bub circle { animation: none !important; }
  .ch-fab-t { transition: none; }
}

.ch-panel { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 70;
  width: min(380px, calc(100vw - 24px)); height: min(580px, calc(100dvh - 32px)); display: flex; flex-direction: column;
  background: var(--card, #fff); color: var(--ink, #0b1426); border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 60px -12px rgba(10, 20, 48, .45); animation: ch-in .18s ease-out; }
@keyframes ch-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
/* Teléfono: pantalla completa; con el teclado abierto chat.js ajusta la altura al espacio VISIBLE (como WhatsApp). */
@media (max-width: 520px) {
  .ch-panel { right: 0; left: 0; top: 0; bottom: auto; width: 100%; height: 100dvh; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) { .ch-panel { animation: none; } }

.ch-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--navy, #0a1430); color: #fff; flex: none; }
.ch-av { width: 36px; height: 36px; border-radius: 50%; background: radial-gradient(circle at 30% 25%, #ff7aa8, #8b3dff 70%); display: inline-flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.ch-av .ch-bub { width: 22px; height: 22px; animation: none; }
.ch-ttl { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.ch-ttl b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-ttl small { font-size: 12px; opacity: .75; }
.ch-x { border: 0; background: transparent; color: #fff; font-size: 28px; line-height: 1; padding: 2px 6px; cursor: pointer; border-radius: 8px; }
.ch-x:hover, .ch-x:focus-visible { background: rgba(255, 255, 255, .14); outline: none; }

.ch-log { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg, #f3f5fa); overscroll-behavior: contain; }
.ch-msg { margin: 0; max-width: 86%; padding: 10px 12px; border-radius: 14px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.ch-bot { align-self: flex-start; background: var(--card, #fff); border: 1px solid var(--line, #e3e8f2); border-bottom-left-radius: 4px; }
.ch-me { align-self: flex-end; background: var(--brand, #3355ff); color: #fff; border-bottom-right-radius: 4px; }
.ch-msg a { color: var(--brand-ink, #1f3ad6); font-weight: 700; }
.ch-typing { color: var(--muted, #6b7a93); font-style: italic; }
.ch-err { align-self: center; font-size: 13px; color: #b42318; background: #fef3f2; border-radius: 10px; padding: 6px 10px; }
.ch-hand { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 8px; }
.ch-hand a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; font-size: 14px; font-weight: 800; text-decoration: none; }
.ch-hand .ch-wa { background: #25d366; color: #fff; }
.ch-hand .ch-ct { background: var(--brand-soft, #eef1ff); color: var(--brand-ink, #1f3ad6); }

.ch-quick { display: flex; gap: 6px; padding: 8px 12px 0; overflow-x: auto; flex: none; background: var(--card, #fff); }
.ch-quick[hidden] { display: none; }
.ch-quick button { flex: none; border: 1px solid var(--line, #e3e8f2); background: var(--card, #fff); color: var(--brand-ink, #1f3ad6);
  border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.ch-quick button:hover, .ch-quick button:focus-visible { border-color: var(--brand, #3355ff); outline: none; }

.ch-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; background: var(--card, #fff); flex: none; }
.ch-form textarea { flex: 1; resize: none; min-height: 42px; max-height: 120px; border: 1.5px solid var(--line, #e3e8f2); border-radius: 12px;
  padding: 10px 12px; font: inherit; font-size: 16px; line-height: 1.35; color: var(--ink, #0b1426); background: #fff; }
.ch-form textarea:focus { border-color: var(--brand, #3355ff); outline: none; }
.ch-send { flex: none; width: 42px; height: 42px; border: 0; border-radius: 12px; background: var(--brand, #3355ff); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; }
.ch-send:disabled { opacity: .5; cursor: default; }
.ch-foot { margin: 0; padding: 0 12px 10px; font-size: 12px; color: var(--muted, #6b7a93); background: var(--card, #fff); flex: none; }
.ch-foot a { color: inherit; }
body.ch-open { overflow: hidden; }
@media (min-width: 521px) { body.ch-open { overflow: auto; } }

/* CHAT-002 · tarjetas con botones (comprar con el asistente) */
.ch-card { align-self: stretch; background: var(--card, #fff); border: 1px solid var(--line, #e3e8f2); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ch-card p { margin: 0; font-size: 14.5px; }
.ch-card-t { font-weight: 800; font-size: 15px !important; }
.ch-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-opt, .ch-yes, .ch-pay { font: inherit; font-size: 14px; font-weight: 800; border-radius: 999px; padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ch-opt { border: 1.5px solid var(--brand, #3355ff); background: #fff; color: var(--brand-ink, #1f3ad6); }
.ch-yes { border: 0; background: #12a150; color: #fff; }
.ch-pay { border: 0; background: var(--brand, #3355ff); color: #fff; padding: 12px 16px; font-size: 15.5px; border-radius: 12px; }
.ch-pay:disabled, .ch-opt:disabled, .ch-yes:disabled, .ch-offer:disabled, .ch-num:disabled { opacity: .45; cursor: default; }
.ch-choices { flex-direction: row; flex-wrap: wrap; background: transparent; border: 0; padding: 0; }
.ch-offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.ch-offer { position: relative; font: inherit; text-align: left; border: 1.5px solid var(--line, #e3e8f2); background: #fff; border-radius: 12px; padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; color: var(--ink, #0b1426); }
.ch-offer:not(:disabled):hover, .ch-offer:focus-visible { border-color: var(--brand, #3355ff); outline: none; }
.ch-amt { font-size: 14.5px; line-height: 1.25; }
.ch-price { font-weight: 800; color: var(--brand-ink, #1f3ad6); font-size: 16px; }
.ch-price s { color: var(--muted, #6b7a93); font-weight: 600; font-size: 13px; }
.ch-badge { align-self: flex-start; font-size: 11px; font-weight: 800; color: #8a5a00; background: #fff4d6; border-radius: 999px; padding: 2px 8px; margin-bottom: 2px; }
.ch-num { font: inherit; text-align: left; border: 1.5px solid var(--line, #e3e8f2); background: #fff; border-radius: 12px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; color: var(--ink, #0b1426); }
.ch-num:not(:disabled):hover { border-color: var(--brand, #3355ff); }
.ch-num-d { font-size: 16px; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.ch-big { font-size: 22px !important; font-weight: 800; letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.ch-warn { font-size: 12.5px !important; color: #8a5a00; background: #fff8e6; border-radius: 10px; padding: 8px 10px; }
.ch-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 14.5px; }
.ch-dl dt { color: var(--muted, #6b7a93); }
.ch-dl dd { margin: 0; font-weight: 700; }
.ch-ok { color: #0e7a3c; font-weight: 700; font-size: 13.5px !important; }
.ch-note, .ch-fine { font-size: 12.5px !important; color: var(--muted, #6b7a93); }
.ch-tip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--brand-soft, #eef1ff); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; }
.ch-check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.ch-check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--brand, #3355ff); }
.ch-must { background: #f6f8ff; border-radius: 10px; padding: 8px 10px; font-weight: 700; }
.ch-err-in { color: #b42318; font-size: 13.5px !important; }
.ch-err-in[hidden] { display: none; }
.ch-pur { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-top: 1px solid var(--line, #e3e8f2); }
.ch-pur-i { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; }
.ch-pill { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 2px 8px; background: #eef0f5; color: #33415c; }
.ch-green { background: #e7f7ee; color: #0e7a3c; } .ch-amber { background: #fff4d6; color: #8a5a00; } .ch-red { background: #fde8e7; color: #b42318; } .ch-blue { background: #e8efff; color: #1f3ad6; }
.ch-steps { margin: 0; padding-left: 20px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.ch-ios { width: 100%; max-width: 280px; height: auto; border-radius: 10px; align-self: center; }
.ch-fine[hidden], .ch-note[hidden] { display: none; }
.ch-badge-cu { color: #fff; background: linear-gradient(120deg, #d62839, #1f3ad6); }
