Flexible all-carbon photovoltaics with improved thermal stability