/**
 * مراقبة أخطاء العملاء — هيكل ثابت يظهر فوراً قبل اكتمال الجلب
 */
.cea-panel,
.cea-panel-modal #cea-modal-body {
    --cea-primary: var(--primary-color, #2563eb);
    --cea-danger: #b91c1c;
    --cea-danger-dark: #7f1d1d;
    --cea-border: #e2e8f0;
    --cea-muted: #64748b;
    --cea-text: #0f172a;
    --cea-surface: #ffffff;
    --cea-soft: #f8fafc;
    font-family: inherit;
    color: var(--cea-text);
}

.cea-panel {
    padding: 1rem 1.1rem 1.35rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--cea-border);
    border-radius: 18px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
    min-height: 420px;
}

.cea-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.cea-toolbar__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.875rem;
    color: var(--cea-muted);
}

.cea-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cea-live-dot {
    font-weight: 800;
}

.cea-sync-hint {
    font-size: 0.75rem;
    color: #94a3b8;
}

.cea-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .cea-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.cea-stat {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    min-height: 88px;
    background: var(--cea-surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.cea-stat::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--cea-accent, var(--cea-primary));
}

.cea-stat:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.cea-stat__label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--cea-muted);
    margin-bottom: 0.35rem;
}

.cea-stat__value {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--cea-accent, var(--cea-text));
    font-variant-numeric: tabular-nums;
    direction: ltr;
    text-align: start;
    min-height: 1.5em;
}

.cea-stat.is-loading .cea-stat__value {
    color: transparent;
    border-radius: 8px;
    background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 45%, #e2e8f0 100%);
    background-size: 200% 100%;
    animation: cea-shimmer 1.1s linear infinite;
    width: 56%;
    max-width: 88px;
}

.cea-filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .cea-filters {
        grid-template-columns: 1.4fr 1fr 1fr auto;
        align-items: center;
    }
}

.cea-banner {
    margin-bottom: 0.75rem;
}

.cea-banner[hidden] {
    display: none !important;
}

.cea-alert {
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.cea-alert-warn {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.cea-alert-err {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.cea-alert-ok {
    background: #f0fdfa;
    color: #0f766e;
    border: 1px solid #99f6e4;
}

.cea-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--cea-border);
    border-radius: 14px;
    background: #fff;
    min-height: 220px;
}

.cea-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.cea-table thead tr {
    background: var(--cea-soft);
    text-align: right;
}

.cea-table th,
.cea-table td {
    padding: 0.65rem 0.7rem;
    border-top: 1px solid var(--cea-border);
    vertical-align: top;
}

.cea-table thead th {
    border-top: none;
    color: #475569;
    font-weight: 800;
    font-size: 0.78rem;
}

.cea-badge {
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
}

.cea-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.cea-row-actions button {
    font-size: 11px;
    padding: 4px 8px;
    white-space: nowrap;
}

.cea-row-actions button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.cea-empty {
    text-align: center;
    color: var(--cea-muted);
    padding: 2.5rem 1rem;
}

.cea-skeleton-row td {
    padding: 0.85rem 0.7rem;
}

.cea-skel {
    display: block;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #e2e8f0 0%, #f8fafc 45%, #e2e8f0 100%);
    background-size: 200% 100%;
    animation: cea-shimmer 1.1s linear infinite;
}

.cea-skel--lg { height: 16px; width: 78%; }
.cea-skel--md { height: 12px; width: 58%; }
.cea-skel--sm { height: 10px; width: 42%; }

@keyframes cea-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.cea-panel.is-booting .cea-table-wrap {
    opacity: 0.96;
}

@media (max-width: 480px) {
    .cea-panel {
        padding: 0.85rem;
        border-radius: 14px;
    }

    .cea-stat {
        min-height: 78px;
        padding: 0.75rem;
    }

    .cea-stat__value {
        font-size: 1.25rem;
    }
}
