Mr Temer now promises to revive the economy, largely by reversing her policies. His talk of privatisation, deregulation and fiscal discipline has cheered investors. “Our motto is to spend only what we collect,” he said in his first television address as president. His economic team, led by the finance minister, Henrique Meirelles, inspires confidence. The São Paulo stockmarket and the real, Brazil’s currency, have strengthened since Mr Temer took charge. The cost of insuring government bonds against default has fallen by a quarter.
Among ordinary voters, though, the new president has little more support than the outgoing one. His approval rating is below 20%, according to recent polls. His Party of the Brazilian Democratic Movement (PMDB) is as embroiled in the Petrobras scandal as the PT, its ally for more than a decade. Half of Brazilians want a chance to choose a new president in a fresh election. This would heal wounds opened by the flawed impeachment process, says João Castro Neves of Eurasia Group, a consultancy, but it would also delay urgent economic reforms. Mr Temer has no intention of triggering an election by resigning.
Now it’s Michel’s mess
Instead, he will begin the Herculean task of cleaning up Brazil’s chaotic public finances. Ms Rousseff began her presidency with a primary surplus (before interest payments) of 3.1% of GDP and ended it with a deficit of 2.7%. That deterioration raised borrowing costs, which made the fiscal situation still worse. The overall deficit is an alarming 10% of GDP.
If nothing is done, warns Vilma Pinto of FGV-IBRE, a think-tank, public debt will exceed 110% of GDP in 2022, double what it was when Ms Rousseff took office, and will keep on rising. That could lead to a default, or to a return of the hyperinflation that blighted the decade after 1985. That was tamed by Itamar Franco, the last vice-president who was thrust into the top job (by the impeachment on corruption charges of Fernando Collor).
Mr Temer hopes to work similar wonders. He is counting on two measures to achieve that: a 20-year freeze on public spending in real terms and a reform of the pension system, which generously rewards retired workers at the expense of everyone else. Both require amending the constitution. The proposals stalled during the impeachment process. Now, the government promises, both will move ahead.
Many analysts say they are not ambitious enough. The budget presented on August 31st did nothing to dispel those worries. It would reduce the primary deficit only modestly, to 2% of GDP. Under the proposed spending freeze, the government would not run a primary surplus before 2021, says Ms Pinto. Public debt would peak at 90% of GDP in the early 2020s. That would probably avert catastrophe, but it would still crimp Brazil’s capacity to respond to economic shocks, such as a sudden domestic slowdown or a flight by nervous foreign investors.
Faster deficit reduction will be politically painful. Brazilians want more from public services, not less. A survey in July found that a third of Brazilians had dropped their private health insurance over the past year because of economic hardship; they now rely on public clinics. Some 14% of parents say they have withdrawn children from fee-charging schools. Plenty of wasteful spending remains that could be cut without hurting ordinary Brazilians, reckons Alberto Ramos of Goldman Sachs, an investment bank. Non-interest expenditure grew twice as fast as the economy under the PT. “It is hard to believe that all that was wise and efficient,” says Mr Ramos.
Opposition from the PT will be ineffectual. Demoralised by recession and scandal, it is fielding half as many mayoral candidates in October’s local elections as it did four years ago. Its distinctive red star has disappeared from some candidates’ campaign literature. Lula, still its most popular leader, has been charged with obstructing the investigation of the Petrobras affair. He denies wrongdoing. Several other party leaders are serving prison sentences.
As so often in Brazilian politics, the president’s friends may prove more troublesome. The spending freeze and the proposal to raise the retirement age need three-fifths majorities in both houses of congress to pass. Mr Temer’s PMDB wants them watered down, for example by ring-fencing parts of health and education spending (together a third of the federal budget). The odds of other structural reforms, to Brazil’s Mussolini-era labour laws or its Byzantine taxes, are slim. 
Mr Temer will thus have plenty to ponder on his long flight to the G20 meeting on September 4th-5th in China, his first official trip as president. In striving to be the next Itamar Franco he could suffer the fate of José Sarney, a vice-president who was unexpectedly promoted in 1985 after the end of military rule. Mr Sarney proposed a series of half-baked inflation-fighting plans that only made things worse. The resulting turmoil helped usher in a telegenic populist in 1989: Fernando Collor.