Resurgent Juventus climbed into Serie A's top four as Mario Mandzukic and Paulo Dybala both struck late to secure a 3-1 win over second-placed Fiorentina.