I think the ideal is 3 hours.
I follow advice from Huberman podcast on not eating 60-90 min after you wake up, and not eating 2-3 hours before you go to sleep. At minimum I would keep to not eat at 2 hours before I sleep, finishing at 8:30 to 9 and sleeping at 11.