Macroscopic equations arising out of stochastic particle systems in detailed balance (called dissipative systems or gradient flows) have a natural variational structure, which can be derived from the large-deviation rate functional for the density of the particle system. While large deviations can be studied in considerable generality, these variational structures are often restricted to systems in detailed balance. Using insights from macroscopic fluctuation theory, in this work we aim to generalise this variational connection beyond dissipative systems by augmenting densities with fluxes, which encode non-dissipative effects. Our main contribution is an abstract theory, which for a given flux-density cost and a quasipotential, provides a decomposition into dissipative and non-dissipative components and a generalised orthogonality relation between them. We then apply this abstract theory to various stochastic particle systems—independent copies of jump processes, zero-range processes, chemical-reaction networks in complex balance and lattice-gas models—without assuming detailed balance. For macroscopic equations arising out of these particle systems, we derive new variational formulations that generalise the classical gradient-flow formulation.