Economic and environmental impacts of demographic changes in a life-cycle model