Polyelectrolyte-based nanofiltration membranes with exceptional performance in Mg2+/Li+ separation in a wide range of solution conditions