/* ── Reports Dashboard Styles ─────────────────────────────────────────── */

/* Topbar */
.rpt-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    background: #fff;
    border: 1px solid #d6deea;
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 16px;
}

.rpt-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.rpt-back-link {
    color: #1e5aa8;
    font-weight: 700;
    text-decoration: none;
    font-size: 14px;
}

.rpt-back-link:hover {
    text-decoration: underline;
}

.rpt-page-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: #12315e;
}

.rpt-user {
    font-size: 13px;
    color: #4a5570;
}

/* ── KPI Cards ────────────────────────────────────────────────────────── */
.rpt-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

@media (max-width: 800px) {
    .rpt-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .rpt-kpi-grid {
        grid-template-columns: 1fr;
    }
}

.rpt-kpi-card {
    border-radius: 14px;
    padding: 18px 20px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.rpt-kpi-card::after {
    content: '';
    position: absolute;
    inset: -50% -30% auto auto;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255,255,255,0.10);
    pointer-events: none;
}

.rpt-kpi-blue   { background: linear-gradient(130deg, #1e5aa8 0%, #2563eb 100%); }
.rpt-kpi-indigo { background: linear-gradient(130deg, #4c1d95 0%, #7c3aed 100%); }
.rpt-kpi-green  { background: linear-gradient(130deg, #065f46 0%, #059669 100%); }
.rpt-kpi-amber  { background: linear-gradient(130deg, #92400e 0%, #d97706 100%); }

.rpt-kpi-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.82;
    margin-bottom: 6px;
}

.rpt-kpi-value {
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.rpt-kpi-sub {
    font-size: 12px;
    opacity: 0.78;
}

/* ── Section titles ───────────────────────────────────────────────────── */
.rpt-section {
    margin-bottom: 16px;
}

.rpt-section-title {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 800;
    color: #12315e;
}

/* ── Invoice status stats ─────────────────────────────────────────────── */
.rpt-invoice-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

@media (max-width: 600px) {
    .rpt-invoice-stat-grid {
        grid-template-columns: 1fr;
    }
}

.rpt-inv-stat {
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rpt-inv-revenue    { background: #eff6ff; border: 1px solid #bfdbfe; }
.rpt-inv-collected  { background: #ecfdf5; border: 1px solid #a7f3d0; }
.rpt-inv-outstanding { background: #fffbeb; border: 1px solid #fde68a; }

.rpt-inv-num {
    font-size: 20px;
    font-weight: 800;
    color: #1e3a5f;
}

.rpt-inv-lbl {
    font-size: 12px;
    font-weight: 600;
    color: #4a5570;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.rpt-status-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rpt-spill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 15px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

.rpt-spill strong {
    font-size: 16px;
    font-weight: 900;
}

.rpt-spill-paid     { background: #dcfce7; border: 1px solid #86efac; color: #166534; }
.rpt-spill-partial  { background: #dbeafe; border: 1px solid #93c5fd; color: #1e40af; }
.rpt-spill-unpaid   { background: #fef9c3; border: 1px solid #fde047; color: #713f12; }
.rpt-spill-overdue  { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }

/* ── Trend chart ──────────────────────────────────────────────────────── */
.rpt-trend-section {
    margin-bottom: 16px;
}

.rpt-trend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.rpt-period-tabs {
    display: flex;
    gap: 6px;
}

.rpt-period-btn {
    width: auto;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 999px;
    border: 1px solid #c5d2e7;
    background: #f4f8ff;
    color: #1e416f;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.rpt-period-btn:hover {
    background: #e5efff;
    border-color: #93b3d8;
}

.rpt-period-btn.active {
    background: #1e5aa8;
    border-color: #1e5aa8;
    color: #fff;
}

.rpt-trend-wrap {
    position: relative;
    height: 300px;
}

.rpt-trend-wrap canvas {
    max-height: 300px;
}

/* ── Charts ───────────────────────────────────────────────────────────── */
.rpt-charts-row {
    display: grid;
    grid-template-columns: 1.4fr 0.6fr;
    gap: 14px;
    margin-bottom: 16px;
}

@media (max-width: 860px) {
    .rpt-charts-row {
        grid-template-columns: 1fr;
    }
}

.rpt-chart-wrap {
    position: relative;
    height: 280px;
}

.rpt-chart-wrap canvas {
    max-height: 280px;
}

/* ── Bottom two-column tables ─────────────────────────────────────────── */
.rpt-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 24px;
}

@media (max-width: 860px) {
    .rpt-bottom-row {
        grid-template-columns: 1fr;
    }
}

.rpt-table-wrap {
    overflow-x: auto;
}

.rpt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.rpt-table th {
    background: #f1f5fb;
    border-bottom: 2px solid #d6deea;
    padding: 8px 10px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #2f4266;
    white-space: nowrap;
}

.rpt-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eff2f8;
    color: #2e3a50;
}

.rpt-table tbody tr:hover td {
    background: #f7faff;
}

.rpt-rank {
    font-weight: 700;
    color: #8494b2;
    text-align: center;
    width: 28px;
}

.text-center { text-align: center; }
.text-right  { text-align: right; font-variant-numeric: tabular-nums; }

.rpt-text-green { color: #15803d; font-weight: 600; }
.rpt-text-amber { color: #a16207; font-weight: 600; }

/* ── Collection % bar ─────────────────────────────────────────────────── */
.rpt-pct-bar-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 90px;
}

.rpt-pct-bar {
    height: 8px;
    border-radius: 4px;
    background: #22c55e;
    flex-shrink: 0;
    transition: width 0.5s ease;
}

.rpt-pct-bar-wrap span {
    font-size: 12px;
    font-weight: 700;
    color: #1a3a1a;
    white-space: nowrap;
}
