/* Hub AI livechat — #arvinlink-hub-chat (compact panel, tawk-control visual language) */
#arvinlink-hub-chat-launcher {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 2147482999;
	width: 56px;
	height: 56px;
	border: none;
	border-radius: 50%;
	background: var(--al-hub-accent, #6366f1);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#arvinlink-hub-chat-launcher:hover {
	transform: scale(1.04);
	box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
}
#arvinlink-hub-chat-launcher.al-hidden {
	display: none;
}

#arvinlink-hub-chat {
	position: fixed;
	/* bottom set in JS to align with headset button; fallback below */
	bottom: var(--al-hub-panel-bottom, 90px);
	right: var(--al-hub-panel-right, 92px);
	z-index: 2147483000;
	width: 360px;
	max-width: calc(100vw - 32px);
	/* Fixed chat size — content scrolls inside .al-body (Tawk-like). */
	height: var(--al-hub-panel-height, 420px);
	min-height: var(--al-hub-panel-height, 420px);
	max-height: var(--al-hub-panel-height, 420px);
	display: none;
	flex-direction: column;
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 0.2s ease, transform 0.2s ease, height 0.2s ease, max-height 0.2s ease;
	border-radius: 16px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 12px 40px rgba(15, 23, 42, 0.22);
	font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
	font-size: 14px;
}
#arvinlink-hub-chat.al-open {
	display: flex;
	opacity: 1;
	transform: translateY(0);
}
/* Inquiry card open: taller panel (JS may override with exact px). */
#arvinlink-hub-chat.al-has-form {
	--al-hub-panel-height: min(560px, calc(100vh - 24px));
}

#arvinlink-hub-chat .al-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	color: #fff;
	background: var(--al-hub-accent, #6366f1);
	flex: 0 0 auto;
}
#arvinlink-hub-chat .al-ava {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	flex: 0 0 38px;
	background: rgba(255, 255, 255, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 15px;
	overflow: hidden;
}
#arvinlink-hub-chat .al-ava.al-ava-img {
	background: #fff;
}
#arvinlink-hub-chat .al-ava img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}
#arvinlink-hub-chat .al-meta {
	flex: 1;
	min-width: 0;
}
#arvinlink-hub-chat .al-name {
	font-weight: 700;
	font-size: 14px;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#arvinlink-hub-chat .al-sub {
	font-size: 11.5px;
	opacity: 0.9;
	display: flex;
	align-items: center;
	gap: 5px;
	margin-top: 2px;
}
#arvinlink-hub-chat .al-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #4ade80;
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}
#arvinlink-hub-chat .al-x {
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	opacity: 0.85;
	padding: 2px 4px;
	border-radius: 6px;
	border: none;
	background: transparent;
	color: inherit;
}
#arvinlink-hub-chat .al-x:hover {
	opacity: 1;
	background: rgba(255, 255, 255, 0.18);
}

#arvinlink-hub-chat .al-body {
	padding: 14px 14px 8px;
	flex: 1 1 auto;
	min-height: 0; /* allow flex child to scroll inside fixed panel */
	overflow-y: auto;
	overscroll-behavior: contain;
	background: #f7f8fa;
	-webkit-overflow-scrolling: touch;
}
#arvinlink-hub-chat .al-row {
	display: flex;
	margin-bottom: 10px;
	align-items: flex-end;
	gap: 8px;
}
#arvinlink-hub-chat .al-row.al-me {
	flex-direction: row-reverse;
}
#arvinlink-hub-chat .al-bub {
	max-width: 82%;
	padding: 9px 12px;
	border-radius: 14px;
	font-size: 13.5px;
	word-wrap: break-word;
	line-height: 1.45;
}
#arvinlink-hub-chat .al-row.al-agent .al-bub {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-bottom-left-radius: 4px;
}
#arvinlink-hub-chat .al-row.al-me .al-bub {
	background: var(--al-hub-accent, #6366f1);
	color: #fff;
	border-bottom-right-radius: 4px;
}

#arvinlink-hub-chat .al-card {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 12px;
	margin-top: 4px;
}
#arvinlink-hub-chat .al-card h4 {
	margin: 0 0 8px;
	font-size: 13px;
	font-weight: 700;
	color: #111827;
}
#arvinlink-hub-chat .al-form.al-form-done {
	opacity: 0.92;
	pointer-events: none;
}
#arvinlink-hub-chat .al-form.al-form-done .al-submit {
	display: none;
}
#arvinlink-hub-chat .al-form.al-form-compact {
	padding: 6px 8px 8px;
	border-radius: 10px;
	background: #fff;
}
#arvinlink-hub-chat .al-form-nudge {
	margin: 0 0 5px;
	padding: 6px 8px;
	font-size: 11.5px;
	font-weight: 700;
	line-height: 1.3;
	color: #1f2937;
	background: #fef9c3;
	border: 1px solid #facc15;
	border-radius: 7px;
}
#arvinlink-hub-chat .al-form.al-form-compact h4 {
	margin: 0 0 4px;
	font-size: 11.5px;
	font-weight: 700;
	color: #374151;
}
#arvinlink-hub-chat .al-form-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 5px 8px;
	margin: 0;
}
#arvinlink-hub-chat .al-form-grid .al-form-span2 {
	grid-column: 1 / -1;
}
#arvinlink-hub-chat .al-form.al-form-compact label {
	display: flex;
	flex-direction: column;
	gap: 1px;
	font-size: 10.5px;
	font-weight: 600;
	color: #4b5563;
	margin: 0;
	min-width: 0;
}
#arvinlink-hub-chat .al-form.al-form-compact label > span {
	line-height: 1.15;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#arvinlink-hub-chat .al-form.al-form-compact input,
#arvinlink-hub-chat .al-form.al-form-compact textarea {
	width: 100%;
	padding: 4px 7px;
	border: 1px solid #d1d5db;
	border-radius: 5px;
	font-size: 12px;
	line-height: 1.2;
	box-sizing: border-box;
	min-width: 0;
}
#arvinlink-hub-chat .al-form.al-form-compact textarea {
	min-height: 36px;
	resize: vertical;
}

#arvinlink-hub-chat .al-req-star {
	color: #dc2626;
	font-style: normal;
	margin-left: 2px;
	font-weight: 700;
}
#arvinlink-hub-chat .al-field-err {
	display: block;
	min-height: 0;
	margin: 1px 0 0;
	font-size: 10px;
	font-weight: 600;
	line-height: 1.2;
	color: #dc2626;
}
#arvinlink-hub-chat label.al-invalid .al-field-lab {
	color: #b91c1c;
}
#arvinlink-hub-chat .al-invalid-input,
#arvinlink-hub-chat label.al-invalid input,
#arvinlink-hub-chat label.al-invalid textarea {
	border-color: #ef4444 !important;
	background: #fef2f2;
}
#arvinlink-hub-chat .al-form-err {
	margin: 4px 0 0;
	padding: 0;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.3;
	color: #dc2626;
}
#arvinlink-hub-chat .al-form.al-form-compact button.al-submit {
	margin-top: 6px;
	width: 100%;
	padding: 6px;
	border: none;
	border-radius: 6px;
	background: var(--al-hub-accent, #6366f1);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
}
@media (max-width: 380px) {
	#arvinlink-hub-chat .al-form-grid {
		grid-template-columns: 1fr;
	}
}
#arvinlink-hub-chat .al-form label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: #374151;
	margin: 8px 0 4px;
}
#arvinlink-hub-chat .al-form input,
#arvinlink-hub-chat .al-form textarea {
	width: 100%;
	padding: 9px 11px;
	border: 1px solid #d1d5db;
	border-radius: 9px;
	font-size: 13.5px;
	box-sizing: border-box;
}
#arvinlink-hub-chat .al-form textarea {
	min-height: 72px;
	resize: vertical;
}
#arvinlink-hub-chat .al-form button.al-submit {
	margin-top: 10px;
	width: 100%;
	padding: 10px;
	border: none;
	border-radius: 9px;
	background: var(--al-hub-accent, #6366f1);
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}
#arvinlink-hub-chat .al-compose.al-needs-lead input {
	cursor: pointer;
}
#arvinlink-hub-chat .al-bub-form {
	max-width: 100%;
	padding: 0;
	background: transparent;
	box-shadow: none;
}
#arvinlink-hub-chat .al-handoff a {
	display: block;
	margin: 6px 0;
	color: var(--al-hub-accent, #6366f1);
	text-decoration: none;
	font-weight: 600;
}
#arvinlink-hub-chat .al-handoff .al-note {
	font-size: 12px;
	color: #6b7280;
	margin-top: 8px;
}

#arvinlink-hub-chat .al-form-help {
	margin: 0 0 8px;
	font-size: 12px;
	line-height: 1.45;
	color: #6b7280;
}
#arvinlink-hub-chat .al-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 12px 10px;
	background: #f7f8fa;
	flex: 0 0 auto;
}
#arvinlink-hub-chat .al-chips:empty {
	display: none;
}
#arvinlink-hub-chat .al-chip {
	border: 1px solid #d1d5db;
	background: #fff;
	color: #374151;
	border-radius: 999px;
	padding: 6px 12px;
	font-size: 12.5px;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
#arvinlink-hub-chat .al-chip:hover {
	border-color: var(--al-hub-accent, #6366f1);
	color: var(--al-hub-accent, #6366f1);
	background: #fff;
}

#arvinlink-hub-chat .al-compose {
	display: flex;
	gap: 8px;
	padding: 10px 12px 12px;
	background: #f7f8fa;
	border-top: 1px solid #e5e7eb;
	flex: 0 0 auto;
}
#arvinlink-hub-chat .al-compose input {
	flex: 1;
	padding: 10px 12px;
	border: 1px solid #d1d5db;
	border-radius: 20px;
	font-size: 13.5px;
}
#arvinlink-hub-chat .al-compose button {
	border: none;
	border-radius: 20px;
	padding: 0 14px;
	background: var(--al-hub-accent, #6366f1);
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}
#arvinlink-hub-chat .al-compose.al-disabled {
	opacity: 0.55;
	pointer-events: none;
}

#arvinlink-hub-chat .al-typing {
	display: inline-flex;
	gap: 4px;
	padding: 11px 12px;
}
#arvinlink-hub-chat .al-typing i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #c4c8ce;
	display: inline-block;
	animation: al-hub-bounce 1.2s infinite ease-in-out;
}
#arvinlink-hub-chat .al-typing i:nth-child(2) {
	animation-delay: 0.15s;
}
#arvinlink-hub-chat .al-typing i:nth-child(3) {
	animation-delay: 0.3s;
}
@keyframes al-hub-bounce {
	0%, 80%, 100% {
		transform: translateY(0);
	}
	40% {
		transform: translateY(-5px);
	}
}

/* Launcher (fallback only). Panel bottom/right are set in JS to align with headset. */
body.arvinlink-has-float-stack #arvinlink-hub-chat-launcher {
	bottom: calc(24px + var(--al-float-stack-offset, 220px));
	right: 24px;
	z-index: 2147483000;
}
body.arvinlink-has-float-stack #arvinlink-hub-chat,
html.arvinlink-has-float-stack #arvinlink-hub-chat {
	right: var(--al-hub-panel-right, 92px);
	bottom: var(--al-hub-panel-bottom, 90px);
}
/* Float stack is portaled onto <html>, so match on html/document — not body only. */
html:has(.arvinlink-float-hubai) #arvinlink-hub-chat-launcher,
body:has(.arvinlink-float-hubai) #arvinlink-hub-chat-launcher,
html:has([data-arvinlink-hub-chat="1"]) #arvinlink-hub-chat-launcher,
#arvinlink-hub-chat-launcher.al-removed {
	display: none !important;
	pointer-events: none !important;
	visibility: hidden !important;
}
@media (max-width: 640px) {
	#arvinlink-hub-chat {
		left: 12px;
		right: 12px !important;
		width: auto;
		max-width: none;
		--al-hub-panel-height: min(420px, calc(100vh - 96px));
		bottom: var(--al-hub-panel-bottom, 78px);
	}
	#arvinlink-hub-chat.al-has-form {
		--al-hub-panel-height: min(460px, calc(100vh - 72px));
	}
	body.arvinlink-has-float-stack #arvinlink-hub-chat-launcher {
		bottom: calc(16px + var(--al-float-stack-offset, 200px));
		right: 16px;
	}
	body.arvinlink-has-float-stack #arvinlink-hub-chat,
	html.arvinlink-has-float-stack #arvinlink-hub-chat {
		left: 12px;
		right: 12px !important;
		bottom: var(--al-hub-panel-bottom, 78px);
	}
}

/* Read-only inquiry snapshot in thread (after submit) */
#arvinlink-hub-chat .al-lead-summary {
	padding: 8px 10px;
	border-radius: 10px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	max-width: 100%;
}
#arvinlink-hub-chat .al-lead-title {
	font-size: 11.5px;
	font-weight: 700;
	color: #334155;
	margin: 0 0 6px;
}
#arvinlink-hub-chat .al-lead-row {
	display: grid;
	grid-template-columns: 88px 1fr;
	gap: 4px 8px;
	font-size: 12px;
	line-height: 1.35;
	margin: 0 0 3px;
}
#arvinlink-hub-chat .al-lead-k {
	color: #64748b;
	font-weight: 600;
}
#arvinlink-hub-chat .al-lead-v {
	color: #0f172a;
	word-break: break-word;
	white-space: pre-wrap;
}
#arvinlink-hub-chat .al-lead-pre {
	margin: 0;
	font-family: inherit;
	font-size: 12px;
	line-height: 1.4;
	white-space: pre-wrap;
	color: #0f172a;
}
#arvinlink-hub-chat .al-bub:has(.al-lead-summary) {
	background: transparent;
	padding: 0;
	max-width: 100%;
}
