.bofs-assistant {
	--bofs-assistant-blue: #2563eb;
	--bofs-assistant-purple: #7c3aed;
	--bofs-assistant-navy: #0b1220;
	--bofs-assistant-muted: #64748b;
	--bofs-assistant-border: #e2e8f0;
	--bofs-assistant-surface: #fff;
	--bofs-assistant-soft: #f8fafc;
	position: fixed;
	right: max(22px, env(safe-area-inset-right));
	bottom: max(22px, env(safe-area-inset-bottom));
	z-index: 99999;
	font-family: inherit;
	color: var(--bofs-assistant-navy);
}

.admin-bar .bofs-assistant { z-index: 99998; }
.admin-bar .bofs-assistant__panel { height: min(640px, calc(100vh - 76px)); height: min(640px, calc(100dvh - 76px)); }

.bofs-assistant *, .bofs-assistant *::before, .bofs-assistant *::after { box-sizing: border-box; }

.bofs-assistant button, .bofs-assistant textarea, .bofs-assistant input, .bofs-assistant select { font: inherit; }
.bofs-assistant .screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.bofs-assistant__launcher {
	display: flex;
	align-items: center;
	gap: 9px;
	min-height: 56px;
	padding: 0 18px;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--bofs-assistant-blue), var(--bofs-assistant-purple));
	box-shadow: 0 15px 35px rgba(37, 99, 235, .3), 0 4px 12px rgba(11, 18, 32, .16);
	color: #fff;
	cursor: pointer;
	transition: transform .2s ease, box-shadow .2s ease;
}

.bofs-assistant__launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(37, 99, 235, .36), 0 5px 14px rgba(11, 18, 32, .18); }
.bofs-assistant__launcher-icon { display: grid; width: 25px; height: 25px; place-items: center; }
.bofs-assistant__launcher svg { width: 25px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.bofs-assistant__launcher-label { font-size: 14px; font-weight: 700; letter-spacing: .01em; }

.bofs-assistant__panel {
	position: absolute;
	right: 0;
	bottom: 0;
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
	width: min(410px, calc(100vw - 44px));
	height: min(650px, calc(100vh - 44px));
	height: min(650px, calc(100dvh - 44px));
	max-height: calc(100vh - 44px);
	max-height: calc(100dvh - 44px);
	overflow: hidden;
	border: 1px solid rgba(226, 232, 240, .9);
	border-radius: 22px;
	background: var(--bofs-assistant-surface);
	box-shadow: 0 28px 70px rgba(11, 18, 32, .22), 0 8px 24px rgba(11, 18, 32, .1);
	transform-origin: right bottom;
	animation: bofs-assistant-enter .22s ease-out;
}

.bofs-assistant__panel[hidden] { display: none; }

.bofs-assistant__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 70px;
	padding: 11px 12px 11px 18px;
	background: linear-gradient(135deg, #0b1220, #14254a);
	color: #fff;
}

.bofs-assistant__header h2 { margin: 0 0 2px; color: inherit; font-size: 17px; font-weight: 750; line-height: 1.2; }
.bofs-assistant__header p { margin: 0; color: #cbd5e1; font-size: 12px; line-height: 1.4; }
.bofs-assistant__header-actions { display: flex; gap: 4px; }
.bofs-assistant__icon-button { display: grid; width: 42px; height: 42px; padding: 0; place-items: center; border: 0; border-radius: 12px; background: transparent; color: #e2e8f0; cursor: pointer; }
.bofs-assistant__icon-button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.bofs-assistant__icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.bofs-assistant__content { min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 17px 15px 14px; background: var(--bofs-assistant-soft); overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
.bofs-assistant__content::-webkit-scrollbar { width: 6px; }
.bofs-assistant__content::-webkit-scrollbar-track { background: transparent; }
.bofs-assistant__content::-webkit-scrollbar-thumb { border-radius: 999px; background: #cbd5e1; }
.bofs-assistant__messages { display: flex; flex-direction: column; gap: 10px; }
.bofs-assistant__message { display: flex; flex-direction: column; align-items: flex-start; }
.bofs-assistant__message--visitor { align-items: flex-end; }
.bofs-assistant__bubble { max-width: 84%; padding: 10px 12px; border: 1px solid #dbeafe; border-radius: 6px 15px 15px; background: #eff6ff; color: var(--bofs-assistant-navy); font-size: 13.5px; line-height: 1.48; overflow-wrap: anywhere; white-space: pre-wrap; }
.bofs-assistant__message--visitor .bofs-assistant__bubble { border-color: transparent; border-radius: 15px 6px 15px 15px; background: linear-gradient(135deg, var(--bofs-assistant-blue), #4f46e5); color: #fff; }
.bofs-assistant__message--system .bofs-assistant__bubble { max-width: 100%; border-color: var(--bofs-assistant-border); border-radius: 12px; background: #fff; color: var(--bofs-assistant-muted); font-size: 12px; }
.bofs-assistant__contact-links { display: flex; flex-direction: column; gap: 5px; margin-top: 9px; }
.bofs-assistant__contact-links a { color: #1d4ed8; font-weight: 650; overflow-wrap: anywhere; }

.bofs-assistant__typing { display: inline-flex; align-items: center; gap: 5px; min-width: 58px; }
.bofs-assistant__typing i { width: 7px; height: 7px; border-radius: 50%; background: #64748b; animation: bofs-assistant-dot 1.1s infinite ease-in-out; }
.bofs-assistant__typing i:nth-child(2) { animation-delay: .14s; }
.bofs-assistant__typing i:nth-child(3) { animation-delay: .28s; }

.bofs-assistant__composer { display: flex; align-items: center; flex-shrink: 0; gap: 9px; min-height: 68px; padding: 11px 12px; border-top: 1px solid var(--bofs-assistant-border); background: #fff; }
.bofs-assistant__composer textarea { flex: 1; min-width: 0; height: 44px; min-height: 44px; max-height: 104px; padding: 10px 12px; overflow-x: hidden; overflow-y: hidden; border: 1px solid #cbd5e1; border-radius: 13px; outline: 0; background: var(--bofs-assistant-soft); color: var(--bofs-assistant-navy); font-size: 14px; line-height: 22px; resize: none; }
.bofs-assistant__composer button { display: grid; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; place-items: center; border: 0; border-radius: 12px; background: var(--bofs-assistant-blue); color: #fff; cursor: pointer; }
.bofs-assistant__composer button:disabled { cursor: not-allowed; opacity: .42; }
.bofs-assistant__composer svg { width: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.bofs-assistant :focus-visible { outline: 3px solid rgba(37, 99, 235, .34); outline-offset: 2px; }
.bofs-assistant__header :focus-visible { outline-color: rgba(255, 255, 255, .65); }

@keyframes bofs-assistant-enter { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes bofs-assistant-dot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

@media (max-width: 600px) {
	.bofs-assistant { right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); }
	.bofs-assistant__launcher { padding: 0 15px; }
	.bofs-assistant__panel { position: fixed; right: max(10px, env(safe-area-inset-right)); bottom: calc(max(10px, env(safe-area-inset-bottom)) + var(--bofs-assistant-keyboard-offset, 0px)); width: min(92vw, 410px); max-width: calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)); height: min(650px, 72vh); height: min(650px, 72dvh, var(--bofs-assistant-mobile-height, 72dvh)); max-height: 72vh; max-height: min(72dvh, var(--bofs-assistant-mobile-height, 72dvh)); border-radius: 18px; }
	.admin-bar .bofs-assistant__panel { height: min(650px, 72vh); height: min(650px, 72dvh, var(--bofs-assistant-mobile-height, 72dvh)); }
	.bofs-assistant__content { padding: 16px 12px 14px; }
	.bofs-assistant__bubble { max-width: 90%; }
}

@media (max-width: 350px) {
	.bofs-assistant__header { padding-left: 14px; }
	.bofs-assistant__header p { font-size: 11px; }
	.bofs-assistant__composer { gap: 7px; padding-inline: 9px; }
}

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