Ryan Sweeting and Kaley Cuoco… before the breakup. (Photo: Instagram)

Kaley Cuoco is leaving her divorce like a boss … protecting the hell out of her Big Bang Theory fortune.

We obtained the settlement agreement between Kaley and her now-ex hubby, tennis pro Ryan Sweeting, and she made out well, and the key is her prenup.

More News: Blac Chyna - I’m Gonna Own the Kardashian Name for Profit

Kaley got hitched in 2013, and months later she reportedly signed a staggering $72 million contract — $1 million an episode for 72 shows. That money is protected under the prenup — it’s all hers.

On top of that, she gets their home in Tarzana, Calif., and their Santa Barbara area beach house.

More News: Kim and Kanye Throw Dance Party in Cuba

Ryan did … not so well. He walks away with a lump sum parting gift of $165,000. She’s also agreed to pay the $195,000 bill for his two personal trainers.

Oh, one other thing. He gets to keep whatever cash and gift certificates in his possession. So, dinner at Chili’s?