/* Revenue page — per-page styles */

/* Membership sub-rows: indented, lighter weight */
.data-table tbody tr.rev-subrow td {
    background: rgba(0, 0, 0, 0.015);
    color: var(--text-secondary, #666);
}
.data-table tbody tr.rev-subrow .rev-sub-label {
    padding-left: 1.75rem;
    position: relative;
}
.data-table tbody tr.rev-subrow .rev-sub-label::before {
    content: '↳';
    position: absolute;
    left: 0.75rem;
    color: var(--sage-dark);
}

/* Footnotes under tables */
.rev-note {
    margin: 0.5rem 0.25rem 0;
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
}
.rev-note code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    color: var(--forest);
}

/* Badges */
.rev-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
}
.rev-badge-placeholder {
    background: rgba(200, 133, 106, 0.15);
    color: var(--desert-dark);
    border: 1px solid var(--desert);
}
.rev-badge-standby {
    background: rgba(107, 125, 138, 0.15);
    color: var(--stone-dark);
    border: 1px solid var(--stone);
}

/* Standby (pending data source) cards */
.rev-standby {
    border: 1px dashed var(--stone-light, #8fa0ad);
    background: rgba(107, 125, 138, 0.04);
}
.rev-standby-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.5rem 0 0.25rem;
}

/* ── Data freshness + manual refresh (added 2026-07-29) ──────────────────────
   The nightly Kajabi import used to land at 7pm Pacific, so the report silently
   excluded the previous evening's sales. These surface how current the data
   actually is and let anyone re-pull it. */

.rev-freshness {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-secondary, #777);
    white-space: nowrap;
    cursor: help;
}
.rev-freshness i { font-size: 0.85rem; opacity: 0.75; }
.rev-freshness.is-stale { color: #b8860b; font-weight: 600; }
.rev-freshness.is-stale i { opacity: 1; }
.rev-freshness.is-unknown { font-style: italic; opacity: 0.7; }

.rev-refresh-btn {
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--forest);
    border: 1px solid var(--sage);
    background: transparent;
    white-space: nowrap;
}
.rev-refresh-btn:hover:not(:disabled) {
    background: var(--sage);
    color: #fff;
}
.rev-refresh-btn:disabled {
    opacity: 0.65;
    cursor: progress;
}

/* Spinner on the refresh icon while an import is in flight. */
@keyframes rev-spin-kf { to { transform: rotate(360deg); } }
.rev-spin {
    display: inline-block;
    animation: rev-spin-kf 0.9s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
    .rev-spin { animation-duration: 2.5s; }
}

/* Inline status note beside the button (no global toast system exists). */
.rev-flash {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}
.rev-flash.is-ok    { color: #1b5e20; background: rgba(27, 94, 32, 0.08); }
.rev-flash.is-warn  { color: #8a6100; background: rgba(184, 134, 11, 0.12); }
.rev-flash.is-error { color: #a02020; background: rgba(160, 32, 32, 0.10); }

/* The header row carries more controls now — let it wrap on narrow screens
   instead of squeezing the title. */
.tp-page-flex > .section-header { flex-wrap: wrap; gap: 0.5rem 0.75rem; }

/* ── Category include/exclude checkboxes (added 2026-10-05) ─────────────────
   One per category KPI card. Unchecked categories drop out of the chart and
   every total, and are greyed wherever they still appear. */
.rev-cat-toggle {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    user-select: none;
}
.rev-cat-toggle .form-check-input {
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
}
.rev-cat-toggle .form-check-input:checked {
    background-color: var(--forest);
    border-color: var(--forest);
}
.rev-cat-toggle .form-check-input:focus {
    border-color: var(--sage);
    box-shadow: 0 0 0 0.2rem rgba(154, 165, 131, 0.35);
}
.kpi-card.rev-cat-off {
    opacity: 0.5;
    border-left-color: var(--stone-light, #c5ccd1);
}
.kpi-card.rev-cat-off .kpi-value {
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}
.rev-kpi-sub {
    margin-top: 4px;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.data-table tbody tr.rev-row-off td {
    color: var(--text-muted, #999);
    opacity: 0.6;
}

/* ── Sales by Product (Origins) ─────────────────────────────────────────── */
.sbp-table-wrap {
    overflow-x: auto;
}
.sbp-table {
    min-width: 1100px;
}
.sbp-table tbody tr.sbp-clickable {
    cursor: pointer;
}
.sbp-table tbody tr.sbp-selected td {
    background: rgba(61, 91, 71, 0.08);
}
.sbp-table .sbp-codes {
    font-size: 0.75rem;
    color: var(--text-secondary, #666);
    white-space: nowrap;
}
.sbp-product-select {
    width: auto;
    max-width: 22rem;
}

/* Net / Gross: which basis the page is showing (2026-10-05) */
.rev-basis-badge {
    background: rgba(107, 125, 138, 0.15);
    color: var(--stone-dark);
    border: 1px solid var(--stone);
    white-space: nowrap;
}
#revenue-basis-group .btn.active {
    background: var(--stone-dark);
    border-color: var(--stone-dark);
    color: #fff;
}

/* Budget vs Actual: the months compared */
.rev-budget-period {
    font-weight: 400;
    color: var(--stone-dark);
    font-size: 0.9em;
}
