We present a detailed derivation of a new hydrodynamic two-fluid model for viscoelastic phase separation of polymer solutions. It is directly based upon the coarse-graining of a well-defined molecular model, such that all degrees of freedom have a clear and unambiguous molecular interpretation. The considerations are based upon a free-energy functional, and the dynamics is split into a conservative and a dissipative part, where the latter satisfies the Onsager relations and the Second Law of thermodynamics. The model is therefore fully consistent with both equilibrium and non-equilibrium thermodynamics. The derivation proceeds in two steps: Firstly, we derive an extended model comprising two scalar and four vector fields, such that inertial dynamics of the macromolecules and of the relative motion of the two fluids is taken into account. In the second step, we eliminate these inertial contributions and, as a replacement, introduce phenomenological dissipative terms, which can be modeled easily by taking into account the principles of non-equilibrium thermodynamics. The final simplified model comprises the momentum conservation equation, which includes both interfacial and elastic stresses, a convection-diffusion equation where interfacial and elastic contributions occur as well, and a suitably convected relaxation equation for the end-to-end vector field. In contrast to the traditional two-scale description that is used to derive rheological equations of motion, we here treat the hydrodynamic and the macromolecular degrees of freedom on the same basis. Nevertheless, the resulting model is fairly similar, though not fully identical, to models that have been discussed previously.