Lots of common sense answers, none of which substitute for the law.
The below is not legal advice, but you may want to get some.
A “security deposit” is not last months rent.
Assuming that you have a standard rental agreement,If you don’t pay by a certain date, you incur a late charge.
Upon vacating, landlord has 21 days to provide you with an itemized list of expenses/costs, which CAN include any unpaid rent + late charges, abnormal wear & tear etc.
If that is not provided(postmarked) timely, you can sue them for return of the entire deposit, and they can countersue you for back rent + late fees +
Discussing this with them in advance may OR may not work to your advantage. ALL agreements should be in writing.
SC judges hate the verbal he said/she said.
Providing a WRITTEN 30 day notice is a completely separate event from paying or not paying your rent.
To address an original comment, I don’t think that there is any requirement in CA to escrow a security deposit nor pay any interest on it to the tenant.
Most tenants and landlords haven’t got a clue what the laws actually are and it’s only when one party hires an attorney or actually reads their rights.
Usually it’s two “ignorant of the law” parties arguing over common sense.
Either take your chances and hope that your LL is clueless
OR
get some legal advice about how to protect your deposit correctly
Good Luck,, post an update when all is said and done~