.team-formation-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.team-formation-hero__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--crm-muted, #64748b);
}

.team-formation-hero__title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.team-formation-hero__hint {
  margin: 0;
  max-width: 52rem;
  color: var(--crm-muted, #64748b);
  line-height: 1.5;
}

.team-formation-board {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 1.25rem 1rem 1rem;
  border-radius: 16px;
  background: var(--crm-panel-bg, #f8fafc);
  border: 1px solid var(--crm-border, #e2e8f0);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  overflow-x: auto;
}

.team-formation-header,
.team-row {
  display: grid;
  grid-template-columns: 1.15fr 0.55fr 1.15fr 0.55fr 1.15fr 0.55fr 1.15fr;
  min-width: 52rem;
  align-items: stretch;
}

.team-formation-header {
  margin-bottom: 0.5rem;
}

.team-formation-header__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.65rem 0.35rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--crm-border, #e2e8f0);
  text-align: center;
}

.team-formation-header__cell--bridge {
  background: transparent;
  border-color: transparent;
}

.team-formation-header__phase {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--crm-muted, #64748b);
}

.team-formation-header__name {
  font-size: 1rem;
  font-weight: 700;
}

.team-formation-header__arrow {
  color: var(--crm-muted, #94a3b8);
  font-size: 1.1rem;
  font-weight: 600;
}

.team-formation-col--cc .team-formation-header__name { color: #1d4ed8; }
.team-formation-col--qc .team-formation-header__name { color: #0f766e; }
.team-formation-col--sc .team-formation-header__name { color: #d97706; }
.team-formation-col--fulfilment .team-formation-header__name { color: #6d28d9; }

.team-formation-col--cc.team-formation-header__cell { border-bottom: 2px solid #93c5fd; }
.team-formation-col--qc.team-formation-header__cell { border-bottom: 2px solid #5eead4; }
.team-formation-col--sc.team-formation-header__cell { border-bottom: 2px solid #fcd34d; }
.team-formation-col--fulfilment.team-formation-header__cell { border-bottom: 2px solid #c4b5fd; }

.team-formation-rows {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.team-formation-empty {
  margin: 1rem 0;
  text-align: center;
}

.team-row {
  position: relative;
  min-height: 5.5rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--crm-border, #e2e8f0);
}

.team-row__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.team-row__cell {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5.5rem;
}

.team-row__cell--center {
  z-index: 2;
}

.team-row__cell--solo {
  gap: 1.5rem;
  padding: 0 0.75rem;
}

.team-row__dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.15);
}

.team-row__dot--cc { background: #3b82f6; }
.team-row__dot--qc { background: #14b8a6; }
.team-row__dot--sc { background: #f59e0b; }
.team-row__dot--fulfilment { background: #8b5cf6; }

.team-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.team-player--center {
  max-width: 5rem;
}

.team-player:hover,
.team-player:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.team-player__figure {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 2.6rem;
}

.team-player__head {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #f8d7b8;
  border: 2px solid rgba(15, 23, 42, 0.15);
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.12);
  z-index: 1;
}

.team-player__body {
  width: 2.1rem;
  height: 1.45rem;
  margin-top: -0.2rem;
  border-radius: 0.9rem 0.9rem 0.15rem 0.15rem;
  border: 2px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.14);
}

.team-player__name {
  max-width: 5.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-player--cc .team-player__body { background: linear-gradient(180deg, #60a5fa, #1d4ed8); }
.team-player--qc .team-player__body { background: linear-gradient(180deg, #2dd4bf, #0f766e); }
.team-player--sc .team-player__body { background: linear-gradient(180deg, #fbbf24, #d97706); }
.team-player--fulfilment .team-player__body { background: linear-gradient(180deg, #a78bfa, #6d28d9); }
.team-player--bench .team-player__body { background: linear-gradient(180deg, #cbd5e1, #64748b); }

.team-player--inactive {
  opacity: 0.5;
}

.team-formation-bench {
  padding: 1rem 1.1rem 1.2rem;
  border-radius: 14px;
  background: var(--crm-panel-bg, #f8fafc);
  border: 1px solid var(--crm-border, #e2e8f0);
}

.team-formation-bench__title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.team-formation-bench__hint {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
}

.team-formation-bench__players {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
}

.team-phase-checks {
  display: grid;
  gap: 0.65rem;
}

.team-phase-check {
  display: grid;
  grid-template-columns: auto 4.5rem 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--crm-border, #e2e8f0);
  cursor: pointer;
}

.team-phase-check:has(input:checked) {
  border-color: #2f6df6;
  background: rgba(47, 109, 246, 0.06);
}

.team-phase-check__badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--crm-muted, #64748b);
}

.team-phase-check__label {
  font-size: 1rem;
  font-weight: 700;
}

.team-phase-check--cc .team-phase-check__label { color: #1d4ed8; }
.team-phase-check--qc .team-phase-check__label { color: #0f766e; }
.team-phase-check--sc .team-phase-check__label { color: #d97706; }
.team-phase-check--fulfilment .team-phase-check__label { color: #6d28d9; }

.team-phase-hint {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
}

@media (max-width: 900px) {
  .team-formation-layout {
    padding: 1rem 0.85rem 1.5rem;
  }

  .team-formation-header,
  .team-row {
    min-width: 44rem;
  }
}
