/* LFCBD pipeline status surface (E5D) — static/pipeline.css.
   Consumes the design-system tokens from static/app.css (DESIGN.md):
   --hull/--raised/--raised-2/--hairline/--text/--muted/--paper/--ink,
   --blue/--green/--red/--amber/--orange, --font-ui/--font-mono,
   --r-sm/--r-md/--r-lg. Every var carries its dark value as fallback so the
   surface renders even if a token is briefly undefined. No gradients, no
   pill radii, 150ms transitions only; severity chips are NEUTRAL (P0 strong
   text / P1 muted / P2 faint — never status hues); safety orange is used
   only for the action (retry/run) buttons and the focus-visible ring. */

.pipeline-surface {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- Header ---- */

.pipeline-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pipeline-back {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--muted, #5b6478);
  text-decoration: none;
}

.pipeline-back:hover {
  color: var(--text, #1a1d20);
}

.pipeline-heading {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text, #1a1d20);
  line-height: 1.3;
  margin: 0;
  text-transform: uppercase;
}

.pipeline-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pipeline-opp {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted, #5b6478);
}

.pipeline-run-chip {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--r-sm, 4px);
  border: 1px solid var(--hairline, #ddd9ce);
  background: var(--raised, #ffffff);
}

.pipeline-run-chip.run-ready {
  color: var(--green, #2e8b57);
  border-color: var(--green, #2e8b57);
}

.pipeline-run-chip.run-failed {
  color: var(--red, #c0392b);
  border-color: var(--red, #c0392b);
}

.pipeline-run-chip.run-parked {
  color: var(--amber, #b8860b);
  border-color: var(--amber, #b8860b);
}

.pipeline-run-chip.run-queued,
.pipeline-run-chip.run-superseded {
  color: var(--muted, #5b6478);
}

.pipeline-run-chip.run-running {
  color: var(--text, #1a1d20);
}

.pipeline-flash {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--r-sm, 4px);
  border: 1px solid var(--hairline, #ddd9ce);
  background: var(--raised, #ffffff);
  color: var(--text, #1a1d20);
}

.pipeline-flash.flash-ok {
  border-color: var(--green, #2e8b57);
}

.pipeline-flash.flash-err {
  border-color: var(--red, #c0392b);
}

/* ---- Upload required state ---- */

.pipeline-upload-required {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--amber, #b8860b);
  border-radius: var(--r-md, 6px);
  background: var(--raised, #ffffff);
  padding: 12px 14px;
}

.pipeline-upload-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text, #1a1d20);
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.warn {
  background: var(--amber, #b8860b);
  box-shadow: 0 0 0 1px var(--amber, #b8860b);
}

.status-dot.danger {
  background: var(--red, #c0392b);
  box-shadow: 0 0 0 1px var(--red, #c0392b);
}

.pipeline-upload-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pipeline-upload-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pipeline-upload-input,
.pipeline-upload-textarea {
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 13px;
  color: var(--text, #1a1d20);
  background: var(--hull, #f7f5f0);
  border: 1px solid var(--hairline, #ddd9ce);
  border-radius: var(--r-sm, 4px);
  padding: 8px 10px;
}

.pipeline-upload-textarea {
  resize: vertical;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
}

.pipeline-upload-submit {
  align-self: flex-start;
}

/* ---- Panels ---- */

.pipeline-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--raised, #ffffff);
  border: 1px solid var(--hairline, #ddd9ce);
  border-radius: var(--r-md, 6px);
  padding: 16px 18px;
}

.pipeline-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pipeline-section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #5b6478);
  margin: 0;
}

.pipeline-run-meta,
.pipeline-register-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--muted, #5b6478);
}

/* ---- Stage line ---- */

.stage-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.stage-node {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.stage-node.stage-succeeded {
  color: var(--muted, #5b6478);
}

.stage-node.stage-running {
  color: var(--text, #1a1d20);
}

.stage-node.stage-future,
.stage-node.stage-pending {
  color: var(--muted, #5b6478);
  opacity: 0.55;
}

.stage-node.stage-failed {
  color: var(--red, #c0392b);
}

.stage-node.stage-parked {
  color: var(--amber, #b8860b);
}

.stage-node.stage-skipped {
  color: var(--muted, #5b6478);
  opacity: 0.6;
  text-decoration: line-through;
}

.stage-tick {
  color: var(--text, #1a1d20);
  font-size: 10px;
}

.stage-arrow {
  color: var(--muted, #5b6478);
  opacity: 0.5;
  font-size: 12px;
}

.stage-badge {
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: var(--r-sm, 4px);
  border: 1px solid var(--hairline, #ddd9ce);
  background: var(--raised-2, #f1efe8);
}

.stage-failed .stage-badge {
  color: var(--red, #c0392b);
  border-color: var(--red, #c0392b);
}

.stage-parked .stage-badge {
  color: var(--amber, #b8860b);
  border-color: var(--amber, #b8860b);
}

.stage-skipped .stage-badge,
.stage-pending .stage-badge {
  color: var(--muted, #5b6478);
}

/* ---- Run error / park reason ---- */

.stage-reason-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text, #1a1d20);
  padding: 8px 10px;
  border-radius: var(--r-sm, 4px);
  border: 1px solid var(--hairline, #ddd9ce);
  background: var(--hull, #f7f5f0);
}

.stage-reason-line .status-dot {
  margin-top: 4px;
}

/* ---- Confidence meter + retry action ---- */

.pipeline-meter-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--hairline, #ddd9ce);
}

.pipeline-confidence {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}

.pipeline-meter-label {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #5b6478);
}

.pipeline-meter-value {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pipeline-meter-value.conf-high {
  color: var(--green, #2e8b57);
}

.pipeline-meter-value.conf-mid {
  color: var(--amber, #b8860b);
}

.pipeline-meter-value.conf-low {
  color: var(--red, #c0392b);
}

.pipeline-meter-value.conf-none {
  color: var(--muted, #5b6478);
}

.pipeline-tier {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted, #5b6478);
}

.pipeline-meter-note {
  font-size: 12px;
  color: var(--muted, #5b6478);
}

/* Safety-orange action button — the design-contract exception: orange is
   the action hue (retry/run/vote), never a status. */
.pipeline-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 600;
  color: #FFFFFF;
  background: var(--orange, #cc3333);
  border: 1px solid var(--orange, #cc3333);
  border-radius: var(--r-sm, 4px);
  padding: 9px 16px;
  min-height: 44px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 150ms ease;
}

.pipeline-action:hover {
  opacity: 0.88;
}

/* ---- Empty state ---- */

.pipeline-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.pipeline-empty-text {
  font-size: 13px;
  color: var(--muted, #5b6478);
  margin: 0;
}

.pipeline-retry-form {
  display: inline-flex;
}

/* ---- Claim register ---- */

.pipeline-needs-review {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text, #1a1d20);
  padding: 8px 10px;
  border-radius: var(--r-sm, 4px);
  border: 1px solid var(--amber, #b8860b);
  background: var(--raised-2, #f1efe8);
}

.pipeline-register-summary {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text, #1a1d20);
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--hairline, #ddd9ce);
  background: var(--hull, #f7f5f0);
  border-radius: 0 var(--r-sm, 4px) var(--r-sm, 4px) 0;
}

.pipeline-register {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pipeline-register th {
  text-align: left;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #5b6478);
  font-weight: 600;
  padding: 6px 10px;
  border-bottom: 1px solid var(--hairline, #ddd9ce);
}

.pipeline-register td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline, #ddd9ce);
  vertical-align: top;
}

.pipeline-reg-row:last-child td {
  border-bottom: none;
}

.pipeline-reg-sev {
  width: 72px;
  white-space: nowrap;
}

/* Neutral severity grammar: severity is NOT a status — P0 strong text,
   P1 muted, P2 faint; never blue/green/red/amber hues. */
.sev-chip {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--r-sm, 4px);
  border: 1px solid var(--hairline, #ddd9ce);
  background: var(--raised-2, #f1efe8);
}

.sev-chip.sev-p0 {
  color: var(--text, #1a1d20);
  border-color: var(--text, #1a1d20);
}

.sev-chip.sev-p1 {
  color: var(--muted, #5b6478);
}

.sev-chip.sev-p2 {
  color: var(--muted, #5b6478);
  opacity: 0.6;
}

.pipeline-reg-claim {
  width: 44%;
}

.pipeline-reg-claim-text {
  color: var(--text, #1a1d20);
}

.pipeline-reg-category {
  display: block;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  color: var(--muted, #5b6478);
  margin-top: 2px;
}

.pipeline-reg-source {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--muted, #5b6478);
  width: 22%;
}

.pipeline-reg-status {
  white-space: nowrap;
}

/* Verdict dot+label: VERIFIED green, FLAGGED red, UNVERIFIED muted —
   always dot + text, never color alone (WCAG 1.4.1). */
.reg-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.reg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.reg-status.reg-verified .reg-dot {
  background: var(--green, #2e8b57);
  box-shadow: 0 0 0 1px var(--green, #2e8b57);
}

.reg-status.reg-verified .reg-word {
  color: var(--green, #2e8b57);
}

.reg-status.reg-flagged .reg-dot {
  background: var(--red, #c0392b);
  box-shadow: 0 0 0 1px var(--red, #c0392b);
}

.reg-status.reg-flagged .reg-word {
  color: var(--red, #c0392b);
}

.reg-status.reg-unverified .reg-dot {
  background: var(--muted, #5b6478);
  box-shadow: 0 0 0 1px var(--muted, #5b6478);
}

.reg-status.reg-unverified .reg-word {
  color: var(--muted, #5b6478);
}

.reg-reason {
  display: inline-block;
  margin-left: 6px;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted, #5b6478);
  border: 1px solid var(--hairline, #ddd9ce);
  border-radius: 50%;
  cursor: help;
}

.pipeline-draft-status {
  color: var(--muted, #5b6478);
  opacity: 0.8;
}

/* ---- Artifacts ---- */

.pipeline-artifacts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.pipeline-artifact-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--hairline, #ddd9ce);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
}

.pipeline-artifact-row:last-child {
  border-bottom: none;
}

.pipeline-artifact-kind {
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text, #1a1d20);
  min-width: 108px;
}

.pipeline-artifact-stage {
  color: var(--muted, #5b6478);
}

.pipeline-artifact-size {
  margin-left: auto;
  color: var(--muted, #5b6478);
  font-variant-numeric: tabular-nums;
}

.pipeline-artifact-time {
  color: var(--muted, #5b6478);
  opacity: 0.8;
  min-width: 84px;
  text-align: right;
}

/* ---- A11y + responsive ---- */

.pipeline-surface :focus-visible {
  outline: 2px solid var(--orange, #cc3333);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .pipeline-action {
    transition: none;
  }
}

/* ≤760px: the stage line wraps naturally (flex-wrap); upload fields stack.
   ≤620px: header and meter stack, artifact time hides. */
@media (max-width: 760px) {
  .pipeline-upload-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .pipeline-surface {
    padding: 16px 12px 48px;
  }

  .pipeline-heading {
    font-size: 17px;
  }

  .pipeline-artifact-time {
    display: none;
  }
}
