Hillary Clinton spent most of the past 18 months running a pretty lousy campaign — a halting, stumbling, elusive, press-avoidant and issue-free coronation that failed so spectacularly to crown her early that she lost 22 states to a fringe candidate with a voice like Larry David’s and a platform like Bulworth’s.

Now, suddenly, her campaign can’t put a foot wrong. Consider this: Over the past week, in 82 head-to-head national and state-level polls, Hillary is up in 65, Donald Trump is up in 15, with two tied.

She hasn’t changed. She’s still the same lame candidate she always was. Her convention speech was a historic dud. She has said nothing memorable since the convention that wasn’t an “oh-no-she-di’n’t” moment, as when she claimed FBI Director James Comey called her “truthful” when he’d said entirely the opposite to a congressional committee.

And yet she leads by eight points or more in states with sufficient Electoral College votes to make her the president — a fact that presents Trump with an unprecedented challenge.

For while it might be the case that occasionally a candidate comes back from an 8-point deficit in a single race, the idea that Trump could pull this off in eight different states in four different regions once potentially considered “battlegrounds” winnable by either party this year would require almost supernatural intervention.

No, what she’s got going for her, the thing that seems to have transformed her campaign and the race, is her rival. Trump’s candidacy has turned the Clinton bid for the presidency into something she only ever thought it could be as a matter of her gender. It has become a mission.

She and her team once believed she could get to the presidency by playing the “woman card,” offering a historic first for women the way Barack Obama offered a historic first for African-Americans. But she never quite figured out how to play that card, and whether, if she played it too eagerly, it would work against her as much as it worked for her.

In any case, it was the Sanders campaign that had a mission, not hers. What was she running for? No one could ever quite say.

Now she can. Now they can. She’s running to prevent Trump from reaching the presidency — from being the person in control of the country’s nukes, from imposing a religious test on entry into the United States, from being the representative of what she sees as divisive and horrifying extremism.

For one thing, his dark summary of America’s present condition at the GOP convention effectively ceded flag-waving optimism to the Democratic Party.

For another, his attack on Gold Star parents Khizr and Ghazala Khan provided her with an inestimable gift — the gift of making her seem reasonable simply by dint of the fact that she didn’t say what he said.

If things don’t change, she can simply ride this fact — the fact that she’s the not-Trump — into the presidency. And that’s a pretty safe and risk-averse way for her to approach the next 80 days.

But then she faces a problem. If she wins the presidency in that fashion, what claim can she make to having any kind of a mandate for action once she’s sworn in on Jan. 20, 2017?

Will the extraordinarily leftist Democratic platform drafted largely to please the 14 million Sanders voters suddenly be palatable to the American people?

Will her promise to push immigration reform in the first 100 days be met with interest and enthusiasm by the new Congress?

Well, possibly, if her victory is so overwhelming she manages to bring Democratic majorities with her to the Senate and House. But if she falls a few votes short in the House, there’s no way on Earth she’ll get her way.

In addition, she’ll be facing two tough realities. First, President Obama is going to be leaving her with a huge ObamaCare mess, in which state exchanges will likely begin collapsing almost from the day she takes office.

Second, the economy may well sink into recession in her first year — and, unlike George W. Bush and Obama before her, she won’t be able to blame the hand she was dealt on the bad policies of her predecessor.

She’ll have a tough row to hoe. By electing her, the nation will be making it clear it doesn’t want what Trump was selling. But she’ll have no rational claim that it wants her bag of goods, either.