Heh, you can use padding instead of margin. (got a green background on the flexcontainer)
You could also change the flex direction (column/row) to match the direction of the margin (doesnt work if you have margin in all directions)