/* CSS الرئيسي — مُستخرَج من index.php (المرحلة 0: فصل الأصول الثابتة) */
        body {
            font-family: 'Cairo', sans-serif;
            background-color: #f8fafc;
            color: #1e293b;
            min-height: 100vh;
        }
        .stat-card {
            border: 1px solid #e2e8f0;
            border-radius: 14px;
            background: #ffffff;
            box-shadow: 0 2px 8px rgba(0,0,0,0.03);
            transition: transform 0.2s, box-shadow 0.2s;
        }
        .stat-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.06);
        }
        .stat-icon {
            width: 46px;
            height: 46px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.25rem;
        }
        /* تصميم شاشة العمليات بالنمط الأبيض العصري */
        .hud-card {
            background: #ffffff;
            color: #1e293b;
            border: 1px solid #e2e8f0;
            border-radius: 14px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.04);
        }
        .hud-console {
            background: #f8fafc;
            border: 1px solid #e2e8f0;
            color: #334155;
            border-radius: 10px;
            font-family: 'SFMono-Regular', Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
            font-size: 0.82rem;
            line-height: 1.6;
            min-height: 120px;
            max-height: 200px;
            overflow-y: auto;
        }
        .table-card {
            border: 1px solid #e2e8f0;
            border-radius: 14px;
            background: #ffffff;
            box-shadow: 0 2px 10px rgba(0,0,0,0.03);
            overflow: hidden;
        }
        .table th {
            font-size: 0.82rem;
            font-weight: 700;
            color: #64748b;
            background-color: #f8fafc;
            border-bottom: 2px solid #e2e8f0;
            padding: 12px 14px;
        }
        .table td {
            font-size: 0.86rem;
            vertical-align: middle;
            padding: 12px 14px;
            border-bottom: 1px solid #f1f5f9;
        }
        .badge-cert-type {
            font-size: 0.75rem;
            font-weight: 600;
            padding: 4px 8px;
            border-radius: 6px;
            background: #e0f2fe;
            color: #0369a1;
        }
        .login-card {
            max-width: 460px;
            width: 100%;
            border-radius: 20px;
            border: none;
            box-shadow: 0 10px 30px rgba(0,0,0,0.08);
        }
        .btn-portal-primary {
            background-color: #0284c7;
            border-color: #0284c7;
            color: #ffffff;
            font-weight: 700;
            border-radius: 10px;
            padding: 9px 18px;
        }
        .btn-portal-primary:hover {
            background-color: #0369a1;
            border-color: #0369a1;
            color: #ffffff;
        }
        .nav-auth .nav-link {
            border-radius: 10px;
            font-weight: 700;
            font-size: 0.9rem;
            color: #64748b;
        }
        .nav-auth .nav-link.active {
            background-color: #0284c7;
            color: #ffffff;
        }
        /* بنية الشاشة والسايدبار الجانبي */
        .app-layout {
            display: flex;
            min-height: 100vh;
        }
        .app-sidebar {
            width: 260px;
            background: #ffffff;
            border-left: 1px solid #e2e8f0;
            display: flex;
            flex-direction: column;
            position: sticky;
            top: 0;
            height: 100vh;
            z-index: 1020;
            flex-shrink: 0;
        }
        .app-main {
            flex: 1;
            min-width: 0;
            background: #f8fafc;
            display: flex;
            flex-direction: column;
        }
        .sidebar-brand {
            padding: 18px 20px;
            border-bottom: 1px solid #f1f5f9;
        }
        .sidebar-menu {
            padding: 16px 12px;
            flex: 1;
            overflow-y: auto;
        }
        .sidebar-link {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 11px 14px;
            border-radius: 10px;
            color: #475569;
            font-weight: 600;
            font-size: 0.92rem;
            text-decoration: none;
            margin-bottom: 4px;
            transition: all 0.18s ease;
            border: 1px solid transparent;
            cursor: pointer;
        }
        .sidebar-link:hover {
            color: #0284c7;
            background: #f0f9ff;
        }
        .sidebar-link.active {
            color: #0284c7;
            background: #e0f2fe;
            font-weight: 700;
            border-color: #bae6fd;
        }
        .sidebar-link .icon {
            font-size: 1.15rem;
            width: 24px;
            text-align: center;
        }
        .sidebar-footer {
            padding: 14px 16px;
            border-top: 1px solid #f1f5f9;
            background: #fbfcfe;
        }
        .quick-action-card {
            border: 1px solid #e2e8f0;
            border-radius: 14px;
            background: #ffffff;
            padding: 20px;
            transition: all 0.2s ease;
            cursor: pointer;
            height: 100%;
        }
        .quick-action-card:hover {
            border-color: #0284c7;
            box-shadow: 0 4px 14px rgba(2, 132, 199, 0.1);
            transform: translateY(-2px);
        }
        @media (max-width: 991.98px) {
            .app-sidebar {
                position: fixed;
                right: -270px;
                top: 0;
                bottom: 0;
                box-shadow: -5px 0 25px rgba(0,0,0,0.15);
                transition: right 0.3s ease;
            }
            .app-sidebar.show {
                right: 0;
            }
            .sidebar-backdrop {
                display: none;
                position: fixed;
                inset: 0;
                background: rgba(0,0,0,0.4);
                z-index: 1015;
            }
            .sidebar-backdrop.show {
                display: block;
            }
        }
        /* Landing Page Styles */
        .landing-navbar {
            background: rgba(15, 23, 42, 0.95);
            backdrop-filter: blur(10px);
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }
        .landing-hero {
            background: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 75%, #020617 100%);
            color: #ffffff;
            padding: 95px 0 75px;
            position: relative;
        }
        .landing-feature-card {
            border: 1px solid #e2e8f0;
            border-radius: 18px;
            padding: 32px 24px;
            background: #ffffff;
            transition: all 0.3s ease;
            height: 100%;
        }
        .landing-feature-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.08);
            border-color: #cbd5e1;
        }
        .feature-icon-wrapper {
            width: 54px;
            height: 54px;
            border-radius: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.4rem;
            margin-bottom: 20px;
        }
        .step-circle {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: #0284c7;
            color: #ffffff;
            font-weight: bold;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 16px;
            font-size: 1.1rem;
        }

/* ==========================================================================
   P6 — جدول الوارد: نصوص طويلة بلا كسر التصميم (قرار المالك ٢٨/٠٩/٢٠٢٦)
   القصّ **بصري** فقط: القيمة الكاملة تبقى في الصف (`title`) وفي التصدير والتفاصيل.
   ========================================================================== */
/* القصّ على عنصر داخلي: أسلوب يعمل في كل المتصفحات (القصّ على <td> غير موثوق) */
.nz-clip {
    display: inline-block;
    vertical-align: middle;
    max-width: 15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
th.nz-col-wide { min-width: 12rem; }

/* ==========================================================================
   قرار المالك (٢٨/٠٩/٢٠٢٦): الجدولان (صادر/وارد) — خلايا **بعرض ثابت** + قصّ الأجزاء
   الأكبر + **تمركز كل البيانات** + تمرير أفقي مضمون (كان الجدول يتضخّم بالالتفاف
   ويُقتطع بلا أي إسكرول لأن الأب يقصّ المحتوى).
   ⛔ لا تُلمس قواعد الجوال أدناه (البطاقات المكدّسة) — التمركز والقصّ لسطح المكتب فقط.
   ========================================================================== */
/* (١) حاوية التمرير: عرض مقيّد + overflow-x مضمون مهما كان الأب */
.nz-grid-wrap {
    overflow-x: auto !important;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}
.nz-grid-wrap::-webkit-scrollbar { height: 10px; }
.nz-grid-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}
/* الأب يجب ألا يتضخّم مع الجدول (وإلا لن يظهر إسكرول) */
.table-card,
.card > .card-body.p-0 { min-width: 0; max-width: 100%; }
.table-card { overflow-x: hidden; }   /* يقصّ الأطراف فقط — التمرير داخل .nz-grid-wrap */

@media (min-width: 768px) {
    /* (٢) تخطيط ثابت: العرض يأتي من عروض الأعمدة المعلنة (ملف العرض/الجدول) */
    table.nz-grid {
        table-layout: fixed;
        width: max-content;
        min-width: 100%;
        margin-bottom: 0;
    }
    /* (٣) كل خلية: عرض ثابت + قصّ بصري + تمركز */
    table.nz-grid > thead > tr > th,
    table.nz-grid > tbody > tr > td {
        text-align: center !important;
        vertical-align: middle !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: .45rem .4rem;
    }
    /* المحتوى الداخلي: لا يتجاوز عرض الخلية (يقصّ بدل أن يوسّع الجدول) */
    table.nz-grid > tbody > tr > td > * {
        max-width: 100%;
    }
    table.nz-grid > tbody > tr > td > .d-flex {
        justify-content: center;
    }
    /* القصّ الموحّد داخل الخلايا: العرض يأتي من الخلية نفسها */
    table.nz-grid .nz-clip {
        display: block;
        max-width: 100%;
        margin: 0 auto;
    }
    /* أعمدة مساعدة */
    table.nz-grid .nz-col-w-xs { width: 5rem; }
    table.nz-grid .nz-col-w-sm { width: 7rem; }
    table.nz-grid .nz-col-w-md { width: 9rem; }
    table.nz-grid .nz-col-w-lg { width: 12rem; }
}

/* على الجوال: البطاقات المكدّسة تُلتف بلا قصّ (لا تُخفى معلومة) */
@media (max-width: 767.98px) {
    .nz-clip {
        display: block;
        max-width: none;
        white-space: normal;
        overflow-wrap: anywhere;
        text-align: end;
    }
}

/* =========================================================================
   المرحلة 9 — جداول متوافقة مع الجوال (بند 17)
   تحويل صفوف الجدول إلى بطاقات مقروءة تحت 768px، باستخدام data-label
   التي يضعها renderCertificates على كل خلية.
   ========================================================================= */
@media (max-width: 767.98px) {
    .nz-stack-table thead {
        display: none;
    }
    .nz-stack-table,
    .nz-stack-table tbody,
    .nz-stack-table tr,
    .nz-stack-table td {
        display: block;
        width: 100%;
    }
    .nz-stack-table tr {
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 8px 10px;
        margin-bottom: 10px;
        background: #ffffff;
        box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
    }
    .nz-stack-table td {
        border: 0 !important;
        padding: 4px 0 !important;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
        text-align: start;
    }
    .nz-stack-table td::before {
        content: attr(data-label);
        color: #64748b;
        font-size: .72rem;
        font-weight: 700;
        flex: 0 0 40%;
    }
    .nz-stack-table td > * {
        text-align: end;
    }
    /* خانات التحديد والإجراءات: عرض كامل بدون عنوان */
    .nz-stack-table td[data-label="تحديد"] {
        justify-content: flex-start;
    }
    .nz-stack-table td[data-label="تحديد"]::before {
        content: "تحديد الشهادة";
    }
    .nz-stack-table td[data-label="تفاصيل السحب"] {
        flex-direction: column;
        align-items: stretch;
    }
    .nz-stack-table td[data-label="تفاصيل السحب"]::before {
        margin-bottom: 4px;
    }
    /* أزرار الشريط العلوي للإجراءات الجماعية على الجوال */
    #certs-bulk-bar {
        flex-direction: column;
        align-items: stretch !important;
    }
    #certs-bulk-bar .btn {
        width: 100%;
    }
}

/* ==========================================================================
   المعاينة السريعة للشهادة داخل الجدول (البند #13 — المرحلة 11)
   صف قابل للطي تحت الشهادة: قراءة فورية بلا نافذة وبلا أي طلب شبكة.
   ========================================================================== */
tr.nz-pv-open > td { background: rgba(2, 132, 199, 0.06); }
.nz-preview-row > td.nz-preview-cell {
    padding: 0;
    background: #f8fafc;
    border-bottom: 2px solid rgba(2, 132, 199, 0.25);
}
.nz-preview-cell .nz-pv-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    padding: .6rem .9rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    font-size: .82rem;
}
.nz-preview-cell .nz-pv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1px;
    background: #e2e8f0;
}
.nz-preview-cell .nz-pv-cell {
    background: #fff;
    padding: .45rem .7rem;
    display: flex;
    flex-direction: column;
    gap: .1rem;
    min-width: 0;
}
.nz-preview-cell .nz-pv-wide { grid-column: span 2; }
.nz-preview-cell .nz-pv-lbl { color: #64748b; font-size: .68rem; font-weight: 600; }
.nz-preview-cell .nz-pv-val { color: #0f172a; font-size: .8rem; font-weight: 600; word-break: break-word; }
.nz-preview-cell .nz-pv-foot {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    padding: .55rem .9rem;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}
@media (max-width: 768px) {
    .nz-preview-cell .nz-pv-wide { grid-column: span 1; }
    .nz-preview-cell .nz-pv-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ==========================================================================
   شرائح الفلاتر المحفوظة (البند #16 — المرحلة 11)
   ========================================================================== */
.nz-sf-chip {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: 999px;
    padding: .15rem .2rem .15rem .6rem;
    font-size: .76rem;
}
.nz-sf-chip .nz-sf-apply { color: #1d4ed8; text-decoration: none; font-weight: 600; }
.nz-sf-chip .nz-sf-apply:hover { text-decoration: underline; }
.nz-sf-chip .nz-sf-del {
    border: 0;
    background: transparent;
    color: #dc2626;
    font-size: .95rem;
    line-height: 1;
    padding: 0 .25rem;
    cursor: pointer;
}
.nz-sf-chip .nz-sf-del:hover { background: rgba(220, 38, 38, 0.12); border-radius: 999px; }
@media (max-width: 768px) {
    #nz-saved-filters-bar { row-gap: .4rem; }
    #nz-saved-filters-bar .btn { width: 100%; }
}
