Multitask Principal-Agent Problems: Optimal Contracts, Fragility, and Effort Misallocation