Last week, much of Washington was stunned as the Republican process to repeal Obamacare was stopped, at least for now, by the votes of Sens. Susan Collins, John McCain, and Lisa Murkowski. This was obviously a significant setback for the Trump administration, and for the party.

But what are the electoral implications? In the House, the calculus is reasonably straightforward: A number of Republicans in vulnerable seats voted for an unpopular bill with little to show for it. While there is some question of whether voting for a controversial bill that fails to become law will have the same effect as voting for a controversial bill that is actually enacted, it is difficult to say that this enhances Republicans’ chances of retaining their majority.

In the Senate, however, things are more complicated. To understand why, let’s take a look at Gallup’s recent job approval ratings for President Trump in all 50 states. These are useful because, while Gallup’s measurements have tended toward the low end among pollsters, the 40 percent average for Trump comes in just a couple of points above the current RealClearPolitics average for his job approval. Second, presidential job approval has a strong relationship with elections in swing states. While it isn’t the be-all and end-all when it comes to predicting outcomes, it gives us some idea how things are playing out.

So what do we find? It might be useful to divide the job approval statistics into thirds. First, let’s look at states where Trump’s approval is below his national average, and where Senate contests will take place next year:

As you can see, all of these are “blue” states, and in fact comprise about three-quarters of the electoral votes that Hillary Clinton received last year. Votes by a Republican for the health care bill in these states would probably be harmful next fall. But there are few Republicans in this group. Moreover, there’s only one Democrat, Tim Kaine of Virginia, who would make any list of potentially vulnerable senators under almost any circumstances. The bottom line is that there’s very little action here.

The next “tier” of Senate seats are those where Trump’s job approval is below water, but where he is more popular than he is in the country as a whole:

Note first that these are mostly red states. While Trump’s job approval has declined nationally since his inauguration, the fundamental structure of his coalition remains unchanged.

Next, we note that there are three potentially vulnerable Republican Senate seats in this category. This probably explains Dean Heller’s reluctance to go along with most of the Republican health care plans (especially as they relate to the Medicaid repeal) and Jeff Flake’s recent op-ed urging Republicans to distance themselves from Trump.

The third seat is Ted Cruz’s in Texas. Cruz has a quality opponent in Rep. Beto O’Rourke, and the state swung heavily toward Democrats in 2016, although Trump still won it by a healthy margin. This could potentially be the third Senate seat Democrats need to take the majority. While I wouldn’t rate the seat safe right now, I’d also interpose two notes of caution. First, the Gallup poll is a poll of all adults, and a substantial share of the adult population in Texas is comprised of non-citizens. Second, this is still a state where Democrats haven’t won a statewide race since 1994, which represents their longest losing streak in the country. Perhaps they will start out by defeating a Republican incumbent in a Senate race, but it would take a lot more evidence to convince me that Cruz really is in serious jeopardy.

But even if Democrats did sweep these three seats, in order to reclaim the majority they would have to hold all of their current seats. And this is where things get interesting. First, if Trump were to somehow regain his footing and push his job approval back into the mid-40s, the seats in Michigan, Wisconsin, Pennsylvania and Florida should become highly competitive.

Second, note that even with his job approval in the low 40s nationally, Ohio and Indiana look poised for competitive races. The individual mandate – which lies at the heart of the “skinny repeal” – is still unpopular, and Republican strategists are doubtless preparing ads accusing Sherrod Brown and Joe Donnelly of casting the deciding vote to save the mandate. Of course, Brown and Donnelly will have their own counterpunches ready, and Brown in particular has proved adept at winning in what has been a highly competitive state. My point is simply that when you get down to a granular level, you start to see how the failure of “skinny repeal” can interact with the highly unfavorable Democratic map to pose challenges for them.

This becomes even more apparent when we look at the third tier of states: those where Trump remains popular.

First, this illustrates once again the challenges that Democrats face this cycle. Trump remains popular in most of the remaining states where Republicans hold seats. Perhaps more important is the number of vulnerable Democratic seats in this category: four. In other words, Democrats are defending more seats where Trump is popular than Republicans are defending seats where Trump is unpopular.

This is where the vote on the repeal of the mandate becomes interesting. These four Democrats, with the arguable exception of Claire McCaskill, have won in the past by successfully distancing themselves from their party. While she and Joe Manchin, Jon Tester and Heidi Heitkamp repeatedly have voted against Obamacare repeal in the past, there has never been much consequence for it. This time, however, they are on record as voting to keep the mandate. We can expect Republicans to make hay of the fact that, had any of them switched their vote, the mandate would probably be dead. In particular, I’ve never really bought concerns that Manchin is particularly vulnerable, but I am gradually reconsidering.

The cautionary tale here is found in the careers of Southern Democrats like Blanche Lincoln and Mark Pryor. Lincoln won by double digits in 2004, while Pryor was seen as so unbeatable that he didn’t even draw a Republican opponent in 2008. They did this by breaking with their caucus on key issues. But in the 111th Congress (2009-2010), their votes were needed to break every single Republican filibuster. Their independent brands were badly damaged.

If we put this together, it is consistent with the interactive Senate tool David Byler and I developed earlier this year. If you simulate the election with Trump’s job approval around 40 percent, the most likely result is that Republicans hold steady or lose a seat, although they gain seats in around a quarter of the scenarios. Whether Republicans end up on the upside of the mean (from their perspective) or the downside probably depends on the extent to which Democratic senators like Tester, Heitkamp and Manchin can maintain their semi-independent brands. The politics of health-care reform probably complicate this.