p90x workout routines

I work out at night and then go to sleep a couple hours later; is this a bad idea?
I been doing the P90X workout routines and have been wondering if it is a bad idea for my health to then go to sleep afterwords.
By the way, I’m 19 5’10 and weigh 140. Not try to less weight but gain muscles and become more tone.
thank you everyone i wish i could vote all of you for best answers.
a couple hours before bedtime aint that bad, but i’d make sure to eat right after working out(like within 30min), ’cause you shouldnt go to bed right after eating, its not good if you wanna get toned/decrease body fat and it might mess with your ability to get sleep, dont forget sleep is a big factor if you wanna see results
I Started A Workout Routine: P90X