/* Newsletter numbers (docs/EMAIL_NUMBERS.md): the campaign list, one send's report and
   the mailing list's health. Builds on the blog numbers kit (blog-numbers.css: .bn,
   cards, tiles, glance, segmented links, bars) and the app.css tokens; what's here is
   only what email adds: send-by-send charts, the opens timeline, the vs-average chips
   and the engagement colors. */

.bn {
    --en-auto: #C9DEF3;
    --en-cool: #A9C9EE;
    --en-cold: var(--cc-marigold, #EFA537);
    --en-never: var(--cc-text-faint, #7B8494);
}

/* Vs-your-average chips, and the comparison verdicts. */
.en-chip {
    display: inline-block; margin: 0 4px 4px 0; padding: 0.1rem 0.5rem; border-radius: 999px;
    font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.en-chip.is-good { background: #E3F1E8; color: #2F6B4B; }
.en-chip.is-watch { background: var(--cc-attention-soft, #FDF4E3); color: var(--cc-attention-text, #7A4E05); }
.en-chip.is-neutral { background: var(--cc-surface-2); color: var(--cc-text-muted); }

/* Send-by-send bars with the dashed average across them. */
.en-sends {
    position: relative; display: flex; align-items: flex-end; gap: 10px;
    height: 132px; padding-top: 12px; border-bottom: 1px solid var(--cc-border);
}
.en-sends .en-col {
    flex: 1 1 0; min-width: 0; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
}
.en-sends .en-bar { width: 100%; max-width: 34px; border-radius: 3px 3px 0 0; background: var(--bn-past); }
.en-sends .en-bar.is-now { background: var(--cc-accent); }
.en-sends .en-bar.is-approx {
    background: repeating-linear-gradient(135deg, var(--bn-past) 0 4px, var(--cc-surface) 4px 7px);
    border: 1px solid var(--bn-past); border-bottom: 0;
}
.en-sends .en-val { font-size: 0.72rem; color: var(--cc-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.en-avg { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--cc-text-faint, #7B8494); pointer-events: none; }
.en-avg span {
    position: absolute; right: 0; top: -18px; padding: 0 4px;
    font-size: 0.72rem; color: var(--cc-text-muted); background: var(--cc-surface);
}
.en-xlab { display: flex; gap: 10px; margin-top: 6px; }
.en-xlab span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 0.72rem; color: var(--cc-text-muted); }

/* Coming up */
.en-coming { display: flex; flex-direction: column; }
.en-coming a {
    display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--cc-surface-2); color: var(--cc-text); font-size: 0.9rem;
}
.en-coming a:last-child { border-bottom: 0; }
.en-coming a:hover { text-decoration: none; background: var(--cc-bg); }
.en-coming .en-sub { color: var(--cc-text-muted); }
.en-coming .en-when { font-size: 0.8rem; color: var(--cc-text-muted); text-align: right; }
.en-pill {
    display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px;
    font-size: 0.72rem; font-weight: 600; white-space: nowrap; justify-self: start;
}
.en-pill.is-scheduled { background: var(--cc-accent-soft, #E7F2FC); color: var(--cc-accent-hover, #165A9F); }
.en-pill.is-sending { background: #FBF0D9; color: var(--cc-attention-text, #7A4E05); }
.en-pill.is-draft { background: var(--cc-surface-2); color: var(--cc-text-muted); }
.en-pill.is-sent { background: #E3F1E8; color: #0A6B2D; }
.en-pill.is-cancelled, .en-pill.is-failed { background: var(--cc-surface-2); color: var(--cc-text-muted); }

/* The sent table */
.en-table .en-nl { min-width: 240px; }
.en-table .en-to { min-width: 110px; }
.en-table .en-vs { min-width: 150px; }
.en-table .en-nl a { font-weight: 600; color: var(--cc-text); }
.en-table .en-nl small { display: block; color: var(--cc-text-muted); font-size: 0.8rem; }
.en-table td.num small { display: block; color: var(--cc-text-muted); font-size: 0.75rem; }
.en-table td { vertical-align: top; }

/* Opens over the first three days: real opens stacked on Apple's automatic ones,
   clicks in marigold underneath. */
.en-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; font-size: 0.78rem; color: var(--cc-text-muted); }
.en-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; vertical-align: -1px; }
.en-k-real { background: var(--cc-accent); }
.en-k-auto { background: var(--en-auto); }
.en-k-click { background: var(--en-cold); }
.en-stack { display: flex; align-items: flex-end; gap: 4px; height: 130px; border-bottom: 1px solid var(--cc-border); }
.en-stack .en-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column-reverse; }
.en-stack .en-real { background: var(--cc-accent); }
.en-stack .en-auto { background: var(--en-auto); }
.en-stack .en-real:last-child, .en-stack .en-auto:last-child { border-radius: 2px 2px 0 0; }
.en-clicks { display: flex; align-items: flex-end; gap: 4px; height: 34px; margin-top: 6px; }
.en-clicks span { flex: 1 1 0; min-width: 0; background: var(--en-cold); border-radius: 2px 2px 0 0; }
.en-axis { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 0.72rem; color: var(--cc-text-muted); }

/* People lists: who followed, who left. */
.en-people { list-style: none; margin: 0; padding: 0; }
.en-people li {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    padding: 8px 0; border-bottom: 1px solid var(--cc-surface-2); font-size: 0.88rem;
}
.en-people li:last-child { border-bottom: 0; }
.en-people small { display: block; color: var(--cc-text-muted); font-size: 0.78rem; }
.en-people .en-n { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.en-cmp { width: 100%; border-collapse: collapse; }
.en-cmp th, .en-cmp td { padding: 7px 8px; border-bottom: 1px solid var(--cc-surface-2); font-size: 0.88rem; text-align: left; }
.en-cmp th {
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--cc-text-muted); border-bottom-color: var(--cc-border);
}
.en-cmp th:first-child, .en-cmp td:first-child { padding-left: 0; }
.en-cmp .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Mailing list health: one bar split by engagement, the five counts, six months. */
.en-split { display: flex; height: 14px; overflow: hidden; border-radius: 7px; border: 1px solid var(--cc-border); }
.en-split span { display: block; height: 100%; }
.en-s-engaged { background: var(--cc-accent); }
.en-s-cooling { background: var(--en-cool); }
.en-s-cold { background: var(--en-cold); }
.en-s-never { background: var(--en-never); }
.en-s-apple { background: var(--en-auto); }
.en-s-new { background: var(--cc-surface); }
.en-keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; margin-top: 14px; }
.en-key { display: flex; gap: 10px; align-items: flex-start; color: var(--cc-text); }
a.en-key:hover { text-decoration: none; }
a.en-key:hover .en-lab { text-decoration: underline; }
.en-key i { flex: 0 0 12px; height: 12px; margin-top: 5px; border-radius: 3px; border: 1px solid var(--cc-border-strong); }
.en-key b { display: block; font-size: 1.25rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.en-lab { font-size: 0.85rem; font-weight: 600; }
.en-def { display: block; font-size: 0.76rem; color: var(--cc-text-muted); }
.en-months { display: flex; align-items: flex-end; gap: 12px; height: 140px; border-bottom: 1px solid var(--cc-border); }
.en-months .en-col {
    flex: 1 1 0; min-width: 0; max-width: 56px; height: 100%; margin: 0 auto;
    display: flex; flex-direction: column-reverse;
}
.en-months .en-col span:last-child { border-radius: 3px 3px 0 0; }
.en-months .en-s-new { border: 1px dashed var(--cc-border-strong); border-bottom: 0; }
.en-mlab { display: flex; gap: 12px; margin-top: 6px; }
.en-mlab span { flex: 1 1 0; max-width: 56px; margin: 0 auto; text-align: center; font-size: 0.72rem; color: var(--cc-text-muted); }
.en-winback { background: var(--cc-attention-soft, #FDF4E3); border-color: var(--cc-attention-border, #F5DDB0); }
.en-winback p { margin: 6px 0 12px; font-size: 0.9rem; max-width: 70ch; }
.en-winback ol { margin: 0 0 12px; padding-left: 18px; font-size: 0.86rem; }
.en-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.en-eng { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.en-eng.is-engaged { background: var(--cc-accent-soft, #E7F2FC); color: var(--cc-accent-hover, #165A9F); }
.en-eng.is-cooling { background: var(--cc-surface-2); color: var(--cc-text); }
.en-eng.is-cold { background: var(--cc-attention-soft, #FDF4E3); color: var(--cc-attention-text, #7A4E05); }
.en-eng.is-never, .en-eng.is-new { background: var(--cc-surface-2); color: var(--cc-text-muted); }
.en-eng.is-apple { background: #EDF4FB; color: var(--cc-text-muted); }

.en-steps { list-style: none; margin: 0; padding: 0; }
.en-steps li {
    display: grid; grid-template-columns: 32px minmax(0, 1.7fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.9fr);
    gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--cc-surface-2);
}
.en-steps li:last-child { border-bottom: 0; }
.en-num {
    display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
    background: var(--cc-accent-soft, #E7F2FC); color: var(--cc-accent-hover, #165A9F); font-size: 0.85rem; font-weight: 700;
}
.en-num.is-removed { background: var(--cc-surface-2); color: var(--cc-text-muted); }
.en-step-title { font-weight: 600; font-size: 0.92rem; }
.en-step-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 2px; font-size: 0.78rem; color: var(--cc-text-muted); }
.en-meter-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 0.78rem; color: var(--cc-text-muted); }
.en-meter-top b { color: var(--cc-text); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.en-meter small { display: block; margin-top: 3px; font-size: 0.72rem; color: var(--cc-text-muted); }
.en-out { font-size: 0.82rem; }
.en-out small { display: block; color: var(--cc-text-muted); font-size: 0.75rem; }

@media (max-width: 640px) {
    .en-coming a { grid-template-columns: minmax(0, 1fr) auto; }
    .en-coming a .en-pill { grid-column: 1 / -1; }
    .en-sends, .en-xlab { gap: 5px; }
    .en-sends .en-val { font-size: 0.66rem; }
    .en-steps li { grid-template-columns: 28px minmax(0, 1fr); gap: 8px 12px; }
    .en-steps li > .en-meter, .en-steps li > .en-out { grid-column: 2; }
}
