:root {
	--bg: #0f172a; /* Slate 900 */
	--surface: #1e293b; /* Slate 800 */
	--surface2: #334155; /* Slate 700 */
	--border: #475569; /* Slate 600 */
	--text: #f8fafc;
	--muted: #94a3b8;
	--primary: #10b981; /* Emerald 500 */
	--primary-hover: #059669;
	--primary-text: #ffffff;
	--radius: 12px;
	--shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
	--bg: #f8fafc;
	--surface: #ffffff;
	--surface2: #f1f5f9;
	--border: #e2e8f0;
	--text: #0f172a;
	--muted: #64748b;
	--primary: #2563eb; /* Blue 600 */
	--primary-hover: #1d4ed8;
	--primary-text: #ffffff;
	--shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; }
body {
	margin: 0;
	background-color: var(--bg);
	color: var(--text);
	font-family: 'Inter', system-ui, sans-serif;
	line-height: 1.5;
	transition: background-color 0.3s, color 0.3s;
}

.shell {
	max-width: 900px;
	margin: 0 auto;
	padding: 40px 20px;
}

header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 40px;
}
.header-brand {
	display: flex;
	align-items: center;
	gap: 16px;
}
.brand-icon {
	font-size: 3rem;
	background: var(--surface);
	padding: 12px;
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}
h1 {
	margin: 0 0 4px 0;
	font-size: 1.8rem;
	font-weight: 700;
}
.model-badge {
	font-size: 0.45em;
	vertical-align: middle;
	color: white;
	padding: 3px 8px;
	border-radius: 6px;
	margin-left: 8px;
	font-weight: 600;
	font-family: monospace;
	display: inline-block;
}
.badge-pro  { background: #3b82f6; }
.badge-flash { background: #64748b; }
.badge-free { background: #16a34a; }
.muted { color: var(--muted); margin: 0; }
.text-center { text-align: center; }

.panel {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 30px;
	margin-bottom: 24px;
	box-shadow: var(--shadow);
	transition: transform 0.2s, box-shadow 0.2s;
}

h2 {
	margin-top: 0;
	font-size: 1.3rem;
	border-bottom: 1px solid var(--border);
	padding-bottom: 12px;
	margin-bottom: 20px;
}

.form-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 16px;
}
.form-group label {
	font-weight: 600;
	font-size: 0.95rem;
}
input, textarea, select {
	background: var(--bg);
	border: 1px solid var(--border);
	color: var(--text);
	border-radius: 8px;
	padding: 12px 14px;
	font-family: inherit;
	font-size: 1rem;
	transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus, select:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.grid-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}
@media(max-width: 600px) {
	.grid-2 { grid-template-columns: 1fr; gap: 10px; }
}

.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }

button {
	background: var(--surface2);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 10px 16px;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
	transition: all 0.2s;
}
button:hover { background: var(--border); }
button.primary {
	background: var(--primary);
	color: var(--primary-text);
	border-color: var(--primary);
	padding: 14px 20px;
	font-size: 1.05rem;
}
button.primary:hover {
	background: var(--primary-hover);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
button.primary:disabled {
	opacity: 0.7;
	cursor: not-allowed;
	transform: none;
}
.w-100 { width: 100%; }

/* Pipeline Progress */
.pipeline-progress {
	height: 8px;
	background: var(--bg);
	border-radius: 4px;
	overflow: hidden;
	margin-bottom: 24px;
}
.progress-fill {
	height: 100%;
	width: 0%;
	background: var(--primary);
	transition: width 0.5s ease-out;
}

/* Agent Pills & Cards */
.agent-preview {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}
.agent-pill {
	background: var(--bg);
	border: 1px solid var(--border);
	padding: 6px 12px;
	border-radius: 20px;
	font-size: 0.85rem;
	font-weight: 500;
}
.agent-pill.highlight {
	border-color: var(--primary);
	color: var(--primary);
}

.agent-card {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 10px;
	margin-bottom: 12px;
	overflow: hidden;
}
.agent-header {
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	cursor: pointer;
	background: var(--surface);
	user-select: none;
}
.agent-header:hover { background: var(--surface2); }
.agent-icon { font-size: 1.2rem; }
.agent-name { font-weight: 600; flex: 1; }
.agent-status { font-size: 0.85rem; color: var(--muted); }

.agent-output {
	padding: 16px;
	border-top: 1px solid var(--border);
	font-family: 'JetBrains Mono', monospace;
	font-size: 0.85rem;
	line-height: 1.6;
	background: var(--bg);
}
.agent-output.collapsed { display: none; }

/* Status Classes */
.agent-running { border-color: var(--primary); }
.agent-running .agent-header { background: rgba(16, 185, 129, 0.1); }
.agent-spinner { display: inline-block; animation: spin 1.5s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* File List */
.file-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 15px;
}
.file-item {
	display: flex;
	align-items: center;
	gap: 12px;
	background: var(--bg);
	padding: 12px 16px;
	border: 1px solid var(--border);
	border-radius: 8px;
}
.file-size { margin-left: auto; color: var(--muted); font-size: 0.85rem; }

.bar { display: flex; flex-wrap: wrap; gap: 12px; }
.error-box { background: rgba(239,68,68,0.1); color: #ef4444; padding: 12px; border-radius: 8px; border: 1px solid #ef4444; }

.text-muted-small {
    color: var(--muted);
    font-size: 0.75rem;
}

.gen-title {
    color: var(--muted);
    margin-bottom: 8px;
}

.file-item {
    padding: 3px 0;
}

.error-title {
    color: var(--error);
    margin-bottom: 6px;
}

.raw-pre {
    white-space: pre-wrap;
    font-size: 0.75rem;
}

.token-usage-card {
    margin-top: 16px;
    padding: 12px 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.85rem;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.mono-blocks {
    font-family: monospace;
    letter-spacing: 1px;
    color: var(--primary);
}

.text-muted-mt {
    color: var(--muted);
    margin-top: 4px;
}

.text-main {
    color: var(--text-main);
}


/* Compact desktop & Windows 125%-150% scaling (1280x600 - 1536x750) */
@media (max-height: 800px) {
	body { padding: 16px; }
	header { margin-bottom: 16px; padding-bottom: 12px; }
	.card { padding: 18px; margin-bottom: 16px; }
	textarea { min-height: 110px; }
}
