/* Hengyi AI Advisor - all selectors are prefixed .hy-ai- to avoid theme/Elementor clashes. */
.hy-ai-root, .hy-ai-root * { box-sizing: border-box; }
.hy-ai-root {
	--hy-primary: #C00000;
	--hy-dark: #12202A;
	--hy-bg: #ffffff;
	--hy-text: #1b2730;
	--hy-muted: #5b6770;
	--hy-line: #dfe4e8;
	--hy-bot: #eef1f4;
	font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--hy-text);
	letter-spacing: normal;
	text-transform: none;
}
.hy-ai-root button, .hy-ai-root input, .hy-ai-root select, .hy-ai-root textarea { font: inherit; color: inherit; }
.hy-ai-root p { margin: 0 0 .5em; }
.hy-ai-root p:last-child { margin-bottom: 0; }
.hy-ai-root ul { margin: .25em 0 .25em 1.1em; padding: 0; }
.hy-ai-root button { cursor: pointer; }
.hy-ai-root button:focus-visible, .hy-ai-root a:focus-visible, .hy-ai-root input:focus-visible,
.hy-ai-root textarea:focus-visible, .hy-ai-root select:focus-visible { outline: 3px solid #f2a100; outline-offset: 2px; }

/* Floating placement */
.hy-ai-floating { position: fixed; z-index: 99990; bottom: calc(var(--hy-bottom, 20px) + env(safe-area-inset-bottom, 0px)); }
.hy-ai-pos-right { right: calc(var(--hy-side, 20px) + env(safe-area-inset-right, 0px)); }
.hy-ai-pos-left { left: calc(var(--hy-side, 20px) + env(safe-area-inset-left, 0px)); }
.hy-ai-launcher {
	display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 20px 0 16px;
	background: var(--hy-primary); color: #fff; border: 0; border-radius: 999px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .28); font-weight: 600; font-size: 15px;
	transition: transform .15s ease, box-shadow .15s ease;
}
.hy-ai-launcher:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0, 0, 0, .32); }
.hy-ai-launcher-icon { font-size: 20px; line-height: 1; }
.hy-ai-open .hy-ai-launcher { display: none; }

/* Panel */
.hy-ai-panel {
	display: flex; flex-direction: column; position: relative; overflow: hidden;
	width: 380px; max-width: calc(100vw - 24px);
	height: min(640px, calc(100vh - 40px)); height: min(640px, calc(100dvh - 40px));
	background: var(--hy-bg); border-radius: 16px; border: 1px solid var(--hy-line);
	box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
}
.hy-ai-panel[hidden] { display: none; }
.hy-ai-inline { width: 100%; max-width: 760px; margin: 0 auto; }
.hy-ai-inline .hy-ai-panel { width: 100%; max-width: 100%; height: var(--hy-ai-h, 560px); box-shadow: 0 2px 14px rgba(0, 0, 0, .12); }
.hy-ai-inline-mount { --hy-ai-h: 560px; }

.hy-ai-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; background: var(--hy-dark); color: #fff; border-bottom: 3px solid var(--hy-primary); }
.hy-ai-head-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.hy-ai-title { font-size: 16px; font-weight: 700; line-height: 1.2; }
.hy-ai-sub { font-size: 12px; opacity: .8; }
.hy-ai-lang { background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .3); border-radius: 8px; padding: 4px 6px; min-height: 36px; font-size: 13px; }
.hy-ai-lang option { color: #111; }
.hy-ai-iconbtn { background: transparent; border: 0; color: #fff; width: 40px; height: 40px; border-radius: 8px; font-size: 18px; line-height: 1; }
.hy-ai-iconbtn:hover { background: rgba(255, 255, 255, .15); }
.hy-ai-badge { padding: 5px 16px; font-size: 12px; color: var(--hy-muted); background: #f7f9fa; border-bottom: 1px solid var(--hy-line); }

.hy-ai-log { flex: 1 1 auto; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #fff; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.hy-ai-msg { display: flex; flex-direction: column; max-width: 88%; }
.hy-ai-bubble { padding: 10px 13px; border-radius: 14px; word-wrap: break-word; overflow-wrap: anywhere; }
.hy-ai-bot { align-self: flex-start; }
.hy-ai-bot .hy-ai-bubble { background: var(--hy-bot); border-bottom-left-radius: 4px; }
.hy-ai-user { align-self: flex-end; }
.hy-ai-user .hy-ai-bubble { background: var(--hy-primary); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.hy-ai-sys { align-self: stretch; max-width: 100%; }
.hy-ai-sys .hy-ai-bubble { background: #fff7e0; border: 1px solid #f0d98a; color: #4a3b00; font-size: 14px; }
.hy-ai-bubble a { color: inherit; text-decoration: underline; }
.hy-ai-typing .hy-ai-bubble { display: inline-flex; gap: 5px; padding: 12px 14px; }
.hy-ai-dot { width: 7px; height: 7px; border-radius: 50%; background: #8793a0; animation: hy-ai-bounce 1.2s infinite ease-in-out; }
.hy-ai-dot:nth-child(2) { animation-delay: .15s; }
.hy-ai-dot:nth-child(3) { animation-delay: .3s; }
@keyframes hy-ai-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

.hy-ai-fb { display: flex; gap: 4px; align-items: center; margin-top: 3px; flex-wrap: wrap; }
.hy-ai-fbbtn { background: transparent; border: 1px solid transparent; border-radius: 8px; min-width: 32px; min-height: 28px; padding: 0 6px; font-size: 14px; opacity: .55; }
.hy-ai-fbbtn:hover { opacity: 1; border-color: var(--hy-line); }
.hy-ai-fbinput { flex: 1 1 150px; min-height: 32px; padding: 4px 8px; border: 1px solid var(--hy-line); border-radius: 8px; font-size: 14px; }
.hy-ai-fb-done { font-size: 12px; color: var(--hy-muted); }

.hy-ai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
.hy-ai-chips:empty { display: none; }
.hy-ai-chip { background: #fff; color: var(--hy-dark); border: 1px solid var(--hy-primary); border-radius: 999px; padding: 7px 12px; font-size: 13.5px; min-height: 36px; }
.hy-ai-chip:hover { background: var(--hy-primary); color: #fff; }
.hy-ai-human { align-self: flex-start; margin: 0 14px 6px; background: transparent; border: 0; padding: 4px 2px; font-size: 13px; color: var(--hy-muted); text-decoration: underline; }
.hy-ai-human:hover { color: var(--hy-primary); }

.hy-ai-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--hy-line); background: #fff; align-items: flex-end; }
.hy-ai-input { flex: 1 1 auto; resize: none; border: 1px solid #c5ccd2; border-radius: 12px; padding: 10px 12px; font-size: 16px; line-height: 1.35; max-height: 120px; min-height: 44px; background: #fff; }
.hy-ai-send { background: var(--hy-primary); color: #fff; border: 0; border-radius: 12px; min-height: 44px; padding: 0 16px; font-weight: 600; }
.hy-ai-send[disabled] { opacity: .5; cursor: default; }
.hy-ai-note { padding: 0 14px 10px; font-size: 11.5px; color: var(--hy-muted); line-height: 1.35; background: #fff; }

.hy-ai-card { background: #fff; border: 1px solid var(--hy-line); border-radius: 12px; padding: 12px; }
.hy-ai-card-t { font-size: 14px; }
.hy-ai-card-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.hy-ai-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--hy-dark); background: #fff; color: var(--hy-dark); font-size: 14px; text-decoration: none; text-align: center; }
.hy-ai-btn:hover { background: var(--hy-dark); color: #fff; }
.hy-ai-btn-primary { background: var(--hy-primary); border-color: var(--hy-primary); color: #fff; }
.hy-ai-btn-primary:hover { filter: brightness(.9); background: var(--hy-primary); }
.hy-ai-btn[disabled] { opacity: .5; }
.hy-ai-cardwrap { max-width: 100%; align-self: stretch; }

/* Lead form overlay */
.hy-ai-lead { position: absolute; inset: 0; background: #fff; overflow-y: auto; padding: 16px; z-index: 5; }
.hy-ai-lead[hidden] { display: none; }
.hy-ai-lead h3 { margin: 0 0 6px; font-size: 18px; color: var(--hy-dark); }
.hy-ai-lead-intro { font-size: 13px; color: var(--hy-muted); }
.hy-ai-field { display: block; margin: 10px 0; }
.hy-ai-field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.hy-ai-field input, .hy-ai-field select, .hy-ai-field textarea { width: 100%; border: 1px solid #c5ccd2; border-radius: 10px; padding: 9px 11px; font-size: 16px; background: #fff; min-height: 42px; }
.hy-ai-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin: 12px 0; }
.hy-ai-consent input { margin-top: 3px; width: 18px; height: 18px; flex: 0 0 auto; }
.hy-ai-err { color: #b32d2e; font-size: 13.5px; min-height: 1em; }
.hy-ai-hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Phones: full-screen sheet */
@media (max-width: 480px) {
	.hy-ai-floating.hy-ai-open { inset: 0; bottom: 0; right: 0; left: 0; }
	.hy-ai-floating .hy-ai-panel { width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; border: 0; }
	.hy-ai-head { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
	.hy-ai-form { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
	.hy-ai-launcher-label { display: none; }
	.hy-ai-launcher { width: 56px; height: 56px; padding: 0; justify-content: center; }
	.hy-ai-msg { max-width: 94%; }
}
html.hy-ai-noscroll, html.hy-ai-noscroll body { overflow: hidden !important; }

@media (prefers-reduced-motion: reduce) {
	.hy-ai-dot { animation: none; }
	.hy-ai-launcher { transition: none; }
}
@media (prefers-contrast: more) {
	.hy-ai-bot .hy-ai-bubble { border: 1px solid #000; }
}
