:root {
	--aikc-primary: #0f766e;
	--aikc-header: var(--aikc-primary);
	--aikc-user-bubble: var(--aikc-primary);
	--aikc-bot-bubble: #ffffff;
	--aikc-bg: #ffffff;
	--aikc-messages-bg: #f8fafc;
	--aikc-text: #1a1a1a;
	--aikc-muted: #667085;
	--aikc-border: #e4e7ec;
	--aikc-shadow: 0 12px 40px rgba(16, 24, 40, 0.18);
	--aikc-radius: 16px;
	--aikc-font: 14px;
	--aikc-panel-w: 380px;
	--aikc-panel-h: 560px;
	--aikc-offset-x: 20px;
	--aikc-offset-y: 20px;
	--aikc-launcher: 56px;
}

.aikc-root,
.aikc-inline-root {
	font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
	font-size: var(--aikc-font);
	z-index: 99999;
	color: var(--aikc-text);
}

.aikc-root[data-theme="dark"] {
	--aikc-bg: #111827;
	--aikc-messages-bg: #0b1220;
	--aikc-bot-bubble: #1f2937;
	--aikc-text: #f3f4f6;
	--aikc-muted: #9ca3af;
	--aikc-border: #374151;
	--aikc-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.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: var(--aikc-shadow);
	cursor: pointer;
	font-size: calc(var(--aikc-launcher) * 0.4);
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 0;
	z-index: 100000;
	transition: transform 0.15s ease;
}

.aikc-launcher:hover {
	transform: scale(1.04);
}

.aikc-root[data-launcher-size="sm"] {
	--aikc-launcher: 48px;
}
.aikc-root[data-launcher-size="md"] {
	--aikc-launcher: 56px;
}
.aikc-root[data-launcher-size="lg"] {
	--aikc-launcher: 64px;
}

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

.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 16px;
	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;
}

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

.aikc-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: var(--aikc-header);
	color: #fff;
	flex-shrink: 0;
}

.aikc-header img {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
	background: rgba(255, 255, 255, 0.2);
}

.aikc-header h2 {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	flex: 1;
}

.aikc-header button {
	background: transparent;
	border: none;
	color: inherit;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	padding: 4px;
}

.aikc-messages {
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: var(--aikc-messages-bg);
}

.aikc-msg {
	max-width: 92%;
	padding: 10px 12px;
	border-radius: 12px;
	font-size: inherit;
	line-height: 1.45;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.aikc-msg--user {
	align-self: flex-end;
	background: var(--aikc-user-bubble);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.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: 4px;
}

.aikc-msg--bot a {
	color: var(--aikc-primary);
}

.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: 4px;
	align-items: center;
}

.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;
	gap: 8px;
	padding: 12px;
	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: 10px;
	padding: 10px 12px;
	font: inherit;
	min-height: 44px;
	max-height: 120px;
	background: var(--aikc-bg);
	color: var(--aikc-text);
}

.aikc-composer button {
	border: none;
	border-radius: 10px;
	background: var(--aikc-primary);
	color: #fff;
	padding: 0 14px;
	cursor: pointer;
	font-weight: 600;
	flex-shrink: 0;
}

.aikc-composer button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.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(480px, 70vh);
	box-shadow: 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(92dvh, 720px);
		max-height: 92dvh;
		border-radius: 16px 16px 0 0;
	}

	.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%;
	}
}

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