Margarita Shabazz admitted last fall that she bilked her employers — a Chicago video production company and an advertising agency — out of more than $2 million.

After she bonded out of jail, she got a new job — and she stole some more, according to federal prosecutors.

“You’re really good at gaming the system,” U.S. District Judge Sara Ellis told Shabazz before sentencing her to four years in prison Friday afternoon at the Dirksen Federal Courthouse. “You seem to have this impulsive desire to see how far you can get away with things.”

Shabazz, who was sentenced on her 40th birthday, wept in her orange jumpsuit as she apologized to the judge, blaming her own “immoral decisions and self-destructive behavior” for the fraud carried out over six years.

It started in 2009 while Shabazz was working as a bookkeeper for the ad agency. For two years, Shabazz cut 39 company checks to herself or her own companies, recording them as payments to vendors while she raked in nearly $350,000.

She kept it up when she started working as a production manager at the video studio in 2011 — even though she was earning a $100,000 annual salary.

Shabazz has been listed as a producer of several TV series and short films since 2012, and last year she was credited as an accountant on a documentary about comedian Patton Oswalt, according to IMDB.

By June 2016, Shabazz had fraudulently signed 92 checks to line her own accounts with more than $1.6 million.

The scheme netted her more than $2 million that she used to fund a glamorous lifestyle for herself, her husband and two children, prosecutors said.

About a third of that — $550,000 — funded drug and gambling habits, according to prosecutors. She spent more than $25,000 on Amazon, $24,000 on Apple products, $20,000 at Macy’s and $38,000 on credit card payments.

Shabazz also dropped $69,000 on plane tickets, $66,000 on hotels and $14,000 on a vacation package. And she bought more than $37,000 worth of tickets on StubHub — plus nearly $28,000 more on White Sox tickets.

“And I’ve got to say, the White Sox aren’t that good,” Ellis said.

Shabazz was arrested in October 2016 after company executives caught on.

She pleaded guilty last November to one count of bank fraud and was released on bond. Within two months, she had written two more bogus checks totaling about $33,000 from a new firm she started working for in Beverly Hills, according to prosecutors. Shabazz hasn’t been charged in that case.

“I keep asking myself, how did I get here? I made terrible decision after terrible, terrible decision,” Shabazz said.

Defense attorney Stephanie Kemen said an undisclosed mental health issue was partly to blame. Ellis said she considered it in handing down the four-year sentence. Prosecutors had sought up to nine years.

“Because of your mental illness, I think you got a rush when you got away with it,” Ellis said.

Before her bond was revoked, Shabazz went back to the video studio’s storage locker and stole about $46,000 worth of video equipment, props and a pair of antique chairs, prosecutors said. She’s facing a pending felony theft charge in state court in that case.

The studio owner said his own family heirlooms were among the items she swiped from the locker. He stood a few feet away from Shabazz while speaking at Friday’s sentencing.

“I rue the day that you came to work for me, Margie,” he said.