#cwbot-root {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	color: #1a1a2e;
}

#cwbot-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #1a1a2e;
	color: #fff;
	border: none;
	border-radius: 28px;
	padding: 8px 18px 8px 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

#cwbot-toggle .cwbot-avatar {
	width: 32px;
	height: 32px;
}

#cwbot-panel {
	position: absolute;
	right: 0;
	bottom: 60px;
	width: 400px;
	max-width: calc(100vw - 40px);
	height: 520px;
	max-height: calc(100vh - 100px);
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* The [hidden] attribute alone loses to the display:flex rule above (author
   CSS always beats the UA stylesheet's [hidden]{display:none}, regardless of
   specificity) — without this, the panel never actually hides. */
#cwbot-panel[hidden] {
	display: none;
}

#cwbot-resize {
	position: absolute;
	top: 0;
	left: 0;
	width: 18px;
	height: 18px;
	cursor: nwse-resize;
	z-index: 2;
	touch-action: none;
}

#cwbot-resize::before {
	content: "";
	position: absolute;
	top: 5px;
	left: 5px;
	width: 8px;
	height: 8px;
	border-top: 2px solid rgba(255, 255, 255, 0.85);
	border-left: 2px solid rgba(255, 255, 255, 0.85);
	border-radius: 2px 0 0 0;
}

#cwbot-header {
	background: #1a1a2e;
	color: #fff;
	padding: 10px 14px;
	font-weight: 700;
	font-size: 15px;
	display: flex;
	align-items: center;
	gap: 10px;
}

#cwbot-header .cwbot-avatar {
	width: 30px;
	height: 30px;
}

#cwbot-header span:first-of-type {
	flex: 1;
}

#cwbot-close {
	background: none;
	border: none;
	color: #fff;
	font-size: 20px;
	cursor: pointer;
	line-height: 1;
	opacity: 0.8;
}

#cwbot-close:hover {
	opacity: 1;
}

#cwbot-log {
	flex: 1;
	overflow-y: auto;
	padding: 14px 12px;
	background: #f7f8fb;
}

.cwbot-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	flex: 0 0 auto;
}

.cwbot-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin-bottom: 14px;
}

.cwbot-row-user {
	justify-content: flex-end;
}

.cwbot-row-bot {
	justify-content: flex-start;
}

.cwbot-bubble {
	max-width: 78%;
	padding: 10px 14px;
	border-radius: 18px;
	line-height: 1.45;
	word-wrap: break-word;
}

.cwbot-bubble-user {
	background: #ccd6e8;
	color: #1a1a2e;
	border-bottom-right-radius: 4px;
}

.cwbot-bubble-bot {
	background: #dfeaf9;
	color: #1a1a2e;
	border-bottom-left-radius: 4px;
}

.cwbot-bubble-system {
	background: #eef1f6;
	color: #5a6472;
	font-style: italic;
	border-bottom-left-radius: 4px;
}

.cwbot-thinking {
	opacity: 0.85;
}

.cwbot-bubble a {
	color: #1552b0;
}

.cwbot-bubble-bot h2,
.cwbot-bubble-bot h3,
.cwbot-bubble-bot h4 {
	margin: 10px 0 4px;
	line-height: 1.3;
	color: #10182b;
}

.cwbot-bubble-bot h2:first-child,
.cwbot-bubble-bot h3:first-child,
.cwbot-bubble-bot h4:first-child {
	margin-top: 0;
}

.cwbot-bubble-bot h2 {
	font-size: 16px;
	font-weight: 800;
	padding-bottom: 4px;
	border-bottom: 1px solid rgba(16, 24, 43, 0.15);
}

.cwbot-bubble-bot h3 {
	font-size: 14.5px;
	font-weight: 700;
}

.cwbot-bubble-bot h4 {
	font-size: 13.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	color: #3a4457;
}

.cwbot-bubble-bot ul,
.cwbot-bubble-bot ol {
	margin: 4px 0 8px;
	padding-left: 20px;
}

.cwbot-bubble-bot li {
	margin-bottom: 3px;
}

.cwbot-bubble-bot strong {
	font-weight: 700;
	color: #10182b;
}

.cwbot-fb {
	margin-top: 8px;
	color: #4a5568;
	font-size: 12.5px;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.cwbot-fb a {
	text-decoration: none;
	font-size: 19px;
	line-height: 1;
	padding: 3px 5px;
	border-radius: 6px;
	filter: grayscale(15%);
}

.cwbot-fb a:hover {
	background: rgba(16, 24, 43, 0.08);
}

.cwbot-escalate {
	margin-top: 8px;
}

.cwbot-escalate a {
	display: inline-block;
	font-size: 12.5px;
	font-weight: 600;
	color: #1a1a2e;
	background: #fff;
	border: 1px solid #b9c6da;
	border-radius: 999px;
	padding: 5px 12px;
	text-decoration: none;
}

.cwbot-escalate a:hover {
	background: #f0f4fa;
}

#cwbot-form {
	display: flex;
	border-top: 1px solid #e5e5e5;
	padding: 8px;
	gap: 6px;
	background: #fff;
}

#cwbot-input {
	flex: 1;
	border: 1px solid #ccc;
	border-radius: 20px;
	padding: 8px 14px;
	font-size: 14px;
}

#cwbot-send {
	background: #1a1a2e;
	color: #fff;
	border: none;
	border-radius: 20px;
	padding: 8px 16px;
	cursor: pointer;
	font-weight: 600;
}

#cwbot-send:disabled,
#cwbot-input:disabled {
	opacity: 0.6;
	cursor: default;
}
