  We use the astrometric and photometric data from Gaia Data Release 2 and
line-of-sight velocities from various other surveys to study the 3d structure
and kinematics of the Sagittarius dwarf galaxy. The combination of photometric
and astrometric data makes it possible to obtain a very clean separation of Sgr
member stars from the Milky Way foreground; our final catalogue contains ~2.6e5
candidate members with magnitudes G<18, more than half of them being red clump
stars. We construct and analyze maps of the mean proper motion and its
dispersion over the region ~30x12 degrees, which show a number of interesting
features. The intrinsic 3d density distribution (orientation, thickness) is
strongly constrained by kinematics; we find that the remnant is a prolate
structure with the major axis pointing at 45deg from the orbital velocity and
extending up to ~5 kpc, where it transitions into the stream. We perform a
large suite of N-body simulations of a disrupting Sgr galaxy as it orbits the
Milky Way over the past 2.5 Gyr, which are tailored to reproduce the observed
properties of the remnant (not the stream). The richness of available
constraints means that only a narrow range of parameters produce a final state
consistent with observations. The total mass of the remnant is ~4e8 Msun, of
which roughly a quarter resides in stars. The galaxy is significantly out of
equilibrium, and even its central density is below the limit required to
withstand tidal forces. We conclude that the Sgr galaxy will likely be
disrupted over the next Gyr.
