/* ═══════════════════════════════════════════════════════════════════════════
   RELEASE PIPELINE — Horizontal timeline + terminal log viewer
   ══════════════════════════════════════════════════════════════════════════ */

.rel-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 860px) { .rel-layout { grid-template-columns: 1fr; } }

.rel-branch-panel { position: sticky; top: 12px; }

/* ── Horizontal timeline ── */
.rel-timeline-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px 16px;
  overflow-x: auto;
  margin-bottom: 14px;
}

.rel-timeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  min-width: max-content;
}

.rel-tl-item {
  display: flex;
  align-items: center;
}

.rel-tl-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 80px;
  flex-shrink: 0;
}

.rel-tl-node {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  transition: all .3s ease;
  position: relative;
  z-index: 1;
}
.rel-tl-node.done {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}
.rel-tl-node.active {
  background: var(--primary, #6366f1);
  border-color: var(--primary, #6366f1);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(99,102,241,.18);
  animation: tl-pulse 2s ease-in-out infinite;
}
.rel-tl-node.failed {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}
@keyframes tl-pulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(99,102,241,.18); }
  50%      { box-shadow: 0 0 0 8px rgba(99,102,241,.04); }
}

.rel-tl-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.rel-tl-label.active { color: var(--primary, #6366f1); }
.rel-tl-label.done   { color: #16a34a; }

.rel-tl-connector {
  height: 2px;
  width: 28px;
  background: var(--border);
  flex-shrink: 0;
  margin-bottom: 22px;
  transition: background .4s;
}
.rel-tl-connector.done   { background: #16a34a; }
.rel-tl-connector.active { background: linear-gradient(to right, #16a34a, var(--primary, #6366f1)); }

/* ── Stage detail cards ── */
.rel-stage-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rel-stage-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: opacity .25s;
}
.rel-stage-card.pending { opacity: .45; pointer-events: none; }
.rel-stage-card.active  { border-color: var(--primary, #6366f1); box-shadow: 0 0 0 3px rgba(99,102,241,.08); }
.rel-stage-card.done    { border-color: #16a34a40; }

.rel-stage-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
}
.rel-stage-head:hover { background: var(--surface-hover, rgba(0,0,0,.025)); }

.rel-stage-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: background .3s;
}
.rel-stage-card.active .rel-stage-dot { background: var(--primary,#6366f1); animation: dot-pulse 1.6s ease-in-out infinite; }
.rel-stage-card.done   .rel-stage-dot { background: #16a34a; }
.rel-stage-card.failed .rel-stage-dot { background: #ef4444; }
@keyframes dot-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(99,102,241,.4); }
  50%      { box-shadow: 0 0 0 5px rgba(99,102,241,0); }
}

.rel-stage-title { font-size: 13px; font-weight: 600; color: var(--text); }
.rel-stage-sub   { font-size: 11px; color: var(--muted); margin-top: 1px; }

.rel-stage-body-wrap { padding: 0 16px 14px; border-top: 1px solid var(--border); }
.rel-stage-body-wrap.hidden { display: none; }

/* ── Terminal log viewer ── */
.rel-terminal {
  background: #0d1117;
  border-radius: 7px;
  padding: 12px 14px;
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
  font-size: 11.5px;
  line-height: 1.65;
  max-height: 260px;
  overflow-y: auto;
  color: #c9d1d9;
  margin-top: 10px;
  white-space: pre-wrap;
  word-break: break-all;
}
.rel-terminal .log-line-err { color: #f87171; }
.rel-terminal .log-line-ok  { color: #4ade80; }
.rel-terminal .log-line-dim { color: #6e7681; }

/* Scrollbar inside terminal */
.rel-terminal::-webkit-scrollbar { width: 4px; }
.rel-terminal::-webkit-scrollbar-track { background: transparent; }
.rel-terminal::-webkit-scrollbar-thumb { background: #30363d; border-radius: 2px; }

/* ── Branch rows ── */
.rel-branch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
  margin-bottom: 2px;
  gap: 8px;
}
.rel-branch-row:hover   { background: var(--surface-hover, rgba(99,102,241,.05)); }
.rel-branch-row.selected { background: rgba(99,102,241,.1); border-color: rgba(99,102,241,.3); }

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD — metric cards, env health row
   ══════════════════════════════════════════════════════════════════════════ */

.dash-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.dash-metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-metric-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.dash-metric-value { font-size: 26px; font-weight: 700; line-height: 1; color: var(--text); }
.dash-metric-value.green  { color: #16a34a; }
.dash-metric-value.amber  { color: #f59e0b; }
.dash-metric-value.purple { color: var(--primary, #6366f1); }
.dash-metric-sub { font-size: 11px; color: var(--muted); }

/* Pipeline stage timeline inside dashboard */
.dash-pipeline-timeline {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 0;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.dash-tl-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
  flex-shrink: 0;
}
.dash-tl-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  margin-bottom: 6px;
  border: 1.5px solid var(--border);
}
.dash-tl-icon.succeeded { background: #f0fdf4; border-color: #86efac; }
.dash-tl-icon.failed    { background: #fef2f2; border-color: #fca5a5; }
.dash-tl-icon.inprogress{ background: rgba(99,102,241,.08); border-color: rgba(99,102,241,.3); animation: tl-pulse 1.8s ease-in-out infinite; }
.dash-tl-name { font-size: 10px; font-weight: 600; text-align: center; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.dash-tl-status { font-size: 9px; color: var(--muted); margin-top: 2px; }
.dash-tl-arrow {
  flex-shrink: 0;
  width: 24px;
  height: 2px;
  background: var(--border);
  margin-bottom: 18px;
}
.dash-tl-arrow.done { background: #16a34a; }

/* Env health cards */
.dash-env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.dash-env-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.dash-env-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.dash-env-name { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.dash-env-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}
.dash-env-badge.active   { background: #f0fdf4; color: #16a34a; border: 1px solid #86efac; }
.dash-env-badge.inactive { background: #fef2f2; color: #ef4444; border: 1px solid #fca5a5; }
.dash-env-image { font-size: 11px; color: var(--text); font-weight: 500; font-family: monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 8px; }
.dash-env-tasks { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--border); }
.dash-env-tasks-val { font-weight: 700; color: var(--text); }

/* ═══════════════════════════════════════════════════════════════════════════
   GLOBAL POLISH — loading skeletons, empty states, better badges
   ══════════════════════════════════════════════════════════════════════════ */

.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--surface-hover,#f1f5f9) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 5px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty-state svg { opacity: .35; margin-bottom: 14px; }
.empty-state p { font-size: 14px; margin: 0 0 16px; }

.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.status-dot.green  { background: #16a34a; box-shadow: 0 0 4px #16a34a80; }
.status-dot.red    { background: #ef4444; }
.status-dot.amber  { background: #f59e0b; }
.status-dot.blue   { background: var(--primary,#6366f1); animation: tl-pulse 2s infinite; }
.status-dot.gray   { background: var(--muted); }

/* badge upgrade */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 5px; font-size: 11px; font-weight: 600; }
.badge-success { background: #f0fdf4; color: #16a34a; border: 1px solid #86efac; }
.badge-danger  { background: #fef2f2; color: #ef4444; border: 1px solid #fca5a5; }
.badge-info    { background: rgba(99,102,241,.08); color: var(--primary,#6366f1); border: 1px solid rgba(99,102,241,.25); }
.badge-amber   { background: #fffbeb; color: #d97706; border: 1px solid #fcd34d; }
.badge-muted   { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
