/* ==========================================================================
   Admin › Revenue & Subscriptions (RevenueAdmin.razor, tasks/RevenueDashboard.md)
   Page head from subscription.css (.sub-page, .sub-page-head). Charts are plain
   bars: heights come from the page in px, colours from the tokens.
   ========================================================================== */

.rev-page {
    --rev-monthly: var(--en-mouth);
    --rev-yearly: var(--en-pro);
    --rev-new: var(--en-done);
    --rev-lost: var(--en-tongue);
    max-width: 1180px;
}

.rev-lead {
    margin: 6px 0 0;
}

.rev-sample-note {
    padding: 10px 14px;
    border-radius: var(--en-radius-md);
    background: var(--en-pro-soft);
    color: var(--en-pro);
    font-size: 0.85rem;
    font-weight: 600;
}

/* ---------- Empty state ---------- */

.rev-empty {
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 64px 24px;
    border: 1px dashed var(--en-line-strong);
    border-radius: var(--en-radius-lg);
    background: var(--en-surface);
    text-align: center;
}

.rev-empty p {
    max-width: 46ch;
    margin: 0;
}

.rev-empty-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--en-mouth-soft);
    color: var(--en-mouth-ink);
}

/* ---------- Key figures ---------- */

.rev-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.rev-kpi {
    padding: 16px 18px;
    border: 1px solid var(--en-line);
    border-radius: var(--en-radius-lg);
    background: var(--en-surface);
}

.rev-kpi-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--en-ink-muted);
}

.rev-kpi-value {
    margin-top: 8px;
    font: 700 1.9rem/1 var(--en-font-display);
    letter-spacing: -0.03em;
    color: var(--en-ink);
}

.rev-kpi-note {
    margin-top: 8px;
    font-size: 0.82rem;
    color: var(--en-ink-muted);
}

.rev-kpi-note.is-good { font-weight: 600; color: var(--en-done); }
.rev-kpi-note.is-bad { font-weight: 600; color: var(--en-danger); }

/* ---------- Panels ---------- */

.rev-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
}

.rev-panel {
    min-width: 0;
    padding: 22px 24px;
    border: 1px solid var(--en-line);
    border-radius: var(--en-radius-lg);
    background: var(--en-surface);
}

.rev-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.rev-panel-title {
    margin: 0;
    font: 700 1.25rem/1.2 var(--en-font-display);
    letter-spacing: -0.02em;
}

.rev-panel-lead {
    margin: 4px 0 14px;
    font-size: 0.85rem;
    color: var(--en-ink-muted);
}

.rev-legend {
    display: flex;
    gap: 14px;
    font-size: 0.85rem;
    color: var(--en-ink-soft);
}

.rev-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rev-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.rev-footnote {
    margin: 12px 0 0;
    font-size: 0.82rem;
    color: var(--en-ink-muted);
}

.rev-muted {
    font-size: 0.82rem;
    color: var(--en-ink-muted);
}

.rev-scroll {
    overflow-x: auto;
}

/* ---------- Bar charts ---------- */

.rev-bars {
    display: grid;
    gap: 10px;
    align-items: end;
    height: 250px;
    padding-top: 8px;
    border-bottom: 1px solid var(--en-line-strong);
}

.rev-bars-short { height: 160px; }

.rev-bars-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); min-width: 640px; }
.rev-bars-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.rev-bar,
.rev-pair > div {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 6px;
    height: 100%;
}

.rev-bar-stack {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 6px 6px 0 0;
}

.rev-bar > .rev-bar-part,
.rev-pair .rev-bar-part {
    border-radius: 5px 5px 0 0;
}

.rev-bar-value {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--en-ink-soft);
    text-align: center;
    white-space: nowrap;
}

.rev-pair {
    display: flex;
    justify-content: center;
    gap: 4px;
    height: 100%;
}

.rev-pair > div {
    width: 40%;
}

.rev-axis {
    display: grid;
    gap: 10px;
    padding-top: 8px;
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--en-ink-muted);
    text-align: center;
}

.rev-axis b {
    color: var(--en-ink-soft);
}

.is-monthly { background: var(--rev-monthly); }
.is-yearly { background: var(--rev-yearly); }
.is-new { background: var(--rev-new); }
.is-lost { background: var(--rev-lost); }
.is-conversion { background: var(--en-mouth); }
.is-open { background: var(--en-mouth-soft); }

/* ---------- Plan table ---------- */

.rev-table {
    width: 100%;
    min-width: 440px;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.rev-table th,
.rev-table td {
    padding: 10px 6px;
    border-bottom: 1px solid var(--en-line);
    text-align: left;
}

.rev-table thead th {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--en-ink-muted);
}

.rev-table tfoot th,
.rev-table tfoot td {
    border-bottom: 0;
    font-weight: 700;
}

.rev-table .is-num { text-align: right; }
.rev-table .is-strong { font-weight: 700; }
.rev-mix-col { width: 26%; }

.rev-plan {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.rev-dot {
    width: 10px;
    height: 10px;
    flex: none;
    border-radius: 50%;
}

.rev-dot.is-good { background: var(--en-done); }
.rev-dot.is-accent { background: var(--en-mouth); }
.rev-dot.is-bad { background: var(--en-danger); }

.rev-mix {
    display: flex;
    height: 8px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--en-surface-3);
}

/* ---------- Small figures under a chart ---------- */

.rev-minis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.rev-minis-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.rev-minis > div {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border-radius: var(--en-radius-md);
    background: var(--en-surface-2);
}

.rev-minis span {
    font-size: 0.75rem;
    color: var(--en-ink-muted);
}

.rev-minis b {
    font: 700 1.1rem/1 var(--en-font-display);
}

.rev-minis b.is-bad { color: var(--en-danger); }

/* ---------- Countries ---------- */

.rev-countries {
    display: grid;
    gap: 12px;
}

.rev-country-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 0.88rem;
}

.rev-code {
    width: 28px;
    flex: none;
    padding: 1px 0;
    border-radius: 5px;
    background: var(--en-surface-3);
    color: var(--en-ink-soft);
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
}

.rev-country-name { flex: 1; font-weight: 600; }
.rev-country-mrr { min-width: 64px; font-weight: 700; text-align: right; }

.rev-meter {
    height: 6px;
    margin: 6px 0 0 38px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--en-surface-3);
}

.rev-meter > div {
    height: 100%;
    background: var(--en-mouth);
}

/* ---------- Lists (renewals, activity) ---------- */

.rev-list {
    display: flex;
    flex-direction: column;
}

.rev-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--en-line);
}

.rev-row-main {
    flex: 1;
    min-width: 0;
}

.rev-row-title {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rev-row-amount {
    min-width: 64px;
    font-weight: 700;
    text-align: right;
}

.rev-date {
    width: 44px;
    flex: none;
    font-size: 0.75rem;
    line-height: 1.2;
    color: var(--en-ink-muted);
    text-align: center;
}

.rev-date b {
    display: block;
    font: 700 1.05rem/1 var(--en-font-display);
    color: var(--en-ink);
}

.rev-founder {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--en-mouth-soft);
    color: var(--en-mouth-ink);
    font-size: 0.72rem;
    font-weight: 700;
}

.rev-when {
    white-space: nowrap;
}

@media (max-width: 560px) {
    .rev-minis { grid-template-columns: minmax(0, 1fr); }
}
