/* Chat de preguntas guiadas (reemplaza al botón flotante de WhatsApp). */
.tw-chat-raiz {
	--c-naranja: #F39C2C;
	--c-hondo: #A8520A;
	--c-suave: #FDEBD3;
	--c-tinta: #1B1B1F;
	--c-papel: #F8F6F2;
	--c-gris: #6B655E;
	--c-linea: #E8E2D9;
	--c-wa: #1FAF55;
	--c-titulo: var(--wp--preset--font-family--display, "Plus Jakarta Sans", system-ui, sans-serif);
	--c-texto: var(--wp--preset--font-family--body, "DM Sans", system-ui, sans-serif);
	font-family: var(--c-texto);
	color: var(--c-tinta);
}
.tw-chat-raiz *, .tw-chat-raiz *::before, .tw-chat-raiz *::after { box-sizing: border-box; }
.tw-chat-raiz [hidden] { display: none !important; }
.tw-chat-raiz p { margin: 0; }
.tw-chat-oculto { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Botón que abre el chat */
.tw-chat-abrir {
	position: fixed; right: max(20px, env(safe-area-inset-right, 0px)); bottom: max(20px, env(safe-area-inset-bottom, 0px)); z-index: 95;
	display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 8px; border: 0; border-radius: 999px; cursor: pointer;
	background: var(--c-tinta); color: #fff; font: 500 15px/1.2 var(--c-texto); text-align: left;
	box-shadow: 0 14px 34px rgba(27, 27, 31, .28); transition: transform .25s ease, box-shadow .25s ease;
	animation: tw-chat-entra .5s ease-out .8s both;
}
.tw-chat-abrir:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(27, 27, 31, .34); }
.tw-chat-abrir:focus-visible { outline: 3px solid var(--c-naranja); outline-offset: 3px; }
.tw-chat-abrir strong { font-family: var(--c-titulo); font-weight: 700; }
.tw-chat-abrir-txt { padding-right: 2px; }
.tw-chat-abrir-flecha { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--c-naranja); color: var(--c-tinta); flex: none; }
.tw-chat-raiz.is-abierto .tw-chat-abrir { opacity: 0; pointer-events: none; transform: scale(.9); }

.tw-chat-avatar { width: 40px; height: 40px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; }
.tw-chat-avatar img { width: 24px; height: 24px; display: block; }

/* Panel */
.tw-chat {
	position: fixed; right: max(20px, env(safe-area-inset-right, 0px)); bottom: max(20px, env(safe-area-inset-bottom, 0px)); z-index: 96;
	width: min(410px, calc(100vw - 40px)); height: min(640px, calc(100vh - 120px)); height: min(640px, calc(100dvh - 120px));
	display: flex; flex-direction: column; overflow: hidden;
	background: #fff; border-radius: 28px; box-shadow: 0 30px 80px rgba(27, 27, 31, .3), 0 0 0 1px rgba(27, 27, 31, .06);
	animation: tw-chat-abre .28s cubic-bezier(.2, .8, .2, 1) both;
}
.tw-chat-cab { display: flex; align-items: center; gap: 12px; padding: 18px 14px 18px 20px; background: var(--c-naranja); color: var(--c-tinta); }
.tw-chat-cab .tw-chat-avatar { width: 46px; height: 46px; box-shadow: 0 4px 12px rgba(120, 60, 0, .18); }
.tw-chat-cab .tw-chat-avatar img { width: 27px; height: 27px; }
.tw-chat-cab-txt { flex: 1; min-width: 0; }
.tw-chat-titulo { font: 800 19px/1.15 var(--c-titulo); letter-spacing: -.02em; }
.tw-chat-sub { font-size: 13px; opacity: .85; margin-top: 2px !important; }
.tw-chat-icono { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--c-tinta); display: grid; place-items: center; cursor: pointer; flex: none; transition: background .2s; }
.tw-chat-icono:hover { background: rgba(255, 255, 255, .35); }
.tw-chat-icono:focus-visible { outline: 3px solid var(--c-tinta); outline-offset: 1px; }

.tw-chat-paso { padding: 12px 20px; background: var(--c-papel); border-bottom: 1px solid var(--c-linea); font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--c-gris); }

.tw-chat-log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; background: var(--c-papel); display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.tw-chat-msg { display: flex; max-width: 88%; animation: tw-chat-msg .25s ease-out both; }
.tw-chat-bot { align-self: flex-start; }
.tw-chat-yo { align-self: flex-end; }
.tw-chat-burbuja { padding: 12px 16px; border-radius: 20px; font-size: 15.5px; line-height: 1.45; overflow-wrap: anywhere; }
.tw-chat-bot .tw-chat-burbuja { background: #fff; border: 1px solid var(--c-linea); border-top-left-radius: 6px; }
.tw-chat-yo .tw-chat-burbuja { background: var(--c-tinta); color: #fff; border-top-right-radius: 6px; }
.tw-chat-resumen { display: grid; gap: 4px; border-left: 3px solid var(--c-naranja) !important; }
.tw-chat-resumen strong { font-weight: 700; }
.tw-chat-escribe { display: flex; gap: 5px; padding: 15px 16px; }
.tw-chat-escribe span { width: 7px; height: 7px; border-radius: 50%; background: var(--c-gris); opacity: .4; animation: tw-chat-punto 1s infinite; }
.tw-chat-escribe span:nth-child(2) { animation-delay: .15s; }
.tw-chat-escribe span:nth-child(3) { animation-delay: .3s; }

.tw-chat-opciones { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 16px 14px; background: var(--c-papel); max-height: 42%; overflow-y: auto; }
.tw-chat-opciones:empty { padding: 0; }
.tw-chat-op {
	display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; cursor: pointer; text-decoration: none;
	border: 1.5px solid #E2A45F; background: #fff; color: var(--c-hondo); font: 700 14.5px/1.2 var(--c-titulo); transition: background .2s, border-color .2s, color .2s;
}
.tw-chat-op:hover { background: var(--c-suave); border-color: var(--c-hondo); }
.tw-chat-op:focus-visible { outline: 3px solid var(--c-tinta); outline-offset: 2px; }
.tw-chat-wa { background: var(--c-wa); border-color: var(--c-wa); color: #fff; }
.tw-chat-wa:hover { background: #18914A; border-color: #18914A; color: #fff; }
.tw-chat-op-sec { border-color: var(--c-linea); color: var(--c-tinta); }

.tw-chat-form { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--c-linea); background: #fff; }
.tw-chat-form input { flex: 1; min-width: 0; height: 48px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--c-linea); background: var(--c-papel); color: var(--c-tinta); font: 400 16px var(--c-texto); }
.tw-chat-form input::placeholder { color: #8A847C; }
.tw-chat-form input:focus { outline: 2px solid var(--c-naranja); outline-offset: 1px; background: #fff; }
.tw-chat-form button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--c-tinta); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.tw-chat-form button:focus-visible { outline: 3px solid var(--c-naranja); outline-offset: 2px; }
.tw-chat-nota { padding: 0 16px 12px; background: #fff; text-align: center; font-size: 12px; color: var(--c-gris); }

.tw-chat-fondo { position: fixed; inset: 0; z-index: 95; background: rgba(27, 27, 31, .45); }

/* Celular: el chat ocupa casi toda la pantalla y el botón se achica. */
@media (max-width: 600px) {
	.tw-chat-abrir { right: max(14px, env(safe-area-inset-right, 0px)); bottom: max(14px, env(safe-area-inset-bottom, 0px)); font-size: 14.5px; gap: 10px; }
	.tw-chat-largo { display: none; }
	.tw-chat-abrir-flecha { width: 34px; height: 34px; }
	.tw-chat { left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom, 0px)); width: auto; height: calc(100vh - 70px); height: calc(100dvh - 70px); border-radius: 26px; }
	.tw-chat-cab { padding: 14px 10px 14px 16px; }
	.tw-chat-opciones { max-height: 46%; }
	html.tw-chat-bloqueo, html.tw-chat-bloqueo body { overflow: hidden; }
}

@keyframes tw-chat-entra { from { opacity: 0; transform: translateY(14px); } }
@keyframes tw-chat-abre { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes tw-chat-msg { from { opacity: 0; transform: translateY(6px); } }
@keyframes tw-chat-punto { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: .9; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
	.tw-chat-abrir, .tw-chat, .tw-chat-msg, .tw-chat-escribe span { animation: none; }
}
@media print { .tw-chat-raiz { display: none; } }
