WD 1145+017 is currently the only white dwarf known to exhibit periodic transits of planetary debris as well as absorption lines from circumstellar gas. We present the first simultaneous fast optical spectrophotometry and broad-band photometry of the system, obtained with the Gran Telescopio Canarias (GTC) and the Liverpool Telescope (LT), respectively. The observations spanned $5.5$ h, somewhat longer than the $4.5$-h orbital period of the debris. Dividing the GTC spectrophotometry into five wavelength bands reveals no significant colour differences, confirming grey transits in the optical. We argue that absorption by an optically thick structure is a plausible alternative explanation for the achromatic nature of the transits that can allow the presence of small-sized ($simmu$m) particles. The longest ($87$ min) and deepest ($50$ per cent attenuation) transit recorded in our data exhibits a complex structure around minimum light that can be well modelled by multiple overlapping dust clouds. The strongest circumstellar absorption line, Fe II $lambda$5169, significantly weakens during this transit, with its equivalent width reducing from a mean out-of-transit value of $2$ AA to $1$ AA in-transit, supporting spatial correlation between the circumstellar gas and dust. Finally, we made use of the Gaia Data Release 2 and archival photometry to determine the white dwarf parameters. Adopting a helium-dominated atmosphere containing traces of hydrogen and metals, and a reddening $E(B-V)=0.01$ we find $T_mathrm{eff}=15,020 pm 520$ K, $log g=8.07pm0.07$, corresponding to $M_mathrm{WD}=0.63pm0.05 mbox{$mathrm{M}_{odot}$}$ and a cooling age of $224pm30$ Myr.