/* ===== Tokens (inherited from dashboard_v2) ===== */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --fg: #0a0a0a;
  --fg-2: #525252;
  --fg-3: #8a8a8a;
  --border: #e5e5e5;
  --border-strong: #0a0a0a;
  --accent: #f43f5e;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;

  --radius-sm: 2px;
  --radius-md: 4px;

  --topbar-h: 64px;
  --gutter: 20px;
}

/* ===== Reset & base ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--fg-2); }
.small { font-size: 12px; }

/* ===== Top bar ===== */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 var(--gutter);
}
.brand-block { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 17px;
}
.brand-dot { color: var(--accent); margin: 0 1px; }
.brand-sep { color: var(--fg-3); }
.brand-product { color: var(--fg-2); font-size: 13px; }

.release-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  font-size: 12px;
}
.release-tag {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-size: 11px;
}
.release-label { font-weight: 600; }
.release-date { color: var(--fg-2); font-family: var(--font-mono); }

.readiness {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--fg-2);
}
.readiness .pip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.readiness .pip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.readiness .pip-blocked .pip-dot { background: #b3271e; }
.readiness .pip-flight .pip-dot { background: #b8860b; }
.readiness .pip-review .pip-dot { background: #1a7d3f; }

/* ===== Cockpit layout ===== */
.cockpit {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  height: calc(100vh - var(--topbar-h));
}

/* ===== Queue ===== */
.queue {
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.queue-head {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.queue-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.015em;
}
.queue-sub { margin: 0; font-size: 12px; }
.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}
.queue-item {
  display: block;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 100ms ease;
  position: relative;
}
.queue-item:hover { background: var(--surface-2); }
.queue-item.is-selected {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  padding-left: 17px;
}
.qi-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.qi-id {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--fg);
}
.qi-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.35;
}
.qi-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--fg-2);
}
.qi-progress {
  display: flex;
  gap: 3px;
  margin-top: 8px;
}
.qi-progress .step-dot {
  width: 18px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}
.qi-progress .step-dot.done { background: #1a7d3f; }
.qi-progress .step-dot.active { background: var(--accent); }

.queue-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ===== Tags / pills ===== */
.tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  white-space: nowrap;
}
.tag-critical { background: #ffe1e7; color: #8a0d27; border: 1px solid #f4a4b3; }
.tag-high { background: #ffe9d6; color: #8a3a00; border: 1px solid #f4b88a; }
.tag-medium { background: #fff7e0; color: #7a5a00; border: 1px solid #f5d985; }
.tag-low { background: #e6f9ec; color: #0a6e34; border: 1px solid #b6ecc6; }
.tag-type {
  background: var(--surface-2);
  color: var(--fg-2);
  border: 1px solid var(--border);
}

/* ===== Detail pane ===== */
.detail {
  overflow-y: auto;
  padding: 28px 32px;
}
.detail-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}
.detail-head { margin-bottom: 28px; }
.detail-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.task-id {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 14px;
  color: var(--fg);
  padding: 3px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.task-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  line-height: 1.25;
}
.task-summary {
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-2);
  margin: 0 0 8px;
  max-width: 70ch;
}
.task-source {
  margin: 0;
  font-family: var(--font-mono);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.01em;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--fg);
  color: var(--bg);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}
.btn:hover { background: #1f1f1f; }
.btn:disabled {
  background: var(--border);
  color: var(--fg-3);
  border-color: var(--border);
  cursor: not-allowed;
}
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { background: var(--fg); color: var(--bg); }
.btn-ghost:disabled {
  background: transparent;
  color: var(--fg-3);
  border-color: var(--border);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
.btn .arr { transition: transform 200ms ease; display: inline-block; }
.btn:hover:not(:disabled) .arr { transform: translateX(3px); }

/* ===== Stepper ===== */
.stepper-wrap { margin-bottom: 20px; }
.stepper-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.stepper-head .sub-title { margin: 0; flex: 1; }
.sub-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg);
  margin: 0;
}
.stepper {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color 100ms;
}
.step:hover { border-color: var(--fg-3); }
.step.is-active { border-color: var(--accent); border-width: 1px; box-shadow: inset 0 0 0 1px var(--accent); }
.step.is-done { background: var(--surface); }
.step.is-pending { opacity: 0.55; }
.step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-3);
  letter-spacing: 0.06em;
}
.step-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.step-state {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-2);
}
.step.is-done .step-state { color: #1a7d3f; }
.step.is-active .step-state { color: var(--accent); }

.step-action {
  margin-top: 4px;
}

/* ===== Output pane ===== */
.output {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 200px;
  padding: 0;
  overflow: hidden;
}
.output:empty::after {
  content: 'Run a step to preview its output.';
  display: block;
  padding: 28px;
  color: var(--fg-3);
  font-size: 13px;
}
.output-head {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
}
.output-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.output-body {
  padding: 18px 22px;
}
.output-body pre,
.output-body code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
}
.output-body pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 12px;
  white-space: pre;
}
.output-body p { margin: 0 0 12px; }
.output-body p:last-child { margin-bottom: 0; }
.output-body h1, .output-body h2, .output-body h3, .output-body h4 {
  margin: 18px 0 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.output-body h1:first-child, .output-body h2:first-child, .output-body h3:first-child { margin-top: 0; }
.output-body h1 { font-size: 18px; }
.output-body h2 { font-size: 16px; }
.output-body h3 { font-size: 14px; }
.output-body ul, .output-body ol {
  margin: 0 0 12px;
  padding-left: 22px;
}
.output-body li { margin-bottom: 4px; }
.output-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 12px;
  font-size: 12.5px;
}
.output-body th, .output-body td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.output-body th {
  font-weight: 700;
  background: var(--surface-2);
}

/* Diff colouring (for impl step) */
.diff-line { display: block; }
.diff-line.add { background: #e6f9ec; color: #0a6e34; }
.diff-line.del { background: #ffe1e7; color: #8a0d27; }
.diff-line.hunk { background: var(--surface-2); color: var(--fg-3); }

/* PR card */
.pr-card { display: flex; flex-direction: column; gap: 14px; }
.pr-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.015em;
  margin: 0;
}
.pr-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--fg-2);
}
.pr-meta-row b { color: var(--fg); font-weight: 700; }
.pr-stats {
  display: flex;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.pr-stats .add-num { color: #0a6e34; font-weight: 700; }
.pr-stats .del-num { color: #8a0d27; font-weight: 700; }
.pr-checks {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pr-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pr-check.pass { background: #e6f9ec; color: #0a6e34; }
.pr-check.fail { background: #ffe1e7; color: #8a0d27; }
.pr-check.warn { background: #fff7e0; color: #7a5a00; }
.pr-check.na { background: var(--surface-2); color: var(--fg-3); }
.pr-labels {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pr-label {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--fg-2);
}
.pr-body {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

/* Stub state */
.stub-note {
  padding: 18px 22px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--fg-2);
  border-left: 3px solid var(--accent);
}

/* ===== Responsive ===== */
@media (max-width: 1000px) {
  .cockpit { grid-template-columns: 1fr; height: auto; }
  .queue { border-right: none; border-bottom: 1px solid var(--border); max-height: 50vh; }
  .stepper { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .stepper { grid-template-columns: 1fr; }
  .readiness { display: none; }
  .topbar-inner { gap: 12px; }
}
