The negative Pell equation and Stevenhagen's conjecture