All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
We will summarize the answer in the following points:
1 - You need to look at whether or not you are pure in order to make sure about purity before sleeping, when waking up from sleep, and at the times of the prayer. The jurists stated that it is an obligation to make sure whether or not you are pure during the times of the prayer, and they did not exclude the Maghrib prayer from other prayers.
2 - If you see purity, you have to take the initiative to perform Ghusl (ritual bath). The brownish discharges that you see after that are not considered as menses, because the yellowish or brownish discharges are not considered menses according to the view that we adopt here in Islamweb unless it is connected to bleeding, but after the interruption of the blood, then it is not menstruation.
3 - You must check whether or not you are pure before sleeping, and then if you wake up after the beginning time of Fajr and you see the purity, then in principle it happened in the most recent time. Therefore, you are not obliged to pray ‘Isha because you are not aware of what happened during sleep; because if it is possible to relate an incident to either of the two times, then it is added to the most recent time.
4- You are not obliged to stay indoors when you want to go outside, but you have to make sure about purity at the times that we have mentioned, and if you see a sign of purity, then you do not go out until you perform Ghusl if you will be outside throughout the time of prayer, in a way that you are not able to return home in a time that is sufficient to perform Ghusl and the prayer before the end of the time of the prayer.
For more benefit, please refer to Fataawa 382321, 231715, 252556, 355546 and 364015.
Allah knows best.