:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-alt: #1e2229;
  --border: #2a2f3a;
  --text: #e6e8ee;
  --muted: #8b94a3;
  --accent: #4f8cff;
  --danger: #ef5350;
  --success: #4caf50;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 320px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
}

.sidebar h1 {
  font-size: 18px;
  margin: 0 0 16px;
}

.account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--muted);
  margin: -8px 0 16px;
}
.account strong { color: var(--text); }
.account a, .link-btn {
  color: var(--accent);
  font-size: 12px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}
.account a:hover, .link-btn:hover { text-decoration: underline; }

.question-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.question-card {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.question-card:hover { border-color: var(--accent); }
.question-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.question-card h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.question-card .meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.question-card .summary {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--muted);
}
.status-dot.running { background: var(--success); }
.status-dot.finished { background: var(--accent); }

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn-ghost:hover { color: var(--text); border-color: var(--danger); }

.finished-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.finished-note strong { color: var(--text); }

.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.hidden { display: none !important; }

.active-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.panel-header h2 { margin: 0; font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

.panel-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--muted);
  min-width: 48px;
  text-align: right;
}
.timer.low { color: var(--danger); }

.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: white;
}
.btn-primary { background: var(--accent); }
.btn-danger { background: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.panel-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.instructions {
  width: 380px;
  flex-shrink: 0;
  padding: 20px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--panel);
}

.env-note {
  background: rgba(79, 140, 255, 0.1);
  border: 1px solid rgba(79, 140, 255, 0.35);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 16px;
}

.env-note code {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
}

.instructions h3 {
  margin-top: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.instructions pre {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}

.checklist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
}

.checklist-header h3 {
  margin: 0;
}

.btn-secondary {
  background: var(--panel-alt);
  border: 1px solid var(--border);
}

.btn-small {
  padding: 5px 10px;
  font-size: 12px;
}

.preview-result {
  margin-top: 10px;
  font-size: 12.5px;
}

.preview-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.status-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  background: var(--border);
}
.status-badge.ok { background: var(--success); color: white; }
.status-badge.bad { background: var(--danger); color: white; }

.preview-error { color: var(--danger); line-height: 1.5; }

.preview-headers {
  margin: 0 0 8px;
  padding: 6px 8px;
  background: #000;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  white-space: pre-wrap;
  color: var(--muted);
}

.preview-frame {
  width: 100%;
  height: 180px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}

.terminal-wrap {
  flex: 1;
  padding: 12px;
  min-width: 0;
  background: #000;
}

#terminal {
  height: 100%;
  width: 100%;
}
