#aichat-root {
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#aichat-root.aichat-pos-right { right: 20px; }
#aichat-root.aichat-pos-left { left: 20px; }
#aichat-root.aichat-pos-left .aichat-window { right: auto; left: 0; }

.aichat-bubble {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--aichat-color, #2563eb);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0,0,0,0.2);
	font-size: 26px;
	border: none;
	padding: 0;
	overflow: hidden;
}

.aichat-bubble img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.aichat-window {
	position: absolute;
	bottom: 76px;
	right: 0;
	width: 340px;
	max-width: 90vw;
	height: 460px;
	max-height: 70vh;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 8px 30px rgba(0,0,0,0.25);
	display: none;
	flex-direction: column;
	overflow: hidden;
}

.aichat-window.aichat-open { display: flex; }

.aichat-header {
	background: var(--aichat-color, #2563eb);
	color: var(--aichat-header-text, #ffffff);
	padding: 12px 16px;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 8px;
}

.aichat-header .aichat-header-title {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
}

.aichat-header img.aichat-header-icon {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	object-fit: cover;
}

.aichat-header .aichat-close {
	cursor: pointer;
	background: none;
	border: none;
	color: var(--aichat-header-text, #ffffff);
	line-height: 1;
	width: 28px;
	height: 28px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	padding: 0;
	opacity: 0.9;
	margin: 5px 0 5px 0;
}

.aichat-header .aichat-close:hover {
	background: rgba(255,255,255,0.15);
	opacity: 1;
}

.aichat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	background: #f9fafb;
}

.aichat-msg {
	margin-bottom: 10px;
	max-width: 85%;
	padding: 8px 12px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.4;
	white-space: pre-wrap;
}

.aichat-msg.user {
	background: var(--aichat-color, #2563eb);
	color: #fff;
	margin-left: auto;
	border-bottom-right-radius: 2px;
}

.aichat-msg.bot {
	background: var(--aichat-bot-bubble, #eef0f3);
	color: #111;
	margin-right: auto;
	border-bottom-left-radius: 2px;
}

.aichat-sources {
	font-size: 11px;
	margin-top: 4px;
	color: #555;
}
.aichat-sources a { color: #2563eb; }

.aichat-input-row {
	display: flex;
	align-items: center;
	border-top: 1px solid #e5e7eb;
	padding: 10px;
	gap: 8px;
}

.aichat-input-row textarea {
	flex: 1;
	resize: none;
	border: 1px solid #ddd;
	border-radius: 8px;
	padding: 10px 12px;
	font-size: 14px;
	height: 42px;
	font-family: inherit;
	margin-bottom: 10px;
}

.aichat-input-row button {
  background: var(--aichat-color, #2563eb);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0;
  width: 42px;
  height: 42px;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0px 10px 10px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aichat-input-row button:hover {
  opacity: 0.9;
}

.aichat-input-row button:disabled {
  opacity: 0.6;
  cursor: default;
}

.aichat-input-row button svg {
  flex-shrink: 0;
}

.aichat-typing {
	font-size: 13px;
	color: #888;
	font-style: italic;
}
