Variational Multistate Density Functional Theory for a Balanced Treatment of Static and Dynamic Correlation.