I have some trouble understanding what is going on in some steps of the Clausius-Clapeyron equation derivation. When we have a substance in two phases the Gibbs energy will be a function $G=G(T,P,n_1,n_2)$. At equilibrium (constant $T$ and $P$):
\begin{align} dG&=-SdT + VdP + μ_1dn_1 + μ_2dn_2=0\\ μ_1dn_1&= -μ_2dn_2 \end{align}
and because $dn_1=-dn_2$ the chemical potentials must be equal:
$$μ_1(T,P)=μ_2(Τ,P)$$
so must be their differentials and the derivation goes like this (taking temperature as independent variable):
$${\left(\frac{\partial{μ_1}}{\partial{T}}\right)_P}dP + {\left(\frac{\partial{μ_1}}{\partial{P}}\right)_T}dT = {\left(\frac{\partial{μ_2}}{\partial{T}}\right)_P}dP + {\left(\frac{\partial{μ_2}}{\partial{P}}\right)_T}dT $$
Because we move on the coexisting curve (taking temperature as independent variable):
$$-S_1+V_1\frac{dP}{dT}=-S_2 + V_2\frac{dP}{dT}$$
With a little manipulation one gets:
$$\frac{dP}{dT}=\frac{S_2-S_1}{V_2-V_1}$$
where both $S$ and $V$ denote molar quantities.
My first question is why we are able to substitute ${\left(\frac{\partial{μ_1}}{\partial{T}}\right)_P}$ with $S_1$. When I tried to derive it I thought the following:
$$dG=-VdP + SdT + μ_1dn_1 + μ_2dn_2 \tag{1}$$
and because Gibbs is homogeneous with respect to the extensive variables:
$$dG=μ_1dn_1 + μ_2dn_2 + n_1dμ_1 + n_2dμ_2 \tag{2}$$
we can write:
$$n_1dμ_1 + n_2dμ_2=-VdP + SdT \Rightarrow \left(\frac{\partial{μ_1}}{\partial{T}}\right)=-\frac{S}{n_1}$$
Why $S/n_1$ must be equal to $S_1$ (molar). Doesn't the entropy of the system depend both on $n_1$ and $n_2$ whereas the molar entropy for a given species is only a function of $n_1$? Can we do this because the species are in different phases so we can treat them seperately that is by defining $G^1=G(T,P,n_1)$ and $G^2=G(T,P,n_2)$ (where the superscripts denote the corresponding phases)?
My next trouble is why we are able to substitute $ΔS=S_2-S_1$ with $\frac{1}{T}ΔH$
In some derivations it is justified because the process is reversible so we can use the classical definition of entropy $dS=\frac{dq}{T}$ and because the process happens at constant pressure $q=ΔH$. But $S$ in the classical definition should correspond to the total entropy of the system that is $S=S_1+S_2$, same gos for enthalpy. How does it make sense to say that $ΔS_{system}=S_2-S_1$? Change in system's entropy means:
$$ΔS=Δ(S_1+S_2)=S^{f}_1 + S^{f}_2 - S^{i}_1 - S^{i}_2$$
So to sum it up my questions aer why it is valid to say $S/n_1=S_1$ and why we are able to substitute $S_2-S_1$ with $q/T$.