Theory of dirty type-II superconductors