#xado-chat {
	--xado-principal: #1b2a4a;
	--xado-acento: #d62828;
	--xado-fondo: #ffffff;
	--xado-gris: #f2f4f7;
	--xado-texto: #1f2937;
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: var(--xado-texto);
}

#xado-chat *,
#xado-chat *::before,
#xado-chat *::after {
	box-sizing: border-box;
}

/* Botón flotante */
#xado-chat .xado-lanzador {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: 0;
	padding: 0;
	cursor: pointer;
	background: var(--xado-principal);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
	transition: transform .2s ease, background .2s ease;
	position: relative;
}
#xado-chat .xado-lanzador::after {
	content: "";
	position: absolute;
	top: 6px;
	right: 6px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--xado-acento);
	border: 2px solid #fff;
}
#xado-chat .xado-lanzador:hover { transform: scale(1.06); }
#xado-chat.xado-abierto .xado-lanzador::after { display: none; }

/* Panel */
#xado-chat .xado-panel {
	position: absolute;
	right: 0;
	bottom: 76px;
	width: 370px;
	max-width: calc(100vw - 32px);
	height: 540px;
	max-height: calc(100vh - 120px);
	background: var(--xado-fondo);
	border-radius: 16px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, .25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: xado-entrar .22s ease-out;
}
#xado-chat .xado-panel[hidden] { display: none; }

@keyframes xado-entrar {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: translateY(0); }
}

#xado-chat .xado-cabecera {
	background: var(--xado-principal);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 3px solid var(--xado-acento);
}
#xado-chat .xado-titulo {
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 8px;
}
#xado-chat .xado-punto {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #34d399;
	box-shadow: 0 0 0 3px rgba(52, 211, 153, .25);
}
#xado-chat .xado-cerrar {
	background: transparent;
	border: 0;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
	opacity: .85;
}
#xado-chat .xado-cerrar:hover { opacity: 1; }

/* Mensajes */
#xado-chat .xado-mensajes {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafbfc;
}
#xado-chat .xado-msg {
	max-width: 85%;
	padding: 10px 13px;
	border-radius: 14px;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
#xado-chat .xado-asistente {
	align-self: flex-start;
	background: var(--xado-gris);
	border-bottom-left-radius: 4px;
}
#xado-chat .xado-usuario {
	align-self: flex-end;
	background: var(--xado-principal);
	color: #fff;
	border-bottom-right-radius: 4px;
}
#xado-chat .xado-error {
	background: #fdecec;
	color: #8a1c1c;
}
#xado-chat .xado-msg ul {
	margin: 4px 0;
	padding-left: 18px;
}
#xado-chat .xado-msg li { margin: 2px 0; }
#xado-chat .xado-msg a {
	color: var(--xado-acento);
	text-decoration: underline;
}

/* Indicador "escribiendo" */
#xado-chat .xado-escribiendo {
	display: flex;
	gap: 4px;
	padding: 14px 16px;
}
#xado-chat .xado-escribiendo span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #9ca3af;
	animation: xado-bote 1.2s infinite ease-in-out;
}
#xado-chat .xado-escribiendo span:nth-child(2) { animation-delay: .15s; }
#xado-chat .xado-escribiendo span:nth-child(3) { animation-delay: .3s; }
@keyframes xado-bote {
	0%, 60%, 100% { transform: translateY(0); opacity: .5; }
	30% { transform: translateY(-5px); opacity: 1; }
}

/* Botón de contacto */
#xado-chat .xado-contacto {
	display: block;
	margin: 0 16px 8px;
	padding: 8px;
	text-align: center;
	font-size: 13px;
	font-weight: 600;
	color: var(--xado-acento);
	border: 1px solid var(--xado-acento);
	border-radius: 8px;
	text-decoration: none;
	transition: background .2s, color .2s;
}
#xado-chat .xado-contacto:hover {
	background: var(--xado-acento);
	color: #fff;
}

/* Formulario */
#xado-chat .xado-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid #e5e7eb;
	background: #fff;
	margin: 0;
}
#xado-chat .xado-form textarea {
	flex: 1;
	resize: none;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	padding: 9px 11px;
	font: inherit;
	color: inherit;
	background: #fff;
	min-height: 40px;
	max-height: 110px;
	outline: none;
	margin: 0;
}
#xado-chat .xado-form textarea:focus {
	border-color: var(--xado-principal);
	box-shadow: 0 0 0 3px rgba(27, 42, 74, .12);
}
#xado-chat .xado-form button {
	width: 40px;
	height: 40px;
	flex: 0 0 40px;
	border-radius: 10px;
	border: 0;
	padding: 0;
	background: var(--xado-acento);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
#xado-chat .xado-form button:disabled {
	opacity: .5;
	cursor: default;
}
#xado-chat .xado-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
}

#xado-chat .xado-aviso {
	font-size: 11px;
	color: #6b7280;
	text-align: center;
	padding: 0 12px 10px;
	background: #fff;
}

/* Móvil */
@media (max-width: 480px) {
	#xado-chat {
		right: 14px;
		bottom: 14px;
	}
	#xado-chat .xado-panel {
		position: fixed;
		inset: 0;
		width: 100%;
		max-width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
	}
	#xado-chat.xado-abierto .xado-lanzador { display: none; }
	#xado-chat .xado-form textarea { font-size: 16px; } /* evita zoom en iOS */
}
