:root {
	--espe-primary: #004b23;
	--espe-primary-dark: #003318;
	--espe-primary-light: #006830;
	--espe-accent: #ffffff;
	--espe-text: #1a1a1a;
	--espe-text-light: #666666;
	--espe-bg: #ffffff;
	--espe-bubble-bot: #f0f4f0;
	--espe-bubble-user: #004b23;
	--espe-shadow: 0 8px 32px rgba(0, 75, 35, 0.18);
	--espe-radius: 16px;
	--espe-font: "Segoe UI", system-ui, sans-serif;
}

#espe-chat-trigger {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 99999;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	border: 0;
	border-radius: 50%;
	background: var(--espe-primary);
	box-shadow: var(--espe-shadow);
	color: var(--espe-accent);
	cursor: pointer;
	transition: transform 150ms ease, background-color 150ms ease;
}

#espe-chat-trigger svg {
	width: 28px;
	height: 28px;
	fill: currentcolor;
}

#espe-chat-trigger:hover {
	background: var(--espe-primary-dark);
	transform: scale(1.08);
}

#espe-chat-trigger:active {
	transform: scale(0.95);
}

#espe-chat-window {
	position: fixed;
	right: 24px;
	bottom: 96px;
	z-index: 99999;
	display: none;
	flex-direction: column;
	width: 370px;
	height: 520px;
	border-radius: var(--espe-radius);
	overflow: hidden;
	background: var(--espe-bg);
	box-shadow: var(--espe-shadow);
	font-family: var(--espe-font);
	color: var(--espe-text);
	transform: translateY(16px);
	opacity: 0;
}

#espe-chat-window.espe-open {
	display: flex;
	animation: espe-chat-window-in 250ms ease-out forwards;
}

@keyframes espe-chat-window-in {
	from {
		opacity: 0;
		transform: translateY(16px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

#espe-chat-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 20px;
	background: var(--espe-primary);
	color: var(--espe-accent);
}

.espe-chat-avatar {
	flex: 0 0 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--espe-accent);
	color: var(--espe-primary);
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
}

.espe-chat-header-text {
	min-width: 0;
}

.espe-chat-header-title {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
}

.espe-chat-header-subtitle {
	margin-top: 2px;
	font-size: 12px;
	line-height: 1.2;
	opacity: 0.8;
}

#espe-chat-close {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border: 0;
	background: transparent;
	color: var(--espe-accent);
	cursor: pointer;
	opacity: 1;
	transition: opacity 150ms ease;
}

#espe-chat-close:hover {
	opacity: 0.7;
}

#espe-chat-messages {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 16px;
	overflow-y: auto;
}

#espe-chat-messages::-webkit-scrollbar {
	width: 4px;
}

#espe-chat-messages::-webkit-scrollbar-track {
	background: transparent;
}

#espe-chat-messages::-webkit-scrollbar-thumb {
	border-radius: 999px;
	background: var(--espe-primary-light);
}

#espe-chat-messages {
	scrollbar-color: var(--espe-primary-light) transparent;
	scrollbar-width: thin;
}

.espe-message {
	max-width: 80%;
	padding: 10px 14px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.5;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.espe-message p {
	margin: 0;
}

.espe-message p + p {
	margin-top: 8px;
}

.espe-message strong {
	font-weight: 700;
}

.espe-message-list {
	margin: 6px 0 0;
	padding-left: 20px;
}

.espe-message-list li + li {
	margin-top: 4px;
}

.espe-message-break {
	height: 8px;
}

.espe-message--bot {
	align-self: flex-start;
	background: var(--espe-bubble-bot);
	color: var(--espe-text);
	border-bottom-left-radius: 4px;
}

.espe-message--user {
	align-self: flex-end;
	background: var(--espe-bubble-user);
	color: var(--espe-accent);
	border-bottom-right-radius: 4px;
}

.espe-typing {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	max-width: 80%;
	padding: 10px 14px;
	border-radius: 12px;
	border-bottom-left-radius: 4px;
	background: var(--espe-bubble-bot);
	color: var(--espe-text);
}

.espe-typing-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: currentcolor;
	opacity: 0.3;
	animation: espe-typing-dot 1s infinite ease-in-out;
}

.espe-typing-dot:nth-child(2) {
	animation-delay: 0.2s;
}

.espe-typing-dot:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes espe-typing-dot {
	0%,
	100% {
		opacity: 0.3;
	}
	50% {
		opacity: 1;
	}
}

#espe-chat-footer {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	border-top: 1px solid #e8f0e8;
}

#espe-chat-input {
	flex: 1;
	max-height: 100px;
	padding: 10px 16px;
	border: 1px solid #d0ddd0;
	border-radius: 20px;
	font-family: var(--espe-font);
	font-size: 14px;
	line-height: 1.4;
	color: var(--espe-text);
	resize: none;
	overflow-y: auto;
	background: var(--espe-bg);
}

#espe-chat-input:focus {
	outline: none;
	border-color: var(--espe-primary);
	box-shadow: 0 0 0 3px rgba(0, 75, 35, 0.12);
}

#espe-chat-send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: var(--espe-primary);
	color: var(--espe-accent);
	cursor: pointer;
	transition: background-color 150ms ease, transform 150ms ease, opacity 150ms ease;
}

#espe-chat-send svg {
	width: 18px;
	height: 18px;
	fill: currentcolor;
}

#espe-chat-send:hover:not(:disabled) {
	background: var(--espe-primary-dark);
}

#espe-chat-send:active:not(:disabled) {
	transform: scale(0.96);
}

#espe-chat-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.espe-status {
	padding: 4px 0;
	font-size: 12px;
	color: var(--espe-text-light);
	text-align: center;
}

@media (max-width: 480px) {
	#espe-chat-window {
		right: 0;
		bottom: 0;
		width: 100vw;
		height: 100dvh;
		border-radius: 0;
	}

	#espe-chat-trigger {
		right: 16px;
		bottom: 16px;
	}
}
