  We study the properties of $D$ and $D^*$ mesons in nuclear matter within a
simultaneous self-consistent coupled-channel unitary approach that implements
heavy-quark symmetry. The in-medium solution accounts for Pauli blocking
effects, and for the $D$ and $D^*$ self-energies in a self-consistent manner.
We pay a special attention to the renormalization of the intermediate
propagators in the medium beyond the usual cutoff scheme. We analyze the
behavior in the nuclear medium of the rich spectrum of dynamically-generated
baryonic resonances in the C=1 and S=0 sector, and their influence in the
self-energy and, hence, the spectral function of the $D$ and $D^*$ mesons. The
$D$ meson quasiparticle peak mixes with $\Sigma_c(2823)N^{-1}$ and
$\Sigma_c(2868)N^{-1}$ states while the $\Lambda_c(2595)N^{-1}$ mode is present
in the low-energy tail of the spectral function. The $D^*$ spectral function
incorporates $J=3/2$ resonances, and $\Sigma_c(2902)N^{-1}$ and
$\Lambda_c(2941)N^{-1}$ fully determine the behavior of $D^*$ meson spectral
function at the quasiparticle peak. As density increases, these resonant-hole
modes tend to smear out and the spectral functions get broad. We also obtain
the $D$ and $D^*$ scattering lengths, and optical potentials for different
density regimes. The $D$ meson potential stays attractive while the $D^*$ meson
one is repulsive with increasing densities up to twice that of the normal
nuclear matter. Compared to previous in-medium SU(4) models, we obtain similar
values for the real part of the $D$ meson potential but much smaller imaginary
parts. This result can have important implications for the observation of
$D^0$-nucleus bound states.
