Thermodynamics of phase equilibria