Annual report [Section 13 and 15(d), not S-K Item 405]

Commitment and Contingencies - Litigation (Details)

v3.25.0.1
Commitment and Contingencies - Litigation (Details)
$ in Thousands
3 Months Ended 12 Months Ended
Jul. 22, 2024
USD ($)
Feb. 15, 2024
USD ($)
Dec. 18, 2023
USD ($)
Mar. 20, 2023
USD ($)
Dec. 13, 2022
USD ($)
Dec. 01, 2022
USD ($)
Nov. 14, 2022
USD ($)
lawsuit
Aug. 01, 2022
USD ($)
Aug. 02, 2021
USD ($)
May 13, 2021
USD ($)
Jun. 30, 2024
USD ($)
Dec. 31, 2024
USD ($)
lawsuit
agreement
Dec. 31, 2023
USD ($)
Dec. 31, 2022
USD ($)
Dec. 31, 2021
USD ($)
Oct. 18, 2024
USD ($)
Oct. 16, 2024
USD ($)
Oct. 01, 2024
USD ($)
Jan. 21, 2020
USD ($)
Sep. 10, 2019
individual
defendant
Guarantor Obligations [Line Items]                                        
Pre-tax charge                     $ 170,700                  
Accounts receivable, net                       $ 195,639 $ 11,275 $ (52,527)            
Change in provision for expected credit losses                       $ 171,539 $ 47 $ 3,550            
Legal settlement, amount           $ 9,250   $ 9,250 $ 6,500           $ 25,000          
Litigation settlement, expense                             $ 5,400          
FEMA Official                                        
Guarantor Obligations [Line Items]                                        
Fine issued for indictment         $ 15                              
Minimum                                        
Guarantor Obligations [Line Items]                                        
Litigation settlement, interest-bearing, interest rate                 6.00%                      
Maximum                                        
Guarantor Obligations [Line Items]                                        
Litigation settlement, interest-bearing, interest rate                 12.00%                      
Cobra Acquisitions                                        
Guarantor Obligations [Line Items]                                        
Number of lawsuits pending | lawsuit                       13                
Number of claims judgment issued and under appeal | lawsuit             1                          
Number of other individuals indicted | individual                                       2
Number of other individuals indicted, charges dismissed | defendant                                       2
Cobra Acquisitions | Former President                                        
Guarantor Obligations [Line Items]                                        
Fine issued for indictment         $ 25                              
Puerto Rico Electric Power Authority (PREPA)                                        
Guarantor Obligations [Line Items]                                        
Withheld payments revoked   $ 9,000                                    
Puerto Rico Electric Power Authority (PREPA)                                        
Guarantor Obligations [Line Items]                                        
Amount release on hold                       $ 18,400                
Puerto Rico Electric Power Authority (PREPA) | Cobra Acquisitions                                        
Guarantor Obligations [Line Items]                                        
Number of agreements entered into | agreement                       2                
Amount release on hold                       $ 18,400                
Claim of administrative expense $ 170,000                                      
Claim of administrative expense withheld FEMA funds 18,400                                      
First installment of administrative expense claim pending $ 150,000                                      
Period allowed for first installment 10 days                                      
Second installment of administrative expense claim pending $ 20,000                                      
Period allowed for second installment 7 days                                      
Third installment of administrative expense claim pending $ 18,400                                      
Period allowed for third installment 10 days                                      
Proceeds from PREPA under settlement agreement                               $ 18,400   $ 150,000    
Restricted cash                       19,300       19,300        
Pre-tax charge                     170,700 $ 170,700                
Accounts receivable, net                     359,100                  
Change in provision for expected credit losses                     89,200                  
Accounts receivable, recognized, interest charge                     $ 81,500                  
Loss contingency, damages awarded, value       $ 8,500     $ 9,000                          
Cobra Acquisitions | Puerto Rico Electric Power Authority (PREPA)                                        
Guarantor Obligations [Line Items]                                        
Construction exercise taxes     $ 9,000                                  
Cobra Acquisitions | Puerto Rico Electric Power Authority (PREPA) | Letter of Credit                                        
Guarantor Obligations [Line Items]                                        
Maximum borrowing capacity                               $ 18,400 $ 18,400      
Mastec Renewables Puerto Rico, LLC                                        
Guarantor Obligations [Line Items]                                        
Contracts amount                                     $ 500,000  
Foreman Electric Services, Inc.                                        
Guarantor Obligations [Line Items]                                        
Loss contingency, damages awarded, value                   $ 250,000