.htpl-chat-root {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 9999;
	font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.htpl-chat-toggle {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	background: #015790;
	color: #fff;
	border: none;
	box-shadow: 0 6px 20px rgba(1,65,108, 0.35);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease, background 0.2s ease;
}
.htpl-chat-toggle:hover { background: #01416c; transform: scale(1.05); }
.htpl-chat-toggle svg { width: 26px; height: 26px; }
.htpl-chat-toggle-open { background: #01416c; }

.htpl-chat-panel {
	position: absolute;
	right: 0;
	bottom: 74px;
	width: 340px;
	max-width: calc(100vw - 24px);
	height: 480px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.htpl-chat-header {
	background: #015790;
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}
.htpl-chat-header-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.htpl-chat-dot { width: 8px; height: 8px; border-radius: 50%; background: #a3c9e6; display: inline-block; }
.htpl-chat-close { background: none; border: none; color: #fff; cursor: pointer; padding: 2px; opacity: 0.85; }
.htpl-chat-close:hover { opacity: 1; }
.htpl-chat-close svg { width: 18px; height: 18px; }

.htpl-chat-body {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: #f6f9fc;
}

.htpl-chat-row { display: flex; }
.htpl-chat-row-user { justify-content: flex-end; }
.htpl-chat-row-bot { justify-content: flex-start; }

.htpl-chat-bubble {
	max-width: 85%;
	padding: 9px 13px;
	border-radius: 14px;
	font-size: 15px;
	line-height: 1.45;
}
.htpl-chat-bubble-user { background: #015790; color: #fff; border-bottom-right-radius: 4px; }
.htpl-chat-bubble-bot { background: #fff; color: #333; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; }

.htpl-chat-typing .htpl-chat-bubble-bot { display: flex; gap: 4px; align-items: center; padding: 12px 14px; }
.htpl-chat-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9ca3af;
	display: inline-block;
	animation: htpl-typing-bounce 1.2s infinite ease-in-out;
}
.htpl-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.htpl-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes htpl-typing-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

.htpl-chat-form {
	display: flex;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid #eee;
	flex-shrink: 0;
	background: #fff;
}
.htpl-chat-input {
	flex: 1;
	border: 1px solid #ddd;
	border-radius: 20px;
	padding: 9px 14px;
	font-size: 15px;
	outline: none;
}
.htpl-chat-input:focus { border-color: #015790; }
.htpl-chat-send {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: #015790;
	color: #fff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.htpl-chat-send:hover { background: #01416c; }
.htpl-chat-send svg { width: 16px; height: 16px; }

/* Lead capture inline form */
.htpl-lead-form { max-width: 92% !important; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.htpl-lead-intro { margin: 0 0 2px; font-size: 14px; color: #555; }
.htpl-lead-form input {
	border: 1px solid #ddd;
	border-radius: 8px;
	padding: 7px 10px;
	font-size: 14px;
	outline: none;
	width: 100%;
	box-sizing: border-box;
}
.htpl-lead-form input:focus { border-color: #015790; }
.htpl-lead-error { margin: 0; font-size: 12px; color: #ef4444; }
.htpl-lead-submit {
	width: 100%;
	padding: 7px 10px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	border: none;
	margin-top: 2px;
	background: #015790;
	color: #fff;
}
.htpl-lead-submit:hover { background: #01416c; }
.htpl-lead-done { opacity: 0.6; }

@media (max-width: 400px) {
	.htpl-chat-root { right: 12px; bottom: 12px; }
	.htpl-chat-panel { width: calc(100vw - 24px); }
}
