.hkti-chat {
	--hkti-primary: #6d4aff;
	--hkti-ink: #171421;
	--hkti-muted: #6b6675;
	--hkti-surface: #ffffff;
	--hkti-soft: #f5f3f8;
	--hkti-border: #e5e0eb;
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 999999;
	font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: var(--hkti-ink);
}

.hkti-chat button,
.hkti-chat textarea,
.hkti-chat section,
.hkti-chat div,
.hkti-chat header,
.hkti-chat footer {
	box-sizing: border-box;
}

.hkti-chat [hidden] {
	display: none !important;
}

.hkti-chat .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.hkti-chat__launcher {
	width: 58px;
	height: 58px;
	margin: 0 0 0 auto;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: var(--hkti-primary);
	color: #fff;
	box-shadow: 0 14px 35px rgba(27, 18, 55, 0.24);
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: transform 160ms ease, box-shadow 160ms ease;
}

.hkti-chat__launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 18px 42px rgba(27, 18, 55, 0.3);
}

.hkti-chat__launcher:focus-visible,
.hkti-chat button:focus-visible,
.hkti-chat textarea:focus-visible,
.hkti-chat a:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--hkti-primary) 45%, white);
	outline-offset: 3px;
}

.hkti-chat__launcher svg,
.hkti-chat__form svg {
	width: 25px;
	height: 25px;
	fill: currentColor;
}

.hkti-chat__greeting {
	position: absolute;
	right: 70px;
	bottom: 7px;
	min-width: 230px;
	max-width: 290px;
	padding: 12px 36px 12px 15px;
	border: 1px solid var(--hkti-border);
	border-radius: 14px;
	background: var(--hkti-surface);
	box-shadow: 0 10px 28px rgba(27, 18, 55, 0.14);
}

.hkti-chat__greeting-close {
	position: absolute;
	top: 4px;
	right: 7px;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--hkti-muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.hkti-chat__dialog {
	position: absolute;
	right: 0;
	bottom: 72px;
	width: min(390px, calc(100vw - 32px));
	height: min(640px, calc(100vh - 120px));
	min-height: 430px;
	border: 1px solid var(--hkti-border);
	border-radius: 22px;
	background: var(--hkti-surface);
	box-shadow: 0 24px 70px rgba(27, 18, 55, 0.24);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.hkti-chat__header {
	min-height: 72px;
	padding: 13px 12px 13px 16px;
	background: var(--hkti-primary);
	color: #fff;
	display: flex;
	align-items: center;
	gap: 10px;
}

.hkti-chat__avatar {
	width: 42px;
	height: 42px;
	flex: 0 0 42px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.22);
	display: grid;
	place-items: center;
	font-weight: 750;
}

.hkti-chat__header strong,
.hkti-chat__header span {
	display: block;
}

.hkti-chat__header strong {
	font-size: 15px;
	line-height: 1.25;
}

.hkti-chat__header span {
	margin-top: 2px;
	font-size: 12px;
	line-height: 1.25;
	opacity: 0.83;
}

.hkti-chat__header-action {
	padding: 6px 8px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #fff;
	font: inherit;
	font-size: 12px;
	cursor: pointer;
}

.hkti-chat__header-action:hover {
	background: rgba(255, 255, 255, 0.14);
}

.hkti-chat__header-action:first-of-type {
	margin-left: auto;
}

.hkti-chat__close {
	width: 34px;
	height: 34px;
	padding: 0;
	font-size: 25px;
	line-height: 1;
}

.hkti-chat__messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 18px 15px 10px;
	background: linear-gradient(180deg, #fbfaff 0%, #fff 32%);
	scroll-behavior: smooth;
}

.hkti-chat__message {
	width: fit-content;
	max-width: 86%;
	margin: 0 0 12px;
	padding: 10px 13px;
	border-radius: 15px;
	overflow-wrap: anywhere;
}

.hkti-chat__message p {
	margin: 0 0 8px;
}

.hkti-chat__message p:last-child {
	margin-bottom: 0;
}

.hkti-chat__message ul,
.hkti-chat__message ol {
	margin: 7px 0;
	padding-left: 20px;
}

.hkti-chat__message a {
	color: inherit;
	font-weight: 650;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.hkti-chat__message--assistant {
	margin-right: auto;
	border-bottom-left-radius: 5px;
	background: var(--hkti-soft);
	color: var(--hkti-ink);
}

.hkti-chat__message--user {
	margin-left: auto;
	border-bottom-right-radius: 5px;
	background: var(--hkti-primary);
	color: #fff;
}

.hkti-chat__message--error {
	margin-right: auto;
	background: #fff0f0;
	color: #8c1d1d;
}

.hkti-chat__sources {
	max-width: 86%;
	margin: -5px 0 14px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.hkti-chat__source {
	padding: 4px 8px;
	border: 1px solid var(--hkti-border);
	border-radius: 999px;
	background: #fff;
	color: var(--hkti-muted);
	font-size: 11px;
	line-height: 1.3;
	text-decoration: none;
}

.hkti-chat__typing {
	padding: 8px 18px 12px;
	display: flex;
	gap: 4px;
}

.hkti-chat__typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--hkti-muted);
	animation: hkti-pulse 1.1s infinite ease-in-out;
}

.hkti-chat__typing span:nth-child(2) { animation-delay: 120ms; }
.hkti-chat__typing span:nth-child(3) { animation-delay: 240ms; }

@keyframes hkti-pulse {
	0%, 70%, 100% { transform: translateY(0); opacity: 0.45; }
	35% { transform: translateY(-4px); opacity: 1; }
}

.hkti-chat__consent {
	position: absolute;
	inset: 72px 0 0;
	z-index: 3;
	padding: 28px;
	background: rgba(255, 255, 255, 0.97);
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	text-align: center;
}

.hkti-chat__consent p {
	max-width: 290px;
	margin: 0 0 12px;
}

.hkti-chat__consent a {
	margin-bottom: 18px;
	color: var(--hkti-primary);
}

.hkti-chat__consent button,
.hkti-chat__rating button {
	padding: 10px 18px;
	border: 0;
	border-radius: 10px;
	background: var(--hkti-primary);
	color: #fff;
	font: inherit;
	font-weight: 650;
	cursor: pointer;
}

.hkti-chat__form {
	min-height: 66px;
	padding: 10px 11px;
	border-top: 1px solid var(--hkti-border);
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.hkti-chat__form textarea {
	width: 100%;
	max-height: 108px;
	min-height: 42px;
	resize: none;
	padding: 10px 11px;
	border: 1px solid var(--hkti-border);
	border-radius: 12px;
	background: #fff;
	color: var(--hkti-ink);
	font: inherit;
	line-height: 1.4;
}

.hkti-chat__form button {
	width: 42px;
	height: 42px;
	flex: 0 0 42px;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: var(--hkti-primary);
	color: #fff;
	display: grid;
	place-items: center;
	cursor: pointer;
}

.hkti-chat__form button:disabled,
.hkti-chat__form textarea:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.hkti-chat__footer {
	padding: 4px 10px 7px;
	color: var(--hkti-muted);
	font-size: 10px;
	line-height: 1.2;
	text-align: center;
}

.hkti-chat__rating {
	margin: 8px 0 16px;
	padding: 14px;
	border: 1px solid var(--hkti-border);
	border-radius: 14px;
	text-align: center;
}

.hkti-chat__rating p {
	margin: 0 0 8px;
}

.hkti-chat__rating-stars {
	display: flex;
	justify-content: center;
	gap: 5px;
}

.hkti-chat__rating-stars button {
	padding: 2px;
	background: transparent;
	color: var(--hkti-primary);
	font-size: 26px;
	line-height: 1;
}

.hkti-chat__rating .hkti-chat__rating-skip {
	margin-top: 8px;
	padding: 5px 8px;
	background: transparent;
	color: var(--hkti-muted);
	font-size: 12px;
}

@media (max-width: 520px) {
	.hkti-chat {
		right: 12px;
		bottom: 12px;
	}

	.hkti-chat__dialog {
		position: fixed;
		inset: 10px 10px 82px;
		width: auto;
		height: auto;
		min-height: 0;
	}

	.hkti-chat__greeting {
		right: 67px;
		min-width: min(230px, calc(100vw - 105px));
	}
}

@media (prefers-reduced-motion: reduce) {
	.hkti-chat__launcher,
	.hkti-chat__messages {
		transition: none;
		scroll-behavior: auto;
	}

	.hkti-chat__typing span {
		animation: none;
	}
}
