  Context. The radiative losses in the solar chromosphere vary from
4~kW~m$^{-2}$ in the quiet Sun, to 20~kW~m$^{-2}$ in active regions. The
mechanisms that transport non-thermal energy to and deposit it in the
chromosphere are still not understood. Aims. We aim to investigate the
atmospheric structure and heating of the solar chromosphere in an emerging flux
region. Methods. We use observations taken with the CHROMIS and CRISP
instruments on the Swedish 1-m Solar Telescope in the Ca II K, Ca II 854.2 nm,
H$\alpha$, and Fe I 630.1 nm and 630.2 nm lines. We analyse the various line
profiles and in addition perform multi-line, multi-species, non-Local
Thermodynamic Equilibrium (non-LTE) inversions to estimate the spatial and
temporal variation of the chromospheric structure. Results. We investigate
which spectral features of Ca II K contribute to the frequency-integrated Ca II
K brightness, which we use as a tracer of chromospheric radiative losses. The
majority of the radiative losses are not associated with localized high-Ca II
K-brightness events, but instead with a more gentle, spatially extended, and
persistent heating. The frequency-integrated Ca II K brightness correlates
strongly with the total linear polarization in the Ca II 854.2 nm line, while
the Ca II K profile shapes indicate that the bulk of the radiative losses occur
in the lower chromosphere.
  Non-LTE inversions indicate a transition from heating concentrated around
photospheric magnetic elements below $\log{\tau_{500}} =-3$ to a more
space-filling and time-persistent heating above $\log{\tau_{500}} =-4$. The
inferred gas temperature at $\log{\tau_{500}} =-3.8$ correlates strongly with
the total linear polarization in the Ca II 854.2 nm line, suggesting that that
the heating rate correlates with the strength of the horizontal magnetic field
in the low chromosphere.
