For the first 10 months of President Trump's administration, the Republican Party has weathered his missteps and record-low approval ratings. The GOP batted 1,000 in five special elections to fill House vacancies, creating confidence about the 2018 midterms despite gale-force headwinds fanned by the White House.

And then came Nov. 7.

The Democrats won big in state and local contests, flipping executive offices and legislative seats in white, upscale suburbs near Philadelphia, New York, and Washington, D.C., long held by Republicans and crucial to their coalition.

Now, after energized Democrats and moderate swing voters turned out in droves to repudiate Trump, the political calculus has changed. Republicans are now heatedly debating how to protect their House and Senate majorities in a dangerous midterm environment dominated by the unpopular lightning rod in the White House.

“These races are all going to be hard fought. It’s a referendum,” said Rep. Greg Walden of Oregon, a senior lawmaker who served as the House Republican campaign chief in 2014 and 2016. “This is not a cycle for complacency.”

It's not unusual for presidents to cost their party seats in the midterm. The Republicans lost 26 House seats in 1982 under Ronald Reagan, a contest bookended by landslide victories of 44 and 49 states for the iconic leader. The party has generally expected a similar result with Trump, whose national approval numbers were hovering around an abysmal 40 percent in early November.

But after the party escaped a spate of special elections this year, especially in suburban Atlanta’s 6th Congressional District, a competitive seat where Democrats invested tens of millions of dollars only to come up short, Republicans were brimming with optimism about escaping the midterm curse — or worse, an anti-Trump wave.

The first regular general elections on the president’s watch offered fresh evidence of voter dissatisfaction with his polarizing leadership, and proof that the Democrats can harness it. Anxiety about the damage Trump could do is on the rise.

With Trump's caustic rhetoric, chaotic governance and preference for culture war politics, Republicans recognize the president as uniquely problematic. Yet, the Republican base appreciates his no-holds-barred style and other qualities that could fuel a 2018 wipeout.

Shifting their plan

Republicans now are urging Trump not to give Democrats any more ammunition than they already have.

“Remember, this is a team sport, and we’re all on the same team. You can differ with your teammates; it’s usually done better in the locker room than on the field,” said Rep. Tom Cole of Oklahoma, referencing Trump’s occasional habit of taking to Twitter to beat up on his fellow Republicans.

Cole is a veteran politician who was chairman of the National Republican Congressional Committee in 2008, which was George W. Bush’s last year in the White House. Col understands what it's like to try to win congressional elections under the shadow of an unpopular president.

“Recognize also that if we lose the majority in either chamber, you’re not going to escape the consequences, they’re going to come home,” he said. “Be all in, don’t think that the team can suffer a defeat and you somehow will be held blameless.”

Republicans, now realistic about the political atmosphere and what they can expect from the president, are putting more emphasis on what they can control.

Politically, party leaders are imploring all members, regardless of how safely drawn their seat is, to gird for a tough re-election battle. Start running early, raise money, spend time cultivating and maintaining relationships in the district and make sure constituent services operations are top notch.

Yet, the most important part of the Republicans’ survival strategy to overcome the Trump drag is to produce on Capitol Hill, a task that has proven difficult. Their bid to repeal and replace Obamacare barely made it out of the House before collapsing in the Senate.

The only other big-ticket legislation in the pipeline is the long-promised overhaul of the federal tax code. The scope of the bill, and differences between Republicans in the House and Senate, make passage uncertain, never-mind by year’s end. Republicans are betting all of their 2018 chips on their tax package.

If they fail, next year could be a bloodbath as their own voters abandon them. Republicans hope that threat is creating a sense of political urgency that didn’t exist during the aborted debate over repealing the Affordable Care Act.

“He will be the issue until we do what we said we’d do,” said Rep. Pete Sessions, R-Texas, the House Rules Committee Chairman who ran the NRCC in 2010, when Republicans won control of the House in a tidal wave that ejected Democrats from power across the country. “When we do what we said we’d do, then we stand a chance to be competitive.”

Past midterms

Republicans know a little something about midterm elections that can go sideways on the party that controls Congress and the White House.

In 2010, as voter frustration with Obama and the Democratic House and Senate boiled over, the GOP won a whopping 63 House seats to secure their largest majority in decades. The party swiped seven Senate seats, including in a special election in deep blue Massachusetts, building a strong enough minority to stymie Obama’s initiatives.

But the wave really began in 2009, when the Republicans won off-year races in Virginia, New Jersey, and other suburban battlegrounds, in impressive fashion. A year before the 2018 elections, the Democrats have returned the favor, sweeping in Virginia, New Jersey, and Republican-leaning counties in the Northeast.

It wasn’t just that Democrats won that has Republicans fretting. It was the stunning breadth of their victories. In Virginia, they swept statewide in a landslide. Significantly, they picked up almost all of the 17 seats they needed to erase the GOP’s hold on the House of Delegates and loosened their grip on the Legislature.

On Long Island, a Democrat was elected town supervisor of Hempstead for the first time in more than 100 years. In Nassau and Westchester counties, typically dominated by Republicans, Democrats were elected county executive for the first time since they lost the seats in the off year GOP blowout of 2009.

In Delaware County, in the Philadelphia suburbs, Democrats won seats on the council for the first time ever, breaking a Republican lock on the body that goes back a century. Altogether, the results remind Democrats of what they experienced in 2006, Bush’s second midterm election, when they won control of Congress for the first time in a dozen years.

“By the end of 2005, we were smelling a wave — we got all kinds of inclinations that a wave was going to occur in 2006, and it did. I’m getting the same feelings now,” said Senate Minority Leader Chuck Schumer of New York, who during that cycle served as chairman of the Democratic Senatorial Campaign Committee.

The Democrats' plan

Democrats see a path back to power in Washington, where they are at a generational low point, and an opportunity to get there, because their victories in November ran right through the suburbs and were built on a voting bloc that has long been a reliable part of the GOP coalition: upscale, white professionals.

Fiscally conservative and interested in safe communities and good schools, this cohort usually votes Republican. Suspicious of Trump, whose provocative behavior and culturally charged politics don’t mix with their moderate pragmatism, the suburbs stuck with Trump in 2016, despite signs they might defect to Democratic nominee Hillary Clinton.

It enabled Republicans to form a winning coalition of traditionally GOP white-collar voters and historically working-class Democrats who joined up because of Trump. One year later, the coalition cracked, as swing counties and Republican bastions peeled off and voted Democrat.

Democrats are still struggling with blue-collar voters. Swaying suburban professionals could be a formula for flipping enough seats to take back the House. The Republicans are defending a 24-seat majority, 23 of which were won by Clinton. Many of those are dominated by suburban communities.

In Virginia, the exit polls compiled by NBC News tell the tale.

Gov.-elect Ralph Northam, the sitting lieutenant governor, beat Republican nominee Ed Gillespie by winning women by 22 percentage points. He lost white women by only 3 points, and won college graduates by 21 points and white college graduates by 3 points.

Northam won voters earning $100,000-$200,000 by 9 points; married voters by 4 points and married women by 10 points. He only lost married men by 2 points. Among Virginians who cited Trump as their motivation for voting, opponents outnumbered supporters by 2-1. Northam won 87 percent of voters who disapproved of the president.

"What were Republicans running on, and were they on the right topics?" said GOP pollster David Winston, who advises congressional Republicans. "One of reasons Republicans did so well in 2010 was, Obama was on the wrong topic and Republicans were on the right topic — jobs."

Northam defeated Republican nominee Ed Gillespie by nearly 10 points. Gillespie, an affable politician from the governing wing of the GOP, ran a bifurcated campaign that sought to keep the party’s 2016 coalition together.

Gillespie, in trying to satisfy traditional GOP voters and independents, focused on his 21 white paper proposals, prioritizing kitchen table issues such as jobs, education, and transportation. To placate working-class Trump voters, Gillespie ran TV advertising dominated by cultural issues, such as his promise to crack down on illegal immigration protect Confederate statues from removal.

Learning from mistakes

Winston and other Republican strategists said Gillespie lost in part because his campaign got sidetracked from economic growth, the key issue that propelled Trump to the presidency. Trump is held responsible as well, in Virginia and across the board, because he has lately put so much energy into stoking cultural insecurities, distracting from the issue of jobs.

The view crystalizing in circles loyal to Trump, and particularly supportive of the nationalist portion of his agenda, was that Republicans on 2017 ballots were doomed by a party establishment that chose not to focus primarily on the GOP base, and declined to go all in with the president.

Corey Stewart, a county supervisor in Northern Virginia who is challenging Sen. Tim Kaine, D-Va., next year and almost won the Republican primary for governor running as Trump’s heir in the commonwealth, said Gillespie blew it in the general election by trying to have it both ways.

Democrats and moderates were turned off by an advertising campaign that presented Gillespie as aligned with Trump. Conservatives and the blue-collar voters lured into the party because of their support for Trump, remained suspicious of him because he didn’t enthusiastically embrace the president.

If Republicans don’t get that message before the campaign gets underway next year, the party should expect more disappointment.

“It was a half-hearted attempt and everybody knew it. He didn’t match the ads with rhetoric on the stump,” Stewart said. “This is what happens when you nominate an establishment Republican who’s got no message, distances himself from the president and makes fun of supporters of the president and fails to inspire base voters in an off-year election.”