/* أرباح الشركة — تقرير الربحية المحسّن */

.cp-report {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cp-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    margin: 0 0 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cp-section-title span {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted, #64748b);
}

/* KPI hero grid */
.cp-hero {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
}

.cp-kpi {
    position: relative;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-subtle, #e2e8f0);
    background: linear-gradient(145deg, #fff 0%, #f8fafc 100%);
    min-height: 88px;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.cp-kpi::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 4px;
    border-radius: 0 12px 12px 0;
}

.cp-kpi--theory::before { background: linear-gradient(180deg, #3b82f6, #2563eb); }
.cp-kpi--real::before { background: linear-gradient(180deg, #10b981, #059669); }
.cp-kpi--cash::before { background: linear-gradient(180deg, #8b5cf6, #7c3aed); }
.cp-kpi--expense::before { background: linear-gradient(180deg, #f59e0b, #d97706); }
.cp-kpi--net::before { background: linear-gradient(180deg, #0d9488, #0f766e); }

.cp-kpi__label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    line-height: 1.3;
}

.cp-kpi__value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    line-height: 1.2;
}

.cp-kpi__hint {
    font-size: 0.7rem;
    color: var(--text-muted, #94a3b8);
}

.cp-kpi--net {
    background: linear-gradient(145deg, #f0fdfa 0%, #ecfeff 100%);
    border-color: #99f6e4;
}

/* Dual comparison panels */
.cp-dual {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.cp-panel {
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-subtle, #e2e8f0);
    background: #fff;
}

.cp-panel--theory {
    border-top: 3px solid #3b82f6;
}

.cp-panel--real {
    border-top: 3px solid #10b981;
}

.cp-panel h4 {
    margin: 0 0 0.75rem;
    font-size: 0.88rem;
    font-weight: 700;
}

.cp-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px dashed #f1f5f9;
    font-size: 0.82rem;
}

.cp-stat-row:last-child {
    border-bottom: none;
}

.cp-stat-row strong {
    font-variant-numeric: tabular-nums;
}

/* Realization progress */
.cp-realization {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
}

.cp-realization__head {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    margin-bottom: 0.35rem;
    color: var(--text-muted, #64748b);
}

.cp-realization__track {
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.cp-realization__fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #10b981, #059669);
    transition: width 0.4s ease;
}

/* Branch comparison chart */
.cp-branch-compare {
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-subtle, #e2e8f0);
    background: #fff;
}

.cp-branch-bars {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.cp-branch-row {
    display: grid;
    grid-template-columns: minmax(80px, 120px) 1fr minmax(70px, 90px);
    gap: 0.65rem;
    align-items: center;
}

.cp-branch-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
    line-height: 1.25;
}

.cp-branch-bar-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cp-bar-line {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.68rem;
    color: var(--text-muted, #64748b);
}

.cp-bar-track {
    flex: 1;
    height: 10px;
    border-radius: 999px;
    background: #f1f5f9;
    overflow: hidden;
    min-width: 0;
}

.cp-bar-fill {
    height: 100%;
    border-radius: 999px;
    min-width: 2px;
    transition: width 0.35s ease;
}

.cp-bar-fill--theory { background: linear-gradient(90deg, #60a5fa, #3b82f6); }
.cp-bar-fill--real { background: linear-gradient(90deg, #34d399, #10b981); }

.cp-branch-pct {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted, #64748b);
}

/* Legend */
.cp-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.72rem;
    color: var(--text-muted, #64748b);
}

.cp-legend span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.cp-legend i {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

.cp-legend i.theory { background: #3b82f6; }
.cp-legend i.real { background: #10b981; }

/* Responsive tables wrapper */
.cp-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
    .cp-branch-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .cp-branch-pct {
        text-align: right;
    }

    .cp-kpi__value {
        font-size: 1rem;
    }
}
