#swpc-widget {
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#swpc-widget.swpc-right { right: 20px; }
#swpc-widget.swpc-left { left: 20px; }
#swpc-widget *,
#swpc-widget *::before,
#swpc-widget *::after { box-sizing: border-box; }

#swpc-bubble {
	position: relative;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--swpc-color, #2563eb);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0,0,0,.2);
	border: none;
	font-size: 26px;
	padding: 0;
}
#swpc-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	border: 2px solid #fff;
}

#swpc-window {
	display: none;
	flex-direction: column;
	width: 340px;
	height: 460px;
	max-height: 75vh;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 10px 30px rgba(0,0,0,.25);
	overflow: hidden;
	position: absolute;
	bottom: 74px;
}
#swpc-widget.swpc-right #swpc-window,
#swpc-widget.swpc-right #swpc-toast { right: 0; }
#swpc-widget.swpc-left #swpc-window,
#swpc-widget.swpc-left #swpc-toast { left: 0; }
#swpc-widget.swpc-open #swpc-window { display: flex; }

#swpc-header {
	background: var(--swpc-color, #2563eb);
	color: #fff;
	padding: 12px 14px;
	font-weight: 600;
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.swpc-identity {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}
#swpc-title {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.swpc-avatar {
	position: relative;
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #fff;
	color: var(--swpc-color, #2563eb);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.swpc-avatar svg {
	width: 60%;
	height: 60%;
}
.swpc-online {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #22c55e;
	border: 2px solid var(--swpc-color, #2563eb);
}
.swpc-avatar-sm {
	width: 26px;
	height: 26px;
	background: var(--swpc-color, #2563eb);
	color: #fff;
}
.swpc-avatar-xs {
	width: 16px;
	height: 16px;
	background: var(--swpc-color, #2563eb);
	color: #fff;
}
#swpc-close {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 20px;
	cursor: pointer;
	line-height: 1;
	padding: 4px;
}

#swpc-messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	background: #f5f6f8;
	display: flex;
	flex-direction: column;
	gap: 8px;
	scrollbar-width: none;
	-ms-overflow-style: none;
}
#swpc-messages::-webkit-scrollbar {
	display: none;
}

.swpc-msg {
	max-width: 85%;
	padding: 8px 12px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.4;
	word-wrap: break-word;
	white-space: pre-wrap;
}
.swpc-msg.swpc-bot {
	background: #fff;
	border: 1px solid #e3e5e8;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}
.swpc-msg.swpc-user {
	background: var(--swpc-color, #2563eb);
	color: #fff;
	align-self: flex-end;
	border-bottom-right-radius: 4px;
}
.swpc-msg.swpc-admin {
	background: #fff;
	border: 1px solid #e3e5e8;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}
.swpc-msg-label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	font-weight: 600;
	color: var(--swpc-color, #2563eb);
	margin-bottom: 3px;
}

#swpc-toast {
	position: absolute;
	bottom: 74px;
	width: 280px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 24px rgba(0,0,0,.2);
	padding: 12px 14px;
	cursor: pointer;
	font-size: 14px;
	color: #1f2937;
}
#swpc-widget.swpc-open #swpc-toast { display: none !important; }
.swpc-toast-head {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
	font-size: 13px;
}
.swpc-toast-text {
	line-height: 1.4;
}
#swpc-toast-close {
	position: absolute;
	top: 6px;
	right: 8px;
	background: none;
	border: none;
	font-size: 16px;
	color: #9ca3af;
	cursor: pointer;
	padding: 2px;
}

#swpc-loading {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #6b7280;
	font-size: 14px;
}

#swpc-contact-gate {
	padding: 16px;
	background: #fff;
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
#swpc-contact-gate p {
	margin: 0 0 12px;
	font-size: 14px;
	color: #333;
}
#swpc-contact-form {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
#swpc-contact-form input {
	border: 1px solid #d7dadf;
	border-radius: 8px;
	padding: 10px 12px;
	font-size: 14px;
	outline: none;
}
#swpc-contact-form button {
	background: var(--swpc-color, #2563eb);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 10px;
	font-size: 14px;
	cursor: pointer;
}
.swpc-error {
	color: #dc2626;
	font-size: 12px;
	min-height: 16px;
}

#swpc-form {
	display: flex;
	border-top: 1px solid #e3e5e8;
	padding: 8px;
	gap: 6px;
	background: #fff;
}
#swpc-input {
	flex: 1;
	min-width: 0;
	border: 1px solid #d7dadf;
	border-radius: 20px;
	padding: 8px 14px;
	font-size: 14px;
	outline: none;
}
#swpc-send {
	background: var(--swpc-color, #2563eb);
	color: #fff;
	border: none;
	border-radius: 20px;
	padding: 0 16px;
	cursor: pointer;
	font-size: 14px;
}

@media (max-width: 420px) {
	#swpc-window { width: calc(100vw - 40px); }
}
