/* Asistente CDAC — FAB (plugin; tokens con fallback hex). */
.cdac-chat-root {
	--cdac-tinta: #1a1f2c;
	--cdac-luz-pura: #ffffff;
	--cdac-luz: #f7f8fa;
	--cdac-linea: #e6e8ec;
	--cdac-cielo: #c45c48;
	--cdac-cielo-oscuro: #b04f3d;
	--cdac-piedra: #5c6478;
	--cdac-radius: 6px;
	position: fixed;
	right: max(1.25rem, env(safe-area-inset-right));
	bottom: max(1.25rem, env(safe-area-inset-bottom));
	z-index: 9990;
	font-family: Figtree, system-ui, sans-serif;
}

/* Visible even if the home landing hides header/footer. */
body.home .cdac-chat-root {
	display: block !important;
}

.cdac-chat-fab {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.7rem;
	border: none;
	cursor: pointer;
	background: transparent;
	padding: 0;
}

.cdac-chat-fab:focus-visible {
	outline: 2px solid var(--cdac-cielo);
	outline-offset: 3px;
}

.cdac-chat-fab__avatar {
	width: 4.25rem;
	height: 4.25rem;
	border-radius: 50%;
	object-fit: cover;
	display: block;
	border: 3px solid #fff;
	box-shadow: 0 10px 28px rgba(26, 31, 44, 0.28);
	background: var(--cdac-tinta);
}

.cdac-chat-fab__meta {
	display: flex;
	align-items: center;
	padding: 0.65rem 0.9rem;
	background: rgba(26, 31, 44, 0.94);
	color: #fff;
	border-radius: 999px;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.cdac-chat-fab__label {
	font-size: 0.82rem;
	font-weight: 700;
	line-height: 1.15;
	white-space: nowrap;
}

.cdac-chat-fab__pulse {
	position: absolute;
	left: 3.15rem;
	top: 0.35rem;
	width: 0.7rem;
	height: 0.7rem;
	border-radius: 50%;
	background: var(--cdac-cielo);
	border: 2px solid #fff;
}

.cdac-chat-panel {
	position: absolute;
	right: 0;
	bottom: calc(100% + 0.85rem);
	width: min(22.5rem, calc(100vw - 2.5rem));
	height: min(32.5rem, 70vh);
	background: #fff;
	color: var(--cdac-tinta);
	border: 1px solid var(--cdac-linea);
	border-radius: 12px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
	transform: translateY(0.5rem);
	transition: opacity 0.2s ease, transform 0.2s ease;
	box-shadow: 0 18px 40px rgba(26, 31, 44, 0.18);
}

.cdac-chat-panel.is-open {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

.cdac-chat-panel__head {
	background: var(--cdac-tinta);
	color: #fff;
	padding: 0.85rem 1rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}

.cdac-chat-panel__head-main {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	min-width: 0;
}

.cdac-chat-panel__head-avatar {
	width: 2.4rem;
	height: 2.4rem;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid rgba(255, 255, 255, 0.35);
	flex-shrink: 0;
}

.cdac-chat-panel__head h2 {
	margin: 0;
	font-family: Newsreader, Georgia, serif;
	font-size: 1.05rem;
	font-weight: 600;
	color: inherit;
	line-height: 1.2;
}

.cdac-chat-panel__status {
	display: block;
	font-size: 0.72rem;
	font-weight: 500;
	opacity: 0.8;
	margin-top: 0.15rem;
}

.cdac-chat-panel__close {
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.35);
	color: inherit;
	border-radius: 6px;
	cursor: pointer;
	padding: 0.25rem 0.55rem;
	font-size: 0.8rem;
}

.cdac-chat-panel__body {
	padding: 1rem;
	overflow: auto;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.cdac-chat-messages {
	display: flex;
	flex-direction: column;
	gap: 0.55rem;
}

.cdac-chat-msg {
	margin: 0;
	padding: 0.7rem 0.85rem;
	border-radius: 10px;
	font-size: 0.95rem;
	line-height: 1.5;
	max-width: 95%;
}

.cdac-chat-msg--bot {
	background: var(--cdac-luz);
	color: var(--cdac-tinta);
	border: 1px solid var(--cdac-linea);
	align-self: flex-start;
}

.cdac-chat-msg--user {
	background: var(--cdac-tinta);
	color: #fff;
	align-self: flex-end;
}

.cdac-chat-msg--pending {
	opacity: 0.7;
	font-style: italic;
}

.cdac-chat-msg--bot p {
	margin: 0 0 0.55rem;
}

.cdac-chat-msg--bot p:last-child {
	margin-bottom: 0;
}

.cdac-chat-list {
	margin: 0.1rem 0 0.15rem;
	padding: 0 0 0 1.2rem;
}

.cdac-chat-list li {
	margin: 0.35rem 0;
	padding-left: 0.15rem;
	line-height: 1.45;
}

.cdac-chat-list li::marker {
	color: var(--cdac-cielo);
	font-weight: 650;
}

.cdac-chat-msg--bot strong {
	font-weight: 700;
	letter-spacing: 0.01em;
}

.cdac-chat-sources {
	margin: 0;
	font-size: 0.72rem;
	color: var(--cdac-piedra);
	align-self: flex-start;
}

.cdac-chat-form {
	display: flex;
	gap: 0.45rem;
	padding: 0.75rem;
	border-top: 1px solid var(--cdac-linea);
	background: #fff;
}

.cdac-chat-input {
	flex: 1;
	min-width: 0;
	border: 1px solid var(--cdac-linea);
	border-radius: 6px;
	padding: 0.55rem 0.7rem;
	font: inherit;
	font-size: 0.9rem;
}

.cdac-chat-send {
	border: none;
	border-radius: 6px;
	background: var(--cdac-tinta);
	color: #fff;
	font: inherit;
	font-weight: 700;
	font-size: 0.85rem;
	padding: 0.55rem 0.85rem;
	cursor: pointer;
}

.cdac-chat-send:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.cdac-chat-form.is-limited .cdac-chat-input {
	opacity: 0.7;
	cursor: not-allowed;
	background: var(--cdac-luz);
}

@media (max-width: 720px) {
	.cdac-chat-fab__meta {
		display: none;
	}
}

@media (max-width: 480px) {
	.cdac-chat-panel {
		width: calc(100vw - 1.5rem);
		height: min(28rem, 65vh);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cdac-chat-panel {
		transition: none;
	}
}
