.ai-cs-widget {
	--ai-cs-bottom: 72px;
	position: fixed;
	right: 16px;
	bottom: var(--ai-cs-bottom);
	z-index: 10050;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	max-height: calc(100vh - var(--ai-cs-bottom) - 12px);
	max-height: calc(100dvh - var(--ai-cs-bottom) - 12px);
	font-size: 0.9375rem;
	line-height: 1.5;
}

.ai-cs-launcher {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	margin-left: auto;
	border: 0;
	border-radius: 50%;
	background: var(--mainC, #2678b9);
	color: var(--wordW, #fff);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-cs-launcher:hover,
.ai-cs-launcher:focus-visible {
	transform: translateY(-1px);
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
	color: var(--wordW, #fff);
}

.ai-cs-launcher i {
	font-size: 1.35rem;
}

.ai-cs-launcher-close {
	display: none;
}

.ai-cs-widget.is-open .ai-cs-launcher-open {
	display: none;
}

.ai-cs-widget.is-open .ai-cs-launcher-close {
	display: inline-flex;
}

.ai-cs-panel {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	width: min(360px, calc(100vw - 32px));
	min-height: 0;
	height: min(520px, calc(100vh - var(--ai-cs-bottom) - 84px));
	height: min(520px, calc(100dvh - var(--ai-cs-bottom) - 84px));
	margin: 0 0 12px auto;
	overflow: hidden;
	border-radius: 16px;
	background: var(--bs-body-bg, #fff);
	color: var(--bs-body-color, #171717);
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
	border: 1px solid rgba(0, 0, 0, 0.06);
}

.ai-cs-panel[hidden] {
	display: none !important;
}

.ai-cs-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.85rem 1rem;
	background: var(--mainC, #2678b9);
	color: var(--wordW, #fff);
}

.ai-cs-title {
	font-size: 1rem;
}

.ai-cs-header-actions {
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.ai-cs-clear,
.ai-cs-close {
	border: 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.ai-cs-clear {
	padding: 0.2rem 0.45rem;
	border: 1px solid rgba(255, 255, 255, 0.45);
	border-radius: 999px;
	font-size: 0.75rem;
}

.ai-cs-close {
	width: 32px;
	height: 32px;
	border-radius: 50%;
}

.ai-cs-clear:hover,
.ai-cs-close:hover,
.ai-cs-clear:focus-visible,
.ai-cs-close:focus-visible {
	background: rgba(255, 255, 255, 0.14);
}

.ai-cs-messages {
	flex: 1;
	overflow-y: auto;
	padding: 1rem;
	background: var(--bs-gray-100, #f8f9fa);
}

.ai-cs-msg {
	display: flex;
	margin-bottom: 0.75rem;
}

.ai-cs-msg-user {
	justify-content: flex-end;
}

.ai-cs-bubble {
	max-width: 88%;
	padding: 0.65rem 0.85rem;
	border-radius: 14px;
	white-space: pre-wrap;
	word-break: break-word;
}

.ai-cs-msg-bot .ai-cs-bubble {
	background: var(--wordW, #fff);
	color: var(--bs-body-color, #171717);
	border-top-left-radius: 4px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ai-cs-msg-user .ai-cs-bubble {
	background: var(--mainC, #2678b9);
	color: var(--wordW, #fff);
	border-top-right-radius: 4px;
}

.ai-cs-msg.is-error .ai-cs-bubble {
	background: #fff3f3;
	color: #8a1f1f;
}

.ai-cs-composer {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.5rem;
	padding: 0.75rem;
	background: var(--wordW, #fff);
	border-top: 1px solid var(--bs-border-color, #dee2e6);
}

.ai-cs-composer textarea {
	width: 100%;
	min-height: 44px;
	max-height: 120px;
	resize: none;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--bs-border-color, #dee2e6);
	border-radius: 10px;
	background: var(--bs-body-bg, #fff);
	color: inherit;
}

.ai-cs-composer textarea:focus {
	outline: 0;
	border-color: var(--mainC, #2678b9);
	box-shadow: 0 0 0 0.15rem rgba(var(--mainC-rgb, 38, 120, 185), 0.18);
}

.ai-cs-send {
	align-self: end;
	min-width: 72px;
	height: 44px;
	padding: 0 0.9rem;
	border: 0;
	border-radius: 10px;
	background: var(--mainC, #2678b9);
	color: var(--wordW, #fff);
	cursor: pointer;
}

.ai-cs-send:hover,
.ai-cs-send:focus-visible {
	filter: brightness(1.05);
}

.ai-cs-send:disabled,
.ai-cs-composer textarea:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

.ai-cs-status {
	padding: 0 0.75rem 0.7rem;
	color: var(--bs-secondary-color, #6c757d);
	font-size: 0.8125rem;
	background: var(--wordW, #fff);
}

.ai-cs-typing .ai-cs-bubble {
	display: inline-flex;
	gap: 0.3rem;
	align-items: center;
	min-height: 2.4rem;
}

.ai-cs-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
	opacity: 0.35;
	animation: ai-cs-dot 1s infinite ease-in-out;
}

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

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

@keyframes ai-cs-dot {
	0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-2px); }
}

body.ai-cs-open #goTop {
	visibility: hidden;
	pointer-events: none;
}

@media (max-width: 575.98px) {
	.ai-cs-widget {
		right: 12px;
		left: 12px;
	}

	.ai-cs-panel {
		width: 100%;
		height: min(70vh, calc(100vh - var(--ai-cs-bottom) - 84px));
		height: min(70dvh, calc(100dvh - var(--ai-cs-bottom) - 84px));
	}
}
