.autochat-frontend-shell {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 9999;
	display: grid;
	justify-items: end;
	gap: 14px;
	font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.autochat-frontend-launcher {
	display: inline-grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: var(--autochat-bubble-color, #0f172a);
	color: #f8fafc;
	width: 68px;
	height: 68px;
	box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
	cursor: pointer;
}

.autochat-frontend-shell.is-open .autochat-frontend-launcher {
	display: none;
}

.autochat-frontend-launcher__badge {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #ffffff;
	overflow: hidden;
}

.autochat-frontend-launcher__badge img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.autochat-frontend-panel {
	width: min(420px, calc(100vw - 32px));
	max-height: min(720px, calc(100vh - 120px));
	border-radius: 28px;
	background-color: var(--autochat-panel-background, #020617);
	background-image: radial-gradient(circle at top, rgba(34, 211, 238, 0.18), transparent 42%);
	color: #f8fafc;
	display: none;
	grid-template-rows: auto auto 1fr auto;
	overflow: hidden;
	border: 1px solid rgba(148, 163, 184, 0.18);
	backdrop-filter: blur(18px);
	box-shadow: 0 32px 70px rgba(2, 6, 23, 0.55);
}

.autochat-frontend-shell.is-open .autochat-frontend-panel {
	display: grid;
}

.autochat-frontend-header {
	padding: 22px 22px 10px;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	background: var(--autochat-header-color, #0f172a);
}

.autochat-frontend-header h2,
.autochat-frontend-header p {
	margin: 0;
}

.autochat-frontend-header__brand {
	display: flex;
	align-items: center;
	gap: 12px;
}

.autochat-frontend-header__brand img {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: #ffffff;
	object-fit: cover;
	flex: 0 0 42px;
}

.autochat-frontend-header h2 {
	font-size: 22px;
}

.autochat-frontend-header p {
	color: rgba(226, 232, 240, 0.76);
}

.autochat-frontend-header__close {
	border: 0;
	background: rgba(148, 163, 184, 0.16);
	color: #f8fafc;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
}

.autochat-frontend-prompts {
	padding: 0 22px 14px;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.autochat-frontend-prompts__chip {
	border: 1px solid rgba(148, 163, 184, 0.2);
	background: var(--autochat-system-bubble-background, #1e293b);
	color: #e2e8f0;
	border-radius: 999px;
	padding: 8px 12px;
	font-size: 12px;
	cursor: pointer;
}

.autochat-frontend-messages {
	padding: 8px 22px 18px;
	display: grid;
	gap: 14px;
	overflow-y: auto;
	overflow-x: hidden;
}

.autochat-frontend-message {
	width: min(86%, calc(100% - 8px));
	max-width: 100%;
	display: grid;
	gap: 6px;
}

.autochat-frontend-message--visitor {
	justify-self: end;
	margin-right: 8px;
}

.autochat-frontend-message__row {
	display: grid;
	grid-template-columns: 36px minmax(0, 1fr);
	gap: 10px;
	align-items: end;
}

.autochat-frontend-message--visitor .autochat-frontend-message__row {
	grid-template-columns: minmax(0, 1fr) 36px;
}

.autochat-frontend-message--visitor .autochat-frontend-message__avatar {
	grid-column: 2;
}

.autochat-frontend-message--visitor .autochat-frontend-message__content {
	grid-column: 1;
	grid-row: 1;
}

.autochat-frontend-message__avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(148, 163, 184, 0.2);
	overflow: hidden;
	display: grid;
	place-items: center;
	color: #e2e8f0;
	font-size: 12px;
	font-weight: 700;
}

.autochat-frontend-message__avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.autochat-frontend-message__content {
	display: grid;
	gap: 6px;
	min-width: 0;
	justify-items: start;
}

.autochat-frontend-message--visitor .autochat-frontend-message__content {
	text-align: right;
	justify-items: end;
}

.autochat-frontend-message__meta {
	font-size: 11px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: rgba(148, 163, 184, 0.9);
}

.autochat-frontend-message__body {
	padding: 14px 16px;
	border-radius: 18px;
	background: var(--autochat-agent-chat-background, #0f172a);
	border: 1px solid rgba(148, 163, 184, 0.16);
	width: fit-content;
	max-width: 100%;
	white-space: pre-wrap;
	overflow-wrap: break-word;
	font-size: 14px;
	line-height: 1.5;
	color: var(--autochat-agent-chat-message-color, #f8fafc);
}

.autochat-frontend-message--visitor .autochat-frontend-message__body {
	background: var(--autochat-customer-chat-background, #2563eb);
	border-color: transparent;
	color: var(--autochat-customer-chat-message-color, #ffffff);
	font-weight: 600;
}

.autochat-frontend-message.is-thinking .autochat-frontend-message__body {
	background: var(--autochat-system-bubble-background, #1e293b);
	color: #cbd5e1;
	font-style: italic;
}

.autochat-frontend-composer {
	padding: 18px 22px 22px;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 12px;
	background: var(--autochat-composer-background, #020617);
	border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.autochat-frontend-composer__input {
	width: 100%;
	border-radius: 18px;
	border: 1px solid rgba(148, 163, 184, 0.18);
	background: var(--autochat-textarea-background, #0f172a);
	color: #f8fafc;
	padding: 12px 14px;
	resize: none;
}

.autochat-frontend-composer__button {
	border: 0;
	border-radius: 16px;
	padding: 0 18px;
	background: var(--autochat-send-button-color, #0f172a);
	color: #ffffff;
	font-weight: 700;
	cursor: pointer;
}

.autochat-frontend-shell.is-embedded {
	position: relative;
	right: auto;
	bottom: auto;
	justify-items: stretch;
}

.autochat-frontend-shell.is-embedded .autochat-frontend-panel {
	display: grid;
	width: min(100%, 420px);
}

@media (max-width: 640px) {
	.autochat-frontend-shell {
		right: 12px;
		left: 12px;
		bottom: 12px;
		justify-items: stretch;
	}

	.autochat-frontend-panel {
		width: 100%;
	}
}
