.header-with-nav {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.header-nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding-top: 0.35rem;
}

.header-nav a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.header-nav a:hover,
.header-nav a.active {
  color: #fff;
}

.autopilot-main {
  max-width: 1200px;
}

.autopilot-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.autopilot-tab {
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  color: var(--muted);
}

.autopilot-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.autopilot-panel {
  display: none;
}

.autopilot-panel.active {
  display: block;
}

.refresh-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.5rem 0;
}

.control-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.control-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.secondary {
  background: #e2e8f0;
  color: var(--text);
}

.btn.danger {
  background: #fee2e2;
  color: #991b1b;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.control-message {
  margin-top: 0.75rem;
  font-size: 0.88rem;
  min-height: 1.2rem;
}

.control-message.info {
  color: var(--muted);
}

.control-message.success {
  color: var(--success);
}

.control-message.error {
  color: var(--error);
}

.autopilot-stats {
  margin-bottom: 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.current-run-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem 1rem;
}

.current-run-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfd;
}

.current-run-item dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.current-run-item dd {
  margin: 0;
  font-size: 0.9rem;
  word-break: break-word;
}

.state-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.state-chip {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.state-chip.completed {
  background: #dcfce7;
  color: #166534;
}

.state-chip.pending {
  background: #fef9c3;
  color: #854d0e;
}

.status-badge.pending {
  background: #f1f5f9;
  color: #475569;
}

.status-badge.paused {
  background: #fef9c3;
  color: #854d0e;
}

.status-badge.failed {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge.processing,
.status-badge.running {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-badge.completed,
.status-badge.idle {
  background: #dcfce7;
  color: #166534;
}

.status-badge.stopping {
  background: #ffedd5;
  color: #c2410c;
}

.error-cell {
  max-width: 220px;
  color: var(--error);
  font-size: 0.78rem;
}

.pipeline-progress {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.25rem 0;
}

.progress-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.progress-label {
  font-size: 0.88rem;
  color: var(--text);
}

.progress-bar {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
  min-width: 2%;
}

.progress-fill.success {
  background: #16a34a;
}

@media (max-width: 600px) {
  .header-with-nav {
    flex-direction: column;
  }
}
