/* FalconERP chat — Cursor-inspired side panel, strict LTR */

:root {
	--ai-chat-primary: #2b5ce8;
	--ai-chat-primary-dark: #1a3a8f;
	--ai-chat-primary-light: #5b8def;
	--ai-chat-bg-light: #ffffff;
	--ai-chat-bg-dark: #0f1e35;
	--ai-chat-surface-light: #f8fafc;
	--ai-chat-surface-dark: #1a2744;
	--ai-chat-text-light: #1e293b;
	--ai-chat-text-dark: #e2e8f0;
	--ai-chat-border-light: #e2e8f0;
	--ai-chat-border-dark: #2d3f66;
	--ai-chat-panel-width: 520px;
	--ai-chat-minimized-width: 480px;
	--ai-chat-top-gap: 0px;
	--ai-chat-mesh-light: linear-gradient(165deg, #f8faff 0%, #eef3ff 42%, #f5f0ff 100%);
	--ai-chat-mesh-dark: linear-gradient(165deg, #080f1c 0%, #0f1e35 48%, #101828 100%);
}

/* Strict LTR for entire chat subtree */
.ai-chat-window,
.ai-chat-window * {
	direction: ltr !important;
	unicode-bidi: isolate;
}

.ai-chat-message.user .ai-chat-message-bubble {
	text-align: left !important;
}

/* Bottom-right launcher */
.ai-chat-button.right {
	left: auto !important;
	right: 20px !important;
	bottom: 20px !important;
	width: 48px !important;
	height: 48px !important;
	border-radius: 12px !important;
	background: var(--ai-chat-primary) !important;
	box-shadow: 0 4px 16px rgba(43, 92, 232, 0.35) !important;
}

.ai-chat-button.right.hidden {
	display: none !important;
}

.ai-chat-button {
	z-index: 10001 !important;
}

/* Right panel — flush top and bottom */
.ai-chat-window.right:not(.minimized):not(.fullscreen) {
	top: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	left: auto !important;
	width: min(var(--ai-chat-panel-width), 100vw) !important;
	height: 100vh !important;
	max-height: 100vh !important;
	border-radius: 0 !important;
	border-right: none !important;
	border-left: 1px solid var(--ai-chat-border-light) !important;
	box-shadow: -1px 0 0 var(--ai-chat-border-light), -12px 0 40px rgba(15, 23, 42, 0.06) !important;
	transform-origin: bottom right !important;
}

.ai-chat-window.right.hidden {
	transform: translateX(100%) !important;
}

.ai-chat-window.right:not(.hidden):not(.minimized) {
	transform: translateX(0) !important;
}

/* Minimized bar — bottom-right anchor */
.ai-chat-window.right.minimized {
	top: auto !important;
	bottom: 20px !important;
	right: 20px !important;
	left: auto !important;
	width: min(var(--ai-chat-minimized-width), calc(100vw - 40px)) !important;
	height: 52px !important;
	min-height: 52px !important;
	max-height: 52px !important;
	border-radius: 10px !important;
	transform-origin: bottom right !important;
}

.ai-chat-input-container {
	transition:
		opacity 0.28s ease,
		max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
		padding 0.28s ease !important;
}

.ai-chat-window.minimized .ai-chat-messages-wrap,
.ai-chat-window.minimized .ai-chat-messages,
.ai-chat-window.minimized .ai-chat-input-container {
	opacity: 0 !important;
	max-height: 0 !important;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	overflow: hidden !important;
	pointer-events: none !important;
}

.ai-chat-window.fullscreen {
	top: auto !important;
	left: auto !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100vw !important;
	height: 100vh !important;
	max-height: 100vh !important;
	border-radius: 0 !important;
	transform-origin: bottom right !important;
}

/* Header — high contrast, LTR grid toolbar */
.ai-chat-header {
	display: grid !important;
	grid-template-columns: auto 1fr auto !important;
	align-items: center !important;
	gap: 8px !important;
	direction: ltr !important;
	color: var(--ai-chat-text-light) !important;
	border-bottom: 1px solid var(--ai-chat-border-light) !important;
}

.ai-chat-actions {
	grid-column: 3 !important;
	display: flex !important;
	flex-direction: row !important;
	justify-content: flex-end !important;
	gap: 4px !important;
	direction: ltr !important;
}

.ai-chat-header-left-actions {
	grid-column: 1 !important;
	display: flex !important;
	flex-direction: row !important;
	gap: 4px !important;
	justify-content: flex-start !important;
	direction: ltr !important;
}

.ai-chat-header h3 {
	grid-column: 2 !important;
	text-align: left !important;
	color: var(--ai-chat-text-light) !important;
	font-weight: 600 !important;
}

.ai-chat-close-btn {
	margin-left: 2px !important;
}

.ai-chat-history-error {
	gap: 10px !important;
	color: var(--ai-chat-text-light) !important;
}

.ai-chat-history-error-icon {
	width: 56px !important;
	height: 56px !important;
	border-radius: 16px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	margin-bottom: 4px !important;
	color: #dc2626 !important;
	background: linear-gradient(135deg, rgba(239, 68, 68, 0.14), rgba(239, 68, 68, 0.05)) !important;
	border: 1px solid rgba(239, 68, 68, 0.22) !important;
	box-shadow: 0 6px 18px rgba(239, 68, 68, 0.1) !important;
}

.ai-chat-history-error-icon svg {
	width: 28px !important;
	height: 28px !important;
}

.ai-chat-history-error-title {
	font-size: 14px !important;
	font-weight: 600 !important;
}

.ai-chat-history-error-hint {
	font-size: 12px !important;
	line-height: 1.45 !important;
	color: rgba(30, 41, 59, 0.62) !important;
	max-width: 220px !important;
}

.ai-chat-window.dark .ai-chat-history-error,
[data-theme="dark"] .ai-chat-window .ai-chat-history-error {
	color: var(--ai-chat-text-dark) !important;
}

.ai-chat-window.dark .ai-chat-history-error-hint,
[data-theme="dark"] .ai-chat-window .ai-chat-history-error-hint {
	color: rgba(226, 232, 240, 0.62) !important;
}

.ai-chat-action-btn {
	color: var(--ai-chat-text-light) !important;
	opacity: 0.88;
}

.ai-chat-action-btn:hover {
	opacity: 1;
	background: rgba(30, 41, 59, 0.08) !important;
}

/* Dark mode */
.ai-chat-window.dark,
[data-theme="dark"] .ai-chat-window {
	background: var(--ai-chat-mesh-dark) !important;
	color: var(--ai-chat-text-dark) !important;
}

.ai-chat-window.dark::before,
[data-theme="dark"] .ai-chat-window::before {
	background:
		radial-gradient(ellipse 90% 55% at 10% 12%, rgba(91, 141, 239, 0.28) 0%, transparent 58%),
		radial-gradient(ellipse 70% 50% at 92% 20%, rgba(43, 92, 232, 0.2) 0%, transparent 52%),
		radial-gradient(ellipse 65% 45% at 82% 85%, rgba(26, 58, 143, 0.25) 0%, transparent 55%),
		radial-gradient(ellipse 50% 40% at 30% 70%, rgba(139, 92, 246, 0.12) 0%, transparent 50%),
		var(--ai-chat-mesh-dark) !important;
}

.ai-chat-window.dark::after,
[data-theme="dark"] .ai-chat-window::after {
	background-image: radial-gradient(circle at 1px 1px, rgba(91, 141, 239, 0.12) 1px, transparent 0) !important;
	opacity: 0.35 !important;
}

.ai-chat-window.dark .ai-chat-message.assistant .ai-chat-message-bubble,
[data-theme="dark"] .ai-chat-window .ai-chat-message.assistant .ai-chat-message-bubble {
	background: rgba(26, 39, 68, 0.72) !important;
	border: 1px solid rgba(91, 141, 239, 0.2) !important;
	box-shadow:
		0 2px 20px rgba(0, 0, 0, 0.25),
		0 1px 0 rgba(91, 141, 239, 0.08) inset !important;
}

.ai-chat-window.dark .ai-chat-header,
[data-theme="dark"] .ai-chat-window .ai-chat-header {
	background: rgba(15, 30, 53, 0.88) !important;
	color: var(--ai-chat-text-dark) !important;
	border-bottom-color: var(--ai-chat-border-dark) !important;
}

.ai-chat-window.dark .ai-chat-header h3,
[data-theme="dark"] .ai-chat-window .ai-chat-header h3,
.ai-chat-window.dark .ai-chat-action-btn,
[data-theme="dark"] .ai-chat-window .ai-chat-action-btn {
	color: var(--ai-chat-text-dark) !important;
}

.ai-chat-window {
	z-index: 10002 !important;
	font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
	transform-origin: bottom right !important;
	background: var(--ai-chat-mesh-light) !important;
	isolation: isolate !important;
	transition:
		right 0.38s cubic-bezier(0.4, 0, 0.2, 1),
		bottom 0.38s cubic-bezier(0.4, 0, 0.2, 1),
		width 0.38s cubic-bezier(0.4, 0, 0.2, 1),
		height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
		max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
		border-radius 0.38s cubic-bezier(0.4, 0, 0.2, 1),
		transform 0.38s cubic-bezier(0.4, 0, 0.2, 1),
		opacity 0.3s ease,
		box-shadow 0.38s ease !important;
}

/* Fixed mesh background on panel — does not scroll with messages */
.ai-chat-window::before {
	content: "" !important;
	position: absolute !important;
	inset: 0 !important;
	z-index: 0 !important;
	pointer-events: none !important;
	background:
		radial-gradient(ellipse 90% 55% at 12% 8%, rgba(91, 141, 239, 0.22) 0%, transparent 58%),
		radial-gradient(ellipse 70% 50% at 88% 18%, rgba(165, 196, 255, 0.18) 0%, transparent 52%),
		radial-gradient(ellipse 65% 45% at 78% 88%, rgba(43, 92, 232, 0.14) 0%, transparent 55%),
		radial-gradient(ellipse 50% 40% at 35% 72%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
		var(--ai-chat-mesh-light) !important;
}

.ai-chat-window::after {
	content: "" !important;
	position: absolute !important;
	inset: 0 !important;
	z-index: 0 !important;
	pointer-events: none !important;
	opacity: 0.45 !important;
	background-image: radial-gradient(circle at 1px 1px, rgba(43, 92, 232, 0.07) 1px, transparent 0) !important;
	background-size: 22px 22px !important;
}

.ai-chat-header,
.ai-chat-messages-wrap,
.ai-chat-input-container {
	position: relative !important;
	z-index: 1 !important;
}

.ai-chat-messages-wrap {
	flex: 1 1 auto !important;
	min-height: 0 !important;
	display: flex !important;
	flex-direction: column !important;
	position: relative !important;
}

.ai-chat-messages-shadow {
	position: absolute !important;
	left: 0 !important;
	right: 0 !important;
	height: 32px !important;
	pointer-events: none !important;
	z-index: 10 !important;
	opacity: 0 !important;
	transition: opacity 0.22s ease !important;
}

.ai-chat-messages-shadow-top {
	top: 0 !important;
	background: linear-gradient(to bottom, rgba(15, 23, 42, 0.16), rgba(15, 23, 42, 0.04) 55%, transparent) !important;
}

.ai-chat-messages-shadow-bottom {
	bottom: 0 !important;
	background: linear-gradient(to top, rgba(15, 23, 42, 0.16), rgba(15, 23, 42, 0.04) 55%, transparent) !important;
}

.ai-chat-messages-wrap.has-scroll-top .ai-chat-messages-shadow-top {
	opacity: 1 !important;
}

.ai-chat-messages-wrap.has-scroll-bottom .ai-chat-messages-shadow-bottom {
	opacity: 1 !important;
}

.ai-chat-messages-wrap.has-scroll-top .ai-chat-messages {
	box-shadow: inset 0 22px 18px -14px rgba(15, 23, 42, 0.12) !important;
}

.ai-chat-messages-wrap.has-scroll-bottom .ai-chat-messages {
	box-shadow: inset 0 -22px 18px -14px rgba(15, 23, 42, 0.12) !important;
}

.ai-chat-messages-wrap.has-scroll-top.has-scroll-bottom .ai-chat-messages {
	box-shadow:
		inset 0 22px 18px -14px rgba(15, 23, 42, 0.12),
		inset 0 -22px 18px -14px rgba(15, 23, 42, 0.12) !important;
}

.ai-chat-window.dark .ai-chat-messages-shadow-top,
[data-theme="dark"] .ai-chat-window .ai-chat-messages-shadow-top {
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.12) 55%, transparent) !important;
}

.ai-chat-window.dark .ai-chat-messages-shadow-bottom,
[data-theme="dark"] .ai-chat-window .ai-chat-messages-shadow-bottom {
	background: linear-gradient(to top, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.12) 55%, transparent) !important;
}

.ai-chat-window.dark .ai-chat-messages-wrap.has-scroll-top .ai-chat-messages,
[data-theme="dark"] .ai-chat-window .ai-chat-messages-wrap.has-scroll-top .ai-chat-messages {
	box-shadow: inset 0 22px 18px -14px rgba(0, 0, 0, 0.28) !important;
}

.ai-chat-window.dark .ai-chat-messages-wrap.has-scroll-bottom .ai-chat-messages,
[data-theme="dark"] .ai-chat-window .ai-chat-messages-wrap.has-scroll-bottom .ai-chat-messages {
	box-shadow: inset 0 -22px 18px -14px rgba(0, 0, 0, 0.28) !important;
}

.ai-chat-window.dark .ai-chat-messages-wrap.has-scroll-top.has-scroll-bottom .ai-chat-messages,
[data-theme="dark"] .ai-chat-window .ai-chat-messages-wrap.has-scroll-top.has-scroll-bottom .ai-chat-messages {
	box-shadow:
		inset 0 22px 18px -14px rgba(0, 0, 0, 0.28),
		inset 0 -22px 18px -14px rgba(0, 0, 0, 0.28) !important;
}

/* Scrollable messages area — transparent over fixed panel background */
.ai-chat-messages {
	flex: 1 1 auto !important;
	min-height: 0 !important;
	position: relative !important;
	z-index: 1 !important;
	overflow-y: auto !important;
	overflow-x: hidden !important;
	-webkit-overflow-scrolling: touch !important;
	background: transparent !important;
	transition: box-shadow 0.22s ease !important;
}

.ai-chat-message.assistant .ai-chat-message-bubble {
	background: rgba(255, 255, 255, 0.78) !important;
	backdrop-filter: blur(14px) saturate(1.2) !important;
	-webkit-backdrop-filter: blur(14px) saturate(1.2) !important;
	border: 1px solid rgba(255, 255, 255, 0.85) !important;
	box-shadow:
		0 2px 16px rgba(43, 92, 232, 0.08),
		0 1px 0 rgba(255, 255, 255, 0.9) inset !important;
}

.ai-chat-header {
	background: rgba(255, 255, 255, 0.88) !important;
	backdrop-filter: blur(12px) !important;
	-webkit-backdrop-filter: blur(12px) !important;
}

/* Empty state + sample questions */
.ai-chat-empty-state {
	align-items: flex-start !important;
	text-align: left !important;
	justify-content: flex-start !important;
	padding: 32px 22px 24px !important;
	position: relative !important;
	z-index: 1 !important;
	gap: 6px !important;
}

.ai-chat-empty-state-icon {
	width: 44px !important;
	height: 44px !important;
	border-radius: 14px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	margin-bottom: 8px !important;
	color: var(--ai-chat-primary) !important;
	background: linear-gradient(135deg, rgba(91, 141, 239, 0.18), rgba(43, 92, 232, 0.08)) !important;
	border: 1px solid rgba(43, 92, 232, 0.14) !important;
	box-shadow: 0 4px 16px rgba(43, 92, 232, 0.1) !important;
}

.ai-chat-empty-state h4 {
	background: linear-gradient(135deg, #1a3a8f 0%, #2b5ce8 55%, #5b8def 100%) !important;
	-webkit-background-clip: text !important;
	background-clip: text !important;
	-webkit-text-fill-color: transparent !important;
	font-weight: 700 !important;
	font-size: 20px !important;
	margin: 0 !important;
	letter-spacing: -0.02em !important;
}

.ai-chat-window.dark .ai-chat-empty-state h4,
[data-theme="dark"] .ai-chat-window .ai-chat-empty-state h4 {
	background: linear-gradient(135deg, #a5c4ff 0%, #5b8def 50%, #e2e8f0 100%) !important;
	-webkit-background-clip: text !important;
	background-clip: text !important;
	-webkit-text-fill-color: transparent !important;
}

.ai-chat-empty-state p {
	text-align: left !important;
	width: 100% !important;
	margin: 0 0 4px 0 !important;
	font-size: 13px !important;
	line-height: 1.5 !important;
	color: rgba(30, 41, 59, 0.62) !important;
	max-width: 32ch !important;
}

.ai-chat-window.dark .ai-chat-empty-state p,
[data-theme="dark"] .ai-chat-window .ai-chat-empty-state p {
	color: rgba(226, 232, 240, 0.62) !important;
}

.ai-chat-window.dark .ai-chat-empty-state-icon,
[data-theme="dark"] .ai-chat-window .ai-chat-empty-state-icon {
	color: var(--ai-chat-primary-light) !important;
	background: linear-gradient(135deg, rgba(91, 141, 239, 0.22), rgba(43, 92, 232, 0.1)) !important;
	border-color: rgba(91, 141, 239, 0.25) !important;
}

.ai-chat-sample-questions {
	width: 100% !important;
	margin-top: 18px !important;
	display: flex !important;
	flex-direction: column !important;
	gap: 10px !important;
	direction: ltr !important;
}

.ai-chat-sample-questions-label {
	margin: 0 !important;
	font-size: 11px !important;
	font-weight: 600 !important;
	letter-spacing: 0.07em !important;
	text-transform: uppercase !important;
	color: rgba(30, 41, 59, 0.48) !important;
}

.ai-chat-window.dark .ai-chat-sample-questions-label,
[data-theme="dark"] .ai-chat-window .ai-chat-sample-questions-label {
	color: rgba(226, 232, 240, 0.48) !important;
}

.ai-chat-sample-questions-grid {
	display: flex !important;
	flex-direction: column !important;
	gap: 8px !important;
	width: 100% !important;
}

.ai-chat-sample-question-btn {
	display: flex !important;
	align-items: flex-start !important;
	gap: 12px !important;
	width: 100% !important;
	padding: 12px 14px !important;
	border: 1px solid rgba(43, 92, 232, 0.12) !important;
	border-radius: 12px !important;
	background: rgba(255, 255, 255, 0.72) !important;
	backdrop-filter: blur(10px) !important;
	-webkit-backdrop-filter: blur(10px) !important;
	text-align: left !important;
	direction: ltr !important;
	unicode-bidi: isolate !important;
	color: var(--ai-chat-text-light) !important;
	font-size: 13px !important;
	line-height: 1.45 !important;
	cursor: pointer !important;
	transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease !important;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

.ai-chat-sample-question-btn:hover {
	border-color: rgba(43, 92, 232, 0.32) !important;
	background: rgba(255, 255, 255, 0.94) !important;
	box-shadow: 0 4px 16px rgba(43, 92, 232, 0.1) !important;
	transform: translateY(-1px) !important;
}

.ai-chat-sample-question-icon {
	flex-shrink: 0 !important;
	width: 30px !important;
	height: 30px !important;
	border-radius: 9px !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	color: var(--ai-chat-primary) !important;
	background: linear-gradient(135deg, rgba(91, 141, 239, 0.16), rgba(43, 92, 232, 0.07)) !important;
	border: 1px solid rgba(43, 92, 232, 0.1) !important;
}

.ai-chat-sample-question-text {
	flex: 1 !important;
	padding-top: 5px !important;
	text-align: left !important;
}

.ai-chat-window.dark .ai-chat-sample-question-btn,
[data-theme="dark"] .ai-chat-window .ai-chat-sample-question-btn {
	background: rgba(26, 39, 68, 0.55) !important;
	border-color: rgba(91, 141, 239, 0.18) !important;
	color: var(--ai-chat-text-dark) !important;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15) !important;
}

.ai-chat-window.dark .ai-chat-sample-question-btn:hover,
[data-theme="dark"] .ai-chat-window .ai-chat-sample-question-btn:hover {
	background: rgba(26, 39, 68, 0.78) !important;
	border-color: rgba(91, 141, 239, 0.35) !important;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
}

.ai-chat-window.dark .ai-chat-sample-question-icon,
[data-theme="dark"] .ai-chat-window .ai-chat-sample-question-icon {
	color: var(--ai-chat-primary-light) !important;
	background: linear-gradient(135deg, rgba(91, 141, 239, 0.2), rgba(43, 92, 232, 0.1)) !important;
	border-color: rgba(91, 141, 239, 0.2) !important;
}

.ai-chat-message-bubble.is-collapsible {
	position: relative !important;
	overflow: hidden !important;
	transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.ai-chat-message-bubble.is-collapsible.is-collapsed {
	max-height: 280px !important;
}

.ai-chat-message-bubble.is-collapsible.is-collapsed::after {
	content: "" !important;
	position: absolute !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	height: 52px !important;
	pointer-events: none !important;
	opacity: 1 !important;
	transition: opacity 0.3s ease !important;
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(248, 250, 252, 0.92) 68%, rgba(241, 245, 249, 0.98)) !important;
}

.ai-chat-message.user .ai-chat-message-bubble.is-collapsible.is-collapsed::after {
	background: linear-gradient(to bottom, rgba(43, 92, 232, 0), rgba(35, 78, 210, 0.55) 70%, rgba(26, 58, 143, 0.82)) !important;
}

.ai-chat-message.assistant .ai-chat-message-bubble.is-collapsible.is-collapsed::after {
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.75) 65%, rgba(248, 250, 252, 0.95)) !important;
}

.ai-chat-window.dark .ai-chat-message.assistant .ai-chat-message-bubble.is-collapsible.is-collapsed::after,
[data-theme="dark"] .ai-chat-window .ai-chat-message.assistant .ai-chat-message-bubble.is-collapsible.is-collapsed::after {
	background: linear-gradient(to bottom, rgba(15, 30, 53, 0), rgba(15, 30, 53, 0.72) 68%, rgba(10, 20, 38, 0.92)) !important;
}

.ai-chat-message-bubble.is-collapsible.is-expanded::after {
	opacity: 0 !important;
}

.ai-chat-message-toggle {
	margin-top: 6px !important;
	padding: 0 !important;
	border: none !important;
	background: transparent !important;
	color: var(--ai-chat-primary) !important;
	font-size: 12px !important;
	font-weight: 600 !important;
	line-height: 1.4 !important;
	cursor: pointer !important;
	text-align: left !important;
	direction: ltr !important;
}

.ai-chat-message-toggle:hover {
	color: var(--ai-chat-primary-dark) !important;
	text-decoration: underline !important;
}

.ai-chat-message.user .ai-chat-message-toggle {
	align-self: flex-end !important;
	text-align: right !important;
}

.ai-chat-message.assistant .ai-chat-message-toggle {
	align-self: flex-start !important;
}

.ai-chat-window.dark .ai-chat-message-toggle,
[data-theme="dark"] .ai-chat-window .ai-chat-message-toggle {
	color: var(--ai-chat-primary-light) !important;
}

.thinking-indicator {
	display: inline-flex !important;
	align-items: center !important;
	gap: 10px !important;
	padding: 10px 14px 10px 12px !important;
	border-radius: 999px !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	letter-spacing: 0.01em !important;
	background: linear-gradient(135deg, rgba(43, 92, 232, 0.07), rgba(91, 141, 239, 0.14)) !important;
	border: 1px solid rgba(43, 92, 232, 0.2) !important;
	box-shadow:
		0 2px 14px rgba(43, 92, 232, 0.1),
		inset 0 1px 0 rgba(255, 255, 255, 0.65) !important;
}

.ai-chat-window.dark .thinking-indicator,
[data-theme="dark"] .ai-chat-window .thinking-indicator {
	background: linear-gradient(135deg, rgba(43, 92, 232, 0.14), rgba(26, 58, 143, 0.22)) !important;
	border-color: rgba(91, 141, 239, 0.28) !important;
	box-shadow:
		0 2px 16px rgba(0, 0, 0, 0.22),
		inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

.thinking-indicator-orb {
	position: relative !important;
	width: 18px !important;
	height: 18px !important;
	flex-shrink: 0 !important;
}

.thinking-indicator-orb-core {
	position: absolute !important;
	inset: 5px !important;
	border-radius: 50% !important;
	background: linear-gradient(135deg, var(--ai-chat-primary-light), var(--ai-chat-primary)) !important;
	box-shadow: 0 0 10px rgba(43, 92, 232, 0.45) !important;
	animation: donow-thinking-pulse 1.6s ease-in-out infinite !important;
}

.thinking-indicator-orb-ring {
	position: absolute !important;
	inset: 0 !important;
	border-radius: 50% !important;
	border: 2px solid rgba(43, 92, 232, 0.18) !important;
	border-top-color: var(--ai-chat-primary) !important;
	animation: donow-thinking-spin 1.1s linear infinite !important;
}

.thinking-indicator-label {
	background: linear-gradient(90deg, var(--ai-chat-primary), var(--ai-chat-primary-light), var(--ai-chat-primary)) !important;
	background-size: 200% auto !important;
	-webkit-background-clip: text !important;
	background-clip: text !important;
	-webkit-text-fill-color: transparent !important;
	animation: donow-thinking-shimmer 2.2s linear infinite !important;
}

.ai-chat-window.dark .thinking-indicator-label,
[data-theme="dark"] .ai-chat-window .thinking-indicator-label {
	background: linear-gradient(90deg, #dbeafe, var(--ai-chat-primary-light), #dbeafe) !important;
	background-size: 200% auto !important;
	-webkit-background-clip: text !important;
	background-clip: text !important;
	-webkit-text-fill-color: transparent !important;
}

.thinking-indicator-dots {
	display: inline-flex !important;
	align-items: center !important;
	gap: 4px !important;
	margin-left: 2px !important;
}

.thinking-indicator-dots span {
	width: 5px !important;
	height: 5px !important;
	border-radius: 50% !important;
	background: var(--ai-chat-primary) !important;
	animation: donow-thinking-dot 1.4s ease-in-out infinite !important;
}

.ai-chat-window.dark .thinking-indicator-dots span,
[data-theme="dark"] .ai-chat-window .thinking-indicator-dots span {
	background: var(--ai-chat-primary-light) !important;
}

.thinking-indicator-dots span:nth-child(2) {
	animation-delay: 0.18s !important;
}

.thinking-indicator-dots span:nth-child(3) {
	animation-delay: 0.36s !important;
}

@keyframes donow-thinking-dot {
	0%, 60%, 100% {
		transform: translateY(0) scale(0.85);
		opacity: 0.35;
	}
	30% {
		transform: translateY(-5px) scale(1);
		opacity: 1;
	}
}

@keyframes donow-thinking-pulse {
	0%, 100% {
		transform: scale(0.92);
		opacity: 0.75;
	}
	50% {
		transform: scale(1);
		opacity: 1;
	}
}

@keyframes donow-thinking-shimmer {
	0% { background-position: 0% center; }
	100% { background-position: 200% center; }
}

@keyframes donow-thinking-spin {
	to { transform: rotate(360deg); }
}

.ai-chat-input-container {
	background: rgba(248, 250, 252, 0.55) !important;
	backdrop-filter: blur(12px) !important;
	-webkit-backdrop-filter: blur(12px) !important;
	border-top: 1px solid rgba(226, 232, 240, 0.85) !important;
	flex-direction: column !important;
	direction: ltr !important;
	padding: 14px 16px 16px !important;
}

.ai-chat-composer-card {
	display: flex !important;
	flex-direction: column !important;
	width: 100% !important;
	min-width: 0 !important;
	border-radius: 14px !important;
	border: 1px solid rgba(203, 213, 225, 0.85) !important;
	background: rgba(255, 255, 255, 0.92) !important;
	box-shadow:
		0 1px 2px rgba(15, 23, 42, 0.04),
		0 8px 24px rgba(43, 92, 232, 0.06) !important;
	overflow: hidden !important;
	transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.ai-chat-composer-card:focus-within {
	border-color: rgba(43, 92, 232, 0.35) !important;
	box-shadow:
		0 0 0 3px rgba(43, 92, 232, 0.08),
		0 8px 24px rgba(43, 92, 232, 0.1) !important;
}

.ai-chat-composer-actions {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	gap: 10px !important;
	padding: 8px 10px 10px !important;
	min-width: 0 !important;
}

.ai-chat-composer-actions-left {
	display: flex !important;
	align-items: center !important;
	gap: 6px !important;
	min-width: 0 !important;
	flex: 1 1 auto !important;
	flex-wrap: wrap !important;
}

.ai-chat-composer-actions-right {
	display: flex !important;
	align-items: center !important;
	gap: 6px !important;
	flex-shrink: 0 !important;
}

.ai-chat-mode-group {
	display: inline-flex !important;
	align-items: center !important;
	gap: 2px !important;
	flex-shrink: 0 !important;
	background: none !important;
	border: none !important;
	padding: 0 !important;
}

.ai-chat-mode-btn {
	display: inline-flex !important;
	align-items: center !important;
	gap: 5px !important;
	border: 1px solid transparent !important;
	background: transparent !important;
	padding: 5px 9px !important;
	border-radius: 999px !important;
	font-size: 11.5px !important;
	font-weight: 600 !important;
	line-height: 1 !important;
	cursor: pointer !important;
	color: rgba(71, 85, 105, 0.88) !important;
}

.ai-chat-mode-btn svg {
	width: 13px !important;
	height: 13px !important;
	flex-shrink: 0 !important;
	opacity: 0.72 !important;
}

.ai-chat-composer-card {
	overflow: visible !important;
}

.ai-chat-mode-btn.is-active {
	background: rgba(100, 116, 139, 0.1) !important;
	border-color: rgba(203, 213, 225, 0.75) !important;
}

.ai-chat-mode-btn svg {
	opacity: 0.72 !important;
	stroke: rgba(71, 85, 105, 0.85) !important;
}

.ai-chat-mode-btn:hover svg,
.ai-chat-mode-btn.is-active svg {
	opacity: 1 !important;
}

.ai-chat-mode-btn[data-mode="agent"]:hover svg,
.ai-chat-mode-btn[data-mode="agent"].is-active svg {
	stroke: var(--ai-chat-primary) !important;
}

.ai-chat-mode-btn[data-mode="agent"]:hover,
.ai-chat-mode-btn[data-mode="agent"].is-active {
	color: var(--ai-chat-primary) !important;
}

.ai-chat-mode-btn[data-mode="ask"]:hover svg,
.ai-chat-mode-btn[data-mode="ask"].is-active svg {
	stroke: #059669 !important;
}

.ai-chat-mode-btn[data-mode="ask"]:hover,
.ai-chat-mode-btn[data-mode="ask"].is-active {
	color: #059669 !important;
}

.ai-chat-mode-btn[data-mode="plan"]:hover svg,
.ai-chat-mode-btn[data-mode="plan"].is-active svg {
	stroke: #ea580c !important;
}

.ai-chat-mode-btn[data-mode="plan"]:hover,
.ai-chat-mode-btn[data-mode="plan"].is-active {
	color: #ea580c !important;
}

.ai-chat-model-select-wrap.is-open .ai-chat-model-menu,
.ai-chat-model-menu.is-open {
	opacity: 1 !important;
	visibility: visible !important;
	transform: translateY(0) scale(1) !important;
}

.ai-chat-model-menu {
	bottom: calc(100% + 8px) !important;
	top: auto !important;
	transform-origin: bottom left !important;
	z-index: 40 !important;
}

.ai-chat-model-menu--floating {
	position: fixed !important;
	bottom: auto !important;
	transform: none !important;
	opacity: 1 !important;
	visibility: visible !important;
}

.ai-chat-model-menu-list {
	max-height: min(220px, 36vh) !important;
	min-height: 0 !important;
	overflow-y: auto !important;
}

.ai-chat-window.model-menu-open {
	overflow: visible !important;
}

.ai-chat-window.dark .ai-chat-mode-btn,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn {
	color: rgba(226, 232, 240, 0.88) !important;
}

.ai-chat-window.dark .ai-chat-mode-btn svg,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn svg {
	stroke: rgba(226, 232, 240, 0.78) !important;
	opacity: 0.9 !important;
}

.ai-chat-window.dark .ai-chat-mode-btn.is-active,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn.is-active {
	background: rgba(71, 85, 105, 0.22) !important;
	border-color: rgba(71, 85, 105, 0.45) !important;
}

.ai-chat-window.dark .ai-chat-mode-btn[data-mode="agent"]:hover svg,
.ai-chat-window.dark .ai-chat-mode-btn[data-mode="agent"].is-active svg,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn[data-mode="agent"]:hover svg,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn[data-mode="agent"].is-active svg {
	stroke: var(--ai-chat-primary-light) !important;
}

.ai-chat-window.dark .ai-chat-mode-btn[data-mode="agent"]:hover,
.ai-chat-window.dark .ai-chat-mode-btn[data-mode="agent"].is-active,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn[data-mode="agent"]:hover,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn[data-mode="agent"].is-active {
	color: var(--ai-chat-primary-light) !important;
}

.ai-chat-window.dark .ai-chat-mode-btn[data-mode="ask"]:hover svg,
.ai-chat-window.dark .ai-chat-mode-btn[data-mode="ask"].is-active svg,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn[data-mode="ask"]:hover svg,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn[data-mode="ask"].is-active svg {
	stroke: #6ee7b7 !important;
}

.ai-chat-window.dark .ai-chat-mode-btn[data-mode="ask"]:hover,
.ai-chat-window.dark .ai-chat-mode-btn[data-mode="ask"].is-active,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn[data-mode="ask"]:hover,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn[data-mode="ask"].is-active {
	color: #6ee7b7 !important;
}

.ai-chat-window.dark .ai-chat-mode-btn[data-mode="plan"]:hover svg,
.ai-chat-window.dark .ai-chat-mode-btn[data-mode="plan"].is-active svg,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn[data-mode="plan"]:hover svg,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn[data-mode="plan"].is-active svg {
	stroke: #fdba74 !important;
}

.ai-chat-window.dark .ai-chat-mode-btn[data-mode="plan"]:hover,
.ai-chat-window.dark .ai-chat-mode-btn[data-mode="plan"].is-active,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn[data-mode="plan"]:hover,
[data-theme="dark"] .ai-chat-window .ai-chat-mode-btn[data-mode="plan"].is-active {
	color: #fdba74 !important;
}

.ai-chat-model-select-wrap {
	max-width: min(168px, 42vw) !important;
}

.ai-chat-model-trigger {
	display: inline-flex !important;
	align-items: center !important;
	gap: 6px !important;
	width: 100% !important;
	padding: 5px 8px 5px 7px !important;
	border-radius: 999px !important;
	border: 1px solid rgba(203, 213, 225, 0.95) !important;
	background: rgba(248, 250, 252, 0.95) !important;
	font-size: 11.5px !important;
	font-weight: 600 !important;
	cursor: pointer !important;
}

.ai-chat-composer-icon-btn {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 34px !important;
	height: 34px !important;
	padding: 0 !important;
	border: none !important;
	border-radius: 999px !important;
	background: transparent !important;
	color: rgba(71, 85, 105, 0.75) !important;
}

.ai-chat-model-trigger-icon {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 18px !important;
	height: 18px !important;
	border-radius: 999px !important;
	color: var(--ai-chat-primary) !important;
	background: rgba(43, 92, 232, 0.1) !important;
}

.ai-chat-model-trigger-label {
	min-width: 0 !important;
	overflow: hidden !important;
	text-overflow: ellipsis !important;
	white-space: nowrap !important;
	flex: 1 1 auto !important;
	text-align: left !important;
}

.ai-chat-model-menu {
	position: absolute !important;
	left: 0 !important;
	bottom: calc(100% + 8px) !important;
	top: auto !important;
	min-width: 240px !important;
	max-width: min(280px, 72vw) !important;
	border-radius: 12px !important;
	border: 1px solid rgba(203, 213, 225, 0.95) !important;
	background: rgba(255, 255, 255, 0.98) !important;
	box-shadow:
		0 4px 6px rgba(15, 23, 42, 0.04),
		0 16px 40px rgba(15, 23, 42, 0.12) !important;
	z-index: 40 !important;
	transform-origin: bottom left !important;
}

.ai-chat-model-menu.ai-chat-model-menu--floating {
	position: fixed !important;
	bottom: auto !important;
	z-index: 100005 !important;
	transform: none !important;
	opacity: 1 !important;
	visibility: visible !important;
}

.ai-chat-model-menu-header {
	padding: 10px 12px 8px !important;
	font-size: 10px !important;
	font-weight: 700 !important;
	letter-spacing: 0.06em !important;
	text-transform: uppercase !important;
	color: rgba(100, 116, 139, 0.85) !important;
	border-bottom: 1px solid rgba(226, 232, 240, 0.9) !important;
}

.ai-chat-model-menu-list {
	overflow-y: auto !important;
	padding: 6px !important;
	display: flex !important;
	flex-direction: column !important;
	gap: 2px !important;
	max-height: min(220px, 36vh) !important;
	min-height: 0 !important;
}

.ai-chat-model-option {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	gap: 8px !important;
	width: 100% !important;
	padding: 9px 10px !important;
	border: 1px solid transparent !important;
	border-radius: 8px !important;
	background: transparent !important;
	font-size: 12.5px !important;
	font-weight: 600 !important;
	text-align: left !important;
	cursor: pointer !important;
}

.ai-chat-model-option.is-selected {
	background: rgba(43, 92, 232, 0.1) !important;
	border-color: rgba(43, 92, 232, 0.16) !important;
	color: var(--ai-chat-primary) !important;
}

.ai-chat-window.dark .ai-chat-model-trigger,
[data-theme="dark"] .ai-chat-window .ai-chat-model-trigger {
	background: rgba(15, 23, 42, 0.72) !important;
	border-color: rgba(71, 85, 105, 0.65) !important;
	color: rgba(226, 232, 240, 0.92) !important;
}

.ai-chat-window.dark .ai-chat-model-menu,
[data-theme="dark"] .ai-chat-window .ai-chat-model-menu,
.ai-chat-model-menu.is-dark {
	background: rgba(18, 28, 48, 0.98) !important;
	border-color: rgba(71, 85, 105, 0.55) !important;
	box-shadow:
		0 4px 6px rgba(0, 0, 0, 0.18),
		0 16px 40px rgba(0, 0, 0, 0.35) !important;
}

.ai-chat-model-menu.is-dark .ai-chat-model-menu-header {
	color: rgba(148, 163, 184, 0.85) !important;
	border-bottom-color: rgba(51, 65, 85, 0.65) !important;
}

.ai-chat-model-menu.is-dark .ai-chat-model-option {
	color: rgba(226, 232, 240, 0.92) !important;
}

.ai-chat-model-menu.is-dark .ai-chat-model-option:hover {
	background: rgba(43, 92, 232, 0.14) !important;
	border-color: rgba(91, 141, 239, 0.12) !important;
}

.ai-chat-window.dark .ai-chat-model-option.is-selected,
[data-theme="dark"] .ai-chat-window .ai-chat-model-option.is-selected,
.ai-chat-model-menu.is-dark .ai-chat-model-option.is-selected {
	background: rgba(43, 92, 232, 0.22) !important;
	border-color: rgba(91, 141, 239, 0.24) !important;
	color: var(--ai-chat-primary-light) !important;
}

.ai-chat-composer-icon-btn {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 34px !important;
	height: 34px !important;
	padding: 0 !important;
	border: none !important;
	border-radius: 999px !important;
	background: transparent !important;
	color: rgba(71, 85, 105, 0.75) !important;
}

.ai-chat-composer-divider {
	width: 1px !important;
	height: 18px !important;
	background: rgba(203, 213, 225, 0.9) !important;
	flex-shrink: 0 !important;
	margin: 0 2px !important;
}

.ai-chat-send-btn {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 34px !important;
	height: 34px !important;
	padding: 0 !important;
	border-radius: 999px !important;
	box-shadow: 0 2px 8px rgba(43, 92, 232, 0.28) !important;
}

.ai-chat-send-btn svg {
	width: 16px !important;
	height: 16px !important;
	margin-left: 1px !important;
}

.ai-chat-input {
	flex: 1 !important;
	width: 100% !important;
	padding: 14px 16px 10px !important;
	border: none !important;
	border-radius: 0 !important;
	background: transparent !important;
	min-height: 24px !important;
	max-height: 140px !important;
	box-shadow: none !important;
	direction: ltr !important;
	text-align: left !important;
}

.ai-chat-window.dark .ai-chat-input-container,
[data-theme="dark"] .ai-chat-window .ai-chat-input-container {
	background: rgba(10, 18, 32, 0.55) !important;
	border-top-color: rgba(51, 65, 85, 0.65) !important;
}

.ai-chat-window.dark .ai-chat-composer-card,
[data-theme="dark"] .ai-chat-window .ai-chat-composer-card {
	background: rgba(18, 28, 48, 0.96) !important;
	border-color: rgba(71, 85, 105, 0.45) !important;
}

.ai-chat-window.dark .ai-chat-messages,
[data-theme="dark"] .ai-chat-window .ai-chat-messages {
	background: transparent !important;
}

.ai-chat-window.dark .ai-chat-input-container,
[data-theme="dark"] .ai-chat-window .ai-chat-input-container {
	background: rgba(15, 30, 53, 0.82) !important;
	border-top-color: var(--ai-chat-border-dark) !important;
}

.ai-chat-window.minimized.ai-chat-closing {
	transition: opacity 0.22s ease, transform 0.22s ease !important;
}

@media (max-width: 768px) {
	.ai-chat-window.right:not(.minimized):not(.fullscreen) {
		width: 100vw !important;
	}
}
