today i've had about 100mg total mag from spinach, 50 from cabbage, 75 from sunflower seeds, and maybe 20 from tomatoes. plus two mag citrate pills.
i just had dinner and part of it was spaghetti sauce with a crap ton of frozen spinach cooked into it. family didn't notice it was even there. earlier today for snack i had one of these spinach pies - krinos filo twisters w spinach and feta.
last week i made a batch of lentil soup (lentils have magnesium on their own), had a ton of spinach in that too, again you couldn't tell by taste even though you could see it. you can add spinach to chili as well, there will be magnesium in the beans too. i also cut up blocks of frozen spinach into ice cube size blocks and to things like add it with red pepper and a bit of cheese, in morning eggs. working yams or sweet potatoes into the routine where you normally have regular potatoes can help as well. sometimes i mix them 50/50 if need a milder flavour than full on yam, but don't want plain potato either.
swiss chard is a great side with some butter and a splash of vinegar. it needs to be boiled for 3 mins and the water must be discarded. i usually have it whenever i'm having salmon for supper. With yam and/or potato

if you can manage a handful of trail mix with pumpkin seeds, cashews and sunflower seeds on a regular basis, that will provide magnesium and other goodies as well. if you add dark chocolate-covered dried gojis to the mix, you'll add yet another magnesium boost (mostly from the dark chocolate). all good stuff! just have to get it on the grocery list so that it's in the cupboards when you go looking

is your water regular tap? any chance of keeping a water bottle with you through the day, in case you'll drink some if it's there?
i remember your coffee topic. i would say if you're not good at hydration then coffee as a diuretic would probably be something to avoid even though it's a good shot of magnesium. might be an idea, if you can, to try to down a glass of water when you get up in the morning, before that first coffee.