.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.live-chat {
	--live-chat-z: 1180;
	position: fixed;
	right: 0.85rem;
	bottom: 0.85rem;
	z-index: var(--live-chat-z);
	font-size: 0.86rem;
}

.live-chat__launcher {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3.1rem;
	height: 3.1rem;
	border: 0;
	border-radius: 999px;
	background: var(--yaoshg-primary);
	color: var(--yaoshg-white);
	box-shadow: 0 8px 22px rgba(0, 114, 83, 0.28);
	cursor: pointer;
	transition: transform 0.2s ease, background 0.2s ease;
}

.live-chat__launcher svg {
	width: 1.35rem;
	height: 1.35rem;
}

.live-chat.is-open .live-chat__nudge {
	display: none !important;
}

.live-chat__launcher:hover {
	transform: translateY(-2px);
	background: var(--yaoshg-primary-dark);
}

.live-chat__launcher-icon--close {
	display: none;
}

.live-chat.is-open .live-chat__launcher-icon--chat {
	display: none;
}

.live-chat.is-open .live-chat__launcher-icon--close {
	display: block;
}

.live-chat__badge {
	position: absolute;
	top: -0.1rem;
	right: -0.1rem;
	min-width: 1rem;
	height: 1rem;
	padding: 0 0.2rem;
	border-radius: 999px;
	background: #e53935;
	color: #fff;
	font-size: 0.62rem;
	font-weight: 700;
	line-height: 1rem;
	text-align: center;
}

.live-chat__nudge {
	display: none;
	position: absolute;
	right: 0;
	bottom: calc(100% + 0.55rem);
	width: min(15.5rem, calc(100vw - 2rem));
	padding: 0.65rem 0.75rem 0.7rem;
	border-radius: 12px;
	background: var(--yaoshg-white);
	border: 1px solid var(--yaoshg-border);
	box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
	animation: live-chat-nudge-in 0.35s ease;
}

.live-chat__nudge.is-visible {
	display: block;
}

.live-chat__nudge::after {
	content: "";
	position: absolute;
	right: 1.1rem;
	bottom: -0.4rem;
	width: 0.7rem;
	height: 0.7rem;
	background: var(--yaoshg-white);
	border-right: 1px solid var(--yaoshg-border);
	border-bottom: 1px solid var(--yaoshg-border);
	transform: rotate(45deg);
}

@keyframes live-chat-nudge-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.live-chat__nudge-close {
	position: absolute;
	top: 0.25rem;
	right: 0.35rem;
	border: 0;
	background: none;
	color: var(--yaoshg-gray);
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
}

.live-chat__nudge-text {
	margin: 0 1rem 0.5rem 0;
	font-size: 0.78rem;
	line-height: 1.4;
	color: var(--yaoshg-dark);
}

.live-chat__nudge-action {
	border: 0;
	border-radius: 999px;
	padding: 0.38rem 0.75rem;
	background: var(--yaoshg-primary);
	color: var(--yaoshg-white);
	font-size: 0.74rem;
	font-weight: 600;
	cursor: pointer;
}

.live-chat__nudge-action:hover {
	background: var(--yaoshg-primary-dark);
}

/* Panel hidden by default — never use display:flex without .is-open */
.live-chat__panel {
	display: none;
	position: absolute;
	right: 0;
	bottom: calc(100% + 0.55rem);
	width: min(17.5rem, calc(100vw - 1.75rem));
	flex-direction: column;
	border-radius: 14px;
	background: var(--yaoshg-white);
	box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16);
	overflow: hidden;
}

.live-chat.is-open .live-chat__panel {
	display: flex;
}

.live-chat.is-open .live-chat__panel--room {
	max-height: min(26rem, calc(100vh - 5rem));
}

.live-chat__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.65rem 0.75rem;
	background: linear-gradient(135deg, var(--yaoshg-primary), var(--yaoshg-primary-dark));
	color: var(--yaoshg-white);
	flex-shrink: 0;
}

.live-chat__title {
	display: block;
	font-size: 0.88rem;
}

.live-chat__subtitle {
	margin: 0.1rem 0 0;
	font-size: 0.7rem;
	opacity: 0.9;
}

.live-chat__close {
	border: 0;
	background: rgba(255, 255, 255, 0.15);
	color: inherit;
	width: 1.65rem;
	height: 1.65rem;
	border-radius: 999px;
	cursor: pointer;
	font-size: 1rem;
	line-height: 1;
	flex-shrink: 0;
}

/* Stages: only one visible at a time */
.live-chat__menu,
.live-chat__gate,
.live-chat__room {
	display: none !important;
}

.live-chat__menu.is-active,
.live-chat__gate.is-active {
	display: block !important;
	padding: 0.65rem;
}

.live-chat__room.is-active {
	display: flex !important;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	padding: 0;
}

.live-chat__identity {
	padding: 0.45rem 0.65rem;
	border-bottom: 1px solid var(--yaoshg-border);
	background: var(--yaoshg-white);
	flex-shrink: 0;
}

.live-chat__identity-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

.live-chat__identity-label {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 0.74rem;
	color: var(--yaoshg-dark);
	word-break: break-all;
}

.live-chat__identity-edit,
.live-chat__identity-save,
.live-chat__identity-cancel {
	border: 0;
	background: none;
	color: var(--yaoshg-primary);
	font-size: 0.72rem;
	font-weight: 600;
	cursor: pointer;
	padding: 0;
}

.live-chat__identity-form input {
	width: 100%;
	margin-bottom: 0.4rem;
	padding: 0.45rem 0.55rem;
	border: 1px solid var(--yaoshg-border);
	border-radius: 8px;
	font: inherit;
	font-size: 0.78rem;
	box-sizing: border-box;
}

.live-chat__identity-actions {
	display: flex;
	gap: 0.65rem;
}

.live-chat__identity-save {
	color: var(--yaoshg-primary);
}

.live-chat__identity-cancel {
	color: var(--yaoshg-gray);
}

.live-chat__option {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	width: 100%;
	margin-bottom: 0.45rem;
	padding: 0.55rem 0.65rem;
	border: 1px solid var(--yaoshg-border);
	border-radius: 10px;
	background: var(--yaoshg-light);
	text-align: left;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease;
}

.live-chat__option:last-child {
	margin-bottom: 0;
}

.live-chat__option:hover {
	border-color: rgba(0, 114, 83, 0.35);
	background: rgba(0, 114, 83, 0.06);
}

.live-chat__option-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border-radius: 999px;
	background: var(--yaoshg-white);
	color: var(--yaoshg-primary);
	flex-shrink: 0;
}

.live-chat__option-icon svg {
	width: 1.1rem;
	height: 1.1rem;
}

.live-chat__option--whatsapp .live-chat__option-icon {
	color: #25d366;
}

.live-chat__option-text strong {
	display: block;
	font-size: 0.82rem;
	color: var(--yaoshg-dark);
}

.live-chat__option-text small {
	display: block;
	margin-top: 0.05rem;
	font-size: 0.7rem;
	color: var(--yaoshg-gray);
}

.live-chat__gate-lead {
	margin: 0 0 0.55rem;
	color: var(--yaoshg-gray);
	font-size: 0.78rem;
	line-height: 1.4;
}

.live-chat__label {
	display: block;
	margin-bottom: 0.35rem;
	font-size: 0.82rem;
	font-weight: 600;
}

.live-chat__gate-form input {
	width: 100%;
	margin-bottom: 0.55rem;
	padding: 0.5rem 0.65rem;
	border: 1px solid var(--yaoshg-border);
	border-radius: 8px;
	font: inherit;
	font-size: 0.82rem;
	box-sizing: border-box;
}

.live-chat__gate-submit {
	width: 100%;
	padding: 0.5rem 0.85rem;
	font-size: 0.8rem;
}

.live-chat__back {
	margin-top: 0.65rem;
	border: 0;
	background: none;
	color: var(--yaoshg-primary);
	font-size: 0.82rem;
	cursor: pointer;
}

.live-chat__messages {
	flex: 1 1 auto;
	min-height: 8rem;
	overflow-y: auto;
	padding: 0.65rem;
	background: var(--yaoshg-light);
}

.live-chat__message {
	display: flex;
	margin-bottom: 0.65rem;
}

.live-chat__message--visitor {
	justify-content: flex-end;
}

.live-chat__message--admin,
.live-chat__message--system {
	justify-content: flex-start;
}

.live-chat__bubble {
	max-width: 88%;
	padding: 0.45rem 0.6rem;
	border-radius: 12px;
	font-size: 0.8rem;
	line-height: 1.4;
	word-break: break-word;
}

.live-chat__message--visitor .live-chat__bubble {
	background: var(--yaoshg-primary);
	color: var(--yaoshg-white);
	border-bottom-right-radius: 4px;
}

.live-chat__message--admin .live-chat__bubble,
.live-chat__message--system .live-chat__bubble {
	background: var(--yaoshg-white);
	color: var(--yaoshg-dark);
	border: 1px solid var(--yaoshg-border);
	border-bottom-left-radius: 4px;
}

.live-chat__bubble time {
	display: block;
	margin-top: 0.25rem;
	font-size: 0.68rem;
	opacity: 0.75;
}

.live-chat__composer {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.4rem;
	padding: 0.55rem 0.65rem;
	border-top: 1px solid var(--yaoshg-border);
	flex-shrink: 0;
	background: var(--yaoshg-white);
}

.live-chat__composer textarea {
	width: 100%;
	min-height: 2.2rem;
	max-height: 4.5rem;
	padding: 0.45rem 0.55rem;
	border: 1px solid var(--yaoshg-border);
	border-radius: 8px;
	resize: vertical;
	font: inherit;
	font-size: 0.8rem;
	box-sizing: border-box;
}

.live-chat__send {
	align-self: end;
	padding: 0.45rem 0.7rem;
	font-size: 0.76rem;
	white-space: nowrap;
}

@media (max-width: 480px) {
	.live-chat {
		right: 0.65rem;
		bottom: 0.65rem;
	}

	.live-chat__panel {
		width: min(16.5rem, calc(100vw - 1.3rem));
	}

	.live-chat__nudge {
		width: min(14.5rem, calc(100vw - 1.5rem));
	}
}
