:root {
	--aikc-primary: #0f766e;
	--aikc-primary-soft: color-mix(in srgb, var(--aikc-primary) 14%, transparent);
	--aikc-header: var(--aikc-primary);
	--aikc-user-bubble: var(--aikc-primary);
	--aikc-bot-bubble: #ffffff;
	--aikc-bg: #ffffff;
	--aikc-messages-bg: #f4f6f8;
	--aikc-text: #15202b;
	--aikc-muted: #667085;
	--aikc-border: #e6eaf0;
	--aikc-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
	--aikc-radius: 18px;
	--aikc-font: 14.5px;
	--aikc-panel-w: 400px;
	--aikc-panel-h: 600px;
	--aikc-offset-x: 20px;
	--aikc-offset-y: 20px;
	--aikc-launcher: 58px;
	--aikc-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.aikc-root,
.aikc-inline-root {
	font-family: "Segoe UI Variable", "Segoe UI", "Helvetica Neue", ui-sans-serif, sans-serif;
	font-size: var(--aikc-font);
	z-index: 99999;
	color: var(--aikc-text);
	-webkit-font-smoothing: antialiased;
	line-height: 1.45;
}

.aikc-root[data-theme="dark"] {
	--aikc-bg: #0f172a;
	--aikc-messages-bg: #0b1220;
	--aikc-bot-bubble: #1e293b;
	--aikc-text: #f1f5f9;
	--aikc-muted: #94a3b8;
	--aikc-border: #334155;
	--aikc-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
	--aikc-primary-soft: color-mix(in srgb, var(--aikc-primary) 22%, transparent);
}

.aikc-launcher {
	position: fixed;
	bottom: var(--aikc-offset-y);
	right: var(--aikc-offset-x);
	width: var(--aikc-launcher);
	height: var(--aikc-launcher);
	border-radius: 50%;
	border: none;
	background: var(--aikc-primary);
	color: #fff;
	box-shadow: 0 10px 28px color-mix(in srgb, var(--aikc-primary) 45%, transparent);
	cursor: pointer;
	font-size: calc(var(--aikc-launcher) * 0.38);
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 0;
	z-index: 100000;
	transition: transform 0.2s var(--aikc-ease), box-shadow 0.2s ease;
}

.aikc-launcher:hover {
	transform: translateY(-2px) scale(1.03);
}

.aikc-launcher:focus-visible {
	outline: 2px solid var(--aikc-primary);
	outline-offset: 3px;
}

.aikc-root[data-launcher-size="sm"] { --aikc-launcher: 50px; }
.aikc-root[data-launcher-size="md"] { --aikc-launcher: 58px; }
.aikc-root[data-launcher-size="lg"] { --aikc-launcher: 66px; }

.aikc-root[data-launcher-shape="rounded"] .aikc-launcher {
	border-radius: 18px;
}

.aikc-root[data-launcher-shape="pill"] .aikc-launcher,
.aikc-launcher--labeled {
	width: auto;
	min-width: var(--aikc-launcher);
	height: var(--aikc-launcher);
	border-radius: 999px;
	padding: 0 18px;
	font-size: 14px;
	font-weight: 600;
}

.aikc-launcher__label {
	white-space: nowrap;
}

.aikc-root[data-position="bottom-left"] .aikc-launcher,
.aikc-root[data-position="bottom-left"] .aikc-panel {
	right: auto;
	left: var(--aikc-offset-x);
}

.aikc-root[data-position="top-right"] .aikc-launcher {
	top: var(--aikc-offset-y);
	bottom: auto;
}
.aikc-root[data-position="top-right"] .aikc-panel {
	top: calc(var(--aikc-launcher) + var(--aikc-offset-y) + 12px);
	bottom: auto;
	right: var(--aikc-offset-x);
}

.aikc-root[data-position="top-left"] .aikc-launcher {
	top: var(--aikc-offset-y);
	bottom: auto;
	right: auto;
	left: var(--aikc-offset-x);
}
.aikc-root[data-position="top-left"] .aikc-panel {
	top: calc(var(--aikc-launcher) + var(--aikc-offset-y) + 12px);
	bottom: auto;
	right: auto;
	left: var(--aikc-offset-x);
}

.aikc-panel {
	position: fixed;
	bottom: calc(var(--aikc-launcher) + var(--aikc-offset-y) + 12px);
	right: var(--aikc-offset-x);
	width: min(var(--aikc-panel-w), calc(100vw - 24px));
	height: min(var(--aikc-panel-h), calc(100vh - 120px));
	max-height: calc(100dvh - 100px);
	background: var(--aikc-bg);
	border: 1px solid var(--aikc-border);
	border-radius: var(--aikc-radius);
	box-shadow: var(--aikc-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 100000;
	transform-origin: bottom right;
	animation: aikc-panel-in 0.28s var(--aikc-ease);
}

.aikc-root[data-position="bottom-left"] .aikc-panel {
	transform-origin: bottom left;
}

.aikc-panel[hidden] {
	display: none !important;
	animation: none;
}

@keyframes aikc-panel-in {
	from {
		opacity: 0;
		transform: translateY(10px) scale(0.97);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.aikc-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	background: linear-gradient(135deg, var(--aikc-header), color-mix(in srgb, var(--aikc-header) 78%, #0f172a));
	color: #fff;
	flex-shrink: 0;
}

.aikc-header__avatar,
.aikc-header img {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	background: rgba(255, 255, 255, 0.2);
	flex-shrink: 0;
	border: 2px solid rgba(255, 255, 255, 0.35);
}

.aikc-header__avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 15px;
}

.aikc-header__meta {
	flex: 1;
	min-width: 0;
}

.aikc-header h2 {
	margin: 0;
	font-size: 15px;
	font-weight: 650;
	letter-spacing: -0.01em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aikc-header__status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 2px;
	font-size: 12px;
	opacity: 0.92;
}

.aikc-header__status::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #86efac;
	box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.25);
}

.aikc-header__close {
	background: rgba(255, 255, 255, 0.12);
	border: none;
	color: inherit;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	width: 32px;
	height: 32px;
	border-radius: 10px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
}

.aikc-header__close:hover {
	background: rgba(255, 255, 255, 0.22);
}

.aikc-messages {
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 16px 14px 18px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background:
		radial-gradient(120% 80% at 100% 0%, var(--aikc-primary-soft), transparent 55%),
		var(--aikc-messages-bg);
	scrollbar-width: thin;
}

.aikc-msg {
	max-width: 88%;
	padding: 11px 13px;
	border-radius: 16px;
	font-size: inherit;
	line-height: 1.5;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	animation: aikc-msg-in 0.22s var(--aikc-ease);
}

@keyframes aikc-msg-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.aikc-msg--user {
	align-self: flex-end;
	background: var(--aikc-user-bubble);
	color: #fff;
	border-bottom-right-radius: 5px;
	box-shadow: 0 6px 16px color-mix(in srgb, var(--aikc-user-bubble) 28%, transparent);
}

.aikc-msg--bot {
	align-self: flex-start;
	background: var(--aikc-bot-bubble);
	border: 1px solid var(--aikc-border);
	color: var(--aikc-text);
	border-bottom-left-radius: 5px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.aikc-msg--bot p {
	margin: 0 0 0.55em;
}

.aikc-msg--bot p:last-child {
	margin-bottom: 0;
}

.aikc-msg--bot ul,
.aikc-msg--bot ol {
	margin: 0.35em 0 0.55em;
	padding-left: 1.2em;
}

.aikc-msg--bot a {
	color: var(--aikc-primary);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.aikc-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 10px;
}

.aikc-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	border-radius: 12px;
	border: 1px solid color-mix(in srgb, var(--aikc-primary) 35%, var(--aikc-border));
	background: var(--aikc-primary-soft);
	color: var(--aikc-primary) !important;
	font-weight: 650;
	font-size: 13.5px;
	text-decoration: none !important;
	text-align: center;
	transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.aikc-cta:hover {
	background: color-mix(in srgb, var(--aikc-primary) 22%, transparent);
	border-color: var(--aikc-primary);
	transform: translateY(-1px);
}

.aikc-cta--campaign {
	background: var(--aikc-primary);
	border-color: var(--aikc-primary);
	color: #fff !important;
}

.aikc-cta--campaign:hover {
	filter: brightness(1.05);
	background: var(--aikc-primary);
}

.aikc-cta__icon {
	font-size: 14px;
	line-height: 1;
}

.aikc-sources {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid var(--aikc-border);
	font-size: 12px;
	color: var(--aikc-muted);
}

.aikc-sources a {
	display: block;
	margin-top: 4px;
}

.aikc-typing {
	display: inline-flex;
	gap: 5px;
	align-items: center;
	padding: 2px 0;
}

.aikc-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--aikc-muted);
	animation: aikc-bounce 1.2s infinite ease-in-out;
}

.aikc-typing span:nth-child(2) { animation-delay: 0.15s; }
.aikc-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes aikc-bounce {
	0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
	40% { transform: translateY(-4px); opacity: 1; }
}

.aikc-composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--aikc-border);
	background: var(--aikc-bg);
	flex-shrink: 0;
}

.aikc-composer textarea {
	flex: 1;
	resize: none;
	border: 1px solid var(--aikc-border);
	border-radius: 14px;
	padding: 11px 13px;
	font: inherit;
	min-height: 46px;
	max-height: 120px;
	background: var(--aikc-messages-bg);
	color: var(--aikc-text);
	line-height: 1.4;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.aikc-composer textarea:focus {
	outline: none;
	border-color: color-mix(in srgb, var(--aikc-primary) 55%, var(--aikc-border));
	box-shadow: 0 0 0 3px var(--aikc-primary-soft);
}

.aikc-composer__send {
	border: none;
	border-radius: 14px;
	background: var(--aikc-primary);
	color: #fff;
	width: 46px;
	height: 46px;
	padding: 0;
	cursor: pointer;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease, opacity 0.15s ease, filter 0.15s ease;
}

.aikc-composer__send:hover:not(:disabled) {
	filter: brightness(1.06);
	transform: translateY(-1px);
}

.aikc-composer__send:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.aikc-composer__send svg {
	width: 18px;
	height: 18px;
	display: block;
}

.aikc-launcher--avatar {
	font-size: 0;
	overflow: hidden;
	background-repeat: no-repeat;
}

.aikc-inline-root .aikc-panel {
	position: relative;
	bottom: auto;
	right: auto;
	left: auto;
	top: auto;
	width: 100%;
	height: min(520px, 70vh);
	box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
	animation: none;
}

@media (max-width: 640px) {
	.aikc-root[data-mobile-fs="1"] .aikc-panel {
		bottom: 0 !important;
		top: auto !important;
		right: 0 !important;
		left: 0 !important;
		width: 100vw;
		height: min(94dvh, 780px);
		max-height: 94dvh;
		border-radius: 18px 18px 0 0;
		transform-origin: bottom center;
	}

	.aikc-launcher__label {
		display: none;
	}

	.aikc-root[data-launcher-shape="pill"] .aikc-launcher,
	.aikc-launcher--labeled {
		width: var(--aikc-launcher);
		padding: 0;
		border-radius: 50%;
	}

	.aikc-msg {
		max-width: 94%;
	}

	.aikc-composer {
		padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
	}
}

@media (max-width: 380px) {
	.aikc-msg {
		max-width: 97%;
	}

	.aikc-header {
		padding: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.aikc-panel,
	.aikc-msg,
	.aikc-launcher,
	.aikc-cta {
		animation: none !important;
		transition: none !important;
	}
}
