.bf-ai-chat {
	--bf-ai-chat-accent: #f47a2a;
	--bf-ai-chat-accent-soft: rgba(244, 122, 42, .22);
	--bf-ai-chat-accent-tint: #fff5ed;
	position: fixed;
	z-index: 99990;
	right: 24px;
	bottom: 24px;
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.bf-ai-chat__toggle {
	display: flex;
	min-height: 54px;
	align-items: center;
	gap: .65rem;
	padding: .65rem .95rem;
	border: 1px solid rgba(7, 21, 37, .18);
	border-radius: 999px;
	color: #fff;
	background: #071525;
	box-shadow: 0 16px 42px rgba(7, 21, 37, .24);
	cursor: pointer;
	font: inherit;
	font-weight: 850;
}

.bf-ai-chat__toggle span {
	display: grid;
	width: 32px;
	height: 32px;
	place-items: center;
	border-radius: 50%;
	color: #071525;
	background: var(--bf-ai-chat-accent);
	font-weight: 950;
}

.bf-ai-chat--open .bf-ai-chat__toggle {
	display: none !important;
}

.bf-ai-chat__panel {
	position: absolute;
	right: 0;
	bottom: 72px;
	display: grid;
	grid-template-rows: auto auto minmax(0, 1fr);
	width: 400px;
	height: min(600px, calc(100dvh - 48px));
	overflow: hidden;
	border: 1px solid #cbd7e0;
	border-radius: 20px;
	background: #fff;
	box-shadow: 0 24px 70px rgba(7, 21, 37, .28);
}

.bf-ai-chat--expanded .bf-ai-chat__panel {
	width: min(680px, calc(100vw - 48px));
	height: min(760px, calc(100dvh - 48px));
}

.bf-ai-chat__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: .95rem 1rem;
	color: #fff;
	background: #071525;
}

.bf-ai-chat__header div:first-child {
	display: grid;
}

.bf-ai-chat__header span {
	color: #cbd7e0;
	font-size: .82rem;
}

.bf-ai-chat__controls {
	display: flex;
	gap: .45rem;
}

.bf-ai-chat__close,
.bf-ai-chat__expand {
	display: grid;
	width: 44px;
	height: 44px;
	min-width: 44px;
	place-items: center;
	border: 1px solid rgba(255, 255, 255, .44);
	border-radius: 13px;
	color: #fff;
	background: rgba(255, 255, 255, .08);
	cursor: pointer;
	font: inherit;
	font-size: 1.35rem;
	line-height: 1;
}

.bf-ai-chat__close {
	font-size: 1.6rem;
}

.bf-ai-chat__close:hover,
.bf-ai-chat__close:focus,
.bf-ai-chat__expand:hover,
.bf-ai-chat__expand:focus {
	background: rgba(255, 255, 255, .18);
	outline: 2px solid rgba(255, 255, 255, .25);
}

.bf-ai-chat__tabs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: .45rem;
	padding: .55rem;
	border-bottom: 1px solid #dce4ec;
	background: #edf3f8;
}

.bf-ai-chat__tabs button {
	min-height: 42px;
	border: 1px solid transparent;
	border-radius: 12px;
	color: #33475f;
	background: transparent;
	cursor: pointer;
	font: inherit;
	font-weight: 850;
}

.bf-ai-chat__tabs button[aria-selected="true"] {
	border-color: #cbd7e0;
	color: #071525;
	background: #fff;
	box-shadow: 0 4px 14px rgba(16, 32, 51, .08);
}

.bf-ai-chat__body,
.bf-ai-chat__tabpanel {
	min-height: 0;
}

.bf-ai-chat__body {
	overflow: hidden;
}

.bf-ai-chat__tabpanel {
	height: 100%;
}

.bf-ai-chat__tabpanel[data-bf-ai-panel="chat"] {
	display: grid;
	grid-template-rows: minmax(0, 1fr) auto;
}

.bf-ai-chat__tabpanel[data-bf-ai-panel="contact"] {
	overflow: hidden;
}

.bf-ai-chat__messages {
	display: grid;
	align-content: start;
	gap: .65rem;
	min-height: 0;
	overflow-y: auto;
	padding: .9rem;
	background: #f5f8fa;
}

.bf-ai-chat__msg {
	max-width: 90%;
	padding: .72rem .82rem;
	border-radius: 14px;
	color: #13283f;
	background: #fff;
	box-shadow: 0 3px 14px rgba(16, 32, 51, .08);
	font-size: .93rem;
	line-height: 1.45;
	overflow-wrap: anywhere;
}

.bf-ai-chat__msg a,
.bf-ai-chat__privacy a {
	color: #0b4f7c;
	text-decoration: underline;
	font-weight: 800;
}

.bf-ai-chat__msg--user {
	justify-self: end;
	color: #fff;
	background: #174d79;
}

.bf-ai-chat__msg--bot {
	justify-self: start;
}

.bf-ai-chat__msg--status {
	justify-self: center;
	color: #405168;
	background: transparent;
	box-shadow: none;
	font-size: .86rem;
}

.bf-ai-chat__feedback {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .35rem;
	margin-top: .62rem;
	padding-top: .55rem;
	border-top: 1px solid #e2e9ef;
	color: #405168;
	font-size: .78rem;
}

.bf-ai-chat__feedback span {
	margin-right: .1rem;
}

.bf-ai-chat__feedback button {
	display: grid;
	min-width: 34px;
	min-height: 34px;
	place-items: center;
	padding: .28rem .52rem;
	border: 1px solid #c4d0da;
	border-radius: 999px;
	color: #17324d;
	background: #f7fafc;
	cursor: pointer;
	font: inherit;
	font-size: 1rem;
	font-weight: 800;
	line-height: 1;
}

.bf-ai-chat__feedback button:hover,
.bf-ai-chat__feedback button:focus {
	border-color: var(--bf-ai-chat-accent);
	outline: 2px solid var(--bf-ai-chat-accent-soft);
	background: var(--bf-ai-chat-accent-tint);
}

.bf-ai-chat__feedback--sent {
	color: #24445f;
}

.bf-ai-chat__feedback--sent span {
	font-weight: 800;
}

.bf-ai-chat__form {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: .55rem;
	padding: .75rem;
	border-top: 1px solid #dce4ec;
	background: #fff;
}

.bf-ai-chat textarea,
.bf-ai-chat input {
	box-sizing: border-box;
	width: 100%;
	padding: .72rem .75rem;
	border: 1px solid #a8b5c2;
	border-radius: 11px;
	color: #13283f;
	background: #fff;
	font: inherit;
}

.bf-ai-chat textarea:focus,
.bf-ai-chat input:focus {
	border-color: var(--bf-ai-chat-accent);
	outline: 3px solid var(--bf-ai-chat-accent-soft);
}

.bf-ai-chat__form textarea {
	max-height: 92px;
	resize: none;
}

.bf-ai-chat__form button,
.bf-ai-chat__lead button {
	border: 0;
	border-radius: 11px;
	color: #071525;
	background: var(--bf-ai-chat-accent);
	cursor: pointer;
	font: inherit;
	font-weight: 900;
}

.bf-ai-chat__form button {
	min-width: 72px;
	padding: .62rem .82rem;
}

.bf-ai-chat__lead {
	display: grid;
	align-content: start;
	gap: .62rem;
	height: 100%;
	overflow-y: auto;
	padding: 1rem 1rem 1.2rem;
	background: #fff;
}

.bf-ai-chat__lead strong {
	color: #071525;
	font-size: 1.08rem;
}

.bf-ai-chat__lead p {
	margin: 0;
	color: #405168;
	font-size: .9rem;
	line-height: 1.4;
}

.bf-ai-chat__lead textarea {
	min-height: 70px;
	resize: vertical;
}

.bf-ai-chat__privacy {
	display: flex;
	align-items: flex-start;
	gap: .55rem;
	color: #405168;
	font-size: .84rem;
	line-height: 1.35;
}

.bf-ai-chat__privacy input {
	width: 1.1rem;
	min-width: 1.1rem;
	margin-top: .2rem;
}

.bf-ai-chat__lead button {
	position: sticky;
	bottom: 0;
	min-height: 46px;
	box-shadow: 0 -10px 20px rgba(255, 255, 255, .92);
}

.bf-ai-chat--minimized .bf-ai-chat__toggle {
	display: flex !important;
	width: auto;
	min-width: 54px;
}

.bf-ai-chat--minimized .bf-ai-chat__toggle span {
	width: 30px;
	height: 30px;
}

@media (prefers-reduced-motion: no-preference) {
	.bf-ai-chat__panel {
		transform-origin: right bottom;
		animation: bfChatIn .16s ease-out;
	}

	@keyframes bfChatIn {
		from {
			opacity: .7;
			transform: translateY(8px) scale(.985);
		}

		to {
			opacity: 1;
			transform: translateY(0) scale(1);
		}
	}
}

@media (max-width: 640px) {
	.bf-ai-chat {
		right: 10px;
		bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
	}

	.bf-ai-chat__panel {
		position: fixed;
		inset: auto 10px calc(env(safe-area-inset-bottom, 0px) + 74px) 10px;
		width: auto;
		height: min(680px, calc(100dvh - 108px));
		max-height: calc(100dvh - 108px);
		border: 1px solid #cbd7e0;
		border-radius: 22px;
		box-shadow: 0 18px 52px rgba(7, 21, 37, .3);
	}

	.bf-ai-chat__expand {
		display: none;
	}

	.bf-ai-chat__header {
		padding: .78rem .82rem;
	}

	.bf-ai-chat__close {
		width: 48px;
		height: 48px;
		min-width: 48px;
		border-radius: 15px;
		font-size: 1.8rem;
		touch-action: manipulation;
	}

	.bf-ai-chat__tabs {
		padding: .5rem .65rem;
	}

	.bf-ai-chat__body {
		height: auto;
		min-height: 0;
	}

	.bf-ai-chat__messages {
		padding: .78rem;
	}

	.bf-ai-chat__form {
		grid-template-columns: minmax(0, 1fr) auto;
		padding: .65rem;
	}

	.bf-ai-chat__form textarea {
		min-height: 50px;
	}

	.bf-ai-chat__lead {
		padding: .85rem .8rem 1rem;
	}

	.bf-ai-chat__lead button {
		bottom: -1rem;
	}

	.bf-ai-chat--minimized .bf-ai-chat__toggle {
		min-height: 50px;
		padding: .55rem .82rem;
		box-shadow: 0 8px 24px rgba(7, 21, 37, .2);
	}

	.bf-ai-chat--minimized .bf-ai-chat__toggle span {
		width: 28px;
		height: 28px;
	}

	.bf-ai-chat--minimized .bf-ai-chat__toggle strong {
		font-size: .92rem;
	}
}

@media (max-width: 390px) {
	.bf-ai-chat__panel {
		inset: auto 8px calc(env(safe-area-inset-bottom, 0px) + 68px) 8px;
		height: min(620px, calc(100dvh - 92px));
		max-height: calc(100dvh - 92px);
		border-radius: 18px;
	}

	.bf-ai-chat__form {
		grid-template-columns: 1fr;
	}

	.bf-ai-chat__form button {
		min-height: 42px;
	}

	.bf-ai-chat__header strong {
		font-size: .98rem;
	}

	.bf-ai-chat__header span {
		font-size: .76rem;
	}
}

html.bf-high-contrast .bf-ai-chat__panel,
html.bf-high-contrast .bf-ai-chat__msg {
	border: 2px solid #000;
	box-shadow: none;
}

html.bf-high-contrast .bf-ai-chat__msg--bot {
	color: #000;
	background: #fff;
}

html.bf-high-contrast .bf-ai-chat__msg--user {
	color: #fff;
	background: #000;
}

html.bf-high-contrast .bf-ai-chat__msg a,
html.bf-high-contrast .bf-ai-chat__privacy a {
	color: #000;
	text-decoration-thickness: 2px;
}

html.bf-high-contrast .bf-ai-chat__feedback button {
	border-color: #000;
	color: #000;
	background: #fff;
}
