My question involves employment and labor law for the state of: IL

I'm on track for a bonus tied to job performance for last month. However, I'm leaving the company in a few weeks. The bonus for last month does not pay out until shortly after I will have left the company. My HR sent an email saying since I will not be employed at the co. when the bonus pays out, I am not eligible for it. This seems to make no sense and be unethical, since the bonus is for my job performance last month (when I obviously WAS employed at the company, and performed well beyond expectation; thus the bonus).

My question is, is it legal for them to keep a bonus for work already performed the previous month, just because I left the company a week or so before the bonus was to be paid? Thanks for any help!