The Fardh - obligatory rakats of Maghrib is 3 and a total of 7 rakats: 3 fard, 2 sunnat, 2 nafl
The Maghrib prayer is one of the five mandatory salah (Islamic prayer). Maghrib prayer is a three rakah prayer. There are a few optional prayers.
After three rakat fard, two rakat sunnah muakkadah and two rakat nafl
Fardh - obligatory someone who ignores Fardh intentionally, knowing that it is an obligation, becomes a kaafir (disbeliever) (that is the opinion of most scholars)
Sunnat muakkadah - those actions of Hazrat Muhammad (ﺻﻠﯽ الله ﺗﻌﺎﻟﯽٰ ﻋﻠﯿﮧ ﻭﺍٓﻟﮧ ﻭﺳﻠﻢ) (peace be upon him) that were done regularly. someone who leaves it out due to a valid reason will not be sinning but who doesn t have a valid reason will be sinning.
Nafl - optional.
Time: The time for Maghrib begins when the sun sets, and lasts until the red light has left the sky in the west.
There is a hadith is Sahih Bukhari which says: “One who missed Maghrib prayer will be punished in this world and hereafter.”
And Allah knows best