.hd-chat {
	--hd-chat-accent: #5b3df5;
	position: fixed;
	z-index: 999999;
	bottom: 22px;
	font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: #16151d;
}
.hd-chat--right { right: 22px; }
.hd-chat--left { left: 22px; }
.hd-chat *, .hd-chat *::before, .hd-chat *::after { box-sizing: border-box; }
.hd-chat__launcher {
	float: right;
	width: 60px;
	height: 60px;
	border: 0;
	border-radius: 50%;
	background: var(--hd-chat-accent);
	color: #fff;
	font-size: 25px;
	box-shadow: 0 12px 34px rgba(23, 18, 56, .25);
	cursor: pointer;
}
.hd-chat--left .hd-chat__launcher { float: left; }
.hd-chat__badge {
	position: absolute;
	top: -2px;
	right: -2px;
	width: 14px;
	height: 14px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: #ef394f;
}
.hd-chat__panel {
	display: flex;
	flex-direction: column;
	width: min(370px, calc(100vw - 28px));
	max-height: min(590px, calc(100vh - 110px));
	margin-bottom: 12px;
	border: 1px solid rgba(24, 20, 46, .12);
	border-radius: 20px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 22px 70px rgba(23, 18, 56, .22);
}
.hd-chat.has-conversation .hd-chat__panel { height: min(590px, calc(100vh - 110px)); }
.hd-chat__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 18px;
	background: var(--hd-chat-accent);
	color: #fff;
}
.hd-chat__header strong, .hd-chat__header small { display: block; color: inherit; }
.hd-chat__header small { margin-top: 2px; opacity: .82; font-size: 12px; }
.hd-chat__header button {
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}
.hd-chat__intro { padding: 16px 18px 6px; color: #4f4c5e; }
.hd-chat__start { min-height: 0; padding: 12px 18px 18px; overflow: auto; }
.hd-chat__start label { display: block; margin: 0 0 12px; font-size: 13px; font-weight: 650; }
.hd-chat__start label span { color: #777381; font-weight: 400; }
.hd-chat__start input, .hd-chat__start textarea, .hd-chat__composer textarea {
	width: 100%;
	margin-top: 5px;
	border: 1px solid #d8d5df;
	border-radius: 10px;
	padding: 10px 11px;
	background: #fff;
	color: #16151d;
	font: inherit;
	resize: vertical;
}
.hd-chat__start input:focus, .hd-chat__start textarea:focus, .hd-chat__composer textarea:focus {
	outline: 2px solid color-mix(in srgb, var(--hd-chat-accent) 28%, transparent);
	border-color: var(--hd-chat-accent);
}
.hd-chat__start > button {
	width: 100%;
	border: 0;
	border-radius: 10px;
	padding: 11px 15px;
	background: var(--hd-chat-accent);
	color: #fff;
	font-weight: 700;
	cursor: pointer;
}
.hd-chat__start > small { display: block; margin-top: 10px; color: #777381; font-size: 11px; text-align: center; }
.hd-chat__hp { position: absolute !important; left: -10000px !important; }
.hd-chat__messages {
	flex: 1 1 auto;
	min-height: 0;
	padding: 12px 15px;
	overflow-y: auto;
	background: #f7f6f9;
}
.hd-chat__message { display: flex; flex-direction: column; align-items: flex-start; margin: 8px 0; }
.hd-chat__message--visitor { align-items: flex-end; }
.hd-chat__message p {
	max-width: 82%;
	margin: 0;
	padding: 10px 12px;
	border-radius: 14px 14px 14px 4px;
	background: #fff;
	box-shadow: 0 2px 8px rgba(20, 16, 40, .07);
	white-space: pre-wrap;
}
.hd-chat__message--visitor p {
	border-radius: 14px 14px 4px 14px;
	background: var(--hd-chat-accent);
	color: #fff;
}
.hd-chat__message small { margin-top: 3px; color: #777381; font-size: 10px; }
.hd-chat__composer {
	flex: 0 0 auto;
	display: flex;
	gap: 8px;
	align-items: flex-end;
	padding: 10px;
	border-top: 1px solid #e9e7ed;
}
.hd-chat__composer textarea { margin: 0; min-height: 44px; max-height: 100px; resize: none; }
.hd-chat__composer button {
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 10px;
	background: var(--hd-chat-accent);
	color: #fff;
	font-size: 20px;
	cursor: pointer;
}
.hd-chat__error { position: absolute; right: 12px; bottom: 74px; left: 12px; margin: 0; padding: 8px 10px; border-radius: 8px; background: #fff0f2; color: #a61d35; font-size: 12px; }
@media (max-width: 520px) {
	.hd-chat {
		top: 0;
		right: 0;
		bottom: auto;
		left: 0;
		width: 100%;
		height: var(--hd-chat-viewport-height, 100dvh);
		pointer-events: none;
	}
	.hd-chat__launcher {
		position: fixed;
		right: max(14px, env(safe-area-inset-right));
		bottom: max(14px, env(safe-area-inset-bottom));
		float: none;
		pointer-events: auto;
	}
	.hd-chat--left .hd-chat__launcher {
		right: auto;
		left: max(14px, env(safe-area-inset-left));
		float: none;
	}
	.hd-chat.is-open .hd-chat__launcher { display: none; }
	.hd-chat__panel,
	.hd-chat.has-conversation .hd-chat__panel {
		position: fixed;
		top: calc(var(--hd-chat-viewport-top, 0px) + max(8px, env(safe-area-inset-top)));
		right: max(8px, env(safe-area-inset-right));
		bottom: auto;
		left: max(8px, env(safe-area-inset-left));
		width: auto;
		height: calc(var(--hd-chat-viewport-height, 100dvh) - max(16px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
		max-height: none;
		margin: 0;
		border-radius: 16px;
		pointer-events: auto;
	}
	.hd-chat__start { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
	.hd-chat__composer { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}


/* Refined launcher and live availability indicator. */
.hd-chat__launcher {
  width: 62px;
  height: 62px;
  border: 1px solid rgba(255,255,255,.2);
  background: linear-gradient(145deg, var(--hd-chat-accent), #4f36b8);
  box-shadow: 0 14px 34px rgba(52,35,132,.34), inset 0 1px 0 rgba(255,255,255,.22);
}
.hd-chat__launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(52,35,132,.42), inset 0 1px 0 rgba(255,255,255,.24); }
.hd-chat__launcher-icon { display:grid; width:32px; height:32px; place-items:center; color:#fff; }
.hd-chat__launcher-icon svg { display:block; width:30px; height:30px; overflow:visible; }
.hd-chat__launcher-icon path { fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.hd-chat__header [data-status] { display:inline-flex; align-items:center; gap:7px; margin-top:5px; font-weight:600; line-height:1.25; }
.hd-chat__header [data-status]::before { content:''; width:8px; height:8px; flex:0 0 8px; border-radius:50%; background:#f1b84b; box-shadow:0 0 0 3px rgba(241,184,75,.16); }
.hd-chat__header [data-status].is-online::before { background:#41d394; box-shadow:0 0 0 3px rgba(65,211,148,.17), 0 0 10px rgba(65,211,148,.5); }
.hd-chat__header [data-status].is-offline::before { background:#f1b84b; box-shadow:0 0 0 3px rgba(241,184,75,.16); }
@media (max-width: 520px) {
  .hd-chat__launcher { width:58px; height:58px; }
  .hd-chat__launcher-icon svg { width:28px; height:28px; }
}
