/* Chat en vivo de la web */
.cw-root { --cw-blue: #214c9b; --cw-blue-dark: #1a3d7d; --cw-lime: #94c11f; position: fixed; right: 20px; bottom: 20px; z-index: 9000; font-family: inherit; font-size: 15px; line-height: 1.45; color: #0f172a; }
.cw-root *, .cw-root *::before, .cw-root *::after { box-sizing: border-box; }
.cw-root [hidden] { display: none !important; }
.cw-launcher { position: relative; width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--cw-blue); color: #fff; cursor: pointer; display: grid; place-items: center; box-shadow: 0 10px 30px rgba(33, 76, 155, .35); transition: transform .2s, background .2s; margin-left: auto; }
.cw-launcher:hover { background: var(--cw-blue-dark); transform: translateY(-2px); }
.cw-launcher:focus-visible { outline: 3px solid var(--cw-lime); outline-offset: 3px; }
.cw-launcher .cw-icon-close { display: none; }
.cw-open .cw-launcher .cw-icon-close { display: block; }
.cw-open .cw-launcher .cw-icon-chat { display: none; }
.cw-online .cw-launcher::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--cw-lime); border: 2px solid #fff; }
.cw-open .cw-launcher::after { display: none; }
.cw-badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #e11d48; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.cw-teaser { position: absolute; right: 0; bottom: 76px; width: 340px; max-width: calc(100vw - 40px); animation: cw-pop .35s ease-out; }
.cw-teaser[hidden] { display: none; }
.cw-teaser-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.cw-teaser-label { display: inline-flex; align-items: center; gap: .45rem; background: #fff; border-radius: 99px; padding: .3rem .85rem .3rem .3rem; font-size: .9rem; font-weight: 600; box-shadow: 0 6px 18px rgba(15, 23, 42, .14); }
.cw-teaser-spark { width: 26px; height: 26px; border-radius: 50%; background: var(--cw-blue); color: var(--cw-lime); display: grid; place-items: center; font-size: .95rem; }
.cw-teaser-x { width: 32px; height: 32px; border-radius: 50%; border: 0; background: #e2e8f0; color: #334155; font-size: 1.2rem; line-height: 1; cursor: pointer; box-shadow: 0 4px 12px rgba(15, 23, 42, .12); }
.cw-teaser-x:hover { background: #cbd5e1; color: #0f172a; }
.cw-teaser-card { background: #fff; border-radius: 22px; padding: .45rem; box-shadow: 0 18px 45px rgba(15, 23, 42, .2); border: 1px solid #e2e8f0; }
.cw-teaser-hello { background: #f1f5f9; border-radius: 16px; padding: .9rem 1rem 1rem; }
.cw-teaser-title { display: block; font-size: 1.7rem; font-weight: 700; line-height: 1.15; margin-bottom: .35rem; color: #0f172a; }
.cw-teaser-text { margin: 0; color: #475569; font-size: .98rem; line-height: 1.45; }
.cw-teaser-actions { display: flex; flex-wrap: wrap; gap: .5rem; padding: .75rem .5rem .4rem; }
.cw-teaser-actions button { border: 0; border-radius: 99px; padding: .5rem 1rem; font: inherit; font-size: .92rem; font-weight: 700; cursor: pointer; transition: transform .15s, filter .15s; }
.cw-teaser-actions button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.cw-teaser-offers { background: var(--cw-lime); color: #0f172a; }
.cw-teaser-chat { background: #0f172a; color: #fff; }
.cw-teaser-compose { display: flex; align-items: center; gap: .5rem; padding: .35rem .35rem .3rem .75rem; }
.cw-teaser-input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: .95rem; padding: .55rem 0; color: #0f172a; }
.cw-teaser-input:focus { outline: none; }
.cw-teaser-compose:focus-within { box-shadow: inset 0 -2px 0 var(--cw-blue); }
.cw-teaser-send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: #e2e8f0; color: #334155; display: grid; place-items: center; cursor: pointer; flex: none; }
.cw-teaser-send:hover { background: var(--cw-blue); color: #fff; }
.cw-panel { position: absolute; right: 0; bottom: 76px; width: 380px; height: min(620px, calc(100vh - 110px)); background: #fff; border-radius: 18px; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); display: flex; flex-direction: column; overflow: hidden; animation: cw-pop .2s ease-out; }
.cw-panel.cw-drop { outline: 3px dashed var(--cw-lime); outline-offset: -6px; }
@keyframes cw-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.cw-head { display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; background: linear-gradient(135deg, var(--cw-blue), #2f63c4); color: #fff; }
.cw-logo { width: 36px; height: 36px; border-radius: 50%; background: #fff; padding: 4px; object-fit: contain; }
.cw-head-text { display: grid; flex: 1; min-width: 0; }
.cw-head-text strong { font-size: 1rem; }
.cw-status { font-size: .8rem; opacity: .9; display: flex; align-items: center; gap: .35rem; }
.cw-online .cw-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cw-lime); flex: none; }
.cw-x { background: none; border: 0; color: #fff; font-size: 1.7rem; line-height: 1; cursor: pointer; padding: 0 .2rem; opacity: .85; }
.cw-x:hover { opacity: 1; }
.cw-list { flex: 1; overflow-y: auto; padding: 1rem; background: #f6f8fc; display: flex; flex-direction: column; gap: .55rem; overscroll-behavior: contain; }
.cw-msg { display: flex; flex-direction: column; max-width: 84%; }
.cw-mine { align-self: flex-end; align-items: flex-end; }
.cw-theirs { align-self: flex-start; }
.cw-who { font-size: .72rem; font-weight: 700; color: #64748b; margin: 0 .3rem .15rem; }
.cw-bubble { padding: .6rem .8rem; border-radius: 16px; background: #fff; border: 1px solid #e6ebf3; word-wrap: break-word; overflow-wrap: anywhere; }
.cw-mine .cw-bubble { background: var(--cw-blue); color: #fff; border-color: var(--cw-blue); border-bottom-right-radius: 4px; }
.cw-theirs .cw-bubble { border-bottom-left-radius: 4px; }
.cw-agent .cw-bubble { border-color: #c7e28a; background: #f7fbe9; }
.cw-pending { opacity: .6; }
.cw-text a { color: inherit; text-decoration: underline; word-break: break-all; }
.cw-theirs .cw-text a { color: var(--cw-blue); }
.cw-msg time { font-size: .68rem; color: #94a3b8; margin: .15rem .3rem 0; }
.cw-img { display: block; margin: -.2rem -.3rem .3rem; }
.cw-img img { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; }
.cw-file { display: flex; align-items: center; gap: .55rem; color: inherit; text-decoration: none; padding: .2rem 0; }
.cw-file + .cw-text { margin-top: .35rem; }
.cw-file span:last-child { display: grid; min-width: 0; }
.cw-file strong { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.cw-file small { opacity: .75; font-size: .75rem; }
.cw-file-icon { font-size: 1.5rem; }
.cw-system { align-self: center; font-size: .78rem; color: #64748b; background: #eef2f9; padding: .3rem .7rem; border-radius: 99px; text-align: center; max-width: 90%; }
.cw-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .2rem; }
.cw-chips button { border: 1px solid var(--cw-blue); background: #fff; color: var(--cw-blue); border-radius: 99px; padding: .35rem .75rem; font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; }
.cw-chips button:hover { background: var(--cw-blue); color: #fff; }
.cw-typing { display: flex; align-items: center; gap: 4px; padding: .3rem 1.2rem .4rem; background: #f6f8fc; font-size: .78rem; color: #64748b; }
.cw-typing span { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; animation: cw-dot 1.2s infinite; }
.cw-typing span:nth-child(2) { animation-delay: .15s; }
.cw-typing span:nth-child(3) { animation-delay: .3s; }
.cw-typing em { font-style: normal; margin-left: .4rem; }
@keyframes cw-dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.cw-foot { border-top: 1px solid #e6ebf3; padding: .6rem .7rem .5rem; background: #fff; position: relative; }
.cw-compose { display: flex; align-items: flex-end; gap: .3rem; }
.cw-compose textarea { flex: 1; resize: none; border: 1px solid #cbd5e1; border-radius: 12px; padding: .55rem .7rem; font: inherit; max-height: 120px; min-height: 40px; line-height: 1.35; color: #0f172a; background: #fff; }
.cw-compose textarea:focus { outline: none; border-color: var(--cw-blue); box-shadow: 0 0 0 3px rgba(33, 76, 155, .12); }
.cw-tool, .cw-send { flex: none; width: 38px; height: 40px; border: 0; background: none; border-radius: 10px; cursor: pointer; font-size: 1.2rem; color: #64748b; display: grid; place-items: center; }
.cw-tool:hover { background: #f1f5f9; color: var(--cw-blue); }
.cw-send { background: var(--cw-blue); color: #fff; }
.cw-send:hover { background: var(--cw-blue-dark); }
.cw-emojis { position: absolute; left: .7rem; right: .7rem; bottom: calc(100% + 6px); background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; box-shadow: 0 12px 30px rgba(15, 23, 42, .15); padding: .5rem; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 200px; overflow-y: auto; }
.cw-emojis button { border: 0; background: none; font-size: 1.35rem; padding: .2rem; border-radius: 8px; cursor: pointer; }
.cw-emojis button:hover { background: #f1f5f9; }
.cw-meta { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: .4rem; }
.cw-meta small { font-size: .68rem; color: #94a3b8; line-height: 1.3; text-align: right; }
.cw-human { border: 0; background: none; color: var(--cw-blue); font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; padding: 0; white-space: nowrap; }
.cw-human:hover { text-decoration: underline; }
.cw-error { background: #fef2f2; color: #b91c1c; border-radius: 8px; padding: .4rem .6rem; font-size: .82rem; margin-bottom: .45rem; }
.cw-contact { display: grid; gap: .4rem; background: #f7fbe9; border: 1px solid #c7e28a; border-radius: 12px; padding: .7rem; margin-bottom: .5rem; }
.cw-contact p { margin: 0; font-size: .84rem; }
.cw-contact input { border: 1px solid #cbd5e1; border-radius: 8px; padding: .45rem .6rem; font: inherit; }
.cw-contact button { border: 0; background: var(--cw-blue); color: #fff; border-radius: 8px; padding: .5rem; font: inherit; font-weight: 700; cursor: pointer; }
@media (max-width: 520px) {
  .cw-root { right: 12px; bottom: 12px; }
  .cw-open .cw-launcher { display: none; }
  .cw-panel { position: fixed; inset: 0; width: auto; height: 100%; border-radius: 0; bottom: 0; }
  .cw-compose textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .cw-panel, .cw-teaser, .cw-typing span { animation: none; } }
/* Formulario de datos dentro del chat */
.cw-formcard { align-self: flex-start; width: 88%; background: #fff; border: 1px solid #dbe4f3; border-left: 4px solid var(--cw-lime); border-radius: 14px; padding: .8rem .85rem; display: grid; gap: .5rem; box-shadow: 0 4px 14px rgba(15, 23, 42, .06); }
.cw-form-title { font-size: .92rem; color: #0f172a; }
.cw-formcard input[type=text], .cw-formcard input[type=email], .cw-formcard input[type=tel] { width: 100%; box-sizing: border-box; border: 1px solid #cbd5e1; border-radius: 9px; padding: .55rem .65rem; font: inherit; font-size: .92rem; background: #f8fafc; }
.cw-formcard input:focus { outline: none; border-color: var(--cw-blue); background: #fff; box-shadow: 0 0 0 3px rgba(33, 76, 155, .12); }
.cw-form-check { display: flex; align-items: flex-start; gap: .45rem; font-size: .82rem; color: #475569; cursor: pointer; }
.cw-form-check input { margin-top: .15rem; accent-color: var(--cw-blue); }
.cw-form-actions { display: flex; align-items: center; gap: .6rem; }
.cw-form-send { background: var(--cw-blue); color: #fff; border: 0; border-radius: 99px; padding: .5rem 1.2rem; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; }
.cw-form-send:hover { background: var(--cw-blue-dark); }
.cw-form-send:disabled { opacity: .6; }
.cw-form-skip { background: none; border: 0; color: #64748b; font: inherit; font-size: .85rem; cursor: pointer; text-decoration: underline; }
.cw-form-error { margin: 0; color: #b91c1c; font-size: .82rem; }
.cw-formcard.cw-done { border-left-color: #22c55e; padding: .55rem .8rem; }
.cw-form-thanks { margin: 0; font-size: .88rem; font-weight: 600; color: #166534; }
