  We present a framework for discussing the cosmology of dark energy and dark
matter based on two scalar degrees of freedom. An effective field theory of
cosmological perturbations is employed. A unitary gauge choice renders the dark
energy field into the gravitational sector, for which we adopt a generic
Lagrangian depending on three-dimensional geometrical scalar quantities arising
in the ADM decomposition. We add to this dark-energy associated gravitational
sector a scalar field $\phi$ and its kinetic energy $X$ as dark matter
variables. Compared to the single-field case, we find that there are additional
conditions to obey in order to keep the equations of motion for linear
cosmological perturbations at second order. For such a second-order multi-field
theory we derive conditions under which ghosts and Laplacian instabilities of
the scalar and tensor perturbations are absent. We apply our general results to
models with dark energy emerging in the framework of the Horndeski theory and
dark matter described by a k-essence Lagrangian $P(\phi,X)$. We derive the
effective coupling between such an imperfect-fluid dark matter and the
gravitational sector under the quasi-static approximation on sub-horizon
scales. By considering the purely kinetic Lagrangian $P(X)$ as a particular
case, the formalism is verified to reproduce the gravitational coupling of a
perfect-fluid dark matter.
