.crm-finance-page,
.crm-rating-page,
.crm-report-page {
    display: grid;
    gap: 22px;
}

.crm-finance-page .mb-4,
.crm-rating-page .mb-4,
.crm-report-page .mb-4 {
    margin-bottom: 0 !important;
}

.crm-finance-hero,
.crm-rating-hero,
.crm-report-hero,
.crm-finance-filter-panel,
.crm-report-filter-panel,
.crm-export-panel,
.crm-rating-panel,
.crm-finance-table-panel,
.crm-report-panel {
    padding: 24px !important;
}

.crm-finance-hero .crm-page-head,
.crm-rating-hero .crm-page-head,
.crm-report-hero .crm-page-head {
    align-items: flex-start !important;
    gap: 16px;
}

.crm-finance-hero h2,
.crm-rating-hero h2,
.crm-report-hero h2 {
    color: #162033;
    font-size: 31px !important;
    line-height: 1.4;
    font-weight: 900 !important;
}

.crm-finance-hero .text-muted,
.crm-rating-hero .text-muted,
.crm-report-hero .text-muted,
.crm-export-panel .text-muted,
.crm-rating-panel .text-muted,
.crm-report-panel .text-muted {
    color: #7a8699 !important;
    font-size: 14px;
    line-height: 1.9;
}

.crm-finance-kpis,
.crm-rating-kpis,
.crm-report-top {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.crm-finance-kpi,
.crm-rating-kpi {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    min-height: 132px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e8edf6;
    border-radius: 22px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.05);
}

.crm-finance-kpi-icon,
.crm-rating-kpi-icon,
.crm-finance-empty-icon,
.crm-report-panel-icon,
.crm-report-chart-empty-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: #eef2ff;
    color: #3b5bfd;
}

.crm-finance-kpi-icon svg,
.crm-rating-kpi-icon svg,
.crm-finance-empty-icon svg,
.crm-report-panel-icon svg,
.crm-report-chart-empty-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-finance-kpi small,
.crm-rating-kpi small {
    display: block;
    color: #7c879a;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.8;
}

.crm-finance-kpi strong,
.crm-rating-kpi strong {
    display: block;
    margin-top: 7px;
    color: #172033;
    font-size: 26px;
    line-height: 1.35;
    font-weight: 900;
}

.crm-finance-kpi-meta,
.crm-rating-kpi-meta {
    display: block;
    margin-top: 8px;
    color: #97a2b5;
    font-size: 12px;
    line-height: 1.75;
}

.crm-finance-filter-form {
    display: grid;
    grid-template-columns: minmax(280px, 2fr) minmax(220px, 1fr) minmax(220px, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.crm-finance-field,
.crm-report-field {
    min-width: 0;
}

.crm-finance-filter-form .crm-btn,
.crm-report-filter-actions .crm-btn {
    min-height: 46px;
    min-width: 140px;
}

.crm-finance-table-panel .table-responsive,
.crm-rating-panel .table-responsive,
.crm-export-panel .table-responsive,
.crm-report-panel .table-responsive {
    border: 1px solid #edf1f7;
    border-radius: 18px;
    overflow: hidden;
}

.crm-finance-table,
.crm-rating-table,
.crm-export-table,
.crm-report-table {
    margin-bottom: 0;
}

.crm-finance-table thead th,
.crm-rating-table thead th,
.crm-export-table thead th,
.crm-report-table thead th {
    padding: 16px 18px !important;
    background: #fafbfe;
    color: #67758e;
    font-size: 12px;
    font-weight: 800;
    vertical-align: middle;
}

.crm-finance-table tbody td,
.crm-rating-table tbody td,
.crm-export-table tbody td,
.crm-report-table tbody td {
    padding: 18px !important;
    color: #243146;
    font-size: 14px;
    line-height: 1.85;
    vertical-align: middle;
}

.crm-finance-invoice-title,
.crm-rating-ticket-title,
.crm-report-item-title {
    color: #172033;
    font-weight: 800;
}

.crm-finance-subtext,
.crm-rating-subtext,
.crm-report-subtext {
    display: block;
    margin-top: 4px;
    color: #8c98ab;
    font-size: 12px;
    line-height: 1.75;
}

.crm-finance-status,
.crm-rating-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.crm-finance-status.is-overdue { background: #fff0f1; color: #cf3759; }
.crm-finance-status.is-due { background: #fff7ea; color: #b9780d; }
.crm-finance-status.is-clear { background: #f2f4f8; color: #5b667a; }
.crm-rating-type-badge.is-auto { background: #eaf8f0; color: #0d8b61; }
.crm-rating-type-badge.is-manual { background: #eef2ff; color: #405de8; }

.crm-finance-empty,
.crm-rating-empty,
.crm-report-empty {
    min-height: 170px;
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 34px 24px !important;
    border-radius: 22px;
    border: 1px dashed #dce4f3;
    background: linear-gradient(180deg, #fbfcff 0%, #f5f8fd 100%);
    text-align: center;
}

.crm-finance-empty h4,
.crm-rating-empty h4,
.crm-report-empty h4 {
    margin: 0;
    color: #172033;
    font-size: 20px;
    font-weight: 900;
}

.crm-finance-empty p,
.crm-rating-empty p,
.crm-report-empty p {
    margin: 0;
    max-width: 720px;
    color: #7f8b9e;
    font-size: 14px;
    line-height: 1.9;
}

.crm-rating-layout {
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.45fr);
}

.crm-rating-list {
    display: grid;
    gap: 10px;
}

.crm-rating-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #edf1f7;
}

.crm-rating-user-row:last-child { border-bottom: 0; padding-bottom: 0; }
.crm-rating-user-row:first-child { padding-top: 0; }

.crm-rating-user-meta {
    display: block;
    color: #8a96aa;
    font-size: 12px;
    line-height: 1.7;
    margin-top: 4px;
}

.crm-rating-score {
    color: #172033;
    font-size: 22px;
    font-weight: 900;
    line-height: 1.2;
}

.crm-report-page {
    direction: rtl;
}

.crm-report-panel {
    padding: 24px !important;
}

.crm-report-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.crm-report-panel-head h3 {
    margin: 0 0 6px;
    color: #172033;
    font-size: 22px;
    font-weight: 900;
    line-height: 1.45;
}

.crm-report-panel-head p {
    margin: 0;
    color: #7d899c;
    font-size: 14px;
    line-height: 1.85;
}

.crm-report-filter-form {
    display: grid;
    gap: 18px;
}

.crm-report-filter-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
}

.crm-report-field {
    display: grid;
    gap: 8px;
}

.crm-report-field .crm-form-label {
    margin: 0;
    color: #445066;
    font-size: 13px;
    font-weight: 800;
}

.crm-report-filter-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid #edf1f7;
}

.crm-report-filter-hint {
    margin: 0;
    color: #8a96aa;
    font-size: 13px;
    line-height: 1.9;
}

.crm-report-filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.crm-btn-report-apply,
.crm-btn-report-reset {
    min-width: 136px;
    min-height: 46px;
    border-radius: 14px;
    font-weight: 800;
}

.crm-btn-report-apply {
    box-shadow: 0 10px 24px rgba(84, 72, 255, 0.22);
}

.crm-btn-report-reset {
    background: #f8fafc !important;
    color: #526079 !important;
    border: 1px solid #d8e0ef !important;
    box-shadow: none !important;
}

.crm-export-table tbody td:first-child {
    min-width: 240px;
}

.crm-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.crm-export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 108px;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 13px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all .18s ease;
}

.crm-export-btn:hover {
    transform: translateY(-1px);
}

.crm-export-btn.is-excel {
    background: linear-gradient(135deg, #12b76a 0%, #059669 100%);
    border-color: #059669;
    color: #fff;
    box-shadow: 0 10px 22px rgba(5, 150, 105, 0.18);
}

.crm-export-btn.is-csv {
    background: #eef2ff;
    border-color: #d7ddff;
    color: #405de8;
}

.crm-export-btn.is-pdf {
    background: #fff5f6;
    border-color: #ffc9d2;
    color: #e11d48;
}

.crm-report-grid-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.crm-report-chart-empty {
    min-height: 240px;
    display: grid;
    place-items: center;
    gap: 12px;
    border: 1px dashed #dde5f2;
    border-radius: 20px;
    background: linear-gradient(180deg, #fbfcff 0%, #f6f8fc 100%);
    text-align: center;
    padding: 28px;
}

.crm-report-chart-wrap {
    min-height: 240px;
}

.crm-mini-metric {
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid #edf1f7;
    background: #fafbfe;
}

.crm-mini-metric span {
    display: block;
    color: #7f8b9d;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.8;
}

.crm-mini-metric strong {
    display: block;
    margin-top: 8px;
    color: #172033;
    font-size: 20px;
    font-weight: 900;
}

@media (max-width: 1199.98px) {
    .crm-finance-kpis,
    .crm-rating-kpis,
    .crm-report-top,
    .crm-report-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .crm-finance-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .crm-rating-layout,
    .crm-report-grid-two {
        grid-template-columns: 1fr;
    }

    .crm-report-filter-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .crm-report-filter-actions {
        justify-content: stretch;
    }

    .crm-btn-report-apply,
    .crm-btn-report-reset {
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .crm-finance-page,
    .crm-rating-page,
    .crm-report-page { gap: 16px; }
    .crm-finance-hero, .crm-rating-hero, .crm-report-hero, .crm-finance-filter-panel, .crm-report-filter-panel, .crm-export-panel, .crm-rating-panel, .crm-finance-table-panel, .crm-report-panel { padding: 18px !important; }
    .crm-finance-kpis, .crm-rating-kpis, .crm-finance-filter-form, .crm-report-top, .crm-report-filter-grid { grid-template-columns: 1fr; }
    .crm-finance-kpi, .crm-rating-kpi { grid-template-columns: 50px minmax(0, 1fr); min-height: 118px; padding: 16px; }
    .crm-finance-kpi-icon, .crm-rating-kpi-icon, .crm-finance-empty-icon, .crm-report-panel-icon, .crm-report-chart-empty-icon { width: 50px; height: 50px; border-radius: 16px; }
    .crm-finance-hero h2, .crm-rating-hero h2, .crm-report-hero h2 { font-size: 25px !important; }
    .crm-report-panel-head h3 { font-size: 19px; }
    .crm-export-actions { flex-direction: column; align-items: stretch; }
    .crm-export-btn { width: 100%; }
}


/* v6.30.6 reports export alignment fix */
.crm-export-table thead th:nth-child(2),
.crm-export-table tbody td:nth-child(2) {
    text-align: right !important;
}

.crm-export-table tbody td:nth-child(2) {
    padding-right: 24px !important;
    padding-left: 18px !important;
}

.crm-export-actions {
    justify-content: flex-start;
}

.crm-export-actions .crm-export-btn {
    margin-inline-start: 0;
}

@media (max-width: 767.98px) {
    .crm-export-table tbody td:nth-child(2) {
        padding-right: 18px !important;
        padding-left: 18px !important;
    }

    .crm-export-actions {
        justify-content: stretch;
    }
}
