#hbw-chat-root {
	position: fixed;
	inset: auto 20px 20px auto;
	z-index: 2147483000;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
}
#hbw-chat-root[data-position="left"] {
	inset: auto auto 20px 20px;
}

.hbw-chat-btn {
	width: 58px;
	height: 58px;
	border: 0;
	border-radius: 50%;
	background: var(--hbw-accent, #6366f1);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
	box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.hbw-chat-btn:hover {
	transform: translateY(-2px) scale(1.03);
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.hbw-chat-btn svg { width: 26px; height: 26px; }

.hbw-chat-panel {
	position: absolute;
	bottom: 74px;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 120px);
	background: #0e1020;
	color: #e8eaf6;
	border: 1px solid rgba(255, 255, 255, 0.09);
	border-radius: 18px;
	overflow: hidden;
	display: none;
	flex-direction: column;
	box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
}
#hbw-chat-root[data-position="right"] .hbw-chat-panel { right: 0; }
#hbw-chat-root[data-position="left"] .hbw-chat-panel { left: 0; }
#hbw-chat-root.open .hbw-chat-panel { display: flex; }
#hbw-chat-root.open .hbw-chat-btn { visibility: hidden; }

.hbw-chat-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 15px 18px;
	background: linear-gradient(135deg, var(--hbw-accent, #6366f1), #4338ca);
	color: #fff;
}
.hbw-chat-title { font-weight: 700; font-size: 15px; }
.hbw-chat-close {
	background: rgba(255, 255, 255, 0.16);
	border: 0;
	color: #fff;
	width: 28px;
	height: 28px;
	border-radius: 8px;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}
.hbw-chat-close:hover { background: rgba(255, 255, 255, 0.3); }

.hbw-chat-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	scrollbar-width: thin;
}

.hbw-msg {
	max-width: 86%;
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 14px;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	white-space: normal;
}
.hbw-assistant {
	align-self: flex-start;
	background: #1a1d33;
	color: #e8eaf6;
	border-bottom-left-radius: 4px;
}
.hbw-user {
	align-self: flex-end;
	background: var(--hbw-accent, #6366f1);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.hbw-msg a { color: #a5b4fc; }
.hbw-user a { color: #fff; }

.hbw-sources {
	margin-top: 8px;
	font-size: 12px;
	opacity: 0.85;
}
.hbw-sources a { color: #a5b4fc; text-decoration: underline; }

.hbw-handoff {
	display: inline-block;
	margin-top: 4px;
	padding: 7px 12px;
	border-radius: 9px;
	background: rgba(99, 102, 241, 0.18);
	border: 1px solid rgba(165, 180, 252, 0.5);
	color: #c7d2fe;
	text-decoration: none;
	font-weight: 600;
	font-size: 13px;
}
.hbw-handoff:hover { background: rgba(99, 102, 241, 0.32); }

.hbw-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.hbw-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #6b7280;
	animation: hbw-blink 1.2s infinite both;
}
.hbw-typing span:nth-child(2) { animation-delay: 0.2s; }
.hbw-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes hbw-blink {
	0%, 80%, 100% { opacity: 0.25; }
	40% { opacity: 1; }
}

.hbw-chat-form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	background: #0b0d19;
}
.hbw-chat-input {
	flex: 1;
	background: #161a2e;
	border: 1px solid rgba(255, 255, 255, 0.1);
	color: #e8eaf6;
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 14px;
	outline: none;
}
.hbw-chat-input:focus { border-color: var(--hbw-accent, #6366f1); }
.hbw-chat-input::placeholder { color: #6b7280; }
.hbw-chat-send {
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 10px;
	background: var(--hbw-accent, #6366f1);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
}
.hbw-chat-send:hover { filter: brightness(1.1); }

@media (max-width: 480px) {
	#hbw-chat-root { inset: auto 12px 12px auto; }
	.hbw-chat-panel {
		position: fixed;
		bottom: 0;
		right: 0;
		left: 0;
		width: 100%;
		max-width: 100%;
		height: 78vh;
		border-radius: 18px 18px 0 0;
	}
}
