Magnetotail equilibrium theory: The general three-dimensional solution