#esc-chat-root {
	--esc-accent: #2563eb;
	--esc-accent-dark: #1d4ed8;
	--esc-bg: #ffffff;
	--esc-bubble-user: #2563eb;
	--esc-bubble-bot: #f1f3f5;
	--esc-text: #1a1a1a;
	--esc-text-muted: #6b7280;
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.esc-launcher {
	position: relative;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--esc-accent);
	color: #fff;
	border: none;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease;
}
.esc-launcher:hover {
	transform: scale(1.06);
}
.esc-launcher svg {
	width: 26px;
	height: 26px;
}
.esc-launcher-badge {
	position: absolute;
	top: -3px;
	right: -3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #e53e3e;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	align-items: center;
	justify-content: center;
	border: 2px solid #fff;
}

/* Burbuja de bienvenida automática */
.esc-teaser {
	position: absolute;
	bottom: 76px;
	right: 0;
	width: 280px;
	max-width: calc(100vw - 40px);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
	padding: 20px 18px 18px;
	opacity: 0;
	transform: translateY(10px) scale(0.97);
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}
.esc-teaser-visible {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}
.esc-teaser-close {
	position: absolute;
	top: 10px;
	right: 12px;
	background: transparent;
	border: none;
	color: #aaa;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}
.esc-teaser-close:hover {
	color: #666;
}
.esc-teaser-avatar {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: #e9ecef;
	color: #adb5bd;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	margin-bottom: 12px;
}
.esc-teaser-avatar svg {
	width: 26px;
	height: 26px;
}
.esc-teaser-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.esc-teaser-text {
	margin: 0 0 16px;
	font-size: 13.5px;
	line-height: 1.5;
	color: #333;
}
.esc-teaser-cta {
	width: 100%;
	background: var(--esc-accent);
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 10px 16px;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: filter 0.15s ease;
}
.esc-teaser-cta:hover {
	filter: brightness(0.93);
}

.esc-panel {
	position: absolute;
	bottom: 76px;
	right: 0;
	width: 360px;
	max-width: calc(100vw - 40px);
	height: 520px;
	max-height: calc(100vh - 120px);
	background: var(--esc-bg);
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	pointer-events: none;
	transition: opacity 0.15s ease, transform 0.15s ease;
}
.esc-panel.esc-open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.esc-header {
	background: var(--esc-accent);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.esc-header h3 {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
}
.esc-header button {
	background: transparent;
	border: none;
	color: #fff;
	opacity: 0.85;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
}
.esc-header button:hover {
	opacity: 1;
}
.esc-header-actions {
	display: flex;
	align-items: center;
	gap: 10px;
}
.esc-restart {
	font-size: 16px !important;
}

.esc-privacy-notice {
	background: #fff8e6;
	color: #7a5c00;
	font-size: 11px;
	line-height: 1.4;
	padding: 6px 12px;
	border-bottom: 1px solid #f0e2b0;
	text-align: center;
}
.esc-privacy-notice-form {
	background: #fff8e6;
	color: #7a5c00;
	border: 1px solid #f0e2b0;
	border-radius: 8px;
	padding: 6px 10px;
	margin: 0;
}

.esc-live-bar {
	display: none;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 7px 12px;
	background: #eef4ff;
	border-bottom: 1px solid #d7e6ff;
	font-size: 11.5px;
	color: #1d4ed8;
}
.esc-end-live {
	background: transparent;
	border: 1px solid #c7d9ff;
	color: #1d4ed8;
	border-radius: 999px;
	padding: 4px 10px;
	font-size: 11px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}
.esc-end-live:hover {
	background: #dce8ff;
}

.esc-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafafa;
}

.esc-msg {
	max-width: 82%;
	padding: 9px 13px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-wrap: break-word;
}
.esc-msg-user {
	align-self: flex-end;
	background: var(--esc-bubble-user);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.esc-msg-assistant {
	align-self: flex-start;
	background: var(--esc-bubble-bot);
	color: var(--esc-text);
	border-bottom-left-radius: 4px;
}
.esc-msg-system {
	align-self: center;
	background: transparent;
	color: var(--esc-text-muted);
	font-size: 12px;
	text-align: center;
}

.esc-msg-link {
	color: inherit;
	text-decoration: underline;
	word-break: break-all;
}
.esc-msg-assistant .esc-msg-link {
	color: var(--esc-accent);
}

.esc-typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 10px 13px;
}
.esc-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #b0b3b8;
	animation: esc-bounce 1.2s infinite ease-in-out;
}
.esc-typing span:nth-child(2) { animation-delay: 0.15s; }
.esc-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes esc-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
	30% { transform: translateY(-4px); opacity: 1; }
}

.esc-mode-select {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 4px 0 10px;
}
.esc-mode-intro {
	font-size: 13px;
	color: var(--esc-text-muted);
	margin: 4px 0 2px;
	text-align: center;
}
.esc-mode-btn {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	background: #fff;
	border: 1.5px solid #e5e7eb;
	border-radius: 12px;
	padding: 12px 14px;
	cursor: pointer;
	text-align: left;
	font-size: 14px;
	transition: border-color 0.15s ease, background 0.15s ease;
}
.esc-mode-btn:hover {
	border-color: var(--esc-accent);
	background: #f8faff;
}
.esc-mode-btn span {
	font-weight: 600;
	color: var(--esc-text);
}
.esc-mode-btn small {
	color: var(--esc-text-muted);
	font-size: 11.5px;
}

.esc-cat-btn {
	background: #fff;
	border: 1.5px solid #e5e7eb;
	border-radius: 10px;
	padding: 9px 12px;
	cursor: pointer;
	text-align: left;
	font-size: 13px;
	color: var(--esc-text);
	transition: border-color 0.15s ease, background 0.15s ease;
}
.esc-cat-btn:hover {
	border-color: var(--esc-accent);
	background: #f8faff;
}
.esc-cat-skip {
	color: var(--esc-text-muted);
	font-style: italic;
}

.esc-ticket-cta {
	align-self: flex-start;
	background: #fff;
	border: 1px solid var(--esc-accent);
	color: var(--esc-accent);
	border-radius: 10px;
	padding: 8px 12px;
	font-size: 12.5px;
	cursor: pointer;
}
.esc-ticket-cta:hover {
	background: var(--esc-accent);
	color: #fff;
}

.esc-input-row {
	display: flex;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid #eee;
	background: #fff;
}
.esc-input-row textarea {
	flex: 1;
	resize: none;
	border: 1px solid #ddd;
	border-radius: 10px;
	padding: 8px 10px;
	font-size: 13.5px;
	font-family: inherit;
	max-height: 80px;
}
.esc-input-row textarea:focus {
	outline: 2px solid var(--esc-accent);
	outline-offset: 1px;
}
.esc-send-btn {
	background: var(--esc-accent);
	color: #fff;
	border: none;
	border-radius: 10px;
	width: 40px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.esc-send-btn:hover {
	background: var(--esc-accent-dark);
}
.esc-send-btn:disabled {
	opacity: 0.5;
	cursor: default;
}

.esc-footer {
	text-align: center;
	font-size: 10.5px;
	color: #aaa;
	padding: 6px 0 10px;
	background: #fff;
}
.esc-footer a {
	color: #aaa;
	text-decoration: underline;
}
.esc-footer a:hover {
	color: #888;
}

/* Formulario de ticket */
.esc-ticket-form {
	padding: 14px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fff;
}
.esc-ticket-form h4 {
	margin: 0 0 4px;
	font-size: 14px;
}
.esc-ticket-form label {
	font-size: 12px;
	color: var(--esc-text-muted);
	display: block;
	margin-bottom: 3px;
}
.esc-ticket-form input,
.esc-ticket-form select,
.esc-ticket-form textarea {
	width: 100%;
	box-sizing: border-box;
	border: 1px solid #ddd;
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 13px;
	font-family: inherit;
}
.esc-ticket-form textarea {
	min-height: 70px;
	resize: vertical;
}
.esc-ticket-actions {
	display: flex;
	gap: 8px;
	margin-top: 4px;
}
.esc-ticket-actions button {
	flex: 1;
	padding: 9px;
	border-radius: 8px;
	border: none;
	cursor: pointer;
	font-size: 13px;
}
.esc-ticket-submit {
	background: var(--esc-accent);
	color: #fff;
}
.esc-ticket-cancel {
	background: #f1f3f5;
	color: var(--esc-text);
}
.esc-form-error {
	color: #c0392b;
	font-size: 12px;
}

@media (max-width: 420px) {
	.esc-panel {
		width: calc(100vw - 24px);
		right: -8px;
	}
}
