.ucb {
	--ucb-theme: #f53c0f;
	--ucb-ink: #202124;
	--ucb-muted: #70757a;
	--ucb-line: #e8eaed;
	--ucb-chip: #f8f9fa;
	position: fixed;
	right: max(16px, env(safe-area-inset-right));
	bottom: max(16px, env(safe-area-inset-bottom));
	z-index: 999999;
	font-family: "Manrope", "Segoe UI", Arial, sans-serif;
	color: var(--ucb-ink);
}

.ucb[hidden] { display: none; }
.ucb .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
}

.ucb-panel {
	width: min(360px, calc(100vw - 40px));
	height: min(620px, calc(100vh - 120px));
	display: flex;
	flex-direction: column;
	margin-bottom: 12px;
	background: #fff;
	border-radius: 18px 18px 8px 8px;
	box-shadow: 0 16px 48px rgba(15, 15, 20, .22);
	overflow: hidden;
}

.ucb-panel[hidden] { display: none; }

.ucb-header {
	position: relative;
	display: grid;
	grid-template-columns: 42px 1fr 42px;
	align-items: center;
	min-height: 56px;
	padding: 0 8px;
	background: var(--ucb-theme);
	color: #fff;
}

.ucb-title {
	text-align: center;
	font-size: 17px;
	font-weight: 700;
}

.ucb-icon-btn,
.ucb-send,
.ucb-launcher,
.ucb-tip-ok {
	border: 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.ucb-icon-btn {
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	border-radius: 50%;
}

.ucb-icon-btn:hover { background: rgba(255,255,255,.12); }

.ucb-menu {
	position: absolute;
	top: 54px;
	right: 8px;
	z-index: 2;
	min-width: 160px;
	padding: 6px;
	background: #fff;
	color: var(--ucb-ink);
	border-radius: 10px;
	box-shadow: 0 10px 28px rgba(0,0,0,.16);
}

.ucb-menu[hidden] { display: none; }

.ucb-menu button {
	display: block;
	width: 100%;
	padding: 10px 12px;
	border: 0;
	background: transparent;
	text-align: left;
	cursor: pointer;
	border-radius: 6px;
}

.ucb-menu button:hover { background: #f3f4f6; }

.ucb-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: #fff;
}

.ucb-divider {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 28px 22px 8px;
	color: var(--ucb-muted);
	font-size: 12px;
}

.ucb-divider::before,
.ucb-divider::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--ucb-line);
}

.ucb-messages {
	flex: 1;
	overflow-y: auto;
	padding: 8px 18px 10px;
}

.ucb-row {
	display: flex;
	gap: 8px;
	margin: 10px 0;
	align-items: flex-end;
}

.ucb-row.is-user { justify-content: flex-end; }

.ucb-avatar {
	flex: 0 0 28px;
	display: grid;
	place-items: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--ucb-theme);
	color: #fff;
}

.ucb-bubble {
	max-width: 82%;
	padding: 10px 14px;
	border-radius: 16px;
	background: #f1f3f4;
	font-size: 14px;
	line-height: 1.45;
	white-space: pre-wrap;
}

.ucb-row.is-user .ucb-bubble {
	background: #fff;
	border: 1px solid #dfe3e8;
	color: var(--ucb-theme);
}

.ucb-chips {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	padding: 6px 16px 14px;
}

.ucb-chip {
	padding: 8px 14px;
	border: 1px solid #d7dbe0;
	border-radius: 22px;
	background: #fff;
	color: var(--ucb-theme);
	font-size: 13px;
	cursor: pointer;
}

.ucb-chip:hover { background: var(--ucb-chip); }

.ucb-composer {
	display: grid;
	grid-template-columns: 1fr 44px;
	align-items: center;
	min-height: 56px;
	padding: 6px 10px 8px 16px;
	border-top: 1px solid var(--ucb-line);
}

.ucb-composer input {
	width: 100%;
	border: 0;
	outline: 0;
	background: transparent;
	font: inherit;
	font-size: 14px;
}

.ucb-send {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	color: var(--ucb-muted);
}

.ucb-send:hover { color: var(--ucb-theme); }

.ucb-dock {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
}

.ucb-powered {
	margin: 0 auto 0 4px;
	color: var(--ucb-muted);
	font-size: 11px;
}

.ucb.is-closed .ucb-powered { display: none; }

.ucb-tip {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px 8px 14px;
	background: #fff;
	border-radius: 999px;
	box-shadow: 0 8px 24px rgba(0,0,0,.14);
	font-size: 13px;
}

.ucb-tip[hidden] { display: none; }

.ucb-tip-ok {
	padding: 6px 10px;
	border-radius: 999px;
	background: var(--ucb-theme);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
}

.ucb-launcher {
	display: grid;
	place-items: center;
	width: 58px;
	height: 58px;
	border-radius: 50%;
	background: var(--ucb-theme);
	color: #fff;
	box-shadow: 0 10px 24px rgba(0,0,0,.22);
}

.ucb-launcher-close { display: none; }
.ucb.is-open .ucb-launcher-open { display: none; }
.ucb.is-open .ucb-launcher-close { display: block; }

.ucb-typing span {
	display: inline-block;
	width: 6px;
	height: 6px;
	margin-right: 3px;
	border-radius: 50%;
	background: #9aa0a6;
	animation: ucb-dot 1s infinite;
}

.ucb-typing span:nth-child(2) { animation-delay: .15s; }
.ucb-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes ucb-dot {
	0%, 80%, 100% { opacity: .35; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 640px) {
	.ucb { right: 12px; bottom: 12px; }
	.ucb-panel {
		width: min(100vw - 16px, 420px);
		height: min(78vh, 640px);
	}
}
