Bhagavad Gita · 14.14
यदा सत्त्वे प्रवृद्धे तु प्रलयं याति देहभृत्।तदोत्तमविदां लोकानमलान्प्रतिपद्यते॥
yadā sattve pravṛddhe tu pralayaṁ yāti deha-bhṛt tadottama-vidāṁ lokān amalān pratipadyate
When the embodied soul meets death while sattva is predominant, it attains the pure realms of those who know the highest truth.
— Bhagavad Gita 14.14
Source: Sacred-Texts.com (Sanskrit) + Bhagavad-Gita.io (translations)