Quantum variational approach to lattice gauge theory at nonzero density