.kkc-root {
	--kkc-accent: #5b5ce2;
	--kkc-accent-strong: color-mix(in srgb, var(--kkc-accent) 84%, #111827);
	--kkc-text: #111827;
	--kkc-muted: #667085;
	--kkc-border: #e5e7eb;
	--kkc-surface: #ffffff;
	--kkc-soft: #f7f8fb;
	--kkc-danger: #b42318;
	--kkc-warning: #9a6700;
	box-sizing: border-box;
	color: var(--kkc-text);
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
}

.kkc-root *,
.kkc-root *::before,
.kkc-root *::after {
	box-sizing: inherit;
}

.kkc-root [hidden] {
	display: none !important;
}

.kkc-root button,
.kkc-root textarea {
	font: inherit;
}

.kkc-panel {
	background: var(--kkc-surface);
	border: 1px solid var(--kkc-border);
	border-radius: 18px;
	box-shadow: 0 18px 48px rgba(17, 24, 39, 0.12);
	overflow: hidden;
}

.kkc-mode-inline {
	margin-block: 24px;
	max-width: 760px;
	width: 100%;
}

.kkc-mode-inline .kkc-panel {
	box-shadow: 0 12px 34px rgba(17, 24, 39, 0.08);
}

.kkc-mode-floating {
	bottom: max(22px, env(safe-area-inset-bottom));
	position: fixed;
	z-index: 999999;
}

.kkc-mode-floating.kkc-position-right {
	right: max(22px, env(safe-area-inset-right));
}

.kkc-mode-floating.kkc-position-left {
	left: max(22px, env(safe-area-inset-left));
}

.kkc-mode-floating .kkc-panel {
	bottom: 70px;
	max-height: min(720px, calc(100vh - 120px));
	position: absolute;
	width: min(400px, calc(100vw - 32px));
}

.kkc-mode-floating.kkc-position-right .kkc-panel {
	right: 0;
}

.kkc-mode-floating.kkc-position-left .kkc-panel {
	left: 0;
}

.kkc-launcher {
	align-items: center;
	background: var(--kkc-accent);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 12px 28px color-mix(in srgb, var(--kkc-accent) 28%, transparent);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	font-weight: 700;
	gap: 9px;
	min-height: 52px;
	padding: 0 19px;
	transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.kkc-launcher:hover {
	background: var(--kkc-accent-strong);
	box-shadow: 0 15px 34px color-mix(in srgb, var(--kkc-accent) 34%, transparent);
	transform: translateY(-1px);
}

.kkc-launcher:focus-visible,
.kkc-root button:focus-visible,
.kkc-root textarea:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--kkc-accent) 30%, transparent);
	outline-offset: 2px;
}

.kkc-chat {
	display: flex;
	flex-direction: column;
	min-height: 540px;
}

.kkc-mode-floating .kkc-chat {
	height: min(680px, calc(100vh - 122px));
	min-height: 480px;
}

.kkc-header {
	align-items: center;
	background: var(--kkc-surface);
	border-bottom: 1px solid var(--kkc-border);
	display: flex;
	gap: 14px;
	justify-content: space-between;
	padding: 15px 17px;
}

.kkc-title {
	color: var(--kkc-text);
	font-size: 17px;
	font-weight: 750;
	letter-spacing: -0.01em;
	line-height: 1.25;
	margin: 0;
}

.kkc-availability {
	align-items: center;
	color: var(--kkc-muted);
	display: inline-flex;
	font-size: 12px;
	gap: 6px;
	margin-top: 3px;
}

.kkc-availability > span {
	background: #12b76a;
	border-radius: 50%;
	display: inline-block;
	height: 7px;
	width: 7px;
}

.kkc-header-actions {
	align-items: center;
	display: flex;
	gap: 6px;
}

.kkc-clear,
.kkc-close {
	background: transparent;
	border: 0;
	border-radius: 8px;
	color: var(--kkc-muted);
	cursor: pointer;
	min-height: 34px;
	padding: 5px 9px;
}

.kkc-clear {
	font-size: 12px;
	font-weight: 650;
}

.kkc-close {
	font-size: 25px;
	font-weight: 300;
	line-height: 1;
	width: 34px;
}

.kkc-clear:hover,
.kkc-close:hover {
	background: var(--kkc-soft);
	color: var(--kkc-text);
}

.kkc-messages {
	background: linear-gradient(180deg, #fbfbfd 0%, #f8f9fb 100%);
	flex: 1 1 auto;
	overflow-x: hidden;
	overflow-y: auto;
	padding: 20px 16px;
	scroll-behavior: smooth;
}

.kkc-welcome {
	background: #fff;
	border: 1px solid var(--kkc-border);
	border-radius: 14px;
	color: #344054;
	margin: 4px auto 16px;
	max-width: 560px;
	padding: 16px 17px;
	text-align: center;
}

.kkc-welcome p {
	margin: 0;
}

.kkc-message {
	display: flex;
	flex-direction: column;
	margin-bottom: 15px;
	max-width: 88%;
}

.kkc-message-user {
	align-items: flex-end;
	margin-inline-start: auto;
}

.kkc-message-assistant {
	align-items: flex-start;
	margin-inline-end: auto;
}

.kkc-message-meta {
	color: var(--kkc-muted);
	font-size: 11px;
	font-weight: 650;
	margin: 0 5px 4px;
}

.kkc-bubble {
	background: #fff;
	border: 1px solid var(--kkc-border);
	border-radius: 14px 14px 14px 4px;
	color: var(--kkc-text);
	max-width: 100%;
	overflow-wrap: anywhere;
	padding: 11px 13px;
	white-space: pre-wrap;
}

.kkc-message-user .kkc-bubble {
	background: var(--kkc-accent);
	border-color: var(--kkc-accent);
	border-radius: 14px 14px 4px 14px;
	color: #fff;
}

.kkc-message.is-streaming .kkc-bubble:empty::after {
	animation: kkc-pulse 1.1s infinite ease-in-out;
	color: var(--kkc-muted);
	content: "•••";
	letter-spacing: 3px;
}

.kkc-message.is-error .kkc-bubble {
	border-color: #fecdca;
}

.kkc-notice {
	background: #fff;
	border: 1px dashed var(--kkc-border);
	border-radius: 10px;
	color: var(--kkc-muted);
	font-size: 12px;
	margin: 10px auto;
	max-width: 92%;
	padding: 8px 10px;
	text-align: center;
}

.kkc-notice.is-warning {
	background: #fffaeb;
	border-color: #fedf89;
	color: var(--kkc-warning);
}

.kkc-notice.is-error {
	background: #fef3f2;
	border-color: #fecdca;
	color: var(--kkc-danger);
}

.kkc-status-row {
	align-items: center;
	background: #fff;
	border-top: 1px solid var(--kkc-border);
	display: flex;
	font-size: 11px;
	gap: 8px;
	justify-content: space-between;
	min-height: 31px;
	padding: 5px 15px;
}

.kkc-status {
	color: var(--kkc-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.kkc-status.is-error {
	color: var(--kkc-danger);
}

.kkc-status.is-warning {
	color: var(--kkc-warning);
}

.kkc-remaining {
	color: var(--kkc-muted);
	flex: 0 0 auto;
	font-weight: 600;
}

.kkc-remaining.is-empty {
	color: var(--kkc-danger);
}

.kkc-form {
	background: #fff;
	padding: 10px 13px 12px;
}

.kkc-input {
	background: #fff;
	border: 1px solid #d0d5dd;
	border-radius: 12px;
	color: var(--kkc-text);
	display: block;
	line-height: 1.45;
	max-height: 150px;
	min-height: 60px;
	padding: 11px 12px;
	resize: vertical;
	width: 100%;
}

.kkc-input::placeholder {
	color: #98a2b3;
}

.kkc-input:disabled {
	background: #f9fafb;
	cursor: not-allowed;
}

.kkc-composer-footer {
	align-items: center;
	display: flex;
	gap: 10px;
	justify-content: space-between;
	padding-top: 8px;
}

.kkc-counter {
	color: var(--kkc-muted);
	font-size: 11px;
}

.kkc-counter.is-near {
	color: var(--kkc-warning);
}

.kkc-send {
	background: var(--kkc-accent);
	border: 1px solid var(--kkc-accent);
	border-radius: 9px;
	color: #fff;
	cursor: pointer;
	font-size: 13px;
	font-weight: 700;
	min-height: 36px;
	min-width: 74px;
	padding: 7px 15px;
	transition: background 140ms ease, transform 140ms ease;
}

.kkc-send:hover {
	background: var(--kkc-accent-strong);
	transform: translateY(-1px);
}

.kkc-send.is-stop {
	background: #fff;
	border-color: #f04438;
	color: #b42318;
}

.kkc-privacy {
	background: #fff;
	border-top: 1px solid var(--kkc-border);
	color: var(--kkc-muted);
	font-size: 10.5px;
	line-height: 1.45;
	margin: 0;
	padding: 9px 14px 11px;
}

@keyframes kkc-pulse {
	0%, 100% { opacity: 0.35; }
	50% { opacity: 1; }
}

@media (max-width: 600px) {
	.kkc-mode-floating {
		bottom: max(14px, env(safe-area-inset-bottom));
	}

	.kkc-mode-floating.kkc-position-right {
		right: max(14px, env(safe-area-inset-right));
	}

	.kkc-mode-floating.kkc-position-left {
		left: max(14px, env(safe-area-inset-left));
	}

	.kkc-mode-floating .kkc-panel {
		bottom: 64px;
		max-height: calc(100vh - 92px);
		width: calc(100vw - 28px);
	}

	.kkc-mode-floating .kkc-chat {
		height: calc(100vh - 92px);
		min-height: 420px;
	}

	.kkc-launcher span {
		display: none;
	}

	.kkc-launcher {
		border-radius: 50%;
		height: 54px;
		justify-content: center;
		padding: 0;
		width: 54px;
	}

	.kkc-message {
		max-width: 94%;
	}
}

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

.kkc-root .screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}
