.echwa-widget {
	position: fixed;
	bottom: calc(var(--echwa-bottom) + env(safe-area-inset-bottom, 0px));
	z-index: var(--echwa-z);
	box-sizing: border-box;
	font-family: var(--echwa-font);
	color: var(--echwa-text);
	opacity: var(--echwa-opacity);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

.echwa-widget *,
.echwa-widget *::before,
.echwa-widget *::after {
	box-sizing: border-box;
}

.echwa-widget[hidden],
.echwa-widget [hidden] {
	display: none !important;
}

.echwa-position-right {
	right: calc(var(--echwa-edge) + env(safe-area-inset-right, 0px));
}

.echwa-position-left {
	left: calc(var(--echwa-edge) + env(safe-area-inset-left, 0px));
}

.echwa-widget .echwa-launcher {
	position: relative;
	display: grid;
	width: var(--echwa-button-size);
	height: var(--echwa-button-size);
	margin: 0;
	padding: 0;
	place-items: center;
	border: var(--echwa-border) solid var(--echwa-icon-border);
	border-radius: min(var(--echwa-launcher-radius), 50%);
	background: var(--echwa-button-bg);
	box-shadow: 0 calc(var(--echwa-shadow) * 0.35) var(--echwa-shadow) color-mix(in srgb, var(--echwa-shadow-color) 32%, transparent);
	color: var(--echwa-icon-color);
	cursor: pointer;
	transition: transform 180ms ease, opacity 180ms ease;
	-webkit-tap-highlight-color: transparent;
}

.echwa-widget .echwa-launcher::before {
	position: absolute;
	z-index: -1;
	inset: -8px;
	border-radius: inherit;
	background: var(--echwa-button-bg);
	content: "";
	opacity: 0;
	transform: scale(0.82);
}

.echwa-widget .echwa-launcher:hover {
	background: var(--echwa-button-hover);
	color: var(--echwa-icon-hover);
	transform: translateY(-2px);
}

.echwa-widget .echwa-launcher:active {
	background: var(--echwa-button-active);
	color: var(--echwa-icon-active);
	transform: translateY(0) scale(0.96);
}

.echwa-widget .echwa-launcher:focus-visible,
.echwa-widget .echwa-close:focus-visible,
.echwa-widget .echwa-send:focus-visible,
.echwa-body textarea:focus-visible {
	outline: 3px solid var(--echwa-focus);
	outline-offset: 3px;
}

.echwa-icon {
	display: grid;
	width: calc(var(--echwa-icon-size) + 10px);
	height: calc(var(--echwa-icon-size) + 10px);
	place-items: center;
	border-radius: 50%;
	background: var(--echwa-icon-bg);
}

.echwa-icon svg {
	display: block;
	width: var(--echwa-icon-size);
	height: var(--echwa-icon-size);
}

.echwa-widget .echwa-panel {
	position: absolute;
	bottom: calc(var(--echwa-button-size) + 16px);
	width: min(var(--echwa-panel-width), calc(100vw - 24px));
	max-height: min(var(--echwa-panel-height), calc(100vh - var(--echwa-bottom) - var(--echwa-button-size) - 40px));
	overflow: hidden auto;
	border: var(--echwa-border) solid color-mix(in srgb, var(--echwa-text) 12%, transparent);
	border-radius: var(--echwa-panel-radius);
	background: color-mix(in srgb, var(--echwa-panel-bg) var(--echwa-panel-bg-opacity), transparent);
	-webkit-backdrop-filter: blur(var(--echwa-panel-blur));
	backdrop-filter: blur(var(--echwa-panel-blur));
	box-shadow: 0 calc(var(--echwa-shadow) * 0.6) calc(var(--echwa-shadow) * 1.8) color-mix(in srgb, var(--echwa-shadow-color) 28%, transparent);
	color: var(--echwa-text);
	overscroll-behavior: contain;
}

.echwa-widget.echwa-position-right .echwa-panel {
	right: 0;
	transform-origin: bottom right;
}

.echwa-widget.echwa-position-left .echwa-panel {
	left: 0;
	transform-origin: bottom left;
}

.echwa-panel[data-open="true"] {
	animation-duration: var(--echwa-panel-duration);
	animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
	animation-fill-mode: both;
}

.echwa-panel-fade .echwa-panel[data-open="true"] {
	animation-name: echwa-panel-fade;
}

.echwa-panel-slide .echwa-panel[data-open="true"] {
	animation-name: echwa-panel-slide;
}

.echwa-panel-slide-fade .echwa-panel[data-open="true"] {
	animation-name: echwa-panel-slide-fade;
}

.echwa-panel-zoom .echwa-panel[data-open="true"] {
	animation-name: echwa-panel-zoom;
}

.echwa-panel-pop .echwa-panel[data-open="true"] {
	animation-name: echwa-panel-pop;
}

.echwa-panel-bounce .echwa-panel[data-open="true"] {
	animation-name: echwa-panel-bounce;
}

.echwa-widget .echwa-header {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 12px;
	align-items: center;
	padding: 18px;
	border-radius: max(0px, calc(var(--echwa-panel-radius) - var(--echwa-border))) max(0px, calc(var(--echwa-panel-radius) - var(--echwa-border))) 0 0;
	background: color-mix(in srgb, var(--echwa-header-bg) var(--echwa-header-bg-opacity), transparent);
	-webkit-backdrop-filter: blur(var(--echwa-header-blur));
	backdrop-filter: blur(var(--echwa-header-blur));
	color: var(--echwa-header-title);
}

.echwa-profile {
	display: grid;
	width: 52px;
	height: 52px;
	flex: 0 0 52px;
	place-items: center;
	overflow: hidden;
	border: 2px solid rgba(255, 255, 255, 0.38);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
}

.echwa-profile img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: cover;
}

.echwa-profile span,
.echwa-profile svg {
	display: block;
	width: 29px;
	height: 29px;
}

.echwa-identity {
	min-width: 0;
}

.echwa-identity h2,
.echwa-identity p {
	margin: 0;
	padding: 0;
	color: inherit;
	font-family: inherit;
	text-transform: none;
	letter-spacing: normal;
}

.echwa-identity h2 {
	overflow: hidden;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.echwa-widget .echwa-identity > p {
	margin-top: 2px;
	color: var(--echwa-header-subtitle);
	font-size: 12px;
	opacity: 0.82;
}

.echwa-widget .echwa-identity > .echwa-availability {
	display: inline-flex !important;
	gap: 6px;
	align-items: center;
	margin-top: 5px;
	color: var(--echwa-status-text-color) !important;
	font-size: var(--echwa-status-text-size) !important;
	line-height: 1.25;
}

.echwa-widget .echwa-availability > .echwa-availability-dot {
	display: inline-block !important;
	box-sizing: border-box;
	width: var(--echwa-status-dot-size) !important;
	height: var(--echwa-status-dot-size) !important;
	min-width: var(--echwa-status-dot-size) !important;
	min-height: var(--echwa-status-dot-size) !important;
	max-width: var(--echwa-status-dot-size) !important;
	max-height: var(--echwa-status-dot-size) !important;
	flex: 0 0 var(--echwa-status-dot-size) !important;
	align-self: center;
	border: 0 !important;
	border-radius: 50% !important;
	background-color: var(--echwa-status-dot-color) !important;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--echwa-status-dot-ring-color) 38%, transparent) !important;
	line-height: 0 !important;
}

.echwa-widget .echwa-availability > .echwa-availability-text {
	display: inline-block;
	color: inherit !important;
	font: inherit;
}

.echwa-widget .echwa-close {
	display: grid;
	width: 38px;
	height: 38px;
	margin: -6px -7px 0 0;
	padding: 0;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transition: background 150ms ease, transform 150ms ease;
}

.echwa-widget .echwa-close:hover {
	background: rgba(255, 255, 255, 0.15);
	transform: rotate(3deg);
}

.echwa-widget .echwa-close svg {
	width: 21px;
	height: 21px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-width: 2;
}

.echwa-body {
	padding: 18px;
}

.echwa-greeting {
	margin: 0 0 14px;
	padding: 12px 14px;
	border-radius: 14px 14px 14px 4px;
	background: var(--echwa-message-bg);
	color: var(--echwa-message-text);
	font-size: 14px;
}

.echwa-body textarea {
	display: block;
	width: 100%;
	min-height: 88px;
	margin: 0;
	padding: 12px 13px;
	resize: vertical;
	border: 1px solid var(--echwa-input-border);
	border-radius: 12px;
	background: var(--echwa-input-bg);
	box-shadow: none;
	color: var(--echwa-input-text);
	font: inherit;
	font-size: 14px;
	line-height: 1.45;
}

.echwa-body textarea::placeholder {
	color: var(--echwa-input-placeholder);
	opacity: 1;
}

.echwa-widget .echwa-send {
	display: flex;
	gap: 9px;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 46px;
	margin: 14px 0 0;
	padding: var(--echwa-send-padding-y) var(--echwa-send-padding-x);
	border: 0;
	border-radius: var(--echwa-send-radius);
	background: var(--echwa-send-bg);
	box-shadow: none;
	color: var(--echwa-send-text);
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	transition: transform 160ms ease, opacity 160ms ease;
}

.echwa-widget .echwa-send:hover {
	background: var(--echwa-send-hover);
	color: var(--echwa-send-text-hover);
	transform: translateY(-1px);
}

.echwa-widget .echwa-send:active {
	background: var(--echwa-send-active);
	transform: translateY(0);
}

.echwa-widget .echwa-send span,
.echwa-widget .echwa-send svg {
	display: block;
	width: 21px;
	height: 21px;
}

.echwa-qr {
	display: flex;
	flex-direction: column;
	margin-top: 14px;
	padding: 12px;
	border: 1px solid color-mix(in srgb, var(--echwa-text) 14%, transparent);
	border-radius: 12px;
	background: var(--echwa-qr-bg);
	text-align: center;
}

.echwa-qr p {
	margin: 0 0 8px;
	color: var(--echwa-qr-text);
	font-size: 12px;
	font-weight: 650;
}

.echwa-qr-text-after .echwa-qr-instruction { order: 2; margin: 8px 0 0; }
.echwa-qr-text-after .echwa-qr-code { order: 1; }

.echwa-qr-code {
	width: 132px;
	height: 132px;
	margin: 0 auto;
}

.echwa-qr-code svg {
	display: block;
	width: 100%;
	height: 100%;
}

.echwa-privacy {
	margin: 10px 0 0;
	color: color-mix(in srgb, var(--echwa-text) 65%, transparent);
	font-size: 10px;
	line-height: 1.4;
	text-align: center;
}

.echwa-attention {
	position: absolute;
	bottom: calc(var(--echwa-button-size) + var(--echwa-tooltip-gap));
	max-width: min(var(--echwa-tooltip-max-width), calc(100vw - 32px));
	padding: 9px 12px;
	border: 1px solid var(--echwa-tooltip-border);
	border-radius: var(--echwa-tooltip-radius);
	background: var(--echwa-tooltip-bg);
	box-shadow: 0 8px var(--echwa-tooltip-shadow) color-mix(in srgb, var(--echwa-shadow-color) 18%, transparent);
	color: var(--echwa-tooltip-color);
	font-size: var(--echwa-tooltip-size);
	font-weight: var(--echwa-tooltip-weight);
	white-space: nowrap;
	animation: echwa-bubble var(--echwa-tooltip-animation-duration) ease both;
}

.echwa-tooltip-animation-none {
	animation: none;
}

.echwa-tooltip-animation-fade {
	animation: echwa-tooltip-fade var(--echwa-tooltip-animation-duration) ease both;
}

.echwa-tooltip-animation-pop {
	animation: echwa-tooltip-pop var(--echwa-tooltip-animation-duration) ease both;
}

@keyframes echwa-tooltip-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes echwa-tooltip-pop {
	from { opacity: 0; transform: scale(0.9); }
	to { opacity: 1; transform: scale(1); }
}

.echwa-position-right .echwa-attention {
	right: 0;
}

.echwa-position-left .echwa-attention {
	left: 0;
}

.echwa-animate {
	animation-duration: var(--echwa-animation-duration);
	animation-iteration-count: var(--echwa-animation-count);
	animation-timing-function: ease-in-out;
}

.echwa-animation-pulse {
	animation-name: echwa-pulse;
}

.echwa-animation-breathe {
	animation-name: echwa-breathe;
}

.echwa-animation-bounce {
	animation-name: echwa-bounce;
}

.echwa-animation-halo {
	animation-name: none;
}

.echwa-animation-glow {
	animation-name: none;
}

.echwa-animation-halo::before {
	animation: echwa-halo var(--echwa-animation-duration) ease-out var(--echwa-animation-count);
}

.echwa-animation-glow::before {
	animation: echwa-glow var(--echwa-animation-duration) ease-in-out var(--echwa-animation-count);
}

.echwa-animation-heartbeat {
	animation-name: echwa-heartbeat;
}

.echwa-animation-zoom {
	animation-name: echwa-zoom;
}

.echwa-animation-rotate {
	animation-name: echwa-rotate;
}

.echwa-animation-vibrate {
	animation-name: echwa-vibrate;
}

.echwa-animation-custom {
	animation-name: echwa-custom-button;
}

@keyframes echwa-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(var(--echwa-scale)); }
}

@keyframes echwa-breathe {
	0%, 100% { transform: scale(1); opacity: 1; }
	50% { transform: scale(var(--echwa-scale-soft)); opacity: 0.82; }
}

@keyframes echwa-bounce {
	0%, 100% { transform: translateY(0); }
	45% { transform: translateY(var(--echwa-shift-negative)); }
	70% { transform: translateY(var(--echwa-shift)); }
}

@keyframes echwa-halo {
	0% { opacity: 0.45; transform: scale(0.82); }
	100% { opacity: 0; transform: scale(var(--echwa-halo-scale)); }
}

@keyframes echwa-glow {
	0%, 100% { opacity: 0.08; transform: scale(0.9); }
	50% { opacity: 0.38; transform: scale(var(--echwa-scale-soft)); }
}

@keyframes echwa-heartbeat {
	0%, 100% { transform: scale(1); }
	15% { transform: scale(var(--echwa-scale)); }
	28% { transform: scale(1); }
	42% { transform: scale(var(--echwa-scale-soft)); }
	60% { transform: scale(1); }
}

@keyframes echwa-zoom {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(var(--echwa-scale)); }
}

@keyframes echwa-rotate {
	0%, 100% { transform: rotate(0); }
	35% { transform: rotate(var(--echwa-rotation-negative)); }
	65% { transform: rotate(var(--echwa-rotation)); }
}

@keyframes echwa-vibrate {
	0%, 100% { transform: translateX(0); }
	20% { transform: translateX(var(--echwa-shift-negative)); }
	40% { transform: translateX(var(--echwa-shift)); }
	60% { transform: translateX(var(--echwa-shift-negative)); }
	80% { transform: translateX(var(--echwa-shift)); }
}

@keyframes echwa-panel-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes echwa-panel-slide {
	from { transform: translateY(18px); }
	to { transform: translateY(0); }
}

@keyframes echwa-panel-slide-fade {
	from { opacity: 0; transform: translateY(18px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes echwa-panel-zoom {
	from { opacity: 0; transform: scale(0.92); }
	to { opacity: 1; transform: scale(1); }
}

@keyframes echwa-panel-pop {
	0% { opacity: 0; transform: scale(0.82); }
	70% { opacity: 1; transform: scale(1.03); }
	100% { opacity: 1; transform: scale(1); }
}

@keyframes echwa-panel-bounce {
	0% { opacity: 0; transform: translateY(20px); }
	65% { opacity: 1; transform: translateY(-4px); }
	100% { opacity: 1; transform: translateY(0); }
}

@keyframes echwa-bubble {
	from { opacity: 0; transform: translateY(5px); }
	to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
	.echwa-widget {
		--echwa-edge: max(14px, var(--echwa-edge));
		--echwa-bottom: max(14px, var(--echwa-bottom));
	}

	.echwa-widget .echwa-panel {
		position: fixed;
		right: 12px;
		bottom: calc(var(--echwa-bottom) + var(--echwa-button-size) + 12px);
		left: 12px;
		width: auto;
		max-height: calc(100dvh - var(--echwa-bottom) - var(--echwa-button-size) - 36px);
		transform-origin: bottom center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.echwa-widget *,
	.echwa-widget *::before,
	.echwa-widget *::after {
		scroll-behavior: auto !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

@media print {
	.echwa-widget {
		display: none !important;
	}
}
