#kanlux-chat-widget-root { position: fixed; bottom: 24px; right: 24px; z-index: 99999; font-family: system-ui, sans-serif; }
.kcw-bubble { width: 56px; height: 56px; border-radius: 50%; border: 0; background: #2271b1; color: #fff; font-size: 24px; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.2); }

/* Greeting tooltip — sits above the chat bubble, with a small arrow pointing down to it. */
.kcw-greeting {
	position: absolute;
	right: 0;
	bottom: 70px; /* sits above the 56px bubble + 14px gap */
	max-width: 260px;
	padding: 12px 32px 12px 14px;
	background: #fff;
	color: #1d2327;
	border-radius: 10px;
	box-shadow: 0 4px 14px rgba(0,0,0,.18);
	font-size: 14px;
	line-height: 1.4;
	animation: kcw-greeting-in .3s ease;
}
.kcw-greeting[hidden] { display: none; }
.kcw-greeting::after {
	content: '';
	position: absolute;
	right: 20px;
	bottom: -7px;
	width: 14px;
	height: 14px;
	background: #fff;
	transform: rotate(45deg);
	box-shadow: 2px 2px 3px rgba(0,0,0,.05);
}
.kcw-greeting-text { cursor: pointer; word-wrap: break-word; }
.kcw-greeting-close {
	position: absolute;
	top: 4px;
	right: 6px;
	background: transparent;
	border: 0;
	color: #8c8f94;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	padding: 2px 6px;
}
.kcw-greeting-close:hover { color: #1d2327; }

@keyframes kcw-greeting-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}
.kcw-panel { width: 360px; height: 480px; background: #fff; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); display: flex; flex-direction: column; overflow: hidden; }
.kcw-panel[hidden] { display: none; }
.kcw-panel header { background: #2271b1; color: #fff; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; }
.kcw-header-actions { display: flex; gap: 8px; align-items: center; }
.kcw-close { background: transparent; border: 0; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; }
.kcw-end { background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff; font-size: 12px; cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.kcw-end:hover { background: rgba(255,255,255,.15); }
.kcw-end[hidden] { display: none; }
.kcw-messages { flex: 1; padding: 12px; overflow-y: auto; background: #f7f7f8; }
/* Mirrors the admin's .kc-msg structure: avatar in its own column + bubble.
   row-reverse for the visitor side flips avatar to the right and pushes the bubble left. */
.kcw-msg {
	display: flex;
	gap: 8px;
	align-items: flex-end;
	margin: 10px 0;
	max-width: 85%;
	font-size: 14px;
}
.kcw-msg-bubble {
	padding: 8px 12px;
	border-radius: 12px;
	min-width: 0;
	word-wrap: break-word;
	line-height: 1.4;
}
.kcw-msg-body { word-wrap: break-word; }
.kcw-msg.kcw-agent .kcw-msg-bubble {
	background: #fff;
	color: #1d2327;
	border: 1px solid #e0e0e0;
	border-bottom-left-radius: 4px;
}
.kcw-msg.kcw-visitor {
	margin-left: auto;
	flex-direction: row-reverse;
}
.kcw-msg.kcw-visitor .kcw-msg-bubble {
	background: #2271b1;
	color: #fff;
	text-align: right;
	border-bottom-right-radius: 4px;
}
.kcw-msg.kcw-system {
	background: #fff4d0;
	color: #4d3c00;
	margin: 12px auto;
	padding: 8px 12px;
	border-radius: 12px;
	text-align: center;
	font-style: italic;
	border: 1px dashed #e0c060;
	max-width: 90%;
}
.kcw-avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	flex-shrink: 0;
	background: #f0f0f1;
	object-fit: cover;
}
.kcw-avatar-visitor {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-weight: 600;
	font-size: 12px;
	line-height: 1;
	user-select: none;
}
.kcw-composer { display: flex; padding: 8px; gap: 6px; border-top: 1px solid #e0e0e0; background: #fff; align-items: stretch; }
.kcw-composer textarea { flex: 1; min-height: 40px; max-height: 140px; padding: 6px; border: 1px solid #ccc; border-radius: 4px; resize: none; font-family: inherit; font-size: 14px; line-height: 1.4; overflow-y: auto; }
.kcw-composer button { padding: 6px 12px; background: #2271b1; color: #fff; border: 0; border-radius: 4px; cursor: pointer; }
.kcw-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.kcw-welcome { background: #1d2c3a; color: #fff; padding: 16px 14px; text-align: center; }
.kcw-welcome h3 { margin: 0 0 6px; font-size: 16px; }
.kcw-welcome p { margin: 0; font-size: 13px; opacity: .85; }
.kcw-prechat { padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.kcw-prechat input,
.kcw-prechat textarea { padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; font-family: inherit; resize: vertical; min-height: 36px; }
.kcw-prechat textarea { min-height: 70px; }
.kcw-prechat button { padding: 8px; background: #2271b1; color: #fff; border: 0; border-radius: 4px; cursor: pointer; font-size: 14px; }
.kcw-thanks { padding: 24px 18px; text-align: center; background: #fff; flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.kcw-thanks h3 { margin: 0; font-size: 18px; color: #1d2327; }
.kcw-thanks p { margin: 0; color: #50575e; font-size: 14px; line-height: 1.5; }
.kcw-thanks-close { align-self: center; padding: 8px 20px; background: #2271b1; color: #fff; border: 0; border-radius: 4px; cursor: pointer; font-size: 14px; }
.kcw-thanks-close:hover { background: #135e96; }
.kcw-error { color: #b91c1c; margin: 0; font-size: 13px; }
.kcw-typing { padding: 4px 12px; font-size: 12px; color: #646970; font-style: italic; background: #f7f7f8; }
