:root {
	--bgp-chat-blue: #0b3f73;
	--bgp-chat-blue-dark: #062a4e;
	--bgp-chat-accent: #f4b400;
	--bgp-chat-ink: #142233;
	--bgp-chat-muted: #65758a;
	--bgp-chat-border: #dfe7ef;
	--bgp-chat-bg: #f5f8fb;
}

.bgp-chat {
	position: fixed;
	right: max(18px, env(safe-area-inset-right));
	bottom: max(18px, env(safe-area-inset-bottom));
	z-index: 99990;
	font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--bgp-chat-ink);
}

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

.bgp-chat__launcher {
	position: relative;
	display: block;
	width: 112px;
	height: 156px;
	padding: 0;
	overflow: visible;
	border: 0;
	border-radius: 0;
	color: var(--bgp-chat-ink);
	background: transparent;
	box-shadow: none;
	cursor: pointer;
}

.bgp-chat__launcher:hover {
	transform: translateY(-4px);
	box-shadow: none;
}

.bgp-chat__launcher:focus-visible,
.bgp-chat button:focus-visible,
.bgp-chat textarea:focus-visible,
.bgp-chat input:focus-visible,
.bgp-chat select:focus-visible {
	outline: 3px solid rgba(244, 180, 0, 0.65);
	outline-offset: 2px;
}

.bgp-chat__launcher-avatar {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 0;
	object-fit: contain;
	filter: drop-shadow(0 12px 16px rgba(4, 34, 64, 0.28));
}

.bgp-chat__message-form svg {
	width: 21px;
	height: 21px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.9;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.bgp-chat__launcher-status {
	position: absolute;
	right: 8px;
	bottom: 10px;
	width: 17px;
	height: 17px;
	border: 3px solid #fff;
	border-radius: 50%;
	background: #36c778;
	box-shadow: 0 0 0 3px rgba(54, 199, 120, 0.2);
}

.bgp-chat__launcher-label {
	position: absolute;
	top: 43%;
	right: calc(100% + 7px);
	display: grid;
	gap: 1px;
	width: max-content;
	max-width: 210px;
	padding: 9px 13px;
	border: 1px solid rgba(11, 63, 115, 0.13);
	border-radius: 14px 14px 4px 14px;
	background: #fff;
	box-shadow: 0 12px 30px rgba(6, 42, 78, 0.18);
	text-align: left;
	transform: translateY(-50%);
	pointer-events: none;
}

.bgp-chat__launcher-label strong {
	color: var(--bgp-chat-blue);
	font-size: 0.78rem;
	line-height: 1.2;
}

.bgp-chat__launcher-label span {
	color: var(--bgp-chat-muted);
	font-size: 0.68rem;
	line-height: 1.25;
}

.bgp-chat__panel {
	position: absolute;
	right: 0;
	bottom: 170px;
	display: grid;
	grid-template-rows: auto minmax(240px, 1fr) auto;
	width: min(410px, calc(100vw - 28px));
	height: min(680px, calc(100dvh - 110px));
	overflow: hidden;
	border: 1px solid rgba(11, 63, 115, 0.14);
	border-radius: 24px;
	background: #fff;
	box-shadow: 0 24px 80px rgba(6, 42, 78, 0.27);
}

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

.bgp-chat__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	padding: 16px 17px;
	color: #fff;
	background: linear-gradient(135deg, var(--bgp-chat-blue), var(--bgp-chat-blue-dark));
}

.bgp-chat__identity {
	display: flex;
	align-items: center;
	gap: 11px;
}

.bgp-chat__identity div {
	display: grid;
	gap: 2px;
}

.bgp-chat__identity strong {
	font-size: 0.96rem;
}

.bgp-chat__identity span:not(.bgp-chat__status) {
	font-size: 0.72rem;
	opacity: 0.78;
}

.bgp-chat__status {
	width: 11px;
	height: 11px;
	border: 2px solid rgba(255, 255, 255, 0.7);
	border-radius: 50%;
	background: #53d18b;
	box-shadow: 0 0 0 4px rgba(83, 209, 139, 0.14);
}

.bgp-chat__close {
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	color: #fff;
	background: rgba(255, 255, 255, 0.1);
	font-size: 1.45rem;
	line-height: 1;
	cursor: pointer;
}

.bgp-chat__body {
	overflow-x: hidden;
	overflow-y: auto;
	padding: 18px;
	background:
		radial-gradient(circle at top right, rgba(25, 137, 208, 0.08), transparent 40%),
		var(--bgp-chat-bg);
	scroll-behavior: smooth;
}

.bgp-chat__consent,
.bgp-chat__appointment {
	padding: 18px;
	border: 1px solid var(--bgp-chat-border);
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 10px 26px rgba(6, 42, 78, 0.07);
}

.bgp-chat__consent p,
.bgp-chat__appointment p {
	margin: 0 0 12px;
	font-size: 0.86rem;
	line-height: 1.5;
}

.bgp-chat__consent label,
.bgp-chat__appointment-consent {
	display: grid;
	grid-template-columns: 20px 1fr;
	gap: 9px;
	align-items: start;
	margin: 14px 0;
	font-size: 0.76rem;
	line-height: 1.45;
}

.bgp-chat__consent input,
.bgp-chat__appointment-consent input {
	width: 17px;
	height: 17px;
	margin: 2px 0 0;
	accent-color: var(--bgp-chat-blue);
}

.bgp-chat__primary,
.bgp-chat__inline-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 42px;
	padding: 9px 15px;
	border: 0;
	border-radius: 11px;
	color: #fff;
	background: var(--bgp-chat-blue);
	font: inherit;
	font-size: 0.84rem;
	font-weight: 750;
	cursor: pointer;
}

.bgp-chat__primary:disabled {
	cursor: not-allowed;
	opacity: 0.45;
}

.bgp-chat__message {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	margin: 0 0 13px;
}

.bgp-chat__message--user {
	align-items: flex-end;
}

.bgp-chat__bubble {
	max-width: 88%;
	padding: 11px 13px;
	border: 1px solid var(--bgp-chat-border);
	border-radius: 16px 16px 16px 5px;
	background: #fff;
	box-shadow: 0 5px 15px rgba(6, 42, 78, 0.05);
	font-size: 0.84rem;
	line-height: 1.52;
	white-space: pre-wrap;
}

.bgp-chat__message--user .bgp-chat__bubble {
	border-color: transparent;
	border-radius: 16px 16px 5px 16px;
	color: #fff;
	background: var(--bgp-chat-blue);
}

.bgp-chat__bubble p {
	margin: 0 0 8px;
}

.bgp-chat__bubble p:last-child {
	margin-bottom: 0;
}

.bgp-chat__sources {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	max-width: 88%;
	margin-top: 6px;
	font-size: 0.68rem;
}

.bgp-chat__sources > span {
	width: 100%;
	color: var(--bgp-chat-muted);
}

.bgp-chat__sources a {
	padding: 4px 7px;
	border: 1px solid #cbd8e5;
	border-radius: 999px;
	color: var(--bgp-chat-blue);
	background: #fff;
	text-decoration: none;
}

.bgp-chat__typing {
	display: flex;
	gap: 4px;
	align-items: center;
	min-height: 42px;
}

.bgp-chat__typing i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #7e91a7;
	animation: bgp-chat-pulse 1.2s infinite ease-in-out;
}

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

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

.bgp-chat__composer {
	padding: 10px 12px 11px;
	border-top: 1px solid var(--bgp-chat-border);
	background: #fff;
}

.bgp-chat__quick-actions {
	display: flex;
	gap: 6px;
	overflow-x: auto;
	padding: 0 0 8px;
	scrollbar-width: thin;
}

.bgp-chat__quick-actions button {
	flex: 0 0 auto;
	padding: 6px 9px;
	border: 1px solid #cad8e6;
	border-radius: 999px;
	color: var(--bgp-chat-blue);
	background: #f8fbfe;
	font: inherit;
	font-size: 0.7rem;
	font-weight: 700;
	cursor: pointer;
}

.bgp-chat__message-form {
	display: grid;
	grid-template-columns: 1fr 42px;
	gap: 8px;
	align-items: end;
}

.bgp-chat__message-form textarea {
	width: 100%;
	min-height: 42px;
	max-height: 120px;
	resize: none;
	padding: 10px 12px;
	border: 1px solid #cbd8e5;
	border-radius: 13px;
	color: var(--bgp-chat-ink);
	background: #fff;
	font: inherit;
	font-size: 0.84rem;
	line-height: 1.4;
}

.bgp-chat__message-form button {
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 12px;
	color: #fff;
	background: var(--bgp-chat-blue);
	cursor: pointer;
}

.bgp-chat__notice {
	margin: 7px 2px 0;
	color: var(--bgp-chat-muted);
	font-size: 0.61rem;
	line-height: 1.35;
}

.bgp-chat__appointment {
	margin: 8px 0 16px;
}

.bgp-chat__appointment h3 {
	margin: 0 0 7px;
	font-size: 1rem;
}

.bgp-chat__appointment-form {
	display: grid;
	gap: 10px;
}

.bgp-chat__field {
	display: grid;
	gap: 4px;
	font-size: 0.72rem;
	font-weight: 700;
}

.bgp-chat__field input,
.bgp-chat__field select,
.bgp-chat__field textarea {
	width: 100%;
	min-height: 40px;
	padding: 8px 10px;
	border: 1px solid #cbd8e5;
	border-radius: 10px;
	color: var(--bgp-chat-ink);
	background: #fff;
	font: inherit;
	font-size: 0.8rem;
	font-weight: 400;
}

.bgp-chat__field textarea {
	min-height: 78px;
	resize: vertical;
}

.bgp-chat__field-hint,
.bgp-chat__form-status {
	margin: 0 !important;
	color: var(--bgp-chat-muted);
	font-size: 0.7rem !important;
}

.bgp-chat__form-status.is-success {
	color: #12623b;
	font-weight: 700;
}

.bgp-chat__hp {
	position: absolute !important;
	left: -10000px !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

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

@media (max-width: 540px) {
	.bgp-chat {
		right: 10px;
		bottom: max(10px, env(safe-area-inset-bottom));
	}

	.bgp-chat__launcher {
		width: 92px;
		height: 128px;
		padding: 0;
		overflow: visible;
		border: 0;
	}

	.bgp-chat__launcher-label {
		display: none;
	}

	.bgp-chat__panel {
		position: fixed;
		inset: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
		width: auto;
		height: auto;
		border-radius: 18px;
	}

	.bgp-chat__bubble,
	.bgp-chat__sources {
		max-width: 94%;
	}
}

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