I havn't been tracking them to be honest. What would a magnesium defficiency do? I never really thought about magnesium before

My sleep is iffy-some nights I sleep so heavy I wake up with stiff muslces from not moving and other nights I don't sleep so good. I've always been that way. What foods are rich in it?