/* ============================================================================
   Мир «Грид» · Стилизация конвейера миссии и пар исполнителей (/live)
   Файл: pipeline_flow.css · Пакет F22-GOAL-w2-g1-r2
   WCAG 2.2 AAA Compliant · Закон Модульности (< 800 строк)
   ============================================================================ */

/* ---------- 1. Контейнер конвейера и карточки групп ---------- */
#cardPipeline {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-height: 96px;
  max-height: calc(100vh - 280px);
  box-sizing: border-box;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--white-alpha-20) transparent;
}

#cardPipeline::-webkit-scrollbar {
  width: 4px;
}

#cardPipeline::-webkit-scrollbar-track {
  background: transparent;
}

#cardPipeline::-webkit-scrollbar-thumb {
  background: var(--white-alpha-20);
  border-radius: var(--r-xs);
}

#cardPipeline::-webkit-scrollbar-thumb:hover {
  background: var(--white-alpha-30);
}

.live-pipeline-tree {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: 100%;
  box-sizing: border-box;
  overflow: auto;
  max-height: calc(100vh - 340px);
  scrollbar-width: thin;
  scrollbar-color: var(--white-alpha-20) transparent;
  padding-right: var(--sp-1);
}

.live-pipeline-tree::-webkit-scrollbar {
  width: 4px;
}

.live-pipeline-tree::-webkit-scrollbar-track {
  background: transparent;
}

.live-pipeline-tree::-webkit-scrollbar-thumb {
  background: var(--white-alpha-20);
  border-radius: var(--r-xs);
}

.live-pipeline-tree::-webkit-scrollbar-thumb:hover {
  background: var(--white-alpha-30);
}

.pipeline-group-card,
.pipeline-group-card.step {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  height: auto !important;
  min-height: fit-content !important;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-2-5);
  transition: border-color var(--dur-normal) ease, background var(--dur-normal) ease, box-shadow var(--dur-normal) ease;
  position: relative;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.pipeline-group-card:hover {
  border-color: var(--violet-alpha-30);
  background: var(--surface-2);
}

.pipeline-group-card.step-selected {
  border-color: var(--violet);
  box-shadow: 0 0 0 1px var(--violet) inset, 0 4px 14px var(--violet-alpha-20);
}

.pipeline-group-card.step-running {
  border-color: var(--blue-alpha-40);
  box-shadow: 0 0 12px var(--blue-alpha-15);
}

.pipeline-group-card.step-failed {
  border-color: var(--red-alpha-40);
  box-shadow: 0 0 10px var(--red-alpha-15);
}

/* ---------- 2. Заголовок группы и индикаторы ---------- */
.group-header {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  width: 100%;
  box-sizing: border-box;
}

.step-i {
  width: 24px;
  height: 24px;
  border-radius: var(--r-xs);
  display: grid;
  place-items: center;
  font-size: var(--fs-xs);
  font-weight: 700;
  flex: 0 0 24px;
  font-family: var(--mono);
  box-sizing: border-box;
  margin-top: var(--sp-px);
}

.step-i.run {
  background: var(--blue-alpha-15);
  color: var(--blue-light);
  border: 1px solid var(--blue-alpha-30);
}

.step-i.done {
  background: var(--green-alpha-15);
  color: var(--green-light);
  border: 1px solid var(--green-alpha-30);
}

.step-i.failed {
  background: var(--red-alpha-15);
  color: var(--red-light);
  border: 1px solid var(--red-alpha-40);
}

.step-i.pending {
  background: var(--white-alpha-04);
  color: var(--tx3);
  border: 1px solid var(--white-alpha-12);
}

.group-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  width: 100%;
  box-sizing: border-box;
}

.group-title-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-1-5);
  width: 100%;
  min-width: 0;
}

.stage-code-pill {
  font-size: var(--fs-2xs);
  font-weight: 700;
  color: var(--violet-light);
  background: var(--violet-alpha-15);
  border: 1px solid var(--violet-alpha-30);
  padding: 1px var(--sp-1);
  border-radius: var(--r-2xs);
  flex-shrink: 0;
  font-family: var(--mono);
  margin-top: var(--sp-px);
}

.step-n,
.pipeline-group-card .step-n {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--tx);
  line-height: var(--lh-snug);
  flex: 1;
  min-width: 0;
  max-width: 100% !important;
  word-break: break-word;
  white-space: normal;
}

.group-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1-5);
  flex-wrap: wrap;
  width: 100%;
}

.group-badges-left {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-wrap: wrap;
}

.badge-shares-count {
  font-size: var(--fs-2xs);
  padding: 1px var(--sp-1-5);
  background: var(--white-alpha-08);
  border: 1px solid var(--white-alpha-15);
  color: var(--tx2);
  border-radius: var(--r-xs);
  font-family: var(--mono);
}

.stage-lifecycle-dots {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-0-5);
}

.phase-dot {
  width: 5px;
  height: 5px;
  border-radius: var(--r-circle);
  display: inline-block;
}

.phase-dot.done { background: var(--green); }
.phase-dot.active { background: var(--blue); }
.phase-dot.failed { background: var(--red); }
.phase-dot.pending { background: var(--white-alpha-20); }

.stage-meta-right {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1-5);
  font-size: var(--fs-2xs);
  margin-left: auto;
}

.step-dur {
  color: var(--blue-light);
  font-family: var(--mono);
}

.stage-pct {
  color: var(--tx2);
  font-family: var(--mono);
  font-weight: 700;
}

.step-progress-bar {
  height: 3px;
  background: var(--white-alpha-08);
  border-radius: var(--r-2xs);
  overflow: hidden;
  width: 100%;
  margin-top: var(--sp-0-5);
}

.step-progress-bar i {
  display: block;
  height: 100%;
  transition: width var(--dur-normal) ease;
}

.step-progress-bar i.fill-done { background: var(--green); }
.step-progress-bar i.fill-run { background: var(--blue); }
.step-progress-bar i.fill-failed { background: var(--red); }

/* ---------- 3. Дерево долей (Shares) и пары Исполнитель → Критик ---------- */
.group-tree-branch {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1-5);
  margin-top: var(--sp-1-5);
  width: 100%;
  box-sizing: border-box;
}

.pipeline-group-card.expanded .group-tree-branch,
.pipeline-group-card.step-running .group-tree-branch,
.pipeline-group-card.step-selected .group-tree-branch {
  display: flex;
}

.pipeline-shares-tree {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1-5);
  width: 100%;
  border-left: 2px solid var(--violet-alpha-30);
  padding-left: var(--sp-1-5);
  box-sizing: border-box;
}

.share-branch-node {
  background: var(--card2);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-xs);
  padding: var(--sp-1-5) var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease;
  width: 100%;
  box-sizing: border-box;
}

.share-branch-node:hover {
  background: var(--surface-2);
  border-color: var(--violet-alpha-30);
}

.share-branch-node.share-running {
  border-color: var(--blue-alpha-30);
  box-shadow: 0 0 8px var(--blue-alpha-15);
}

.share-branch-node.share-retry,
.share-branch-node.share-rejected {
  border-color: var(--status-failed-border);
  background: linear-gradient(135deg, var(--card2) 0%, var(--red-alpha-08) 100%);
  box-shadow: 0 0 8px var(--red-alpha-15);
}

.share-node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1-5);
  flex-wrap: wrap;
  width: 100%;
}

.share-left-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  min-width: 0;
  flex-wrap: wrap;
}

.share-code {
  font-size: var(--fs-2xs);
  font-weight: 700;
  color: var(--violet-light);
  background: var(--violet-alpha-15);
  padding: 1px var(--sp-1);
  border-radius: var(--r-2xs);
  font-family: var(--mono);
}

.pkg-pill {
  font-size: var(--fs-2xs);
  color: var(--tx2);
  background: var(--surface-base);
  padding: 1px var(--sp-1-5);
  border-radius: var(--r-xs);
  border: 1px solid var(--border-glass);
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  width: auto;
  min-width: max-content;
  max-width: none;
  font-family: var(--mono);
}

.badge-round {
  font-size: var(--fs-2xs);
  padding: 1px var(--sp-1-5);
  border-radius: var(--r-xs);
  font-family: var(--mono);
  font-weight: 700;
}

.badge-round.r1 {
  background: var(--white-alpha-08);
  border: 1px solid var(--white-alpha-15);
  color: var(--tx2);
}

.badge-round.r2,
.badge-round.retry {
  background: var(--amber-alpha-15);
  border: 1px solid var(--amber-alpha-40);
  color: var(--amber-light);
  box-shadow: 0 0 8px var(--amber-alpha-30);
}

.share-pair-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1);
  font-size: var(--fs-2xs);
  padding: var(--sp-1) var(--sp-1-5);
  background: var(--surface-base);
  border-radius: var(--r-xs);
  border: 1px solid var(--white-alpha-04);
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

.pair-member {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-width: 0;
}

.pair-micro-ava {
  width: 16px;
  height: 16px;
  border-radius: var(--r-circle);
  flex-shrink: 0;
  object-fit: cover;
}

.share-model-badge {
  font-size: var(--fs-2xs);
  color: var(--tx3);
  background: var(--white-alpha-04);
  padding: 1px var(--sp-1);
  border-radius: var(--r-2xs);
  font-family: var(--mono);
}

.pair-arrow-icon {
  color: var(--violet-light);
  font-size: var(--fs-2xs);
  font-weight: 700;
}

/* ---------- 4. Целевые файлы ---------- */
.share-files-row {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-wrap: wrap;
  padding: var(--sp-1) var(--sp-1-5);
  background: var(--surface-base);
  border-radius: var(--r-xs);
  border: 1px solid var(--border-glass);
  width: 100%;
  box-sizing: border-box;
}

.share-files-label {
  font-size: var(--fs-2xs);
  color: var(--tx3);
  font-weight: 700;
  text-transform: uppercase;
  font-family: var(--mono);
}

.share-files-list {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.share-file-badge {
  font-size: var(--fs-2xs);
  padding: 1px var(--sp-1-5);
  background: var(--white-alpha-04);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-xs);
  color: var(--tx2);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
  box-sizing: border-box;
  font-family: var(--mono);
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease, color var(--dur-fast) ease;
}

.share-file-badge:hover {
  background: var(--violet-alpha-15);
  border-color: var(--violet-alpha-30);
  color: var(--white);
}

/* ---------- 5. Вердикты трибунала (Возврат r2+) ---------- */
.tribunal-rejection-card {
  margin-top: var(--sp-1-5);
  margin-bottom: var(--sp-1);
  padding: var(--sp-2) var(--sp-2-5);
  padding-bottom: var(--sp-2-5);
  background: var(--red-alpha-15);
  border: 1px solid var(--red);
  border-radius: var(--r-xs);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
  word-break: break-word;
}

.tribunal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1);
  font-size: var(--fs-2xs);
  font-weight: 700;
  color: var(--red-light);
  flex-wrap: wrap;
}

.tribunal-gate-label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}

.tribunal-reason-text {
  font-size: var(--fs-xs);
  color: var(--tx);
  line-height: var(--lh-snug);
  background: var(--card);
  padding: var(--sp-1-5) var(--sp-2);
  border-radius: var(--r-2xs);
  border-left: 2px solid var(--red);
  word-break: break-word;
  white-space: normal;
  overflow: visible;
  box-sizing: border-box;
}

/* ---------- 6. Изумрудный пульсирующий акцент финальной сборки (Assembly) ---------- */
.assembly-phase-card {
  background: linear-gradient(135deg, var(--card) 0%, var(--green-alpha-12) 100%);
  border: 1px solid var(--green-alpha-40);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-2-5);
  margin-top: var(--sp-1-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1-5);
  box-shadow: 0 0 16px var(--green-alpha-20), inset 0 0 8px var(--green-alpha-08);
  animation: emeraldPulse var(--dur-shimmer, 1.6s) ease-in-out infinite;
  transition: border-color var(--dur-normal) ease, box-shadow var(--dur-normal) ease;
  width: 100%;
  box-sizing: border-box;
}

.assembly-phase-card:hover {
  border-color: var(--green);
  box-shadow: 0 0 24px var(--green-alpha-40), inset 0 0 12px var(--green-alpha-15);
}

@keyframes emeraldPulse {
  0%, 100% {
    border-color: var(--green-alpha-40);
    box-shadow: 0 0 12px var(--green-alpha-20), inset 0 0 6px var(--green-alpha-08);
  }
  50% {
    border-color: var(--green);
    box-shadow: 0 0 24px var(--green-alpha-40), inset 0 0 14px var(--green-alpha-20);
  }
}

.assembly-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1-5);
  flex-wrap: wrap;
  width: 100%;
}

.assembly-title-badge {
  font-size: var(--fs-2xs);
  padding: 2px var(--sp-2);
  border-radius: var(--r-xs);
  background: var(--green-alpha-20);
  color: var(--green-light);
  border: 1px solid var(--green-alpha-30);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.assembly-steps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-1);
  margin-top: var(--sp-1);
  width: 100%;
}

.assembly-step-item {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-2xs);
  background: var(--card2);
  padding: var(--sp-1) var(--sp-1-5);
  border-radius: var(--r-xs);
  border: 1px solid var(--white-alpha-04);
  color: var(--tx2);
}

.assembly-step-item.checked {
  color: var(--green-light);
  border-color: var(--green-alpha-30);
  background: var(--green-alpha-08);
}

/* ---------- 7. Детальная карточка параметров этапа (#cardMission) ---------- */
@import url("./stage_details.css?v=56");


/* ---------- 8. Адаптивность под разрешения (1440px, 1280px, 768px, 390px) ---------- */
@media (max-width: 1280px) {
  #cardPipeline {
    max-height: calc(100vh - 240px);
  }
  .live-pipeline-tree {
    max-height: calc(100vh - 300px);
  }
  .assembly-steps-grid {
    grid-template-columns: 1fr;
  }
  .share-file-badge {
    max-width: 160px;
  }
  .stage-assigned-worker,
  .stage-assigned-critic {
    flex-basis: 100%;
  }
}

@media (max-width: 900px) {
  #cardPipeline {
    max-height: 560px;
  }
  .live-pipeline-tree {
    max-height: 480px;
  }
}

@media (max-width: 560px) {
  #cardPipeline {
    max-height: 480px;
  }
  .live-pipeline-tree {
    max-height: 400px;
  }
  .share-node-head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-1);
  }
  .share-pair-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-1);
  }
  .group-header {
    gap: var(--sp-1-5);
  }
  .pipeline-group-card {
    padding: var(--sp-1-5) var(--sp-2);
  }
  .pipeline-shares-tree {
    padding-left: var(--sp-1);
    gap: var(--sp-1);
  }
  .share-branch-node {
    padding: var(--sp-1) var(--sp-1-5);
  }
  .share-file-badge {
    max-width: 140px;
  }
}

/* ---------- 9. Поддержка prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .assembly-phase-card {
    animation: none !important;
  }
  .share-file-badge,
  .pipeline-group-card,
  .share-branch-node {
    transition: none !important;
  }
}

.btn-copy-mini {
  background: var(--white-alpha-04);
  border: 1px solid var(--white-alpha-15);
  border-radius: var(--r-sm);
  color: var(--tx2);
  padding: var(--sp-1) var(--sp-1-5);
  min-height: 32px;
  min-width: 32px;
  box-sizing: border-box;
  font-size: var(--fs-sm);
  font-family: var(--mono);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease;
  user-select: none;
}
.btn-copy-mini:hover {
  background: var(--green-alpha-20);
  border-color: var(--green-alpha-50);
  color: var(--green-light);
}

