Democrats are in danger of moving from complacency to panic. Neither is particularly helpful.

The complacency part is obvious: Until about 9 p.m. Eastern time on Nov. 8, supporters of Hillary Clinton (myself included) were certain that Donald Trump’s weaknesses among women, nonwhite voters and younger Americans would prevent him from becoming president.

This analysis was half-right: Trump lost the popular vote by more than 2 million. But things went just wrong enough for Clinton in Wisconsin, Michigan and Pennsylvania to give Trump his electoral-college victory. His combined margin in the three states stands at about 100,000. Roughly 134 million votes have been counted nationwide.

[Stick a sterling silver fork in Trump’s ‘populism’]

Is pointing to the limits of Trump’s victory simply a way of evading the depth of the Democrats’ plight? After all, they also failed to take over the U.S. Senate in a year many Republican incumbents looked vulnerable. They picked up a paltry six seats in the House. Add to this the large-scale losses of governorships and state legislatures since the Democrats’ recent high point in 2008 and you have the makings of a party-wide nervous breakdown.

Rep. Nancy Pelosi (D-Calif.) on Nov. 30 was reelected as House minority leader, winning 134 votes against 63 votes for her challenger, Rep. Tim Ryan (D-Ohio). (Bastien Inzaurralde/The Washington Post)

Note, however, that the party in the White House often fares badly in midterm elections, Democrats especially so because they lean on votes from the young, who are less inclined to go to the polls in off-years.

But unless Trump’s first two years are wildly successful, 2018 offers Democrats opportunities to rebuild hollowed-out local parties. This is especially true in statehouses, as The Post’s Greg Sargent pointed out. Ten states with Republican governors could plausibly turn blue (as could New Jersey in 2017).

Clinton’s popular-vote advantage speaks to other opportunities. It reflected a shift toward the Democrats in Sun Belt states with large minority populations that is likely to continue. In Texas, Clinton got some 560,000 more votes than President Obama did in 2012, while Trump ran 4.6 percentage points behind Mitt Romney’s showing. Trump also fell short of Romney’s percentages in California, Arizona and Georgia.

[Bernie Sanders: Carrier just showed corporations how to beat Donald Trump]

The Democrats’ big Sun Belt problem on election night was Florida. Both major-party candidates received more votes there than the 2012 nominees, but Trump’s gains were significantly larger. If Democrats are looking for a state to fret about in their postmortems, Florida should be at the top of the list.

Trump’s narrow wins in Wisconsin, Michigan and Pennsylvania (unless they’re miraculously overturned in recounts), plus his larger victories in Ohio and Iowa, have the Democrats focused on the white working class — and on whether it’s time for “the end of identity liberalism,” the headline of a recent New York Times opinion piece by Mark Lilla, a Columbia University political philosopher.

Lilla’s New York Times essay provoked a polemical tempest. Many advocates for African Americans, gay men and lesbians, immigrants and women fear Lilla’s suggestion would lead liberals to abandon beleaguered constituencies at the very moment when they most need defending.

In fact, Lilla is right that liberalism needs to root its devotion to inclusion in larger principles and should not allow itself to be cast (or parodied) as simply about the summing up of group claims. He is also dead on when he writes: “If you are going to mention groups in America, you had better mention all of them. If you don’t, those left out will notice and feel excluded.” Democrats, who gave us the New Deal and empowered the labor movement, should be alarmed by the flight of the white working class.

[Mitt Romney is a sellout. So what?]

But Lilla’s critics are right about something, too: An effort to reach out to the white working class cannot be seen as a strategy for abandoning people of color, Muslims or immigrants, or for stepping back from commitments to gender equality, or for withdrawing support for long-excluded groups. Liberalism’s very inclusiveness offers Democrats long-term advantages both in the Sun Belt and among younger voters who will own the future.

A panicky abandonment of their core commitments is the last thing Democrats need. Far better advice comes from Agriculture Secretary Tom Vilsack, who urges the party to re-engage with rural and small-town voters. Also promising: the formation of a Blue Collar Caucus in the House announced this week by Reps. Brendan Boyle, an Irish Catholic from Philadelphia, and Marc Veasey, an African American from Fort Worth.

I mention the backgrounds of this pair of Democrats because their cross-racial partnership sends exactly the right message. Progressivism’s embrace of social and economic justice is about lifting up the left-out across all of our dividing lines. Remembering this is the first step toward political recovery.

Read more from E.J. Dionne’s archive, follow him on Twitter or subscribe to his updates on Facebook.