Payments are not the same as shares
What somebody owes and what they handed over are two different numbers, and the gap between them is their balance. If Maya put in €50 but only owed €42, she gets €8 back through the settlement rather than having it absorbed into a tip.
A reservation deposit paid weeks ago counts too: whoever funded it is credited for it, the restaurant balance drops by that amount, and the settlement reflects both.