:root {
	--ink: #16141f;
	--muted: #6b6578;
	--line: #e6e1ee;
	--paper: #f6f3ee;
	--panel: #fffcf8;
	--accent: #3d3ae8;
	--accent-2: #211f7a;
	--good: #0f7a4a;
	--warn: #9a4d12;
	--bad: #b42318;
	--shadow: 0 10px 30px rgba(22, 20, 31, 0.08);
	--radius: 16px;
	font-family:
		"Segoe UI",
		system-ui,
		-apple-system,
		sans-serif;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html,
body {
	height: 100%;
	background:
		radial-gradient(1200px 400px at 10% -10%, #ece9ff 0%, transparent 55%),
		var(--paper);
	color: var(--ink);
}

.app {
	height: 100%;
	display: flex;
	flex-direction: column;
	max-width: 1440px;
	margin: 0 auto;
}

.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 20px 8px;
}

.brand {
	display: flex;
	align-items: center;
	gap: 12px;
}

.brand p {
	color: var(--muted);
	font-size: 13px;
}

.mark {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	background:
		linear-gradient(135deg, var(--accent), #8a7cff 55%, #f0b27a);
	box-shadow: var(--shadow);
}

.top-actions,
.composer-row,
.preview-toolbar,
.preview-meta {
	display: flex;
	align-items: center;
	gap: 8px;
}

button,
.chip {
	border: 1px solid var(--line);
	background: white;
	color: var(--ink);
	border-radius: 999px;
	padding: 8px 14px;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

button.primary {
	background: var(--accent);
	border-color: var(--accent);
	color: white;
}

button.ghost {
	background: transparent;
}

button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.workspace {
	flex: 1;
	min-height: 0;
	display: grid;
	grid-template-columns: minmax(320px, 420px) 1fr;
	gap: 16px;
	padding: 8px 20px 20px;
}

.pane {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	min-height: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 18px 16px 8px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.message {
	max-width: 92%;
	padding: 10px 12px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.45;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.user-message {
	margin-left: auto;
	background: #ece9ff;
}

.assistant-message {
	background: #fff;
	border: 1px solid var(--line);
}

.message.error {
	background: #fde8e6;
	border-color: #f3c0bb;
}

.typing {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 18px 10px;
	color: var(--muted);
	font-size: 13px;
}

.typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--accent);
	animation: pulse 1.2s infinite ease-in-out;
}

.typing span:nth-child(2) {
	animation-delay: 0.15s;
}
.typing span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes pulse {
	0%,
	100% {
		opacity: 0.25;
		transform: translateY(0);
	}
	50% {
		opacity: 1;
		transform: translateY(-2px);
	}
}

.composer {
	border-top: 1px solid var(--line);
	padding: 12px;
	background: #fff;
}

textarea {
	width: 100%;
	resize: none;
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 10px 12px;
	font: inherit;
	min-height: 64px;
	background: var(--paper);
}

.composer-row {
	justify-content: space-between;
	margin-top: 8px;
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.chip {
	padding: 5px 10px;
	font-size: 12px;
	color: var(--muted);
}

.preview-toolbar {
	justify-content: space-between;
	padding: 16px 16px 12px;
	border-bottom: 1px solid var(--line);
}

.eyebrow {
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-size: 11px;
	color: var(--muted);
}

.preview-toolbar h2 {
	font-size: 16px;
	font-weight: 650;
}

.pill {
	font-size: 12px;
	border-radius: 999px;
	padding: 4px 10px;
	background: #ece9ff;
	color: var(--accent-2);
}

.pill.muted {
	background: #efece6;
	color: var(--muted);
}

.pill.busy {
	background: #fff3d6;
	color: var(--warn);
}

.pill.ready {
	background: #e4f6ec;
	color: var(--good);
}

.pill.bad {
	background: #fde8e6;
	color: var(--bad);
}

.preview-empty,
.preview-frame {
	flex: 1;
	min-height: 0;
}

.preview-empty {
	display: grid;
	place-items: center;
	padding: 24px;
}

.empty-card {
	max-width: 420px;
	text-align: center;
	color: var(--muted);
}

.empty-card h3 {
	color: var(--ink);
	margin-bottom: 8px;
}

.preview-frame {
	width: 100%;
	border: 0;
	background: #d9d4cb;
}

.banner {
	margin: 0 16px 16px;
	padding: 10px 12px;
	border-radius: 10px;
	background: #ece9ff;
	color: var(--accent-2);
	font-size: 13px;
}

.banner.bad {
	background: #fde8e6;
	color: var(--bad);
}

.hidden {
	display: none !important;
}

@media (max-width: 900px) {
	.workspace {
		grid-template-columns: 1fr;
		grid-template-rows: minmax(280px, 42vh) 1fr;
	}

	.topbar {
		flex-wrap: wrap;
	}
}
