:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #242837;
  --border: #2e3346;
  --text: #e1e4ed;
  --text-dim: #8b90a0;
  --accent: #6c8cff;
  --green: #34d399;
  --red: #f87171;
  --yellow: #fbbf24;
  --orange: #fb923c;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

#auth-wall {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 1rem;
}
#auth-wall h1 { font-size: 1.5rem; }
#auth-wall p { color: var(--text-dim); }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
header h1 { font-size: 1.1rem; font-weight: 600; }
.header-actions { display: flex; gap: 0.5rem; }

button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font);
  transition: background 0.15s;
}
button:hover { background: var(--border); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.primary:hover { opacity: 0.9; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  height: calc(100vh - 50px);
}

main {
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

aside#git-pane {
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem;
  background: var(--surface);
}
aside h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

section { margin-bottom: 1.5rem; }
section h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

select, input[type="text"] {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: var(--font);
  width: 100%;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge.pass { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.badge.fail { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.badge.weak { background: rgba(251, 191, 36, 0.15); color: var(--yellow); }
.badge.running { background: rgba(108, 140, 255, 0.15); color: var(--accent); }
.badge.unknown { background: rgba(139, 144, 160, 0.15); color: var(--text-dim); }

.station-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}
.station-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.station-card-header h3 {
  font-size: 0.95rem;
  font-weight: 500;
}
.station-badges { display: flex; gap: 0.3rem; align-items: center; }
.station-card-body { display: none; padding-top: 0.75rem; }
.station-card.expanded .station-card-body { display: block; }

.tier-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.tier-row:last-child { border-bottom: none; }
.tier-row .tier-name { color: var(--text-dim); min-width: 180px; }
.tier-row .tier-time { color: var(--text-dim); font-size: 0.75rem; }

.conversation {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  margin-top: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.6;
}
.conversation .human { color: var(--accent); }
.conversation .builder { color: var(--green); }
.conversation .tool { color: var(--text-dim); font-style: italic; }

.checks-list {
  margin-top: 0.4rem;
  font-size: 0.8rem;
}
.check-item { padding: 0.15rem 0; }
.check-item .check-pass { color: var(--green); }
.check-item .check-fail { color: var(--red); }

.raw-output {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  margin-top: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text-dim);
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}
.controls-grid label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}
.controls-grid label input[type="checkbox"] {
  margin-right: 0.3rem;
}

.git-commit {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.git-commit:last-child { border-bottom: none; }
.git-commit .hash {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.75rem;
}
.git-commit .msg { margin-top: 0.1rem; }
.git-commit .meta {
  color: var(--text-dim);
  font-size: 0.7rem;
  margin-top: 0.1rem;
}
.git-commit .run-badges { margin-top: 0.2rem; display: flex; gap: 0.2rem; }

.run-option { font-family: var(--mono); font-size: 0.8rem; }

.active-run {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.active-run .info { font-size: 0.85rem; }
.active-run .worker { color: var(--text-dim); font-size: 0.75rem; }

.infra-check {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.infra-check:last-child { border-bottom: none; }

.expand-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
}
.expand-btn:hover { color: var(--text); }

.rerun-btn {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
}

.run-banner {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
}
.run-banner.running {
  background: rgba(108, 140, 255, 0.1);
  border: 1px solid var(--accent);
}
.run-banner.completed {
  background: var(--surface);
  border: 1px solid var(--border);
}
.run-banner small { color: var(--text-dim); }

.pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 0.4rem;
  animation: pulse-anim 1.5s infinite;
  vertical-align: middle;
}
@keyframes pulse-anim {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(108,140,255,0.4); }
  50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(108,140,255,0); }
}

@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  aside#git-pane { border-left: none; border-top: 1px solid var(--border); }
}
