#aicscopilot-bubble {
	position: fixed !important;
	bottom: calc(24px + env(safe-area-inset-bottom, 0px));
	right: calc(24px + env(safe-area-inset-right, 0px));
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--aicscopilot-primary, #1a1a2e);
	color: var(--aicscopilot-primary-text, #ffffff);
	border: 3px solid rgba(255,255,255,0.85);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: grab;
	box-shadow: 0 4px 16px rgba(0,0,0,0.35);
	z-index: 2147483000 !important;
	user-select: none;
	touch-action: none;
	box-sizing: border-box;
}
#aicscopilot-bubble.aicscopilot-left { left: calc(24px + env(safe-area-inset-left, 0px)); right: auto; }
#aicscopilot-bubble:active { cursor: grabbing; }

#aicscopilot-panel {
	position: fixed !important;
	bottom: 96px;
	right: 24px;
	width: 340px;
	max-width: 92vw;
	height: 460px;
	max-height: 70vh;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 10px 40px rgba(0,0,0,0.25);
	display: none;
	flex-direction: column;
	overflow: hidden;
	z-index: 2147483000 !important;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	box-sizing: border-box;
}
#aicscopilot-panel * { box-sizing: border-box; }
#aicscopilot-panel.aicscopilot-left { left: 24px; right: auto; }
#aicscopilot-panel.aicscopilot-open { display: flex; }

/* On small screens, use the full width and most of the height instead of a
   floating card — a fixed 340px card either overflows or looks cramped on a
   phone, and this is the more familiar "bottom sheet" pattern for chat UIs. */
@media (max-width: 600px) {
	#aicscopilot-panel {
		right: 0 !important;
		left: 0 !important;
		bottom: 0 !important;
		width: 100vw;
		max-width: 100vw;
		height: 88vh;
		height: 88dvh;
		max-height: 88dvh;
		border-radius: 16px 16px 0 0;
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}
	#aicscopilot-bubble {
		width: 54px;
		height: 54px;
	}
}

#aicscopilot-header {
	background: var(--aicscopilot-primary, #1a1a2e) !important;
	color: var(--aicscopilot-primary-text, #ffffff) !important;
	padding: 14px 16px;
	font-weight: 600;
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 14px;
}
#aicscopilot-header button {
	background: none !important; border: none !important; color: inherit !important; cursor: pointer; font-size: 16px;
}

#aicscopilot-messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	font-size: 14px;
	line-height: 1.4;
}
.aicscopilot-msg { margin-bottom: 10px; max-width: 85%; padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; }
.aicscopilot-msg.user { background: var(--aicscopilot-primary, #1a1a2e) !important; color: var(--aicscopilot-primary-text, #ffffff) !important; margin-left: auto; border-bottom-right-radius: 2px; }
.aicscopilot-msg.assistant { background: #f0f1f5 !important; color: #1a1a2e !important; margin-right: auto; border-bottom-left-radius: 2px; }
.aicscopilot-msg.assistant a.aicscopilot-nav-link { display: inline-block; margin-top: 6px; font-weight: 600; color: var(--aicscopilot-primary, #1a1a2e) !important; text-decoration: underline; }
.aicscopilot-typing { font-size: 13px; color: #888; padding: 4px 12px; }

/* Voice-chat overlay: a bigger, call-like presence over the message area
   (translucent so the chat feed is still visible underneath), replacing the
   ordinary composer while a hands-free voice conversation is active. */
#aicscopilot-voice-overlay {
	position: absolute;
	top: 53px;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255,255,255,0.86);
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	z-index: 30;
	cursor: pointer;
	text-align: center;
	padding: 24px;
	box-sizing: border-box;
}
#aicscopilot-voice-overlay.aicscopilot-vo-active { display: flex; }
#aicscopilot-vo-exit {
	position: absolute;
	top: 14px;
	right: 14px;
	display: flex !important;
	align-items: center;
	gap: 6px;
	background: #fff !important;
	color: #1a1a2e !important;
	border: 1px solid #ddd !important;
	border-radius: 16px;
	padding: 6px 12px !important;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
#aicscopilot-vo-exit:hover { background: #f4f4f5 !important; }
.aicscopilot-vo-orb {
	width: 76px;
	height: 76px;
	border-radius: 50%;
	background: var(--aicscopilot-primary, #1a1a2e) !important;
	transition: background 0.2s;
}
#aicscopilot-vo-status { font-size: 16px; font-weight: 700; color: #1a1a2e !important; }
.aicscopilot-vo-hint { font-size: 12px; color: #888 !important; max-width: 220px; }

#aicscopilot-voice-overlay.aicscopilot-vc-listening .aicscopilot-vo-orb { background: #1a6fb0 !important; animation: aicscopilot-orb-pulse 1.4s infinite; }
#aicscopilot-voice-overlay.aicscopilot-vc-thinking .aicscopilot-vo-orb { background: #999 !important; }
#aicscopilot-voice-overlay.aicscopilot-vc-speaking .aicscopilot-vo-orb { background: #b5650a !important; animation: aicscopilot-orb-pulse 0.9s infinite; }
@keyframes aicscopilot-orb-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.14); opacity: 0.8; } }

/* Composer row: the pill (mic + textarea + send) plus a separate voice-chat
   button outside it, to its right. */
#aicscopilot-composer-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin: 10px;
}
#aicscopilot-composer {
	flex: 1;
	display: flex;
	align-items: flex-end;
	gap: 2px;
	padding: 4px 4px 4px 10px;
	background: #f4f4f5 !important;
	border: 1px solid #ddd !important;
	border-radius: 20px;
	min-width: 0;
}
#aicscopilot-input {
	flex: 1;
	min-width: 0;
	border: none !important;
	background: transparent !important;
	padding: 6px 2px;
	font-size: 14px;
	line-height: 1.4;
	outline: none !important;
	resize: none;
	max-height: 90px;
	font-family: inherit;
	color: #1a1a2e !important;
}

/* Icon buttons — explicit sizing/colors with !important throughout, since this
   widget is embedded on arbitrary host pages whose own CSS can otherwise bleed
   into generic `button`/`svg` selectors and make these invisible or oddly sized. */
.aicscopilot-icon-btn {
	background: transparent !important;
	border: none !important;
	border-radius: 50% !important;
	width: 34px !important;
	height: 34px !important;
	min-width: 34px !important;
	padding: 0 !important;
	margin: 0 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	flex-shrink: 0 !important;
	box-shadow: none !important;
}
.aicscopilot-icon-btn svg { width: 18px !important; height: 18px !important; display: block !important; fill: currentColor !important; }

#aicscopilot-mic { color: #6b6b74 !important; }
#aicscopilot-mic:hover { background: #e6e6ea !important; }
#aicscopilot-mic.aicscopilot-listening { background: #d64545 !important; color: #ffffff !important; }

.aicscopilot-send-btn {
	background: var(--aicscopilot-primary, #1a1a2e) !important;
	color: var(--aicscopilot-primary-text, #ffffff) !important;
}
.aicscopilot-send-btn svg { width: 15px !important; height: 15px !important; }

.aicscopilot-voicechat-btn {
	background: #f4f4f5 !important;
	color: #6b6b74 !important;
	border: 1px solid #ddd !important;
}
.aicscopilot-voicechat-btn:hover { background: #e6e6ea !important; }
.aicscopilot-voicechat-btn.aicscopilot-listening { background: #d64545 !important; color: #ffffff !important; border-color: #d64545 !important; }
.aicscopilot-voicechat-btn.aicscopilot-active { background: #2e8b57 !important; color: #ffffff !important; border-color: #2e8b57 !important; }
