:root {
	--bg: #0b0d12;
	--surface: #12151c;
	--card: #181c25;
	--muted: #8b93a7;
	--text: #e6e9f2;
	--accent: #5aa2ff;
	--accent-contrast: #0b2340;
	--border: #232838;
	--row-alt: #141925;
}

html, body { height: 100%; }
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Noto Sans", "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji"; margin: 0; padding: 0; color: var(--text); background: linear-gradient(180deg, var(--bg), #0e1118); }

.container { max-width: 1100px; margin: 0 auto; padding: 28px; }
.page-header { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 18px; }
h1 { margin: 0; font-weight: 750; letter-spacing: 0.2px; }
.subtitle { margin: 6px 0 0; color: var(--muted); font-size: 0.95rem; }

.toolbar { display: flex; gap: 12px; align-items: center; }
.inline { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-weight: 600; }
.select, select { appearance: none; padding: 8px 12px; border-radius: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--border); outline: none; }
.select:focus, select:focus { box-shadow: 0 0 0 2px rgba(90,162,255,0.25); }

.card { background: linear-gradient(180deg, var(--card), #10131a); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin: 16px 0; box-shadow: 0 10px 24px rgba(0,0,0,0.25); }

.block-label { display: block; margin: 6px 0 8px; font-weight: 700; color: var(--muted); }
textarea { width: 100%; box-sizing: border-box; font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Noto Sans", "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji"; padding: 12px; resize: vertical; border-radius: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--border); line-height: 1.35; }
/* Only the prompt textarea should be scrollable */
#promptText { overflow-y: auto; }
textarea[readonly] { color: #d1d6e6; }

/* Auto-expanding textareas in table rows */
.ta-auto { overflow-y: hidden; resize: none; }

.status-bar { font-size: 0.9rem; color: var(--muted); background: #0f1422; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; }

.status-right { display: flex; justify-content: flex-end; }
.status-left { display: flex; justify-content: flex-start; }
.status-badge { font-size: 0.85rem; color: var(--muted); background: #0f1422; border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; }
.status-badge .num-done { color: #6ee7a8; /* green-300 */ }
.status-badge .num-total { color: #d7def2; /* near-white */ }
.status-badge .num-inflight { color: #93c5fd; /* blue-300 */ }
.status-badge .num-queued { color: #fbbf24; /* amber-400 */ }

.btn { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; background: var(--surface); color: var(--text); transition: background 120ms ease, box-shadow 120ms ease, border-color 120ms ease; }
.btn:hover { background: #151a23; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, var(--accent), #3f7fe1); color: white; border-color: #3f7fe1; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-sm { padding: 6px 10px; font-size: 0.9rem; border-radius: 8px; }
.btn.disabled, .btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Distinctive actions */
.btn-lg { padding: 12px 18px; font-size: 1.05rem; border-radius: 12px; }
.btn-eval { background: linear-gradient(180deg, #22c55e, #16a34a); color: #ffffff; border-color: #16a34a; }
.btn-eval:hover { filter: brightness(1.06); }
.btn-add { background: linear-gradient(180deg, #a855f7, #7c3aed); color: #ffffff; border-color: #7c3aed; }
.btn-add:hover { filter: brightness(1.06); }

.table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
th, td { border-bottom: 1px solid var(--border); padding: 10px; vertical-align: top; }
th { text-align: left; font-weight: 700; color: var(--muted); background: #0f1320; }
/* Make only the controls header cells sticky (works across browsers better than sticky on tr) */
.controls-row th { position: sticky; top: 0; z-index: 10; background: #0f1320; box-shadow: 0 2px 0 rgba(0,0,0,0.25); }
tbody tr:nth-child(odd) { background: var(--row-alt); }
tbody tr:hover { background: #11172a; }
td textarea { min-height: 120px; }

td.score { text-align: center; font-weight: 800; white-space: nowrap; color: #d7def2; }
td.score.loading { color: #9fb7ff; }

/* Mobile responsiveness */
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Sticky toolbar above table */
.controls-sticky { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 8px; margin-bottom: 8px; background: linear-gradient(180deg, var(--card), #10131a); }
@supports (backdrop-filter: blur(4px)) {
	.controls-sticky { backdrop-filter: blur(4px); }
}
@media (max-width: 720px) {
	.container { padding: 16px; }
	.toolbar { flex-wrap: wrap; gap: 8px; }
	/* Let the first column (text) own the width by stacking cells per row */
	.table { table-layout: auto; border-spacing: 0; width: 100%; }
	.table colgroup { display: none; }
	.table thead th { width: auto !important; }
	.table-container { overflow-x: visible; }
	.table thead tr:first-child { display: none; } /* hide column labels */
	/* Make the Evaluate-all control row sticky on mobile */
		.table thead tr.controls-row { position: sticky; top: 0; z-index: 10; background: #0f1320; }
		.table thead tr.controls-row th { display: block; background: transparent; border-bottom: none; }
	th, td { padding: 8px; }
		th { position: static; }
		/* Re-apply sticky for the controls row on mobile */
		.table thead tr.controls-row th { position: sticky; top: 0; z-index: 10; background: #0f1320; }
	.table tbody, .table tfoot, .table tr, .table td { display: block; width: 100%; }
	.table tbody tr { margin: 12px 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #0f1320; }
	.table tbody tr:nth-child(odd) { background: #0f1320; } /* neutralize zebra within cards */
	.table tbody tr:hover { background: #0f1320; }
	.table tbody tr td { border-bottom: 1px solid var(--border); }
	.table tbody tr td:last-child { border-bottom: none; }
	td textarea { min-height: 140px; }
	.status-badge { font-size: 0.85rem; }
	/* Score cell left-align in stacked view */
	td.score { text-align: left; }
}
