Madrid Airport Overnight

I live in Las Palmas but have to take a last minute trip home to the US because my dad is sick. My flight from Las Palmas lands in Madrid very late and my connecting flight isn’t until late in the morning the following day. Since the ticket was bought so last minute it wasn’t exactly cheap so I really can’t bring myself to spend 170€ for a few hours in an airport hotel. Since my connecting flight is with a different airline, I’ll have to get my luggage and exit the post-security part of the airport. The next airline doesn’t start check-in until 6am so I’ll have to spend the night in the public part of the airport. I travel between Spain and the US often but I don’t usually have this problem. Anyone who’s familiar with the Madrid airport have any tips, cafes open overnight, or a comfortable area I should head to? Idk why I’m feeling so stressed about this, might just be due to the circumstances which are causing me to take this trip to begin with. I’m sure it’ll be fine. Right?