/* AI consultant in the corner (assets/js/chat.js). */

.kb-chat *,
.kb-chat *::before,
.kb-chat *::after {
	box-sizing: border-box;
}

.kb-chat {
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 9990;
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: flex-end;
	font-family: Onest, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.kb-chat__launcher {
	position: relative;
	display: inline-flex;
	gap: 11px;
	align-items: center;
	min-height: 54px;
	padding: 0 18px 0 12px;
	border: 0;
	border-radius: 16px;
	background: #171817;
	color: #f2f4eb;
	box-shadow: 0 16px 40px -12px rgb(23 24 23 / 55%);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: transform 0.18s, box-shadow 0.18s;
}

.kb-chat__launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 20px 48px -12px rgb(23 24 23 / 65%);
}

.kb-chat__launcher span {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	line-height: 1.15;
	text-align: left;
}

.kb-chat__launcher b {
	font-size: 14px;
	font-weight: 700;
}

.kb-chat__launcher small {
	margin-top: 2px;
	color: #a9aea3;
	font-size: 11px;
	font-weight: 500;
}

/* «Online» dot on the icon. */
.kb-chat__launcher::after {
	position: absolute;
	top: 10px;
	left: 32px;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #4fd27a;
	box-shadow: 0 0 0 2px #171817;
	animation: kb-chat-live 2s ease-out infinite;
	content: "";
}

@keyframes kb-chat-live {

	0% {
		box-shadow: 0 0 0 2px #171817, 0 0 0 2px rgb(79 210 122 / 55%);
	}

	70%,
	100% {
		box-shadow: 0 0 0 2px #171817, 0 0 0 9px rgb(79 210 122 / 0%);
	}
}

.kb-chat__launcher i {
	position: relative;
	width: 26px;
	height: 26px;
	border-radius: 9px;
	background: #d4ef72;
}

.kb-chat__launcher i::before,
.kb-chat__launcher i::after {
	position: absolute;
	content: "";
}

.kb-chat__launcher i::before {
	top: 9px;
	left: 7px;
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: #171817;
	box-shadow: 8px 0 #171817;
}

.kb-chat__launcher i::after {
	top: 16px;
	left: 8px;
	width: 10px;
	height: 2px;
	border-radius: 0 0 4px 4px;
	background: #171817;
}

.kb-chat.is-open .kb-chat__launcher {
	display: none;
}

.kb-chat__panel {
	display: flex;
	flex-direction: column;
	width: min(392px, calc(100vw - 28px));
	overflow: hidden;
	border: 1px solid rgb(255 255 255 / 12%);
	border-radius: 20px;
	background: #101217;
	color: #e6e8ec;
	box-shadow: 0 30px 80px -20px rgb(0 0 0 / 55%);
	animation: kb-chat-in 0.22s ease both;
}

.kb-chat__panel[hidden] {
	display: none;
}

@keyframes kb-chat-in {

	from {
		opacity: 0;
		transform: translateY(10px);
	}
}

.kb-chat__head {
	display: flex;
	gap: 10px;
	align-items: center;
	padding: 16px 16px 14px;
	border-bottom: 1px solid rgb(255 255 255 / 8%);
}

.kb-chat__head div {
	flex: 1;
	min-width: 0;
}

.kb-chat__head strong {
	display: block;
	color: #f1f2f4;
	font-size: 15px;
	letter-spacing: -0.01em;
}

.kb-chat__head div span {
	display: block;
	margin-top: 2px;
	color: #828791;
	font-size: 11px;
}

.kb-chat__avatar {
	position: relative;
	display: grid;
	flex: none;
	place-items: center;
	width: 34px;
	height: 34px;
	border-radius: 11px;
	background: #d4ef72;
	color: #14170f;
	font-size: 15px;
	font-weight: 800;
}

.kb-chat__avatar::after {
	position: absolute;
	right: -2px;
	bottom: -2px;
	width: 10px;
	height: 10px;
	border: 2px solid #101217;
	border-radius: 50%;
	background: #4fd27a;
	content: "";
}

.kb-chat__close {
	flex: none;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 9px;
	background: rgb(255 255 255 / 6%);
	color: #8c9098;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.kb-chat__log {
	display: flex;
	flex-direction: column;
	gap: 10px;
	height: min(400px, calc(100dvh - 280px));
	min-height: 220px;
	padding: 14px 14px 6px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.kb-chat__msg {
	max-width: 86%;
	padding: 10px 13px;
	border-radius: 15px;
	font-size: 14px;
	line-height: 1.48;
	overflow-wrap: anywhere;
}

.kb-chat__msg a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.kb-chat__msg.is-bot {
	align-self: flex-start;
	border-bottom-left-radius: 5px;
	background: rgb(255 255 255 / 6.5%);
	color: #e6e8ec;
}

.kb-chat__msg.is-me {
	align-self: flex-end;
	border-bottom-right-radius: 5px;
	background: #d4ef72;
	color: #14170f;
}

.kb-chat__msg.is-err {
	align-self: flex-start;
	background: rgb(196 71 45 / 14%);
	color: #ffb4a3;
}

.kb-chat__dots {
	display: inline-flex;
	gap: 4px;
	padding: 3px 0;
}

.kb-chat__dots i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9aa0aa;
	animation: kb-chat-dot 1s infinite ease-in-out;
}

.kb-chat__dots i:nth-child(2) {
	animation-delay: 0.15s;
}

.kb-chat__dots i:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes kb-chat-dot {

	0%,
	80%,
	100% {
		opacity: 0.3;
		transform: none;
	}

	40% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

.kb-chat__think {
	display: flex;
	flex-direction: column;
	align-self: flex-start;
	gap: 7px;
	padding: 11px 13px;
	border: 1px solid rgb(255 255 255 / 8%);
	border-radius: 15px;
	border-bottom-left-radius: 5px;
	background: rgb(255 255 255 / 3.5%);
}

.kb-chat__step {
	display: flex;
	gap: 9px;
	align-items: center;
	color: #5f6570;
	font-size: 13px;
	transition: color 0.2s;
}

.kb-chat__step i {
	position: relative;
	flex: none;
	width: 14px;
	height: 14px;
	border: 1.5px solid #3a3f48;
	border-radius: 50%;
}

.kb-chat__step.is-on {
	color: #e6e8ec;
}

.kb-chat__step.is-on i {
	border-color: #d4ef72 transparent #d4ef72 #d4ef72;
	animation: kb-chat-spin 0.8s linear infinite;
}

.kb-chat__step.is-done {
	color: #9aa0aa;
}

.kb-chat__step.is-done i {
	border-color: #4fd27a;
	background: #4fd27a;
}

.kb-chat__step.is-done i::after {
	position: absolute;
	top: 1.5px;
	left: 3.5px;
	width: 3px;
	height: 6px;
	border: solid #101217;
	border-width: 0 1.6px 1.6px 0;
	content: "";
	transform: rotate(45deg);
}

@keyframes kb-chat-spin {

	to {
		transform: rotate(360deg);
	}
}

.kb-chat__took {
	align-self: flex-start;
	margin: 0 0 -6px 4px;
	color: #5f6570;
	font-size: 11px;
}

.kb-chat__msg.is-live::after {
	display: inline-block;
	width: 7px;
	height: 14px;
	margin-left: 2px;
	background: #d4ef72;
	vertical-align: -2px;
	animation: kb-chat-caret 1s steps(2) infinite;
	content: "";
}

@keyframes kb-chat-caret {

	50% {
		opacity: 0;
	}
}

.kb-chat__starters {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 2px 0 4px;
}

.kb-chat__starters button {
	min-height: 34px;
	padding: 7px 11px;
	border: 1px solid rgb(255 255 255 / 12%);
	border-radius: 999px;
	background: rgb(255 255 255 / 3%);
	color: #d7d9de;
	font: inherit;
	font-size: 12.5px;
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s;
}

.kb-chat__starters button:hover {
	border-color: rgb(212 239 114 / 55%);
	background: rgb(212 239 114 / 8%);
}

.kb-chat__card {
	padding: 13px;
	border: 1px solid rgb(212 239 114 / 32%);
	border-radius: 15px;
	background: rgb(212 239 114 / 6%);
}

.kb-chat__card b {
	display: block;
	margin-bottom: 9px;
	color: #f1f2f4;
	font-size: 13.5px;
}

.kb-chat__card.is-done {
	border-color: rgb(79 210 122 / 40%);
	background: rgb(79 210 122 / 8%);
	color: #d9f5e2;
	font-size: 13.5px;
	line-height: 1.45;
}

.kb-chat__row {
	display: flex;
	gap: 6px;
	padding: 4px;
	border: 1px solid rgb(255 255 255 / 14%);
	border-radius: 12px;
	background: #0c0e12;
}

.kb-chat__row:focus-within {
	border-color: #a9c94a;
	box-shadow: 0 0 0 3px rgb(212 239 114 / 18%);
}

.kb-chat__row.is-bad {
	border-color: #d0573b;
}

.kb-chat .kb-chat__row input {
	flex: 1;
	min-width: 0;
	height: 38px;
	margin: 0;
	padding: 0 10px;
	border: 0;
	background: transparent;
	box-shadow: none;
	color: #f1f2f4;
	font: inherit;
	font-size: 15px;
	outline: 0;
}

.kb-chat .kb-chat__row input::placeholder,
.kb-chat .kb-chat__input::placeholder {
	color: #6f7580;
}

.kb-chat__row button {
	flex: none;
	padding: 0 14px;
	border: 0;
	border-radius: 9px;
	background: #d4ef72;
	color: #14170f;
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
}

.kb-chat__row button:disabled {
	opacity: 0.6;
}

.kb-chat__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
}

.kb-chat__card label {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	margin-top: 9px;
	color: #8d929b;
	font-size: 11px;
	line-height: 1.4;
	cursor: pointer;
}

.kb-chat__card label input {
	flex: none;
	width: 14px;
	height: 14px;
	margin: 1px 0 0;
	accent-color: #a9c94a;
}

.kb-chat__card label a {
	color: inherit;
}

.kb-chat__err {
	margin: 7px 0 0;
	color: #ffb4a3;
	font-size: 12px;
}

.kb-chat__err:empty {
	display: none;
}

.kb-chat__form {
	display: flex;
	gap: 8px;
	align-items: flex-end;
	margin: 6px 12px 0;
	padding: 6px 6px 6px 12px;
	border: 1px solid rgb(255 255 255 / 12%);
	border-radius: 15px;
	background: #0c0e12;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.kb-chat__form:focus-within {
	border-color: rgb(212 239 114 / 50%);
	box-shadow: 0 0 0 3px rgb(212 239 114 / 12%);
}

.kb-chat .kb-chat__input {
	flex: 1;
	min-width: 0;
	min-height: 38px;
	max-height: 110px;
	margin: 0;
	padding: 9px 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	color: #f1f2f4;
	font: inherit;
	font-size: 14px;
	line-height: 1.4;
	resize: none;
	outline: 0;
}

.kb-chat__send {
	display: grid;
	flex: none;
	place-items: center;
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 11px;
	background: #d4ef72;
	color: #14170f;
	cursor: pointer;
	transition: opacity 0.15s, transform 0.15s;
}

.kb-chat__send:disabled {
	opacity: 0.35;
	cursor: default;
}

.kb-chat__note {
	margin: 7px 14px 10px;
	color: #626873;
	font-size: 10px;
	text-align: center;
}

.kb-chat__tg {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 36px;
	margin: 0 12px 12px;
	border-radius: 10px;
	background: #238bd0;
	color: #eaf6ff;
	font-size: 12px;
	font-weight: 600;
	text-decoration: none;
}

.kb-chat :focus-visible {
	outline: 2px solid #d4ef72;
	outline-offset: 2px;
}

.kb-chat .kb-chat__input:focus-visible,
.kb-chat .kb-chat__row input:focus-visible {
	outline: 0;
}

/* The cookie banner takes the bottom of a narrow screen until the visitor chooses. */
@media (max-width: 720px) {

	/* Only the launcher waits: a chat the visitor already opened stays open. */
	.kb-cookie-open .kb-chat__launcher {
		display: none;
	}
}

@media (max-width: 600px) {

	.kb-chat {
		right: 12px;
		bottom: 12px;
	}

	.kb-chat__panel {
		width: calc(100vw - 24px);
	}

	.kb-chat__log {
		height: min(440px, calc(100dvh - 300px));
		min-height: 180px;
	}

	.kb-chat .kb-chat__input,
	.kb-chat .kb-chat__row input {
		font-size: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {

	.kb-chat__panel,
	.kb-chat__launcher::after,
	.kb-chat__step.is-on i,
	.kb-chat__msg.is-live::after,
	.kb-chat__dots i {
		animation: none;
	}
}
