A theory floated around (including on this blog) has been that having Nancy Pelosi as House speaker might actually be a good thing for President Trump. The idea is that it provides him a tried-and-true foil for 2020 as the conservative media struggle to keep a fading Hillary Clinton in the role of bogeywoman.

That theory might have had it backward.

The first month of Pelosi’s return to the speakership has thus far served as a pretty resounding affirmation of her leadership and political acumen. And Wednesday epitomized it.

At the start of the day, we got a CBS News poll that tested the popularity of Washington’s leaders. Pelosi scored a 39 percent approval rating. That was shy of her disapproval — 50 percent — but it was significantly better than Trump’s split (36-59) and far better than Senate Majority Leader Mitch McConnell’s (R-Ky.) 25-55. It also appears to be her best mark in a poll since the last time she was speaker a decade ago.

The poll also notably tested her head-to-head with Trump, asking who was doing a better job with shutdown negotiations. Forty-seven percent chose Pelosi, while just 35 percent chose Trump. It also affirmed previous polling that showed the American people blame Trump and the Republicans for the shutdown by more than a 20-point margin — the kind of margin that has forced Republicans to fold during past shutdowns.

And Pelosi’s edge in the shutdown fight was only reinforced as the day went on. Early Wednesday afternoon, Trump made the highly questionable decision of telling Pelosi he would deliver the State of the Union address next week from the House chamber, even though Pelosi has raised shutdown-related objections to it. But Pelosi quickly sent a letter back saying she would not extend the invitation, and Trump, rather remarkably, immediately backed down. Pelosi had called his bluff.

We shouldn’t extrapolate too much from the first three weeks of Pelosi’s speakership, but if anything it seems having a long-unpopular and volatile president as her own foil could play to Pelosi’s strengths. What people forget about Pelosi, given her years featured in GOP attack ads, is that she was relatively popular when she had this setup before. She first became speaker after the 2006 election and served in that role for the last two years of the George W. Bush administration. Her poll numbers only took a turn for the negative when Barack Obama and Obamacare came along.

That doesn’t mean her numbers will keep improving or that she won’t still serve as a convenient lightning rod for Republicans, and potentially help Trump keep his base engaged for his reelection campaign. But this is a bit of a zero-sum game, and Trump is dealing with something he has never dealt with before: A Democrat with actual power who can stop him and reinforce his own weaknesses and miscues.

Trump has so far leaned into his fight with Pelosi in highly questionable ways — pushing for a border wall that people don’t want with a shutdown that people don’t want, and picking a State of the Union fight he seemed destined to lose. If he keeps picking the wrong fights, Pelosi will only have more opportunities to look like the superior leader.