Mean-field superconductivity in a strong magnetic field