/* ── Custom properties ────────────────────────────────────────────────────── */
:root {
    --sidebar-w: 230px;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e5e7eb;
    --sidebar-active: #e8f4fe;
    --sidebar-hover: #f3f4f6;
    --accent: #0d6efd;
    --accent-green: #198754;
    --accent-amber: #fd7e14;
    --bar-track: #e9ecef;
    --kpi-sent-bg: #eff6ff;
    --kpi-sent-bdr: #bfdbfe;
    --kpi-del-bg: #f0fdf4;
    --kpi-del-bdr: #bbf7d0;
    --kpi-read-bg: #fff7ed;
    --kpi-read-bdr: #fed7aa;
    --summary-bg: #f8f9fa;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
body {
    background-color: #f1f5f9;
    font-size: 14px;
    display: flex;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    padding: 20px 14px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    gap: 4px;
    box-shadow: 2px 0 8px rgba(0,0,0,.04);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo-text {
    font-weight: 700;
    font-size: 15px;
    color: #111827;
    letter-spacing: -.01em;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 10px 8px 4px;
    margin: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: #4b5563;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, color .15s;
}

    .sidebar-link i {
        font-size: 15px;
    }

    .sidebar-link:hover {
        background: var(--sidebar-hover);
        color: #111827;
    }

    .sidebar-link.active {
        background: var(--sidebar-active);
        color: var(--accent);
    }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 32px 28px;
    min-height: 100vh;
}

/* ── Page header ──────────────────────────────────────────────────────────── */
.rsr-page {
    max-width: 960px;
}

.rsr-header {
    margin-bottom: 24px;
}

.rsr-eyebrow {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 4px;
}

.rsr-title {
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 700;
    color: #111827;
    letter-spacing: -.02em;
    margin: 0;
}

/* ── KPI cards ────────────────────────────────────────────────────────────── */
.kpi-card {
    border-radius: 12px;
    padding: 20px 22px;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

    .kpi-card::after {
        content: '';
        position: absolute;
        top: -16px;
        right: -16px;
        width: 72px;
        height: 72px;
        border-radius: 50%;
        opacity: .12;
    }

.kpi-sent {
    background: var(--kpi-sent-bg);
    border-color: var(--kpi-sent-bdr);
}

    .kpi-sent::after {
        background: var(--accent);
    }

.kpi-delivered {
    background: var(--kpi-del-bg);
    border-color: var(--kpi-del-bdr);
}

    .kpi-delivered::after {
        background: var(--accent-green);
    }

.kpi-read {
    background: var(--kpi-read-bg);
    border-color: var(--kpi-read-bdr);
}

    .kpi-read::after {
        background: var(--accent-amber);
    }

.kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
    margin-bottom: 8px;
}

.kpi-sent .kpi-label {
    color: var(--accent);
}

.kpi-delivered .kpi-label {
    color: var(--accent-green);
}

.kpi-read .kpi-label {
    color: var(--accent-amber);
}

.kpi-value {
    font-size: 36px;
    font-weight: 700;
    color: #111827;
    line-height: 1;
    margin-bottom: 10px;
}

.kpi-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: color-mix(in srgb, var(--badge-color) 15%, transparent);
    color: var(--badge-color);
}

/* ── Section labels ───────────────────────────────────────────────────────── */
.section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: #6b7280;
    display: block;
    margin-bottom: 16px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.section-sub {
    font-size: 12px;
    color: var(--accent);
    font-weight: 500;
}

/* ── Bar components ───────────────────────────────────────────────────────── */
.bar-track {
    flex: 1;
    background: var(--bar-track);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .7s cubic-bezier(.4,0,.2,1);
}

/* ── Funnel rows ──────────────────────────────────────────────────────────── */
.funnel-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

    .funnel-row:last-child {
        margin-bottom: 0;
    }

.funnel-label {
    width: 80px;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.funnel-count {
    width: 64px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
}

.funnel-pct {
    width: 48px;
    text-align: right;
    font-size: 12px;
    color: #9ca3af;
}

/* ── Bucket table ─────────────────────────────────────────────────────────── */
.bucket-table {
    width: 100%;
}

.bucket-thead {
    display: grid;
    grid-template-columns: 110px 1fr 70px 82px 82px 72px;
    gap: 12px;
    font-size: 10px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .09em;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 2px;
}

.bucket-row {
    display: grid;
    grid-template-columns: 110px 1fr 70px 82px 82px 72px;
    gap: 12px;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid #f3f4f6;
}

    .bucket-row:last-child {
        border-bottom: none;
    }

.bucket-total-row {
    border-top: 2px solid #dee2e6 !important;
    border-bottom: none !important;
    background: #f8f9fa;
    margin-top: 2px;
}

.bucket-window {
    font-size: 12px;
    color: #374151;
    font-weight: 500;
}

.bucket-count {
    font-size: 13px;
    font-weight: 600;
}

.bucket-pct {
    font-size: 12px;
    color: #6b7280;
}

.bucket-pct2 {
    font-size: 12px;
    color: #9ca3af;
}

.text-right {
    text-align: right;
}

/* ── Summary strip ────────────────────────────────────────────────────────── */
.summary-strip {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding: 14px 18px;
    background: var(--summary-bg);
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.summary-key {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #9ca3af;
    margin-bottom: 2px;
}

.summary-val {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

/* ── Error / empty states ─────────────────────────────────────────────────── */
.rsr-empty {
    color: #9ca3af;
    font-size: 13px;
    padding: 48px 0;
    text-align: center;
}

.rsr-footnote {
    margin-top: 12px;
    font-size: 11px;
    color: #9ca3af;
    text-align: right;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 20px 16px;
    }

    .bucket-thead,
    .bucket-row {
        grid-template-columns: 90px 1fr 55px;
    }

        .bucket-thead span:nth-child(4),
        .bucket-thead span:nth-child(5),
        .bucket-thead span:nth-child(6),
        .bucket-row .bucket-pct,
        .bucket-row .bucket-pct2,
        .bucket-row span:nth-child(4) {
            display: none;
        }
}
