Sunroofs are not expected to be waterproof forever. That's why there is an inner channel in the roof that drains any water to one or more drain hoses that route to under the car. I'm guessing that yours are clogged, which I've seen before.
The video below goes through the whole process of accessing the hoses in the roof pillars - you probably don't have to do that! (curtain air bags!!)
I located the openings of the hoses around the sunroof and poked around with a wooden skewer, which did the trick.
Volvo XC90 Front and rear sunroof drain tube location 2003-2014
https://www.youtube.com/watch?v=X_eXgdwMzQA