Flexible urban energy in a low-carbon electric world