/* 全站右下角 AI 客服：圆形 SVG 按钮 + 本页对话窗。低于下载闸门 / 登录面板。
   按钮图：/template/1/default/images/kyd-ai-chat-fab.svg
   位置：X 与原先在线咨询一致（right:44px）；Y 与原先「回到顶部」一致（bottom:30px）。 */
.kyd-ai-chat {
	position: fixed;
	z-index: 9800;
	right: calc(44px + env(safe-area-inset-right, 0px));
	bottom: 30px;
	pointer-events: none;
	font-family: "HarmonyOS Sans SC Regular", "PingFang SC", sans-serif;
}

.kyd-ai-chat-fab,
.kyd-ai-chat-panel,
.kyd-ai-chat-close,
.kyd-ai-chat-new {
	pointer-events: auto;
}

.kyd-ai-chat-fab {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: #fff;
	color: #00a1e9;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kyd-ai-chat-fab:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
}

.kyd-ai-chat-fab.is-open {
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

.kyd-ai-chat-fab-img {
	display: block;
	width: 34px;
	height: 34px;
	object-fit: contain;
	pointer-events: none;
}

.kyd-ai-chat-fab-text {
	display: none !important;
}

.kyd-ai-chat-panel {
	position: absolute;
	right: 0;
	bottom: 76px;
	width: 380px;
	height: min(560px, calc(100vh - 120px));
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 12px 40px rgba(0, 35, 61, 0.28);
	border: 1px solid rgba(0, 35, 61, 0.08);
}

.kyd-ai-chat-panel[hidden],
.kyd-ai-chat[hidden] {
	display: none !important;
}

.kyd-ai-chat-bar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 10px 10px 16px;
	background: #00233d;
	color: #fff;
}

.kyd-ai-chat-bar-text {
	flex: 1;
	min-width: 0;
}

.kyd-ai-chat-title {
	margin: 0;
	font-size: 15px;
	line-height: 1.3;
	font-family: "HarmonyOS Sans SC Medium", "PingFang SC", sans-serif;
}

.kyd-ai-chat-sub {
	margin: 2px 0 0;
	font-size: 12px;
	line-height: 1.3;
	color: rgba(255, 255, 255, 0.72);
	font-family: "HarmonyOS Sans SC Light", "PingFang SC", sans-serif;
}

.kyd-ai-chat-new {
	flex-shrink: 0;
	color: #00d4ff;
	text-decoration: none;
	font-size: 12px;
	padding: 4px 6px;
	border-radius: 4px;
}

.kyd-ai-chat-new:hover {
	background: rgba(0, 212, 255, 0.12);
}

.kyd-ai-chat-close {
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	border: none;
	background: transparent;
	color: #fff;
	cursor: pointer;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.kyd-ai-chat-close:hover {
	background: rgba(255, 255, 255, 0.12);
}

.kyd-ai-chat-frame {
	flex: 1;
	width: 100%;
	border: 0;
	background: #f6f8fa;
}

@media (max-width: 768px) {
	.kyd-ai-chat {
		right: calc(16px + env(safe-area-inset-right, 0px));
		bottom: 30px;
	}

	.kyd-ai-chat-panel {
		position: fixed;
		inset: 0;
		width: auto;
		height: auto;
		max-height: none;
		bottom: 0;
		right: 0;
		border-radius: 0;
		z-index: 9801;
	}

	.kyd-ai-chat-new-label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
	}

	body.kyd-ai-chat-open {
		overflow: hidden;
	}
}
