Add sugar to a saucepan and cook over medium heat until melted and golden brown.
Pour the caramel into a baking dish or individual ramekins and spread evenly.
Whisk eggs, milk, condensed milk, cocoa powder, vanilla extract, and salt until smooth.
Strain the mixture to ensure a silky and lump-free custard.
Pour the chocolate custard gently over the caramel.
Place the dish in a water bath and bake until the flan is set but slightly jiggly in the center.
Cool completely, refrigerate for several hours, then invert onto a serving plate and serve chilled.