.crm-page {
    min-height: 100%;
    padding: 26px;
    color: #0f172a;
    background: #eef5ff;
}

.crm-section {
    margin-bottom: 20px;
}

.crm-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.crm-eyebrow,
.crm-section-kicker {
    color: #2563eb;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.crm-hero h1 {
    margin: 5px 0 0;
    color: #132144;
    font-size: clamp(28px, 3.2vw, 40px);
    font-weight: 900;
}

.crm-hero p {
    max-width: 760px;
    margin: 8px 0 0;
    color: #475569;
    font-size: 1rem;
}

.crm-hero-meta,
.crm-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.crm-hero-meta {
    margin-top: 14px;
}

.crm-hero-meta span,
.crm-hero-actions .btn,
.crm-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.crm-hero-meta span {
    min-height: 42px;
    padding: 10px 13px;
    border: 1px solid rgba(99, 102, 241, .16);
    border-radius: 15px;
    color: #334155;
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .05);
    font-size: 13px;
    font-weight: 700;
}

.crm-hero-actions {
    align-items: center;
}

.crm-btn {
    min-height: 46px;
    padding-inline: 16px;
    border-radius: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.crm-hero-actions .btn-light {
    color: #334155;
    border: 1px solid rgba(148, 163, 184, .22);
    background: #fff;
}

.crm-section-heading {
    margin-bottom: 12px;
}

.crm-section-heading h2,
.crm-panel-header h2 {
    margin: 4px 0 0;
    color: #0f172a;
    font-size: 18px;
    font-weight: 900;
}

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

.crm-kpi-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    min-height: 156px;
    padding: 22px;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 14px 40px rgba(15, 23, 42, .04);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.crm-kpi-card:hover {
    transform: translateY(-2px);
    border-color: rgba(96, 165, 250, .26);
    box-shadow: 0 18px 34px rgba(99, 102, 241, .08);
}

.crm-kpi-card:first-child {
    color: #fff;
    background: linear-gradient(135deg, #2563eb 0%, #6366f1 100%);
}

.crm-kpi-card:first-child span,
.crm-kpi-card:first-child small,
.crm-kpi-card:first-child h3 {
    color: rgba(255, 255, 255, .86);
}

.crm-kpi-card:first-child h3 {
    color: #fff;
}

.kpi-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 1.2rem;
}

.crm-kpi-card span {
    color: #94a3b8;
    font-size: .92rem;
    font-weight: 700;
}

.crm-kpi-card h3 {
    margin: 7px 0 0;
    color: #0f172a;
    font-size: 1.8rem;
    font-weight: 900;
    line-height: 1.1;
}

.crm-kpi-card h3 b {
    color: #cbd5e1;
}

.crm-kpi-card small {
    display: block;
    margin-top: 8px;
    color: #64748b;
    font-size: .86rem;
    font-weight: 700;
}

.kpi-sales .kpi-icon { color: #fff; background: rgba(255, 255, 255, .18); }
.kpi-purchases .kpi-icon { color: #b45309; background: #fef3c7; }
.kpi-profit .kpi-icon { color: #16a34a; background: #dcfce7; }
.kpi-ar .kpi-icon { color: #dc2626; background: #fee2e2; }
.kpi-ap .kpi-icon { color: #7c3aed; background: #ede9fe; }
.kpi-partners .kpi-icon { color: #334155; background: #f1f5f9; }

.crm-main-grid,
.crm-workspace-grid,
.crm-tables-grid {
    display: grid;
    gap: 18px;
}

.crm-main-grid {
    grid-template-columns: minmax(0, 8fr) minmax(300px, 4fr);
}

.crm-workspace-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(280px, .85fr) minmax(300px, 1fr);
}

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

.crm-panel {
    overflow: hidden;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 18px 46px rgba(15, 23, 42, .05);
}

.crm-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, .12);
}

.crm-panel-header p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: .9rem;
    font-weight: 600;
}

.crm-chart-wrap,
.crm-alert-list,
.crm-recommendation-list,
.crm-pulse-list,
.crm-shortcuts,
.crm-panel > .table-responsive {
    padding: 18px 20px 22px;
}

.crm-chart-wrap {
    height: 320px;
}

.crm-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: 6px 11px;
    border-radius: 999px;
    color: #1d4ed8;
    background: #dbeafe;
    font-size: 12px;
    font-weight: 900;
}

.crm-alert-list,
.crm-recommendation-list,
.crm-pulse-list {
    display: grid;
    gap: 12px;
}

.crm-alert-item,
.crm-recommendation {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 18px;
    background: #f8fbff;
}

.crm-alert-dot {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    margin-top: 6px;
    border-radius: 50%;
}

.crm-alert-item h6,
.crm-recommendation h6 {
    margin: 0 0 5px;
    color: #0f172a;
    font-size: 14px;
    font-weight: 900;
}

.crm-alert-item p,
.crm-recommendation p {
    margin: 0;
    color: #475569;
    font-size: .9rem;
    font-weight: 600;
}

.alert-danger-x { border-color: #fecaca; background: #fff7f7; }
.alert-warning-x { border-color: #fde68a; background: #fffaf0; }
.alert-info-x { border-color: #bfdbfe; background: #f8fbff; }
.dot-danger { background: #dc2626; }
.dot-warning { background: #d97706; }
.dot-info { background: #2563eb; }

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

.crm-shortcuts a {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 62px;
    padding: 15px;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 18px;
    color: #0f172a;
    background: #f8fbff;
    font-size: .94rem;
    font-weight: 800;
    text-decoration: none;
    transition: background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.crm-shortcuts a:hover {
    color: #0f172a;
    border-color: rgba(96, 165, 250, .3);
    background: #eef4ff;
    transform: translateY(-2px);
    box-shadow: 0 18px 30px rgba(99, 102, 241, .08);
}

.crm-shortcuts i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 14px;
    color: #2563eb;
    background: rgba(37, 99, 235, .12);
    font-size: 1.16rem;
}

.crm-pulse-row > div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: #475569;
    font-size: .9rem;
    font-weight: 800;
}

.crm-progress {
    overflow: hidden;
    height: 9px;
    border-radius: 999px;
    background: #e2e8f0;
}

.crm-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #2563eb;
    transition: width .35s ease;
}

.crm-progress-purple span { background: #7c3aed; }
.crm-progress-red span { background: #dc2626; }

.crm-recommendation-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 14px;
    color: #2563eb;
    background: rgba(37, 99, 235, .12);
}

.crm-table {
    margin-bottom: 0;
}

.crm-table thead th {
    border-bottom: 1px solid rgba(148, 163, 184, .18);
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.crm-table tbody td {
    border-color: rgba(148, 163, 184, .12);
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.partner-name {
    color: #0f172a;
    font-weight: 900;
}

.partner-code {
    display: block;
    margin-top: 3px;
    color: #94a3b8;
    font-size: 11px;
}

.status-pill {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 999px;
    color: #475569;
    background: #e2e8f0;
    font-size: 11px;
    font-weight: 900;
}

.empty-row {
    padding: 22px !important;
    color: #94a3b8 !important;
    text-align: center;
}

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

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

    .crm-next-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1100px) {
    .crm-main-grid,
    .crm-workspace-grid,
    .crm-tables-grid {
        grid-template-columns: 1fr;
    }

    .crm-next-panel {
        grid-column: auto;
    }

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

@media (max-width: 1024px) {
    .crm-page {
        padding-top: 76px;
    }
}

@media (max-width: 700px) {
    .crm-page {
        padding: 72px 14px 18px;
    }

    .crm-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .crm-hero-actions,
    .crm-hero-actions .btn,
    .crm-btn {
        width: 100%;
    }

    .crm-hero-actions .btn,
    .crm-btn {
        justify-content: center;
    }

    .crm-kpi-grid,
    .crm-shortcuts {
        grid-template-columns: 1fr;
    }

    .crm-panel-header {
        display: block;
    }

    .crm-chart-wrap {
        height: 260px;
    }
}

@media (max-width: 480px) {
    .crm-hero h1 {
        font-size: 26px;
    }

    .crm-kpi-card {
        min-height: 132px;
        padding: 18px;
    }

    .crm-kpi-card h3 {
        font-size: 1.55rem;
    }

    .crm-chart-wrap,
    .crm-alert-list,
    .crm-recommendation-list,
    .crm-pulse-list,
    .crm-shortcuts,
    .crm-panel > .table-responsive {
        padding: 14px;
    }
}
