/* Asistente — colores de Abogado Comercial (paleta oficial, regla 20) */
.aca-root {
	--aca-navy: #0F2A4A;
	--aca-terra: #D9A441;
	--aca-terra-dark: #C4902F;
	--aca-ivory: #F8F9FC;
	--aca-cream: #FBF6EA;
	--aca-line: #E2E8F0;
	--aca-text: #5B6576;
	--aca-green: #128C4A;
	--aca-bottom: 24px;
	position: fixed;
	z-index: 99990;
	bottom: calc(var(--aca-bottom) + env(safe-area-inset-bottom, 0px));
	right: 20px;
	font-family: "Plus Jakarta Sans", "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.45;
	color: var(--aca-navy);
}
.aca-root[data-side="left"] { right: auto; left: 20px; }
.aca-root *, .aca-root *::before, .aca-root *::after { box-sizing: border-box; }

/* Botón flotante */
.aca-launcher {
	display: inline-flex; align-items: center; gap: 8px;
	min-height: 52px; padding: 0 20px 0 16px;
	border: 0; border-radius: 999px; cursor: pointer;
	background: var(--aca-navy); color: #fff;
	font: 700 16px/1 "Plus Jakarta Sans", Arial, sans-serif;
	box-shadow: 0 6px 20px rgba(15, 42, 74, .28);
	transition: transform .15s ease, box-shadow .15s ease, background .15s ease, filter .15s ease;
}
.aca-launcher:hover { transform: scale(1.03); filter: brightness(.93); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .25), 0 6px 18px rgba(15, 42, 74, .25); }
.aca-launcher:active { transform: scale(1); box-shadow: inset 0 3px 8px rgba(0, 0, 0, .32); }
.aca-launcher svg { color: #D9A441; }
.aca-launcher:focus-visible, .aca-root button:focus-visible, .aca-root a:focus-visible, .aca-input:focus-visible, .aca-log:focus-visible {
	outline: 3px solid var(--aca-terra); outline-offset: 2px;
}

/* Panel */
.aca-panel {
	position: absolute; bottom: 64px; right: 0;
	width: 384px; max-width: calc(100vw - 32px);
	height: min(640px, calc(100vh - var(--aca-bottom) - 96px));
	height: min(640px, calc(100dvh - var(--aca-bottom) - 96px));
	display: flex; flex-direction: column;
	background: var(--aca-ivory);
	border: 1px solid var(--aca-line); border-radius: 18px;
	box-shadow: 0 18px 50px rgba(15, 42, 74, .25);
	overflow: hidden;
}
.aca-panel[hidden] { display: none; }
.aca-root[data-side="left"] .aca-panel { right: auto; left: 0; }

.aca-head {
	display: flex; align-items: center; gap: 10px;
	padding: 12px 10px 12px 14px;
	background: var(--aca-navy); color: #fff;
}
.aca-avatar {
	flex: 0 0 40px; height: 40px; border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--aca-terra); color: #fff;
}
.aca-head__text { flex: 1; min-width: 0; }
.aca-title { margin: 0; font: 600 19px/1.1 "Plus Jakarta Sans", Arial, sans-serif; color: #fff; }
.aca-subtitle { margin: 2px 0 0; font-size: 13px; color: #D7DBE4; }
.aca-restart, .aca-close {
	min-height: 44px; border: 0; background: transparent; color: #fff; cursor: pointer; border-radius: 10px;
}
.aca-restart { padding: 0 8px; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; color: #D7DBE4; }
.aca-close { width: 44px; display: inline-flex; align-items: center; justify-content: center; }
.aca-restart:hover, .aca-close:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.aca-notice {
	margin: 0; padding: 8px 14px;
	font-size: 12.5px; line-height: 1.4; color: var(--aca-text);
	background: var(--aca-cream); border-bottom: 1px solid var(--aca-line);
}
.aca-notice a { color: var(--aca-terra-dark); }
.aca-testbadge { color: var(--aca-terra-dark); }

.aca-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.aca-msg { max-width: 88%; border-radius: 16px; padding: 10px 13px; font-size: 15px; word-wrap: break-word; }
.aca-msg--bot { align-self: flex-start; background: #fff; border: 1px solid var(--aca-line); border-bottom-left-radius: 6px; color: #1f2a40; }
.aca-msg--user { align-self: flex-end; background: var(--aca-navy); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.aca-msg__body p { margin: 0 0 6px; }
.aca-msg__body p:last-child { margin-bottom: 0; }
.aca-msg__body ul { margin: 4px 0 6px; padding-left: 18px; }
.aca-msg__body li { margin: 2px 0; }
.aca-msg__body a { color: var(--aca-terra-dark); text-decoration: underline; word-break: break-word; }
.aca-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.aca-sugg { display: flex; flex-wrap: wrap; gap: 8px; }
.aca-sugg__btn {
	min-height: 44px; padding: 8px 14px; border-radius: 999px; cursor: pointer;
	background: #fff; color: var(--aca-navy); border: 1px solid var(--aca-navy);
	font-size: 14px; text-align: left;
}
.aca-sugg__btn:hover { background: var(--aca-navy); color: #fff; }

.aca-typing { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--aca-text); }
.aca-dots { display: inline-flex; gap: 4px; }
.aca-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--aca-terra); animation: aca-bounce 1s infinite ease-in-out; }
.aca-dots i:nth-child(2) { animation-delay: .15s; }
.aca-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes aca-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

.aca-chips { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--aca-line); background: #fff; }
.aca-chip {
	flex: 1; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; text-align: center;
	padding: 6px 8px; border-radius: 12px; font-size: 13px; font-weight: 600; line-height: 1.15; text-decoration: none !important;
	transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}
.aca-chip:hover { transform: scale(1.03); filter: brightness(.93); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .22); }
.aca-chip:active { transform: scale(1); box-shadow: inset 0 3px 8px rgba(0, 0, 0, .3); }
.aca-chip--wa { background: var(--aca-green); color: #fff !important; }
.aca-chip--book { background: #fff; color: var(--aca-navy) !important; border: 1.5px solid var(--aca-navy); }
.aca-chip--req { background: var(--aca-terra); color: #fff !important; }
.aca-pulse .aca-chip { animation: aca-pulse 1.2s ease 2; }
@keyframes aca-pulse { 0%, 100% { transform: none; } 50% { transform: scale(1.05); } }

.aca-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px; background: #fff; border-top: 1px solid var(--aca-line); padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
.aca-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.aca-input {
	flex: 1; resize: none; min-height: 44px; max-height: 120px;
	overflow-y: hidden; scrollbar-width: thin; scrollbar-color: var(--aca-line) transparent; /* 0.1.17 (mejora #20): sin barra hasta 3 líneas; después, fina. */
	padding: 11px 12px; border: 1.5px solid var(--aca-line); border-radius: 12px;
	font: 16px/1.35 Figtree, "Helvetica Neue", Arial, sans-serif; color: #1f2a40; background: var(--aca-ivory);
}
.aca-input:focus { border-color: var(--aca-navy); outline: none; }
.aca-send {
	flex: 0 0 48px; height: 48px; border: 0; border-radius: 12px; cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--aca-terra); color: #fff;
}
.aca-send:hover { background: var(--aca-terra-dark); transform: scale(1.03); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .22); }
.aca-send:disabled { opacity: .5; cursor: default; }

/* Teléfono: el chat ocupa toda la pantalla */
@media (max-width: 600px) {
	.aca-root { right: 14px; }
	.aca-root[data-side="left"] { left: 14px; }
	.aca-launcher { min-height: 48px; padding: 0 16px 0 13px; font-size: 16px; }
	.aca-root.is-open { inset: 0; bottom: 0; right: 0; left: 0; }
	.aca-root.is-open .aca-launcher { display: none; }
	.aca-panel {
		position: fixed; inset: 0; width: 100%; max-width: none;
		height: 100vh; height: 100dvh; border-radius: 0; border: 0;
	}
	.aca-restart { font-size: 12px; }
}
html.aca-open, html.aca-open body { overflow: hidden; }
@media (min-width: 601px) { html.aca-open, html.aca-open body { overflow: visible; } }

@media (prefers-reduced-motion: reduce) {
	.aca-launcher, .aca-chip, .aca-dots i, .aca-pulse .aca-chip { transition: none !important; animation: none !important; }
}
@media print { .aca-root { display: none !important; } }

/* En el mundo Consultoría el asistente se viste de morado */
.ac-mundo-consultoria .aca-root { --aca-navy: #3A2366; }
/* Regla 20: sobre el dorado, letra azul (nunca blanca) */
.aca-chip--req, .aca-send { color: var(--aca-navy) !important; box-shadow: inset 0 0 0 2px var(--aca-navy); }
.aca-avatar { color: var(--aca-navy); }

/* Enlaces con texto humano (0.1.3) */
.aca-msg__body a.aca-link { color: #0F2A4A; font-weight: 600; text-decoration: underline; text-decoration-color: #D9A441; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.aca-msg__body a.aca-link:hover { color: #1E4A7A; }

/* 0.1.5: borde blanco para que Dili resalte sobre fondos oscuros (pie de página navy o morado) */
.aca-launcher { border: 2px solid #FFFFFF !important; box-shadow: 0 0 0 1px rgba(15, 42, 74, .35), 0 6px 18px rgba(15, 42, 74, .28); }

/* 0.1.6: en teléfono y tableta Dili es una burbuja redonda pequeña, para no tapar los botones de la página */
@media (max-width: 1023px) {
	.aca-launcher { width: 52px; height: 52px; min-height: 52px; padding: 0; justify-content: center; border-radius: 50%; }
	.aca-launcher .aca-launcher__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* 0.1.12: tickets. Cuando Dili pasa a una persona, el botón dorado deja la consulta al equipo con número de seguimiento. */
.aca-ticket {
	align-self: flex-start; display: inline-flex; align-items: center; justify-content: center; min-height: 46px;
	padding: 10px 20px; border-radius: 999px; border: 1px solid #F2D28A; cursor: pointer;
	background: var(--aca-terra) !important; color: var(--aca-navy) !important; font: 700 15px/1.25 Figtree, "Helvetica Neue", Arial, sans-serif;
	box-shadow: 0 4px 14px rgba(217, 164, 65, .35); transition: transform .15s ease, box-shadow .15s ease;
}
.aca-ticket:hover { background: var(--aca-terra-dark) !important; transform: translateY(-1px); }
.aca-ticket:active { transform: translateY(1px); box-shadow: inset 0 3px 8px rgba(0, 0, 0, .2); }
.aca-ticket:focus-visible, .aca-chip--tk:focus-visible { outline: 3px solid var(--aca-terra); outline-offset: 2px; }
.aca-chip--tk { background: var(--aca-navy) !important; color: #fff !important; border: 0 !important; cursor: pointer; font-family: inherit; }
@media (prefers-reduced-motion: reduce) { .aca-ticket { transition: none !important; } }

/* 0.1.17 (mejora #20): barra fina en la caja de la pregunta (Chrome y Safari), solo desde la cuarta línea. */
.aca-input::-webkit-scrollbar { width: 6px; }
.aca-input::-webkit-scrollbar-thumb { background: var(--aca-line); border-radius: 999px; }
.aca-input::-webkit-scrollbar-track { background: transparent; }

/* 0.1.18 (mejora #26): "Ver todas las preguntas frecuentes" debajo de las sugerencias del saludo. */
.aca-sugg__todas {
	display: inline-flex; align-items: center; min-height: 44px; padding: 8px 4px;
	font-size: 15px; font-weight: 700; color: var(--aca-navy) !important; text-decoration: underline; text-underline-offset: 3px;
}
.aca-sugg__todas:hover { text-decoration-thickness: 2px; }
