.cw-widget {
	position: fixed;
	bottom: var(--cw-bottom, 24px);
	z-index: 99999;
	font-family: var(--cw-font, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

.cw-widget.is-right { right: var(--cw-side, 24px) !important; left: auto !important; }
.cw-widget.is-left { left: var(--cw-side, 24px) !important; right: auto !important; }

.cw-launcher {
	width: var(--cw-button-size, 64px);
	height: var(--cw-button-size, 64px);
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent !important;
	box-shadow: none !important;
	cursor: pointer;
	display: block;
	transition: transform .2s ease;
}

.cw-launcher:hover { transform: translateY(-2px) scale(1.04); }
.cw-launcher img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: contain;
	pointer-events: none;
}

.cw-widget__bubble {
	position: absolute;
	bottom: calc(var(--cw-button-size, 64px) + 12px);
	max-width: 220px;
	padding: 10px 14px;
	border-radius: 16px;
	background: var(--cw-bubble, #111827);
	color: var(--cw-bubble-text, #fff);
	font-size: 14px;
	box-shadow: 0 12px 28px rgba(0, 0, 0, .16);
	transition: opacity .25s ease, transform .25s ease;
}

.cw-widget.is-right .cw-widget__bubble { right: 0; }
.cw-widget.is-left .cw-widget__bubble { left: 0; }
.cw-widget__bubble.is-hidden { opacity: 0; transform: translateY(8px); pointer-events: none; }

.cw-panel {
	position: absolute;
	bottom: calc(var(--cw-button-size, 64px) + 18px);
	width: min(380px, calc(100vw - 28px));
	height: min(620px, calc(100vh - 120px));
	background: #f3f4f6;
	border-radius: var(--cw-radius, 18px);
	box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
	overflow: hidden;
	animation: cw-panel-in .22s ease both;
}

.cw-widget.is-right .cw-panel { right: 0 !important; left: auto !important; }
.cw-widget.is-left .cw-panel { left: 0 !important; right: auto !important; }

@keyframes cw-panel-in {
	from { opacity: 0; transform: translateY(12px) scale(.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.cw-panel__header {
	min-height: 74px;
	background: var(--cw-header, #075e54);
	color: #fff;
	padding: 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.cw-panel__header strong { display: block; font-size: 16px; }
.cw-panel__header span { display: block; margin-top: 3px; font-size: 12px; opacity: .86; }

.cw-icon-button {
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 999px;
	background: rgba(255, 255, 255, .16);
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.cw-register {
	padding: 18px;
	display: grid;
	gap: 14px;
}

.cw-register label span {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	font-weight: 650;
	color: #374151;
}

.cw-register input,
.cw-register select,
.cw-chat textarea {
	width: 100%;
	min-height: 42px;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	background: #fff;
	padding: 9px 11px;
	font-size: 14px;
	box-sizing: border-box;
}

.cw-phone-row { display: grid; grid-template-columns: 120px 1fr; gap: 8px; }

.cw-primary-button {
	min-height: 44px;
	border: 0;
	border-radius: 10px;
	background: var(--cw-button, #25d366);
	color: #fff;
	font-weight: 700;
	cursor: pointer;
}

.cw-error { min-height: 18px; margin: 0; color: #b91c1c; font-size: 13px; }

.cw-chat {
	height: calc(100% - 74px);
	display: grid;
	grid-template-rows: 1fr auto;
	background: #e5ddd5;
}

.cw-chat__messages {
	padding: 16px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 9px;
}

.cw-message {
	max-width: 82%;
	padding: 9px 10px 6px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.35;
	box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
	word-break: break-word;
}

.cw-message.is-sent { align-self: flex-end; background: var(--cw-sent, #dcf8c6); }
.cw-message.is-received { align-self: flex-start; background: var(--cw-received, #fff); }
.cw-message time { display: block; margin-top: 3px; text-align: right; font-size: 10px; color: #667085; }

.cw-chat__composer {
	padding: 10px;
	background: #f9fafb;
	display: grid;
	grid-template-columns: 1fr 42px;
	gap: 8px;
	align-items: end;
}

.cw-chat__composer textarea { resize: none; max-height: 110px; }
.cw-chat__composer button {
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 999px;
	background: var(--cw-button, #25d366);
	color: #fff;
	cursor: pointer;
}

@media (max-width: 480px) {
	.cw-widget { --cw-side: 14px; --cw-bottom: 14px; }
	.cw-panel { height: min(620px, calc(100vh - 96px)); }
	.cw-phone-row { grid-template-columns: 104px 1fr; }
}
