.report-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid var(--cf-line);
    border-radius: var(--cf-radius);
    background: var(--cf-white);
}

.report-filter > div:first-child {
    display: grid;
    gap: 2px;
}

.report-filter > div:first-child span {
    color: var(--cf-text-soft);
    font-size: .76rem;
}

.report-filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.report-filter-options a {
    padding: 7px 10px;
    border-radius: var(--cf-radius-sm);
    color: var(--cf-text-soft);
    font-size: .76rem;
    font-weight: 700;
    text-decoration: none;
}

.report-filter-options a:hover {
    background: var(--cf-surface-soft);
}

.report-filter-options a.active {
    background: var(--cf-navy-950);
    color: var(--cf-white);
}

.report-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.report-kpi {
    padding: 17px;
    border: 1px solid var(--cf-line);
    border-radius: var(--cf-radius);
    background: var(--cf-white);
    box-shadow: var(--cf-shadow-sm);
}

.report-kpi > span {
    display: block;
    color: var(--cf-text-soft);
    font-size: .74rem;
    font-weight: 700;
}

.report-kpi > strong {
    display: block;
    margin: 6px 0 2px;
    color: var(--cf-navy-950);
    font-size: 1.42rem;
    line-height: 1.2;
}

.report-kpi > small {
    font-size: .7rem;
}

.profit-text {
    color: var(--cf-success) !important;
}

.loss-text,
.negative {
    color: var(--cf-danger) !important;
}

/* CommerceFlow r8.2.0 — exact-month Profit report */

body.cf-r820 .report-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

body.cf-r820 .report-period-copy {
    min-width: 150px;
    display: grid;
    gap: 2px;
}

body.cf-r820 .report-period-copy strong {
    color: var(--cf-navy-950);
    font-size: .78rem;
}

body.cf-r820 .report-period-copy span {
    color: var(--cf-text-soft);
    font-size: .72rem;
}

body.cf-r820 .report-filter-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 9px;
}

body.cf-r820 .report-month-form {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding-left: 9px;
    border-left: 1px solid var(--cf-line);
}

body.cf-r820 .report-month-form label {
    display: grid;
    gap: 3px;
}

body.cf-r820 .report-month-form label > span {
    color: var(--cf-text-muted);
    font-size: .62rem;
    font-weight: 750;
}

body.cf-r820 .report-month-form input[type="month"] {
    width: 150px;
    min-height: 32px;
    padding: 5px 8px;
    font-size: .72rem;
}

body.cf-r820 .report-insight-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(270px, .55fr);
    gap: 14px;
    margin-top: 14px;
}

body.cf-r820 .profit-bridge,
body.cf-r820 .report-health-card {
    padding: 16px;
}

body.cf-r820 .bridge-row {
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid #e8edf1;
    font-size: .77rem;
}

body.cf-r820 .bridge-row:last-child {
    border-bottom: 0;
}

body.cf-r820 .bridge-row.total {
    margin-top: 6px;
    padding-top: 7px;
    border-top: 1px solid var(--cf-line-strong);
    font-weight: 800;
}

body.cf-r820 .excluded-fee-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 16px 16px;
    padding: 9px 10px;
    border-radius: var(--cf-radius-sm);
    background: var(--cf-surface-soft);
    font-size: .7rem;
}

body.cf-r820 .excluded-fee-note strong {
    margin-left: auto;
}

body.cf-r820 .ratio-block {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

body.cf-r820 .ratio-block > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: .74rem;
}

body.cf-r820 progress {
    width: 100%;
    height: 7px;
}

body.cf-r820 .report-mini-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 8px;
}

body.cf-r820 .report-mini-metrics > div {
    display: grid;
    gap: 2px;
    padding: 10px;
    border-radius: var(--cf-radius-sm);
    background: var(--cf-surface-soft);
}

body.cf-r820 .monthly-report-card {
    margin-top: 14px;
}

body.cf-r820 .monthly-report-list {
    display: grid;
}

body.cf-r820 .monthly-report-row {
    padding: 14px 16px;
    border-bottom: 1px solid var(--cf-line);
}

body.cf-r820 .monthly-report-row:last-child {
    border-bottom: 0;
}

body.cf-r820 .monthly-report-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

body.cf-r820 .monthly-report-heading > div {
    display: grid;
}

body.cf-r820 .monthly-report-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 8px;
    margin-top: 8px;
}

body.cf-r820 .monthly-report-metrics span {
    display: grid;
    gap: 2px;
    color: var(--cf-text-muted);
    font-size: .66rem;
}

body.cf-r820 .monthly-report-metrics strong {
    color: var(--cf-text);
    font-size: .73rem;
}

@media (max-width: 900px) {

    body.cf-r820 .report-filter,
    body.cf-r820 .report-filter-controls {
        align-items: stretch;
    }

    body.cf-r820 .report-filter {
        display: grid;
    }

    body.cf-r820 .report-filter-controls {
        justify-content: flex-start;
    }

    body.cf-r820 .report-month-form {
        border-left: 0;
        padding-left: 0;
    }

    body.cf-r820 .report-insight-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {

    body.cf-r820 .report-filter-options {
        display: grid;
        grid-template-columns: repeat(3, minmax(0,1fr));
    }

    body.cf-r820 .report-month-form {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0,1fr) auto auto;
    }

    body.cf-r820 .report-month-form input[type="month"] {
        width: 100%;
    }

    body.cf-r820 .monthly-report-metrics {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
}


/* CommerceFlow r8.2.1 — report modifier completeness */
body.cf-r820 .bridge-row.revenue strong,
body.cf-r820 .positive {
    color: var(--cf-success);
}

body.cf-r820 .bridge-row.cost strong,
body.cf-r820 .bridge-row.costs strong {
    color: var(--cf-danger);
}

body.cf-r820 .bridge-row.collected strong,
body.cf-r820 .bridge-row.collection strong {
    color: var(--cf-info);
}

body.cf-r820 .legend-revenue {
    background: var(--cf-info);
}

/* ============================================================
   CommerceFlow r8.2.10 — Profit by SHEIN order mobile cards
   ============================================================ */

body.cf-r820 .cf-order-profit-mobile {
    display: none;
}


/* ------------------------------------------------------------
   Tablet + mobile
   ------------------------------------------------------------ */

@media (max-width: 900px) {

    body.cf-r820
    .order-profit-table
    .cf-order-profit-desktop {
        display: none !important;
    }


    body.cf-r820
    .order-profit-table
    .cf-order-profit-mobile {
        display: grid;

        gap: 12px;

        padding: 12px;
    }


    body.cf-r820
    .cf-order-profit-card {
        overflow: hidden;

        border:
            1px solid var(--cf-line, #d7e0e8);

        border-radius: 10px;

        background: #fff;
    }


    body.cf-r820
    .cf-order-profit-card-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;

        gap: 14px;

        padding: 14px 15px;

        border-bottom:
            1px solid var(--cf-line, #d7e0e8);

        background:
            var(--cf-surface-soft, #f7f9fb);
    }


    body.cf-r820
    .cf-order-profit-card-header > div:first-child {
        min-width: 0;
    }


    body.cf-r820
    .cf-order-profit-card-header span,
    body.cf-r820
    .cf-order-profit-grid section > span,
    body.cf-r820
    .cf-order-profit-result > span {
        display: block;

        margin-bottom: 4px;

        color: var(--cf-text-muted, #66778a);

        font-size: 10px;
        font-weight: 700;

        letter-spacing: .045em;

        text-transform: uppercase;
    }


    body.cf-r820
    .cf-order-profit-card-header strong {
        display: block;

        max-width: 100%;

        color: var(--cf-text, #0d1b2a);

        font-size: 14px;

        line-height: 1.35;

        overflow-wrap: anywhere;
    }


    body.cf-r820
    .cf-order-profit-card-header small {
        display: block;

        margin-top: 4px;

        color: var(--cf-text-muted, #66778a);

        font-size: 11px;
    }


    body.cf-r820
    .cf-order-profit-result {
        flex: 0 0 auto;

        min-width: 92px;

        padding-left: 12px;

        text-align: right;
    }


    body.cf-r820
    .cf-order-profit-result strong {
        font-size: 15px;
    }


    body.cf-r820
    .cf-order-profit-result.is-profit strong {
        color: #167a55;
    }


    body.cf-r820
    .cf-order-profit-result.is-loss strong {
        color: #a43b3b;
    }


    body.cf-r820
    .cf-order-profit-grid {
        display: grid;

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


    body.cf-r820
    .cf-order-profit-grid section {
        min-width: 0;

        padding: 13px 15px;

        border-right:
            1px solid var(--cf-line, #e0e6eb);

        border-bottom:
            1px solid var(--cf-line, #e0e6eb);
    }


    body.cf-r820
    .cf-order-profit-grid section:nth-child(2n) {
        border-right: 0;
    }


    body.cf-r820
    .cf-order-profit-grid section:nth-last-child(-n+2) {
        border-bottom: 0;
    }


    body.cf-r820
    .cf-order-profit-grid section > strong {
        display: block;

        color: var(--cf-text, #0d1b2a);

        font-size: 14px;

        line-height: 1.35;

        overflow-wrap: anywhere;
    }


    body.cf-r820
    .cf-order-profit-grid section > small {
        display: block;

        margin-top: 5px;

        color: var(--cf-text-muted, #66778a);

        font-size: 11px;

        line-height: 1.45;
    }


    body.cf-r820
    .cf-order-profit-grid section.is-due > strong {
        color: #a56713;
    }


    body.cf-r820
    .cf-order-profit-card-footer {
        padding: 10px 15px;

        border-top:
            1px solid var(--cf-line, #e0e6eb);

        background:
            var(--cf-surface-soft, #f8fafb);

        color: var(--cf-text-muted, #66778a);

        font-size: 11px;

        line-height: 1.4;
    }

}


/* ------------------------------------------------------------
   Phone
   ------------------------------------------------------------ */

@media (max-width: 520px) {

    body.cf-r820
    .order-profit-table
    .cf-order-profit-mobile {
        padding: 9px;
    }


    body.cf-r820
    .cf-order-profit-card-header {
        padding: 13px;
    }


    body.cf-r820
    .cf-order-profit-grid {
        grid-template-columns: 1fr;
    }


    body.cf-r820
    .cf-order-profit-grid section {
        border-right: 0 !important;

        border-bottom:
            1px solid var(--cf-line, #e0e6eb) !important;
    }


    body.cf-r820
    .cf-order-profit-grid section:last-child {
        border-bottom: 0 !important;
    }


    body.cf-r820
    .cf-order-profit-grid section {
        display: grid;

        grid-template-columns:
            minmax(105px, .42fr)
            minmax(0, 1fr);

        gap: 10px;

        align-items: start;
    }


    body.cf-r820
    .cf-order-profit-grid section > span {
        margin: 1px 0 0;

        text-align: left;
    }


    body.cf-r820
    .cf-order-profit-grid section > strong,
    body.cf-r820
    .cf-order-profit-grid section > small {
        grid-column: 2;

        text-align: right;
    }


    body.cf-r820
    .cf-order-profit-grid section > small {
        margin-top: 3px;
    }

}


/* CommerceFlow Profit & Business Position refinement */
body.cf-r820 .cf-profit-context-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

body.cf-r820 .cf-profit-context-card {
    padding: 13px 15px;
    border: 1px solid var(--cf-line);
    border-left: 3px solid var(--cf-navy-700);
    border-radius: var(--cf-radius);
    background: var(--cf-white);
}

body.cf-r820 .cf-profit-context-card.current {
    border-left-color: var(--cf-gold-600, #b68a2b);
    background: #fffdf8;
}

body.cf-r820 .cf-profit-context-card > span {
    display: block;
    color: var(--cf-text-muted);
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

body.cf-r820 .cf-profit-context-card > strong {
    display: block;
    margin-top: 4px;
    color: var(--cf-navy-950);
    font-size: .92rem;
}

body.cf-r820 .cf-profit-context-card p {
    margin: 5px 0 0;
    color: var(--cf-text-soft);
    font-size: .72rem;
    line-height: 1.5;
}

body.cf-r820 .cf-current-position-card {
    margin-top: 16px;
}

body.cf-r820 .cf-current-position-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 0 16px 16px;
}

body.cf-r820 .cf-position-metric {
    min-width: 0;
    display: grid;
    gap: 5px;
    padding: 14px;
    border: 1px solid var(--cf-line);
    border-top: 3px solid var(--cf-navy-700);
    border-radius: var(--cf-radius-sm);
    background: var(--cf-surface-soft);
    color: inherit;
    text-decoration: none;
}

body.cf-r820 .cf-position-metric:hover {
    border-color: var(--cf-navy-500);
    background: #fff;
}

body.cf-r820 .cf-position-metric.due { border-top-color: #b95c4b; }
body.cf-r820 .cf-position-metric.invested { border-top-color: #b68a2b; }
body.cf-r820 .cf-position-metric.credit { border-top-color: #3679a4; }
body.cf-r820 .cf-position-metric.received { border-top-color: var(--cf-success); }

body.cf-r820 .cf-position-metric > span {
    color: var(--cf-text-soft);
    font-size: .68rem;
    font-weight: 800;
}

body.cf-r820 .cf-position-metric > strong {
    color: var(--cf-navy-950);
    font-size: 1.2rem;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

body.cf-r820 .cf-position-metric > small {
    color: var(--cf-text-muted);
    font-size: .66rem;
    line-height: 1.4;
}

body.cf-r820 .cf-profit-drilldown-table,
body.cf-r820 .cf-monthly-profit-table,
body.cf-r820 .cf-order-profit-table {
    min-width: 900px;
    font-size: .74rem;
}

body.cf-r820 .cf-profit-drilldown-table td strong,
body.cf-r820 .cf-monthly-profit-table td strong,
body.cf-r820 .cf-order-profit-table td strong {
    font-variant-numeric: tabular-nums;
}

body.cf-r820 .cf-profit-drilldown-table td small,
body.cf-r820 .cf-order-profit-table td small {
    display: block;
    margin-top: 3px;
}

body.cf-r820 .cf-monthly-profit-table th,
body.cf-r820 .cf-monthly-profit-table td,
body.cf-r820 .cf-order-profit-table th,
body.cf-r820 .cf-order-profit-table td {
    white-space: nowrap;
}

body.cf-r820 .cf-order-profit-table th:first-child,
body.cf-r820 .cf-order-profit-table td:first-child,
body.cf-r820 .cf-profit-drilldown-table th:nth-child(2),
body.cf-r820 .cf-profit-drilldown-table td:nth-child(2) {
    white-space: normal;
}

body.cf-r820 .cf-profit-bridge-grid {
    margin-bottom: 0;
}

@media (max-width: 1100px) {
    body.cf-r820 .cf-current-position-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    body.cf-r820 .cf-profit-context-grid,
    body.cf-r820 .cf-current-position-grid {
        grid-template-columns: 1fr;
    }

    body.cf-r820 .cf-current-position-grid {
        padding: 0 12px 12px;
    }
}
