THE longest recession in a century; the biggest bribery scandal in history; the most unpopular leader in living memory. These are not the sort of records Brazil was hoping to set in 2016, the year in which Rio de Janeiro hosts South America’s first-ever Olympic games. When the games were awarded to Brazil in 2009 Luiz Inácio Lula da Silva, then president and in his pomp, pointed proudly to the ease with which a booming Brazil had weathered the global financial crisis. Now Lula’s handpicked successor, Dilma Rousseff, who began her second term in January 2015, presides over an unprecedented roster of calamities.

By the end of 2016 Brazil’s economy may be 8% smaller than it was in the first quarter of 2014, when it last saw growth; GDP per person could be down by a fifth since its peak in 2010, which is not as bad as the situation in Greece, but not far off. Two ratings agencies have demoted Brazilian debt to junk status. Joaquim Levy, who was appointed as finance minister last January with a mandate to cut the deficit, quit in December. Any country where it is hard to tell the difference between the inflation rate—which has edged into double digits—and the president’s approval rating—currently 12%, having dipped into single figures—has serious problems.

Ms Rousseff’s political woes are as crippling as her economic ones. Thirty-two sitting members of Congress, mostly from the coalition led by her left-wing Workers’ Party (PT), are under investigation for accepting billions of dollars in bribes in exchange for padded contracts with the state-controlled oil-and-gas company, Petrobras. On December 15th the police raided several offices of the Party of the Brazilian Democratic Movement (PMDB), a partner in Ms Rousseff’s coalition led by the vice-president, Michel Temer.

Brazil’s electoral tribunal is investigating whether to annul Ms Rousseff’s re-election in 2014 over dodgy campaign donations. In December members of Congress began debating her impeachment. The proceedings were launched by the speaker of the lower house, Eduardo Cunha (who though part of the PMDB considers himself in opposition) on the grounds that Ms Rousseff tampered with public accounts to hide the true size of the budgetary hole. Some see the impeachment as a way to divert attention from Mr Cunha’s own problems; Brazil’s chief prosecutor wants him stripped of his privileged position so that his role in the Petrobras affair can be investigated more freely. Mr Cunha denies any wrongdoing.

Brazil is no stranger to crises. Following the end of two decades of military rule in 1985, the first directly elected president, Fernando Collor, was impeached in 1992. After a “lost decade” of stagnation and hyperinflation ended in the mid-1990s the economy was knocked sideways by the emerging-markets turmoil of 1997-98. In the mid-2000s politics was beset by the scandal of a bribes-for-votes scheme known as the mensalão (“big monthly”, for the size and schedule of the payments), which eventually saw Lula’s chief of staff jailed in 2013.

Yet rarely, if ever, have shocks both external and domestic, political and economic, conspired as they do today. During the original lost decade global conditions were relatively benign; in the crisis of the late 1990s the tough measures to quell inflation and revive growth taken after Mr Collor’s departure stood Brazil in moderately good stead; when scandal rocked the 2000s commodity markets were booming.

A sad convergence

Now prices of Brazilian commodities such as oil, iron ore and soya have slumped: a Brazilian commodities index compiled by Credit Suisse, a bank, has fallen by 41% since its peak in 2011. The commodities bust has hit economies around the world, but Brazil has fared particularly badly, with its structural weaknesses—poor productivity and unaffordable, misdirected public spending—exacerbating the damage. Regardless of what she may or may not have done with respect to the impeachment charge, Ms Rousseff’s cardinal sin is her failure to have confronted these problems in her previous term, when she had some political room for manoeuvre. Instead, that term was marked by loose fiscal and monetary policies, incessant microeconomic meddling and fickle policymaking that bloated the budget, stoked inflation and sapped confidence.

Poor though her record has been, some of these problems have deeper roots in what is in some ways a great achievement: the federal constitution of 1988, which enshrined the transition from military to democratic rule. This 70,000-word doorstop of a document crams in as many social, political and economic rights as its drafters could dream up, some of them highly specific: a 44-hour working week; a retirement age of 65 for men and 60 for women. The “purchasing power” of benefits “shall be preserved”, it proclaims, creating a powerful ratchet on public spending.

Since the constitution’s enactment, federal outlays have nearly doubled to 18% of GDP; total public spending is over 40%. Some 90% of the federal budget is ring-fenced either by the constitution or by legislation. Constitutionally protected pensions alone now swallow 11.6% of GDP, a higher proportion than in Japan, whose citizens are a great deal older. By 2014 the government was running a primary deficit (ie, before interest payments) of 32.5 billion reais ($13.9 billion) (see chart). Mr Levy tried to live up to the nickname he had earned during an earlier stint as a treasury official—“Scissorhands”—with record-breaking cuts of 70 billion reais from discretionary spending. But Mansueto Almeida, a public-finance expert, points out that this work was more than countered by constitutionally mandated spending increases; government expenditure as a share of output rose in 2015. On top of that, a new scrupulousness in government accounting surely not unrelated to the impeachment proceedings has seen 57 billion reais in unpaid bills from years past newly recognised by the treasury. Nor could Mr Levy easily fill the fiscal hole by raising taxes. Taxes already consume 36% of GDP, up from a quarter in 1991. And the recession has hit tax receipts hard. On December 18th, days after Fitch, a rating agency, followed the lead of Standard & Poor’s in downgrading Brazilian debt, Mr Levy threw in the towel. His job went to Nelson Barbosa, previously the planning minister, who insists he is committed to following the same policies. But before his elevation Mr Barbosa made no secret of favouring a more gradual fiscal adjustment—for example, a primary surplus of 0.5% of GDP in 2016, against Mr Levy’s preferred 0.7% (and an original promise of 2% a year ago). The real and the São Paulo stockmarket tumbled on news of his appointment. Analysts at Barclays, a bank, expect debt to reach 93% of GDP by 2019; among big emerging markets only Ukraine and Hungary are more indebted. The figure may still seem on the safe side compared with 197% in Greece or 246% in Japan. But those are rich countries; Brazil is not. As a proportion of its wealth Brazil’s public debt is higher than that of Japan and nearly twice that of Greece.

Unable to increase taxes, Ms Rousseff’s government may prefer something even more troubling to investors and consumers alike: inflation. Faced with the inflationary pressure that has come with the devalued real, the Central Bank has held its nerve, increasing its benchmark rate by three percentage points since October 2014 and keeping it at 14.25% since July in the face of the recession. But despite this juicy rate the real continues to depreciate.

There is a worry that the bank may be unable to raise rates further for fear of making public debt unmanageable—what is known as “fiscal dominance”. This year the treasury spent around 7% of GDP servicing public debt. What is more, raising rates may have the perverse effect of stoking inflation rather than quenching it; an increasing risk of default as borrowing costs grow is likely to see investors dumping government bonds, provoking further currency depreciation.

A handful of economists, including Monica de Bolle of the Peterson Institute for International Economics, believe that Brazil is on the verge of fiscal dominance. And once interest rates no longer have a hold on inflation, she says, it can quickly spiral out of control. Forecasts by Credit Suisse warn that prices could be rising by 17% in 2017. Three-quarters of government spending remains linked to the price level, embedding past inflation in future prices. That said, the economy as a whole is much less indexed than it was in the hyperinflationary early 1990s. That leaves the government a bit more time, thinks Marcos Lisboa of Insper, a university in São Paulo. But not much more: perhaps a year or two.

Despite this pressing economic need for speed there seems to be no political capacity for it. Members of Congress are consumed by Ms Rousseff’s impeachment. By February they must decide whether to send her case to the Senate, which would require the votes of three-fifths of the 513 deputies in the lower house. To fend off such a decision Ms Rousseff is rallying her left-wing, anti-austerity base.

Gently doesn’t always do it

These efforts are meeting with some success: in December pro-government rallies drew more people than anti-government ones for the first time all year. It looks unlikely that the impeachment will indeed move to the Senate (which would trigger a further six months of turmoil). But this hardly provides a political climate conducive to belt-tightening, let alone to the amendment of the constitution which Mr Barbosa has said is needed to deal with the ratchet effect on benefits. Fiscal adjustment is anathema to the government workers and union members who are Ms Rousseff’s core supporters.

Like the country’s economic problems, its political ones, while specific to today’s particular scandals and manoeuvring, can be traced to the transition of the 1980s. History reveals a consistent tendency towards negotiated consensus at Brazil’s political watersheds; it can be seen in the war- and regicide-free independence declared in 1822, the military coup of 1964, which was mild compared with the blood-soaked affairs in Chile and Argentina, and the transition that created the new constitution. One aspect of this often admirable trait is a resistance to purging. The mid-1980s saw a lot of institutions—the federal police, the public prosecutor’s office, the judiciary, assorted regulators—overhauled or created afresh. But many of the old regime kept their jobs in the civil service and elsewhere. The transition was thus bound to be a generational affair.

So it is now proving, with a retiring old guard being replaced by fresh blood often educated abroad. In 2013 the average judge was 45 years old, meaning he entered university in a democratic Brazil. Civil servants are getting younger and better qualified, says Gleisson Rubin, who heads the National School of Public Administration. More than a quarter now boast a postgraduate degree, up from a tenth in 2002. Sérgio Moro, the crusading 43-year-old federal judge who oversees the Petrobras investigations, and Deltan Dallagnol, the case’s 35-year-old lead prosecutor, are the most famous faces of this new generation.

Unfortunately, this rejuvenation does not extend to the institution most in need of it: Congress. Its younger faces typically have family ties to the old guard. “Party politics is a market for lemons,” says Fernando Haddad, the fresh-faced PT mayor of São Paulo and a rare exception to the dynastic rule, nodding to George Akerlof’s classic analysis of adverse selection in the market for used cars: it attracts the venal and repels the honest. Consultants who have advised consecutive Congresses agree that each one is feebler than the last.

Brazilians have noticed the decline, and are transferring their hopes accordingly. “Judges and prosecutors are becoming more legitimate representatives of the Brazilian people than politicians,” says Norman Gall of the Braudel Institute, a think-tank in São Paulo. Everyone wants a selfie with Mr Moro and, disturbingly, nearly half of Brazilians think that military intervention is justified to combat corruption, according to a recent poll. Barely one in five trusts legislators; just 29% identify with a political party.

Monthly, oily, deeply

That last fact is perhaps particularly impressive given that they have so many parties to choose from. Keen to promote pluralism the constitution’s framers set no national cut-off below which a party’s votes would not count. It is possible to get into Congress with less than 1% of the vote: in principle, it could be done with 0.02%. As a result the number of parties has grown from a dozen in 1990 to 28 today. The three biggest—the PT, the PMDB and the opposition centre-right Party of Brazilian Social Democracy (PSDB)—together account for just 182 of 513 seats in the lower house and 42 out of 81 senators.

One of the causes of the mensalão scandal was corruption that provided Lula’s government with a way to get the votes it needed from the disparate small parties. The petrolão (“big oily”, as the Petrobras affair is widely known) apparently shared a similar aim. Such ruses may have helped PT governments pass some good laws, such as an extension of the successful Bolsa Família (family fund) cash-transfer programme. But the party was not able to do all that it had said it would; potentially helpful reforms in which it was less invested fell by the wayside. Raphael Di Cunto of Pinheiro Neto, a big law firm in São Paulo, points to many antiquated statutes in need of an update, such as the Mussolini-inspired labour code (from 1943) and laws governing foreign investments (1962) and capital markets (1974).

A Congress in which dysfunction feeds corruption which feeds further dysfunction is not one likely to take the hard decisions that the economy needs. But this is the Congress Brazil has: though there will be local elections in October 2016, congressional elections, like the next presidential poll, are not due until 2018. Can Brazil’s public finances hold out that long? Many prominent economists think they just about can. They forecast a “muddling-through” in which Ms Rousseff holds on to her job, Congress passes a few modest spending cuts and tax rises, including a financial-transactions levy, the Central Bank continues to fight inflation, the cheap real boosts exports and investors don’t panic. After three years of this, the theory goes, an electorate fed up with stagnation and sleaze will give the PSDB a clear mandate for change. Ms Rousseff narrowly defeated the party’s candidate in 2014 by deriding his calls for prudence as heartless “neoliberalism”, only to propose a similar agenda (through gritted teeth) immediately after winning. If proposed by a PSDB in power that actually believed in them, such measures might receive cross-party support—though given the PSDB’s spiteful unwillingness to support Mr Levy’s measures in 2015 this would not be without irony. Such a scenario is possible. Figures for the third quarter of 2015 show exports picking up. Price rises could slow down as steep increases in government-controlled prices for petrol and electricity put in place in 2015 run their course. Politicians and policymakers are keenly aware that Brazilians are less tolerant of inflation than in the 1980s and 1990s, when rates of 10% would have seemed mild. Investors are staying put, at least in aggregate. Yield-hungry asset managers are taking the place of pension and mutual funds that left in anticipation of Brazil’s inevitable demotion to junk status. The real has fallen 31% since the start of 2015 and the stockmarket is down by 12.4%; but though battered they are not knocked flat. The banking system is well capitalised and, observers agree, diligently monitored by the Central Bank. The $250 billion in foreign-denominated debt racked up by Brazilian companies during the commodity-price-fuelled binge has ballooned in local-currency terms and remains a worry. But much of it is hedged through the firms’ own dollar revenues or with swaps—though settling some of those swaps has cost the government, which sold them, some 2% of GDP this year.

Waxing and waning: Brazil's economic woes, in charts The sardonic Mr Lisboa observes with uncharacteristic optimism that “at last people are talking seriously about Brazil’s structural problems”. Fiscal dominance has left arcane discussions among economic theorists and burst onto newspaper columns. Mr Barbosa is openly discussing pension reform and the constitutional change that would have to go with it. In October the PMDB, which tends to lag behind public opinion more than to lead it, published a manifesto that talked about privatising state businesses and raising the retirement age. Even the famously stubborn Ms Rousseff has begun to listen rather than to hector, says a foreign economic dignitary who met her recently. But the fact that muddling through may be possible does not mean it is assured. It hinges on the hope that politicians come to their senses more quickly than they have done in the past (witness the lost decade begun in the 1980s). It also assumes that Brazil’s penchant for consensus will hold its people back from social unrest on the sort of scale that topples regimes in other countries. The anti-government protests of 2015 were large, drawing up to a million people in a single day. But they were middle-class affairs which took place on sporadic Sundays, causing Ms Rousseff more annoyance than grief. As wages sag and unemployment rises, though, tempers could flare. If they do there will be every chance of a facile populist response that does even deeper economic damage. Should Ms Rousseff be booted out—through impeachment, annulment of the election or coerced resignation (none of which looks likely just now)—chaos would surely ensue. Her core supporters may be less numerous than they once were, but she has many more than Mr Collor had in 1992. They would close ranks against the “coup-mongers”. The strength of Brazil’s institutions suggests something shy of the failed populist experiments of some South American neighbours. And the fact that voters in Argentina and Venezuela rebuffed that populism in the past few months has not escaped the notice of Brazil’s politicians. But every month of dithering and every new petrolão revelation chips away at Brazil’s prospects. The 2010s are already certain to be another lost decade; GDP per person won’t rebound for years to come.

It will be a long time before a president can match the pride with which Lula showed off his Olympic trophy. But if Brazil’s politicians get their act together, the 2020s could be cheerier. Alas, if they do not, things will get a great deal worse.