* {
    box-sizing: border-box;
}

:root {
    --navy: #10233f;
    --navy-light: #193656;
    --page: #f3f6fa;
    --panel: #ffffff;
    --text: #1b2735;
    --muted: #6f7d8d;
    --border: #dfe5ec;
    --accent: #2678c8;
    --success: #1d9b67;
}

body {
    margin: 0;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: var(--page);
    color: var(--text);
}

.topbar {
    height: 72px;
    background: var(--navy);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.brand-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 1.2px;
}

.brand-subtitle {
    margin-top: 3px;
    color: #b8c6d8;
    font-size: 12px;
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #d7e0ea;
    font-size: 13px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #39c886;
}

.layout {
    display: flex;
    padding-top: 72px;
}

.sidebar {
    width: 230px;
    position: fixed;
    top: 72px;
    left: 0;
    bottom: 0;
    background: #162b47;
    color: white;
    padding: 24px 14px;
}

.nav-section {
    color: #8296ae;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.3px;
    padding: 0 12px 10px;
}

.nav-item {
    width: 100%;
    border: 0;
    background: transparent;
    color: #c9d5e2;
    text-align: left;
    border-radius: 7px;
    padding: 11px 12px;
    margin-bottom: 5px;
    cursor: default;
    font-size: 13px;
}

.nav-item span {
    display: inline-block;
    width: 23px;
}

.nav-item.active {
    background: var(--navy-light);
    color: white;
    font-weight: 600;
}

.nav-item small {
    display: block;
    margin: 4px 0 0 24px;
    color: #7890aa;
    font-size: 9px;
}

.sources-title {
    margin-top: 32px;
}

.source-row {
    padding: 7px 12px;
    color: #aebdcd;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 9px;
}

.source-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #52677f;
}

.source-dot.active {
    background: #39c886;
}

.content {
    margin-left: 230px;
    width: calc(100% - 230px);
    padding: 30px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 22px;
}

.page-heading h1 {
    margin: 0;
    font-size: 27px;
}

.page-heading p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.updated {
    color: var(--muted);
    font-size: 12px;
    padding-top: 8px;
}

.filters {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    gap: 14px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.filter {
    min-width: 180px;
}

.filter label,
.status-filter label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 6px;
}

select,
input[type="date"] {
    width: 100%;
    height: 38px;
    border: 1px solid #ccd5df;
    border-radius: 6px;
    background: white;
    padding: 0 10px;
    color: var(--text);
}

.custom-date {
    display: none;
}

.apply-button {
    height: 38px;
    border: 0;
    border-radius: 6px;
    background: var(--navy);
    color: white;
    padding: 0 22px;
    font-weight: 600;
    cursor: pointer;
}

.error-message {
    display: none;
    padding: 12px 15px;
    margin-bottom: 18px;
    background: #fff0f0;
    border: 1px solid #f0bcbc;
    border-radius: 7px;
    color: #a52b2b;
    font-size: 13px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.kpi-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    min-height: 112px;
}

.kpi-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 750;
    margin-top: 9px;
}

.kpi-caption {
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.kpi-caption span {
    color: var(--success);
    font-weight: 700;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}

.panel-heading {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.panel-heading h2 {
    margin: 0;
    font-size: 16px;
}

.panel-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.automation-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.status-filter {
    width: 190px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

th {
    text-align: right;
    color: var(--muted);
    background: #fafbfd;
    padding: 11px 13px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    text-align: right;
    padding: 12px 13px;
    border-bottom: 1px solid #edf0f4;
    white-space: nowrap;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2),
th:nth-child(3),
td:nth-child(3) {
    text-align: left;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover {
    background: #fafcff;
}

.type-overall td {
    font-weight: 700;
    background: #f6f9fc;
}

.status-badge {
    display: inline-block;
    border-radius: 20px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: capitalize;
}

.status-live {
    background: #e7f7f0;
    color: #167a51;
}

.status-paused {
    background: #fff4dd;
    color: #976512;
}

.status-draft {
    background: #eef1f5;
    color: #667485;
}

.status-historical {
    background: #f1ebf8;
    color: #70518f;
}

.chart-container {
    height: 330px;
    padding: 20px;
}

.loading-row td,
.empty-row td {
    text-align: center !important;
    color: var(--muted);
    padding: 24px;
}

@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 850px) {
    .sidebar {
        display: none;
    }

    .content {
        margin-left: 0;
        width: 100%;
        padding: 18px;
    }

    .filters {
        flex-wrap: wrap;
    }

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


/* ============================================================
   REVOLUTION MONEY BRANDING
   ============================================================ */

:root {
    --pink: #F2297B;
    --pink-bright: #FF4B94;
    --pink-soft: #FFF1F6;
    --rm-dark: #252A33;
    --rm-dark-border: #343A45;
}

/* Main application chrome */

.topbar {
    background: var(--rm-dark);
    border-bottom: 3px solid var(--pink);
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand-mark {
    color: #ffffff;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -.5px;
    white-space: nowrap;
}

.brand-mark .rev {
    color: var(--pink);
}

.brand-divider {
    width: 1px;
    height: 38px;
    background: #454B56;
}

.system-title {
    display: flex;
    flex-direction: column;
}

.system-title strong {
    color: #ffffff;
    font-size: 17px;
    font-weight: 800;
}

.system-title small {
    margin-top: 4px;
    color: #929AA8;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
}

.sidebar {
    background: var(--rm-dark);
}

.nav-item.active {
    background: rgba(242, 41, 123, .13);
    box-shadow:
        inset 3px 0 0 var(--pink);
}

.nav-item.active span {
    color: var(--pink);
}

.source-dot.active,
.status-dot {
    background: var(--pink);
}


/* Page accents */

.page-heading h1 {
    position: relative;
    padding-left: 15px;
}

.page-heading h1::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    bottom: 2px;
    width: 4px;
    border-radius: 3px;
    background: var(--pink);
}

.apply-button {
    background: var(--pink);
    transition:
        background .15s ease,
        transform .15s ease;
}

.apply-button:hover {
    background: var(--pink-bright);
    transform: translateY(-1px);
}

select:focus,
input[type="date"]:focus {
    outline: none;
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(242, 41, 123, .10);
}


/* KPI cards */

.kpi-card {
    position: relative;
    overflow: hidden;
    transition:
        transform .15s ease,
        box-shadow .15s ease;
}

.kpi-card::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--pink);
    opacity: .85;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 24px rgba(37, 42, 51, .08);
}

.kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.kpi-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--pink-soft);
    color: var(--pink);
}

.kpi-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.kpi-value {
    color: var(--rm-dark);
}


/* Tables */

th {
    border-top: 2px solid transparent;
}

tbody tr:hover {
    background: var(--pink-soft);
}

.type-overall td {
    background: #fff8fb;
    border-top: 1px solid #f8c6da;
    border-bottom: 1px solid #f8c6da;
}


/* Panels */

.panel-heading h2 {
    display: inline-block;
    position: relative;
}

.panel-heading h2::after {
    content: "";
    display: block;
    width: 28px;
    height: 2px;
    margin-top: 7px;
    border-radius: 2px;
    background: var(--pink);
}


/* ============================================================
   DATE RANGE SELECTOR
   ============================================================ */

#customDates {
    display: contents !important;
}

.filter-row input[type="date"],
.filters input[type="date"],
.filter-bar input[type="date"] {
    min-width: 150px;
}

input[type="date"] {
    height: 38px;
    padding: 0 11px;
    border: 1px solid #d7dde6;
    border-radius: 6px;
    background: #ffffff;
    color: #252A33;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
}

input[type="date"]:hover {
    border-color: #b8c0cc;
}

input[type="date"]:focus {
    outline: none;
    border-color: #F2297B;
    box-shadow: 0 0 0 3px rgba(242, 41, 123, .10);
}
