.esc-chat-root {
	--esc-navy: #0b132b;
	--esc-green: #1db87d;
	--esc-green-dark: #179966;
	--esc-font-sans: "Roboto", sans-serif;
	--esc-font-display: "Poppins", sans-serif;
	font-family: var(--esc-font-sans);
	position: relative;
	z-index: 999999;
}

.esc-chat-root *,
.esc-chat-root *::before,
.esc-chat-root *::after,
.esc-chat-bubble,
.esc-chat-bubble * {
	box-sizing: border-box;
}

/* Reset defensivo: neutraliza o "chrome" que temas costumam injetar em
   botoes/inputs/links dentro do widget (cor de fundo/borda/raio/tamanho sao
   tratados em cada componente, com !important). */
.esc-chat-root button,
.esc-chat-root input,
.esc-chat-root textarea,
.esc-chat-root a,
.esc-chat-bubble {
	-webkit-appearance: none !important;
	appearance: none !important;
	background-image: none !important;
	letter-spacing: normal !important;
	min-width: 0 !important;
	text-shadow: none !important;
	text-transform: none !important;
}

.esc-chat-root button::before,
.esc-chat-root button::after,
.esc-chat-bubble::before,
.esc-chat-bubble::after {
	content: none !important;
}

.esc-chat-backdrop {
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	background: rgba(0, 0, 0, 0.6);
	inset: 0;
	opacity: 0;
	pointer-events: none;
	position: fixed;
	transition: opacity 200ms ease;
	z-index: 200;
}

.esc-chat-window {
	background: var(--esc-navy);
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 16px;
	bottom: 16px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
	display: flex;
	flex-direction: column;
	max-height: min(640px, calc(100vh - 48px));
	opacity: 0;
	overflow: hidden;
	pointer-events: none;
	position: fixed;
	right: 16px;
	transform: translateY(40px) scale(0.95);
	transition:
		opacity 300ms cubic-bezier(0.16, 1, 0.3, 1),
		transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
	width: min(420px, calc(100vw - 32px));
	z-index: 201;
}

.esc-chat-root[data-state="open"] .esc-chat-backdrop {
	opacity: 1;
	pointer-events: auto;
}

.esc-chat-root[data-state="open"] .esc-chat-window {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0) scale(1);
}

.esc-chat-header {
	align-items: center;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	display: flex;
	flex-shrink: 0;
	gap: 12px;
	padding: 16px 20px;
}

.esc-chat-avatar {
	align-items: center;
	background: rgba(29, 184, 125, 0.2);
	border-radius: 999px;
	display: flex;
	flex-shrink: 0;
	height: 36px;
	justify-content: center;
	width: 36px;
}

.esc-chat-avatar img {
	display: block;
	height: 20px;
	object-fit: contain;
	width: 20px;
}

.esc-chat-title-wrap {
	flex: 1;
	min-width: 0;
}

.esc-chat-title {
	color: #ffffff;
	font-family: var(--esc-font-display);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.25;
}

.esc-chat-subtitle {
	color: rgba(255, 255, 255, 0.5);
	font-size: 12px;
	line-height: 1.35;
}

.esc-chat-close {
	align-items: center !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: 12px !important;
	color: rgba(255, 255, 255, 0.42) !important;
	cursor: pointer !important;
	display: flex !important;
	flex-shrink: 0 !important;
	height: 34px !important;
	justify-content: center !important;
	line-height: 1 !important;
	margin: 0 !important;
	min-height: 0 !important;
	min-width: 0 !important;
	padding: 0 !important;
	transition: background 200ms ease, color 200ms ease !important;
	width: 34px !important;
}

.esc-chat-close::before,
.esc-chat-close::after {
	content: none !important;
	display: none !important;
}

.esc-chat-close:hover {
	background: rgba(255, 255, 255, 0.1) !important;
	color: #ffffff !important;
}

.esc-chat-close:focus,
.esc-chat-send:focus,
.esc-chat-option:focus,
.esc-chat-input:focus,
.esc-chat-done:focus {
	box-shadow: 0 0 0 3px rgba(29, 184, 125, 0.22);
	outline: 0;
}

.esc-chat-messages {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 12px;
	min-height: 0;
	overflow-y: auto;
	padding: 16px 20px;
	scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.esc-chat-message {
	animation: esc-chat-message-in 250ms ease both;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.6;
	max-width: 85%;
	padding: 10px 16px;
}

.esc-chat-message strong {
	font-weight: 700;
}

.esc-chat-message-bot {
	align-self: flex-start;
	background: rgba(255, 255, 255, 0.08);
	border-bottom-left-radius: 6px;
	color: rgba(255, 255, 255, 0.9);
}

.esc-chat-message-user {
	align-self: flex-end;
	background: var(--esc-green);
	border-bottom-right-radius: 6px;
	color: var(--esc-navy);
	font-weight: 500;
}

.esc-chat-typing {
	align-items: center;
	align-self: flex-start;
	animation: esc-chat-fade-in 180ms ease both;
	background: rgba(255, 255, 255, 0.08);
	border-bottom-left-radius: 6px;
	border-radius: 16px;
	display: flex;
	gap: 4px;
	padding: 12px 16px;
}

.esc-chat-typing span {
	animation: esc-chat-bounce 0.8s infinite;
	background: rgba(255, 255, 255, 0.4);
	border-radius: 999px;
	height: 8px;
	width: 8px;
}

.esc-chat-typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.esc-chat-typing span:nth-child(3) {
	animation-delay: 0.3s;
}

.esc-chat-option-block {
	align-items: flex-start;
	animation: esc-chat-message-in 250ms ease both;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 4px;
}

.esc-chat-option-block-column {
	flex-direction: column;
}

.esc-chat-option-wrap {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.esc-chat-option {
	background: transparent !important;
	border: 1px solid rgba(255, 255, 255, 0.15) !important;
	border-radius: 100px !important;
	color: rgba(255, 255, 255, 0.8) !important;
	cursor: pointer !important;
	font-family: var(--esc-font-sans) !important;
	font-size: 13px !important;
	font-weight: 500 !important;
	line-height: 1.35 !important;
	margin: 0 !important;
	min-height: 0 !important;
	padding: 8px 16px !important;
	text-decoration: none !important;
	transition: all 200ms ease !important;
	white-space: nowrap !important;
	width: auto !important;
}

.esc-chat-option:hover {
	background: rgba(29, 184, 125, 0.1) !important;
	border-color: var(--esc-green) !important;
	color: var(--esc-green) !important;
}

.esc-chat-option.is-selected,
.esc-chat-option.is-confirm {
	background: var(--esc-green) !important;
	border-color: var(--esc-green) !important;
	color: var(--esc-navy) !important;
}

.esc-chat-option.is-confirm {
	font-weight: 600 !important;
	margin-top: 4px !important;
}

.esc-chat-input-area {
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	flex-shrink: 0;
	padding: 14px 16px;
}

.esc-chat-input-area:empty {
	border-top: 0;
	padding: 0;
}

.esc-chat-input-row {
	align-items: center;
	display: flex;
	gap: 10px;
}

.esc-chat-input {
	-webkit-appearance: none !important;
	appearance: none !important;
	background: rgba(255, 255, 255, 0.08) !important;
	border: 1px solid rgba(255, 255, 255, 0.12) !important;
	border-radius: 14px !important;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
	color: #ffffff !important;
	flex: 1 1 auto !important;
	font-family: var(--esc-font-sans) !important;
	font-size: 14px !important;
	height: 48px !important;
	line-height: 48px !important;
	margin: 0 !important;
	min-width: 0 !important;
	outline: 0 !important;
	padding: 0 16px !important;
	transition: border-color 200ms ease !important;
	width: auto !important;
}

.esc-chat-input::placeholder {
	color: rgba(255, 255, 255, 0.3);
}

.esc-chat-input:focus {
	border-color: rgba(29, 184, 125, 0.55) !important;
	box-shadow:
		0 0 0 3px rgba(29, 184, 125, 0.14),
		inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.esc-chat-send {
	align-items: center !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	background: var(--esc-green) !important;
	border: 0 !important;
	border-radius: 14px !important;
	box-shadow: none;
	color: var(--esc-navy) !important;
	cursor: pointer !important;
	display: flex !important;
	flex-shrink: 0 !important;
	height: 48px !important;
	justify-content: center !important;
	line-height: 1 !important;
	margin: 0 !important;
	min-height: 0 !important;
	padding: 0 !important;
	transition: background 200ms ease !important;
	width: 48px !important;
}

.esc-chat-send:hover {
	background: var(--esc-green-dark) !important;
	color: var(--esc-navy) !important;
}

.esc-chat-send svg,
.esc-chat-close svg {
	background: none !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	color: inherit !important;
	display: block !important;
	flex-shrink: 0;
	margin: 0 !important;
	padding: 0 !important;
	pointer-events: none;
	stroke: currentColor !important;
}

.esc-chat-final-actions {
	display: grid;
	gap: 10px;
}

.esc-chat-done,
.esc-chat-whatsapp {
	-webkit-appearance: none !important;
	align-items: center !important;
	appearance: none !important;
	background: var(--esc-green) !important;
	border: 0 !important;
	border-radius: 12px !important;
	box-shadow: none;
	color: var(--esc-navy) !important;
	cursor: pointer !important;
	display: flex !important;
	font-family: var(--esc-font-display) !important;
	font-size: 14px !important;
	font-weight: 700 !important;
	justify-content: center !important;
	line-height: 1.3 !important;
	margin: 0 !important;
	min-height: 0 !important;
	padding: 12px 16px !important;
	text-align: center !important;
	text-decoration: none !important;
	transition: background 200ms ease !important;
	width: 100% !important;
}

.esc-chat-done:hover,
.esc-chat-whatsapp:hover {
	background: var(--esc-green-dark) !important;
	color: var(--esc-navy) !important;
	text-decoration: none !important;
}

.esc-chat-done {
	background: transparent !important;
	border: 1px solid rgba(255, 255, 255, 0.15) !important;
	color: rgba(255, 255, 255, 0.8) !important;
}

.esc-chat-done:hover {
	background: rgba(255, 255, 255, 0.08) !important;
	color: #ffffff !important;
}

/* Bolinha blindada contra CSS de tema (reset + !important nas props criticas). */
.esc-chat-bubble {
	-webkit-appearance: none !important;
	appearance: none !important;
	align-items: center !important;
	background: #1db87d !important;
	border: 0 !important;
	border-radius: 50% !important;
	bottom: 24px !important;
	box-shadow: 0 10px 30px rgba(11, 19, 43, 0.35) !important;
	box-sizing: border-box !important;
	color: #ffffff !important;
	cursor: pointer !important;
	display: flex !important;
	float: none !important;
	height: 60px !important;
	justify-content: center !important;
	left: auto !important;
	letter-spacing: normal !important;
	line-height: 1 !important;
	margin: 0 !important;
	max-width: none !important;
	min-height: 0 !important;
	min-width: 0 !important;
	opacity: 1 !important;
	outline: none !important;
	overflow: visible !important;
	padding: 0 !important;
	position: fixed !important;
	right: 24px !important;
	text-shadow: none !important;
	text-transform: none !important;
	top: auto !important;
	transform: none !important;
	transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease !important;
	visibility: visible !important;
	width: 60px !important;
	z-index: 999998 !important;
}

.esc-chat-bubble::before,
.esc-chat-bubble::after {
	content: none !important;
	display: none !important;
}

.esc-chat-bubble:hover {
	background: #179966 !important;
	box-shadow: 0 14px 34px rgba(11, 19, 43, 0.45) !important;
	transform: translateY(-2px) scale(1.05) !important;
}

.esc-chat-bubble:focus-visible {
	outline: 3px solid rgba(29, 184, 125, 0.6) !important;
	outline-offset: 3px !important;
}

.esc-chat-bubble svg {
	background: none !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	display: block !important;
	height: 28px !important;
	margin: 0 !important;
	max-width: none !important;
	padding: 0 !important;
	vertical-align: middle !important;
	width: 28px !important;
}

.esc-chat-bubble svg path {
	fill: none !important;
	stroke: currentColor !important;
}

.esc-chat-is-open .esc-chat-bubble {
	display: none !important;
}

@keyframes esc-chat-message-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes esc-chat-fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes esc-chat-bounce {
	0%,
	100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-4px);
	}
}

@media (max-width: 767px) {
	.esc-chat-window {
		bottom: 16px;
		right: 16px;
		width: calc(100vw - 32px);
	}
}

@media (max-width: 520px) {
	.esc-chat-option {
		white-space: normal;
	}
}

@media (prefers-reduced-motion: reduce) {
	.esc-chat-root *,
	.esc-chat-root *::before,
	.esc-chat-root *::after,
	.esc-chat-bubble,
	.esc-chat-bubble * {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}
