  We study decays of $D^0$, $D^+$, and $D_s^+$ mesons into two pseudoscalar
mesons by expressing the decay amplitudes in terms of topological amplitudes.
Including consistently SU(3)$_F$ breaking to linear order, we show how the
topological-amplitude decomposition can be mapped onto the standard expansion
using reduced amplitudes characterized by SU(3) representations. The tree and
annihilation amplitudes can be calculated in factorization up to corrections
which are quadratic in the color-counting parameter $1/N_c$. We find new sum
rules connecting $D^+\rightarrow K_SK^+$, $D_s^+\rightarrow K_S\pi^+$ and
$D^+\rightarrow K^+\pi^0$, which test the quality of the $1/N_c$ expansion.
Subsequently, we determine the topological amplitudes in a global fit to the
data, taking the statistical correlations among the various measurements into
account. We carry out likelihood ratio tests in order to quantify the role of
specific topological contributions. While the SU(3)$_F$ limit is excluded with
a significance of more than five standard deviations, a good fit (with $\Delta
\chi^2 <1$) can be obtained with less than $28\%$ of SU(3)$_F$ breaking in the
decay amplitudes. The magnitude of the penguin amplitude $P_{\mathrm{break}}$,
which probes the Glashow Iliopoulos Maiani (GIM) mechanism, is consistent with
zero; the hypothesis $P_{\mathrm{break}}=0$ is rejected with a significance of
just $0.7\sigma$. We obtain the Standard-Model correlation between
$\mathcal{B}(D^0\rightarrow K_L \pi^0)$ and $\mathcal{B}(D^0\rightarrow
K_S\pi^0)$, which probes doubly Cabibbo-suppressed amplitudes, and find that
$\mathcal{B}(D^0\rightarrow K_L \pi^0)<\mathcal{B}(D^0\rightarrow K_S\pi^0)$
holds with a significance of more than $4\sigma$. We finally predict
$\mathcal{B}(D_s^+\rightarrow K_L K^+)= 0.012^{+0.006}_{-0.002}$ at $3\sigma$
CL.
