.sac-chatbot {
	--sac-primary: #38bdf8;
	--sac-surface: #0a1420;
	--sac-panel: #112134;
	--sac-border: rgba(125, 211, 252, 0.16);
	--sac-text: #ecf5ff;
	--sac-muted: #9eb3c8;
	position: fixed;
	z-index: 99999;
	font-family: "Segoe UI", sans-serif;
	direction: ltr;
}

.sac-chatbot[data-mode="inline"] {
	position: relative;
	right: auto;
	bottom: auto;
	left: auto;
	inset: auto;
	width: min(100%, 780px);
	max-width: 100%;
	margin: 32px 0 56px auto;
	min-height: 680px;
	display: grid;
	grid-template-columns: auto minmax(320px, 390px);
	gap: 16px;
	align-items: start;
	justify-content: end;
}

.sac-chatbot[data-mode="inline"].sac-chatbot--debug-collapsed {
	grid-template-columns: 44px minmax(320px, 390px);
	gap: 0;
}

.sac-chatbot[data-position="bottom-right"] {
	right: 24px;
	bottom: 24px;
}

.sac-chatbot[data-position="bottom-left"] {
	left: 24px;
	bottom: 24px;
}

.sac-chatbot__bubble {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 64px;
	height: 64px;
	padding: 0 18px;
	border: 1px solid rgba(56, 189, 248, 0.28);
	border-radius: 999px;
	background: linear-gradient(180deg, #153e5a 0%, #0d2437 100%);
	color: var(--sac-text);
	box-shadow: 0 20px 50px rgba(5, 12, 26, 0.45);
	cursor: pointer;
}

.sac-chatbot[data-mode="inline"] .sac-chatbot__bubble {
	display: none;
}

.sac-chatbot__panel {
	width: min(390px, calc(100vw - 28px));
	margin-top: 12px;
	border: 1px solid var(--sac-border);
	border-radius: 18px;
	background: linear-gradient(180deg, var(--sac-panel) 0%, var(--sac-surface) 100%);
	box-shadow: 0 26px 70px rgba(4, 10, 22, 0.45);
	overflow: hidden;
}

.sac-chatbot[data-mode="inline"] .sac-chatbot__panel {
	display: block !important;
	margin-top: 0;
	width: min(390px, calc(100vw - 68px));
	max-width: min(390px, calc(100vw - 68px));
	border-radius: 0 18px 18px 18px;
}

.sac-chatbot__panel,
.sac-chatbot__header,
.sac-chatbot__messages,
.sac-chatbot__composer,
.sac-chatbot__input {
	direction: rtl;
}

.sac-chatbot__debug {
	position: relative;
	display: grid;
	grid-template-columns: 44px minmax(0, 320px);
	align-items: stretch;
	width: 364px;
	max-width: calc(100vw - 44px - 68px);
	color: var(--sac-text);
	min-width: 0;
	overflow: visible;
	direction: ltr;
}

.sac-chatbot__debug-toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 44px;
	min-width: 44px;
	min-height: 132px;
	padding: 12px 8px;
	border: 1px solid rgba(56, 189, 248, 0.28);
	border-right: 0;
	border-radius: 16px 0 0 16px;
	background: linear-gradient(180deg, #153e5a 0%, #0d2437 100%);
	color: var(--sac-text);
	box-shadow: 0 16px 40px rgba(5, 12, 26, 0.28);
	cursor: pointer;
	writing-mode: vertical-rl;
	text-orientation: mixed;
	transform: rotate(180deg);
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	z-index: 2;
}

.sac-chatbot__debug-toggle-icon {
	font-size: 16px;
	line-height: 1;
	transform: rotate(90deg);
}

.sac-chatbot__debug-shell {
	display: grid;
	min-width: 0;
	border: 1px solid rgba(56, 189, 248, 0.22);
	border-left: 0;
	border-radius: 0 18px 18px 0;
	background: linear-gradient(180deg, rgba(10, 20, 32, 0.98) 0%, rgba(14, 29, 44, 0.98) 100%);
	box-shadow: 0 20px 50px rgba(4, 10, 22, 0.3);
	overflow: hidden;
}

.sac-chatbot__debug[data-collapsed="true"] {
	width: 44px;
	max-width: 44px;
	grid-template-columns: 44px 0;
}

.sac-chatbot__debug[data-collapsed="true"] .sac-chatbot__debug-shell {
	display: none;
}

.sac-chatbot__debug[data-collapsed="false"] .sac-chatbot__debug-toggle-icon {
	transform: rotate(-90deg);
}

.sac-chatbot__debug-header {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	align-items: flex-start;
	padding: 14px 16px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	background: linear-gradient(90deg, rgba(8, 69, 108, 0.4) 0%, rgba(18, 34, 52, 0.2) 100%);
}

.sac-chatbot__debug-header p {
	margin: 6px 0 0;
	font-size: 12px;
	color: var(--sac-muted);
}

.sac-chatbot__debug-actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.sac-chatbot__debug-button {
	padding: 8px 10px;
	border: 1px solid rgba(56, 189, 248, 0.24);
	border-radius: 10px;
	background: rgba(16, 95, 141, 0.24);
	color: var(--sac-text);
	cursor: pointer;
	font-size: 12px;
}

.sac-chatbot__debug-button.is-secondary {
	background: rgba(255, 255, 255, 0.04);
	border-color: rgba(255, 255, 255, 0.08);
	color: var(--sac-muted);
}

.sac-chatbot__debug-status {
	padding: 10px 16px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	font-size: 12px;
	color: #9fdcf8;
	background: rgba(7, 16, 26, 0.64);
}

.sac-chatbot__debug-status.is-error {
	color: #ffb3b3;
	background: rgba(100, 18, 18, 0.35);
}

.sac-chatbot__debug-log {
	display: grid;
	gap: 10px;
	padding: 14px;
	max-height: 420px;
	overflow: auto;
	background: rgba(0, 0, 0, 0.16);
	scrollbar-width: thin;
	scrollbar-color: #2a5a79 #08111b;
}

.sac-chatbot__debug-log::-webkit-scrollbar {
	width: 10px;
}

.sac-chatbot__debug-log::-webkit-scrollbar-track {
	background: #08111b;
	border-left: 1px solid rgba(255, 255, 255, 0.04);
}

.sac-chatbot__debug-log::-webkit-scrollbar-thumb {
	background: linear-gradient(180deg, #1f4f6c 0%, #14354a 100%);
	border-radius: 999px;
	border: 2px solid #08111b;
}

.sac-chatbot__debug-log::-webkit-scrollbar-thumb:hover {
	background: linear-gradient(180deg, #2b6d94 0%, #18445f 100%);
}

.sac-chatbot__debug-empty {
	padding: 14px;
	border: 1px dashed rgba(56, 189, 248, 0.16);
	border-radius: 14px;
	color: var(--sac-muted);
	font-size: 12px;
	background: rgba(255, 255, 255, 0.02);
}

.sac-chatbot__debug-entry {
	padding: 12px;
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.03);
}

.sac-chatbot__debug-entry.is-success {
	border-color: rgba(16, 185, 129, 0.25);
	background: rgba(9, 47, 35, 0.45);
}

.sac-chatbot__debug-entry.is-error {
	border-color: rgba(248, 113, 113, 0.26);
	background: rgba(67, 21, 21, 0.5);
}

.sac-chatbot__debug-entry.is-info {
	border-color: rgba(56, 189, 248, 0.2);
	background: rgba(14, 38, 60, 0.45);
}

.sac-chatbot__debug-entry-head {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 8px;
	align-items: center;
	margin-bottom: 8px;
	font-size: 12px;
}

.sac-chatbot__debug-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 3px 7px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
	font-size: 10px;
	letter-spacing: 0.06em;
	color: var(--sac-text);
}

.sac-chatbot__debug-entry pre {
	margin: 0;
	white-space: pre-wrap;
	word-break: break-word;
	font-size: 11px;
	line-height: 1.55;
	color: #d5e8f7;
	font-family: Consolas, "SFMono-Regular", monospace;
}

.sac-chatbot__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	color: var(--sac-text);
}

.sac-chatbot__close {
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--sac-muted);
	font-size: 22px;
	cursor: pointer;
}

.sac-chatbot__messages {
	display: grid;
	gap: 10px;
	padding: 16px;
	min-height: 260px;
	max-height: 420px;
	overflow: auto;
	background: rgba(0, 0, 0, 0.12);
}

.sac-chatbot__message {
	max-width: 88%;
	padding: 10px 12px;
	border-radius: 14px;
	line-height: 1.5;
	font-size: 13px;
	white-space: pre-wrap;
}

.sac-chatbot__message--assistant {
	justify-self: start;
	background: rgba(255, 255, 255, 0.06);
	color: var(--sac-text);
}

.sac-chatbot__message--user {
	justify-self: end;
	background: linear-gradient(180deg, #1473a6 0%, #0f4f72 100%);
	color: #f4fbff;
}

.sac-chatbot__composer {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 10px;
	padding: 14px;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sac-chatbot__input {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 12px;
	background: #07101a;
	color: var(--sac-text);
}

.sac-chatbot__send {
	padding: 0 14px;
	border: 1px solid rgba(56, 189, 248, 0.3);
	border-radius: 12px;
	background: linear-gradient(180deg, #1c7db0 0%, #125378 100%);
	color: var(--sac-text);
	cursor: pointer;
}

@media (max-width: 640px) {
	.sac-chatbot[data-mode="floating"] {
		left: 14px;
		right: 14px;
		bottom: 14px;
	}

	.sac-chatbot[data-mode="floating"] .sac-chatbot__panel {
		width: auto;
	}

	.sac-chatbot__bubble {
		width: 100%;
	}

	.sac-chatbot[data-mode="inline"] {
		position: relative;
		inset: auto;
		grid-template-columns: auto minmax(260px, calc(100vw - 58px));
		max-width: 100%;
		width: 100%;
		margin: 24px 0 40px;
		min-height: 620px;
		gap: 12px;
	}

	.sac-chatbot__debug {
		width: 264px;
		max-width: calc(100vw - 102px);
	}

	.sac-chatbot[data-mode="inline"].sac-chatbot--debug-collapsed {
		grid-template-columns: 44px minmax(260px, calc(100vw - 58px));
		gap: 0;
	}

	.sac-chatbot[data-mode="inline"] .sac-chatbot__panel {
		width: min(320px, calc(100vw - 58px));
		max-width: min(320px, calc(100vw - 58px));
	}

	.sac-chatbot__debug-toggle {
		top: 14px;
		height: 110px;
	}
}