* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    min-height: 100vh;
    font-family: 'IBM Plex Sans Arabic', IMBPlexSansArabic, system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    direction: rtl;
    background-color: #ffffff;
    color: #333333;
    font-size: 16px;
    line-height: 1.5;
}

/* ============================================================
   إزالة لون الزرقاء الأوتوماتيكي من جميع الروابط داخل خلايا البيانات
   (حل مشكلة الموبايل اللي بتحول الأرقام والهواتف للون أزرق تلقائياً)
   ============================================================ */
.field-value,
.field-value a,
.field-value *:link,
.field-value *:visited,
.field-value *:hover,
.field-value *:active,
.certificate-body a,
.certificate-body a:link,
.certificate-body a:visited,
.certificate-body a:hover,
.certificate-body a:active,
.cert-container a,
.cert-container a:link,
.cert-container a:visited,
.cert-container a:hover,
.cert-container a:active,
.qr-info a,
.qr-info a:link,
.qr-info a:visited,
.qr-info a:hover,
.qr-info a:active,
.multi-tag,
.multi-tag a,
.multi-tag a:link,
.multi-tag a:visited,
.multi-tag a:hover,
.multi-tag a:active {
    color: #1a1a1a !important;
    text-decoration: none !important;
    text-decoration-color: transparent !important;
    border: none !important;
    -webkit-text-fill-color: #1a1a1a !important;
}
/* حل خاص جداً لـ iPhone و iPad Safari اللي بيحط لون أزرق تلقائي للأرقام */
.field-value,
.cert-container,
.certificate-body {
    -webkit-touch-callout: default;
}

.page-container {
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    padding: 20px 32px 0 32px;
}

/* ============== شريط التحكم العلوي للأزرار (للكمبيوتر فقط) ============== */
.admin-toolbar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;  /* محاذاة منتصف عشان الـ toolbar يبقى أصغر ارتفاعاً */
    width: 100%;
    max-width: 1400px;
    margin: 0 auto 18px auto;  /* مسافة سفلية أصغر شوية */
    padding: 12px 18px;       /* padding مصغر شوية عشان كله يبقى أضيق */
    background: linear-gradient(135deg, #f4faf4 0%, #e9f6ec 100%);
    border: 1.5px solid #178352;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(23, 131, 82, 0.08);
}

.toolbar-left {
    display: flex;
    flex-direction: column;
    gap: 10px;     /* مسافة أصغر بين الأزرار */
    justify-content: center;
}

.toolbar-btn {
    font-family: inherit;
    font-size: 14.5px;         /* حجم خط أصغر شوية */
    font-weight: 600;
    padding: 9px 22px;         /* padding مصغر عشان الزر يبقى أضيق وأقصر */
    border-radius: 9px;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 180px;          /* عرض أدنى أصغر */
    text-align: center;
    line-height: 1.3;
}

.btn-back {
    background: #ffffff;
    color: #178352;
    border-color: #178352;
}
.btn-back:hover {
    background: #178352;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(23,131,82,0.2);
}

.btn-save {
    background: linear-gradient(90deg, #178352, #0f7a49);
    color: #fff;
    border-color: #0f7a49;
}
.btn-save:hover {
    background: linear-gradient(90deg, #0f7a49, #0c6d42);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(23,131,82,0.25);
}

/* زر تسجيل الخروج (أحمر فاتح لتباين جيد مع الأزرار الخضراء) */
.btn-logout {
    background: linear-gradient(90deg, #ffffff, #fff6f6);
    color: #c0392b;
    border: 1.5px solid #e2b3ad;
    font-weight: 600;
}
.btn-logout:hover {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    color: #fff;
    border-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(192, 57, 43, 0.22);
}

/* رابط صفحة تسجيل الدخول (يظهر لو المالك غير مسجل دخول ويريد يفتح الصفحة) */
.toolbar-link-enteradmin {
    display: inline-block;
    margin-top: 4px;
    padding: 5px 2px 0 2px;
    font-size: 13.5px;
    font-weight: 600;
    color: #0f7a49;
    text-decoration: none;
    border-bottom: 1.5px dashed #7ab897;
    width: fit-content;
    line-height: 1.3;
    transition: all 0.2s ease;
}
.toolbar-link-enteradmin:hover {
    color: #c0392b;
    border-color: #e74c3c;
    background: linear-gradient(90deg, transparent 60%, rgba(255, 243, 243, 0.95) 100%);
    border-radius: 3px;
    padding: 5px 6px 0 6px;
}
.toolbar-link-enteradmin:active {
    transform: scale(0.985);
}

.toolbar-right {
    display: flex;
    justify-content: flex-end;
}

/* ---- جزء الباركود (QR Code) للربط بالسيرفر والدومين ---- */
.qr-section {
    display: flex;
    flex-direction: row;
    gap: 12px;           /* مسافة أصغر بين صورة الباركود والروابط */
    align-items: center;
    background: #ffffff;
    padding: 10px 14px;  /* padding مصغر جداً عشان كله يبقى أضيق */
    border-radius: 10px;
    border: 1.5px solid #d5e6dd;
}
.qr-box {
    padding: 5px;        /* padding أصغر حول صورة الباركود */
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}
.qr-box img {
    width: 95px;         /* تصغير حجم الباركود من 150 إلى 95 بكسل (كافي للمسح) */
    height: 95px;
    display: block;
}
.qr-info {
    display: flex;
    flex-direction: column;
    gap: 5px;            /* مسافة أصغر بين السطور */
}
.qr-info h4 {            /* العنوان اللي فيه 📱 */
    margin: 0;
    padding: 0;
    font-size: 13.5px;  /* أصغر حجم للعنوان */
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.25;
}
.qr-info p {
    margin: 0;
    padding: 0;
    font-size: 12px;    /* أصغر حجم للروابط */
    color: #333;
    line-height: 1.45;
}
.qr-info code {
    background: #f5f5f5;
    color: #1a1a1a;
    padding: 2px 6px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 11.5px;
    display: inline-block;
    font-family: 'Consolas', 'Courier New', monospace;
    direction: ltr;
    margin-top: 2px;
}
.qr-note {
    font-size: 11px;
    color: #888;
    margin-top: 3px;
}

/* ============== نموذج تعديل بيانات الشهادة (للكمبيوتر فقط) ============== */
.edit-form-section {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto 28px auto;
    background: #fff;
    border: 1.5px solid #178352;
    border-radius: 14px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(23, 131, 82, 0.07);
}
.edit-form-header {
    background: linear-gradient(90deg, #178352 0%, #0f7a49 100%);
    padding: 16px 24px;
}
.edit-form-header h3 {
    font-size: 18px;
    color: #fff;
    font-weight: 600;
}
.edit-form {
    padding: 22px 26px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.edit-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.edit-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.edit-group label {
    font-size: 14.5px;
    font-weight: 600;
    color: #0f7a49;
    padding-right: 4px;
}
.edit-group input,
.edit-group select {
    font-family: inherit;
    font-size: 15px;
    padding: 11px 16px;
    border: 1.5px solid #d5d5d5;
    border-radius: 9px;
    background: #fff;
    color: #333;
    transition: all 0.2s ease;
    direction: rtl;
    outline: none;
}
.edit-group input:focus,
.edit-group select:focus {
    border-color: #178352;
    box-shadow: 0 0 0 3px rgba(23,131,82,0.12);
}
/* تنسيق الأقسام (fieldsets) داخل النموذج: إطار + عنوان لكل مجموعة بيانات */
.edit-fieldset {
    border: 1.5px solid #17835226;
    border-radius: 11px;
    padding: 16px 20px 20px 20px;
    margin: 0;
    background: linear-gradient(180deg, #f4fbf7 0%, #ffffff 45%);
    direction: rtl;
}
.edit-fieldset legend {
    padding: 5px 15px;
    background: linear-gradient(90deg, #178352, #0f7a49);
    color: #fff;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.2px;
    margin-right: 6px;
}
/* edit-full = خيار الأخذ بالعرض الكامل بدلاً من نصف الشبكة */
.edit-group.edit-full {
    grid-column: 1 / -1;
    width: 100%;
}
.edit-form-footer {
    display: flex;
    gap: 14px;
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px dashed #d8d8d8;
}
.btn {
    font-family: inherit;
    font-size: 15.5px;
    font-weight: 600;
    padding: 12px 30px;
    border-radius: 10px;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.2s ease;
}
.btn-primary {
    background: linear-gradient(90deg, #178352, #0f7a49);
    color: #fff;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(23,131,82,0.25);
}
.btn-secondary {
    background: #fff;
    color: #555;
    border-color: #ccc;
}
.btn-secondary:hover {
    background: #f5f5f5;
    color: #333;
}

/* =============================================================== */

.main-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 0 0 0;
    margin-bottom: 0;
}

.header-right,
.header-left {
    flex: 0 0 auto;
    min-width: 0;
}

.header-center {
    flex: 1;
    min-width: 0;
}

.header-right {
    display: flex;
    justify-content: flex-end;
    padding-right: 0;
}

.header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.header-left {
    display: flex;
    justify-content: flex-start;
    padding-left: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    margin-top: -12px;
}

.balady-official-logo {
    height: 180px;
    width: auto;
    object-fit: contain;
    position: relative;
    z-index: 1;
}

.center-title {
    font-size: 20px;
    font-weight: 700;
    color: #7da026;
    margin-bottom: 8px;
}

.center-subtitle {
    font-size: 14px;
    font-weight: 500;
    color: #0f7d62;
}

.ministry-logo {
    display: flex;
    align-items: center;
}

.ministry-official-logo {
    height: 140px;
    width: auto;
    object-fit: contain;
    position: relative;
    z-index: 1;
}

.form-section {
    margin-bottom: 32px;
    overflow: visible;
}

.section-header {
    width: 100%;
    min-height: 46px;
    background: linear-gradient(90deg, #178352 0%, #0f7a49 100%);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 40px;
    border-radius: 10px 10px 0 0;
    position: relative;
    z-index: 10;
    margin-right: -24px;
    margin-left: -24px;
    width: calc(100% + 48px);
}

.section-title {
    font-size: 17px;
    font-weight: 600;
    color: #ffffff;
}

.section-body {
    background-color: #ffffff;
    padding: 28px 0px 32px 40px;
    border-radius: 0 0 0 0;
    margin-right: -24px;
    margin-left: -24px;
    width: calc(100% + 48px);
}

.form-row {
    display: flex;
    gap: 28px;
    margin-bottom: 10px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group.full-row-only {
    max-width: 50%;
    margin-left: auto;
    margin-right: 0;
}

.field-label {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0px;
    text-align: right;
    padding-right: 0;
}

/* إعدادات خاصة فقط لرفع الأقسام المحددة وتقريبها من الأقسام اللي فوقها */
.tight-top-spacing {
    margin-top: -6px; /* لقسم بيانات الشهادة عشان الشريط الأخضر يظهر فوق الجزء الأبيض السفلي للوجو (تداخل بسيط 6px) */
}
.maarifa-tight-section,
.maarifa-tight-section + .tight-top-spacing,
.maarifa-tight-section + .tight-top-spacing + .tight-top-spacing {
    margin-top: -44px; /* لمعرف المنشأة، والتواصل، والتقييم عشان يطلعوا أكتر لفوق (زيادة صغيرة 4px) */
}

.field-value {
    width: 100%;
    height: 40px;
    padding: 4px 18px;
    background-color: #f3f3f3;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    color: #666666;
    text-align: left;
    font-family: inherit;
    outline: none;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

select.field-value.field-value-dropdown {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23333333' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: 16px center;
    background-size: 18px 18px;
    padding: 4px 18px 4px 50px;
    cursor: pointer;
    display: block;
    direction: rtl;
    text-align: right;
}

select.field-value.field-value-dropdown::-ms-expand {
    display: none;
}

select.field-value.field-value-dropdown option {
    background-color: #ffffff;
    color: #333333;
    font-family: inherit;
    font-size: 15px;
    padding: 10px 14px;
    direction: rtl;
    text-align: right;
}

.field-value-status {
    color: #666666;
    font-weight: 500;
}

/* ===== تنسيقات الخلايا متعددة القيم (أعضاء مجلس الإدارة + أنشطة المنشأة) ===== */
.field-value.field-value-multi {
    height: auto !important;      /* بدل الارتفاع الثابت 40px، خليه يتناسب مع عدد الـ Tags */
    min-height: 40px;             /* أقل ارتفاع ممكن لو كان فيه عضو واحد أو نشاط واحد */
    padding: 8px 14px;
    flex-wrap: wrap;              /* يسمح بتوزيع الـ Tags على أكتر من صف لو كثروا */
    gap: 6px 10px;                /* مسافة بين كل tag والتاني، وبين الأسطر */
    align-content: center;
    display: flex;
    align-items: center;
}
/* الـ Tags داخل الخلية الرمادية في المعاينة */
.multi-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    white-space: nowrap;
}
.tag-green {
    background: #f3f3f3;
    color: #333333;
    border: 1px solid #d0d0d0;
}
.tag-blue {
    background: #f3f3f3;
    color: #333333;
    border: 1px solid #d0d0d0;
}
/* الفاصل بين الـ Tags داخل نفس الخلية */
.multi-sep {
    color: #888;
    font-weight: 700;
    font-size: 15px;
}

/* ===== تنسيقات منطقة إدخال الـ Tags المتعددة داخل نموذج التعديل ===== */
.multi-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1.5px solid #d5d5d5;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fafafa;
    transition: all 0.2s ease;
}
.multi-input-wrapper:focus-within {
    border-color: #178352;
    box-shadow: 0 0 0 3px rgba(23,131,82,0.12);
    background: #fff;
}
.multi-input-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 36px;
    align-items: center;
}
.multi-input-tags .multi-tag {
    font-size: 14.5px;
    padding: 5px 8px 5px 12px;
    border-radius: 7px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    gap: 8px;
}
/* زر ✕ اللي داخل الـ Tag عشان يمسحه */
.tag-remove {
    all: unset;
    width: 20px;
    height: 20px;
    line-height: 1;
    border-radius: 50%;
    background: rgba(0,0,0,0.08);
    color: #555;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}
.tag-remove:hover {
    background: #e74c3c;
    color: #fff;
    transform: scale(1.1);
}
.multi-input-add-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    border-top: 1px dashed #e4e4e4;
    padding-top: 10px;
}
.multi-input-add {
    font-family: inherit;
    font-size: 14.5px;
    padding: 9px 14px;
    border: 1px solid #d5d5d5;
    border-radius: 8px;
    direction: rtl;
    outline: none;
    background: #fff;
    color: #333;
}
.multi-input-add:focus {
    border-color: #178352;
    box-shadow: 0 0 0 2px rgba(23,131,82,0.1);
}
.btn-add-item {
    padding: 9px 16px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    background: linear-gradient(90deg, #178352, #0f7a49) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
.btn-add-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(23,131,82,0.22);
}

.field-label-status-bold {
    font-size: 13px;
    font-weight: 700;
}

.cert-data-section .field-label {
    font-size: 13px;
    font-weight: 700;
}

.rating-table-wrapper {
    width: 100%;
    padding: 12px 0;
}

.rating-table {
    width: auto;
    max-width: 55%;
    margin-left: auto;
    margin-right: 0;
    border-collapse: collapse;
    table-layout: auto;
}

.rating-table thead {
    background-color: #f5f6f8;
}

.rating-table th {
    padding: 14px 42px;
    font-size: 15px;
    font-weight: 700;
    color: #333;
    text-align: right;
    border-bottom: 2px solid #e5e5e5;
    white-space: nowrap;
}

.rating-table td {
    padding: 14px 42px;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    text-align: right;
    border-bottom: 1px solid #ececec;
    vertical-align: middle;
    white-space: nowrap;
}

.rating-table th:last-child,
.rating-table td:last-child {
    text-align: right;
    padding-right: 56px;
}

.rating-table th:first-child,
.rating-table td:first-child {
    text-align: center;
    padding-left: 56px;
}

.rating-table tbody tr:last-child td {
    border-bottom: none;
}

.criterion-name {
    font-weight: 600;
    color: #222;
    text-align: right;
}

.count-cell {
    font-weight: 600;
    font-size: 16px;
    text-align: center;
}

.stars-cell {
    text-align: center;
}

.stars-container {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    justify-content: center;
}

.star {
    font-size: 20px;
    color: #d1d5db;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
    line-height: 1;
}

.star.hovered,
.star.active {
    color: #fbbf24;
}

.rating-text {
    font-size: 15px;
    font-weight: 600;
    color: #555;
    margin-right: 6px;
    white-space: nowrap;
}

.certificate-body {
    padding: 36px 32px 40px 32px;
}

.certificate-logo-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
}

.certificate-logo {
    width: 58px;
    height: 58px;
}

.download-btn-wrapper {
    display: flex;
    justify-content: center;
}

.download-btn {
    min-width: 140px;
    min-height: 52px;
    padding: 12px 36px;
    background: linear-gradient(90deg, #178352 0%, #0f7a49 100%);
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.download-btn:hover {
    background: linear-gradient(90deg, #147a4a 0%, #0d6f42 100%);
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

.download-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.main-footer {
    width: 100%;
    background: linear-gradient(90deg, #0d4d4d 0%, #0a4242 100%);
    margin: 24px -32px 0 -32px;
    padding: 18px 32px;
}

.copyright-text {
    font-size: 14px;
    font-weight: 600;
    color: #f0f0f0;
    text-align: right;
    direction: rtl;
}

@media (max-width: 1440px) {
    .page-container {
        padding: 18px 24px 0 24px;
    }
    .main-footer {
        margin: 24px -24px 0 -24px;
        padding: 16px 24px;
    }
    .balady-official-logo {
        height: 155px;
    }
    .ministry-official-logo {
        height: 115px;
    }
    .center-title {
        font-size: 18px;
    }
    .center-subtitle {
        font-size: 12px;
        font-weight: 500;
    }
    .logo-container {
        margin-top: -10px;
    }
}

@media (max-width: 1280px) {
    .form-row {
        gap: 20px;
    }
    .section-body {
        padding: 22px 0px 26px 40px;
        margin-right: -24px;
        margin-left: -24px;
        width: calc(100% + 48px);
    }
    .tight-top-spacing {
        margin-top: -6px;
    }
    .maarifa-tight-section,
    .maarifa-tight-section + .tight-top-spacing,
    .maarifa-tight-section + .tight-top-spacing + .tight-top-spacing {
        margin-top: -44px;
    }
    .rating-table {
        max-width: 60%;
        margin-left: auto;
        margin-right: 0;
    }
}

/* ===================== إعدادات الطباعة (Print & PDF) - مطابق لصور الموقع الرسمي (3 أوراق) ===================== */
@page {
    size: A4;
    /* أترك الهوامش على الافتراضي للمتصفح عشان يظهر الهيدر والفوتر تلقائياً (التاريخ+العنوان فوق، URL+رقم الصفحة زي 1/3 تحت) */
}

@media print {
    /* ===== أولاً: الحفاظ على نفس تنسيق الشاشة بالظبط (لا نغير أي مسافات أو أحجام نعملها في المحادثة) ===== */
    html, body {
        width: 100%;
        background-color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        color-adjust: exact;
    }

    .page-container {
        max-width: 100%;
        width: 100%;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* ===== إخفاء زر التنزيل وأي أزرار تفاعلية وقت الطباعة ===== */
    .download-btn,
    button,
    .no-print {
        display: none !important;
    }

    /* ===== الإصرار على إظهار نفس الألوان في الشاشة وقت الطباعة (كلاسيك) ===== */
    .center-title { color: #7da026 !important; }
    .center-subtitle { color: #0f7d62 !important; }
    .field-value-status { color: #666666 !important; font-weight: 500 !important; }

    .section-header {
        background: linear-gradient(90deg, #178352 0%, #0f7a49 100%) !important;
        border-radius: 10px 10px 0 0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .field-value {
        background-color: #f3f3f3 !important;
        border: 1px solid #d9d9d9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* ===== منع كسر أي قسم داخلي بين صفحتين ===== */
    .form-section,
    .section-body,
    .form-row,
    .star-rating,
    .rating-table-wrapper {
        page-break-inside: avoid;
        break-inside: avoid;
    }
    .section-header {
        page-break-after: avoid;
        break-after: avoid;
    }

    /* ===== ⭐ أهم جزء: تقسيم الأوراق إلى 3 صفحات بالظبط زي الموقع الرسمي ⭐ =====
       الصفحة 1: الهيدر (اللوجوهات+العناوين) + بيانات الشهادة + بيانات معرف المنشأة
       الصفحة 2: التواصل مع المنشأة + تقييم المنشأة
       الصفحة 3: قسم الشهادة (الأخير)
    */
    /* 1. بعد نهاية قسم "بيانات معرف المنشأة" → إجبار كسر للصفحة (نهاية الصفحة الاولى) */
    .maarifa-tight-section {
        break-after: page;
        page-break-after: always;
    }

    /* 2. بعد نهاية قسم "تقييم المنشأة" → إجبار كسر للصفحة (نهاية الصفحة التانية)
       ملاحظة: قسم تقييم المنشأة هو ثاني قسم .tight-top-spacing اللي ييجي بعد maarifa-tight-section
       يعني هو القسم اللي عنده ترتيب: .maarifa-tight-section + .tight-top-spacing + .tight-top-spacing
    */
    .maarifa-tight-section + .tight-top-spacing + .tight-top-spacing {
        break-after: page;
        page-break-after: always;
    }
}

/* ==========================================================
   ====== RESPONSIVE: أجهزة الموبايل (صحح ظهور الشهادة) ======
   ========================================================== */

/* --- Tablet و Large Phone (حتى 1024 بكسل - iPad, Fold, Max) --- */
@media (max-width: 1024px) {
    .page-container {
        padding: 14px 16px 0 16px;
        max-width: 100%;
    }

    .main-header {
        flex-wrap: wrap;
        gap: 12px;
        padding-bottom: 14px;
    }

    .header-right,
    .header-left {
        flex: 0 0 auto;
    }

    .header-center {
        flex: 1 0 100%;
        order: -1;
        text-align: center;
        margin-bottom: 10px;
    }

    .ministry-official-logo {
        height: 90px !important;
    }

    .balady-official-logo {
        height: 95px !important;
    }

    .center-title {
        font-size: 18px !important;
        margin-bottom: 6px;
    }

    .center-subtitle {
        font-size: 13px !important;
    }

    .section-header {
        min-height: 42px;
        padding: 0 18px;
    }

    .section-title {
        font-size: 15px;
    }

    .section-body {
        padding: 22px 0 26px 22px !important;
        margin-right: -16px !important;
        margin-left: -16px !important;
        width: calc(100% + 32px) !important;
    }

    .section-header {
        margin-right: -16px;
        margin-left: -16px;
        width: calc(100% + 32px);
        padding: 0 30px;
    }

    .form-row {
        flex-direction: column;
        gap: 14px;
    }

    .form-group.full-row-only {
        max-width: 100% !important;
    }

    .form-group {
        width: 100%;
    }

    .rating-table {
        max-width: 100% !important;
        width: 100% !important;
        margin-left: 0 !important;
    }

    .rating-table th,
    .rating-table td {
        padding: 10px 14px !important;
        font-size: 13px !important;
    }

    .certificate-logo-wrapper {
        margin-left: 0;
        margin-top: 14px;
    }

    .certificate-logo {
        width: 70px;
        height: auto;
    }

    .certificate-badge-content {
        flex-direction: column;
        align-items: center;
    }

    .main-footer {
        margin: 20px -16px 0 -16px;
        padding: 14px 18px;
    }

    .copyright-text {
        font-size: 12px;
        text-align: center !important;
    }
}

/* --- Medium Phone (iPhone 12/13/14, Galaxy S حتى 767 بكسل) ---
   ==================================================================
   ★★★ تعديلات جديدة لتصبح مطابقة لـ iPhone 15 Pro Max من الموقع الرسمي ★★★
   ================================================================== */
@media (max-width: 767px) {
    html, body {
        width: 100%;
        overflow-x: auto; /* السكرول أفقي طبيعي عشان المستخدم يقدر يودي الصفحة يمين وشمال طبيعي لو محتاج */
        overflow-y: auto; /* السكرول عمودي طبيعي */
        -webkit-overflow-scrolling: touch; /* سكرول سلس على آيفون وجميع أجهزة الموبايل */
    }
    /* ===== إخفاء جميع أجزاء الديسكتوب (الأزرار + نموذج التعديل + الباركود) تماماً في الموبايل ===== */
    .desktop-only,
    .admin-toolbar,
    .edit-form-section,
    .qr-section,
    .toolbar-left,
    .toolbar-right {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    .page-container {
        padding: 0;
        background: #fff;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: visible; /* تسمح بالسكرول في كل الاتجاهات بدون قطع */
    }

    /* === الهيدر مطابق 100% للصورة الصحيحة اللي بعتها دلوقتي (آيفون 15 برو ماكس):
       ✅ التفاصيل الدقيقة من الصورة الجديدة:
         1️⃣ .header-right   → لوجو وزارة البلديات فوق يمين الصفحة، مع اسم الوزارة تحته محاذي لليمين
         2️⃣ .header-center  → اسم المؤسسة كبير جداً بعد مسافة كبيرة من اسم الوزارة، ثم المعلومات تحتها بهوامش يمين صغيرة (7%)
         3️⃣ .header-left    → لوجو بلدي (تنظيم مشغلي المدن) في مستوى اسم الشركة على اليسار (أعلى من القاع بكتير)
    === */
    .main-header {
        display: block;
        padding: 22px 14px 18px 14px;
        gap: 0;
        position: relative;
        min-height: 390px;
    }

    /* 1️⃣ لوجو وزارة البلديات: فوق يمين الصفحة بحجم الدائرة في الصورة الجديدة */
    .header-right {
        display: block;
        width: auto;
        float: right;
        clear: none;
        margin: 0;
        padding: 0;
        text-align: right;
    }

    /* 2️⃣ اسم المؤسسة + العنوان:
         - اسم الشركة (h1): كبير وواضح، يأتي بعد مسافة كبيرة من اسم الوزارة (margin-top: 80px)
         - العنوان الفرعي: تحته بهوامش يمين صغيرة جداً (7%) عشان تبقى قريبة من بداية اسم الشركة زي الأصل
    */
    .header-center {
        display: block;
        width: 98%;
        float: right;
        clear: both;
        margin-top: 80px;
        padding: 0;
        text-align: right;
    }

    /* 3️⃣ لوجو تنظيم مشغلي المدن — تحت المعلومات التفصيلية مباشرة وقريب منها، عرض وارتفاع أكبر وأوضح */
    .header-left {
        display: block;
        position: absolute;
        left: -180px;
        top: 395px;
        bottom: auto;
        width: 118%;
        text-align: left;
        margin-top: 0;
        padding-left: 0;
        float: none;
        background: transparent !important;
        z-index: 1;
    }

    .ministry-official-logo {
        height: 120px !important;
        max-width: 100%;
        float: right;
        background: transparent !important;
    }

    .logo-container {
        background: transparent !important;
        margin: 0;
        padding: 0;
    }

    .balady-official-logo {
        height: 260px !important;
        max-width: 100%;
        width: 100% !important;
        object-fit: contain;
        object-position: left center;
        background: transparent !important;
        mix-blend-mode: multiply;
        isolation: isolate;
        opacity: 1;
        display: block;
    }

    /* اسم الشركة + المعلومات — أول حرف في الجملة (م) يبدأ من منتصف كلمة الإسكان في لوجو الوزارة */
    .header-center {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: flex-start;
        width: auto;
        margin: 0;
        padding: 0;
        position: absolute;
        right: 138px;
        left: auto;
        top: 192px;
        text-align: right;
    }

    /* اسم الشركة: أول حرف (م) منتصف كلمة الإسكان — موضع جديد شمال شوية */
    .center-title {
        font-size: 22px !important;
        font-weight: 400 !important;
        margin: 0 0 18px 0 !important;
        letter-spacing: 0;
        text-align: right;
        align-self: flex-end;
        padding: 0;
        line-height: 1.25;
        color: #89ad2b;
        direction: rtl;
        white-space: nowrap;
        word-break: keep-all;
        display: block;
    }

    /* المعلومات التفصيلية: في المنتصف الأفقي تحت جملة مؤسسة جسور اللي فوقها */
    .center-subtitle {
        font-size: 16px !important;
        line-height: 1.8;
        text-align: center;
        font-weight: 400 !important;
        padding: 0;
        color: #0c7a5f;
        margin: 0 !important;
        display: block;
        width: 100%;
        align-self: center;
    }

    .ministry-logo,
    .logo-container {
        margin: 0;
        padding: 0;
    }

    /* فلوت كلير */
    .main-header::after {
        content: "";
        display: table;
        clear: both;
    }

    /* الشريط الأخضر: اليمين ثابت زي مهو، والشمال يمتد شمالاً ويتوقف بعد لوجو تنظيم */
    .section-header {
        min-height: 43px; /* ارتفاع الشريط اللي فوق (بيانات الشهادة) - ثابت */
        border-radius: 14px 14px 0 0;
        margin-right: 18px; /* ثابت تماماً زي مهو، غير متغير */
        margin-left: -195px; /* شمال يمتد أكتر ويتوقف بعد لوجو تنظيم (-180px) ب 15 بكسل */
        width: calc(100% + 213px); /* يعوض الإمتداد الشمالي الجديد + اليمين الثابت */
        padding: 0 20px 0 24px !important; /* إرجاع padding الأصلي لأن النص هنا مش المطلوب تعديله */
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    }

    /* الشريط الأخضر الخاص بـ قسم الشهادة (فوق لوجو أكروبات وزر التنزيل) - تقليل ارتفاعه شوية صغيرين فقط */
    .form-section:nth-of-type(2) .section-header,
    section.form-section:last-of-type .section-header {
        min-height: 36px !important; /* تقليل ارتفاع الشريط الاخضر الخاص بتنزيل شوية صغيرين */
        height: 36px !important; /* force الارتفاع 36px */
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        line-height: 36px !important; /* النص يبقى في منتصف الارتفاع الصغير */
    }

    .form-section:nth-of-type(2) .section-title,
    section.form-section:last-of-type .section-title {
        font-size: 15px !important; /* تصغير حجم الخط شوية عشان يتناسب مع ارتفاع الشريط الصغير */
    }

    .section-title {
        font-size: 17px !important; /* تكبير حجم الكلام داخل الشريط الأخضر */
        font-weight: 400 !important; /* إزالة البولد من عنوان الشريط الأخضر (حالة/بيانات الشهادة) */
    }

    .section-body {
        padding: 22px 20px 26px 54px !important;
        margin-right: 18px !important; /* ثابت تماماً زي مهو */
        margin-left: -195px !important; /* نفس الشمال بتاع الشريط فوق */
        width: calc(100% + 213px) !important;
    }

    /* الحقول في عمود واحد زي الأصل (مش عمودين) مع مسافات أفضل */
    .form-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 20px 0;
    }

    .form-group,
    .form-group.full-row-only {
        width: 100%;
    }

    .field-label {
        font-size: 16px !important; /* إرجاع الحجم الأصلي لقصد كان قبل التصغير (مش عنوان الشريط) */
        font-weight: 400 !important; /* إزالة البولد من عناوين الحقول فوق البلوكات */
        margin-bottom: 7px !important;
        text-align: right !important;
        direction: rtl !important;
        margin-right: -14px !important; /* تحريك الـ Label يمين بنفس مقدار الخلية الرمادية تحت (-14px) عشان يبقى في نفس المحاذاة بالظبط */
        margin-left: 0 !important;
        padding: 0 !important;
        width: calc(100% - 320px) !important; /* نفس عرض الخلية الرمادية تحتها بالظبط (100% - margin-left بتاع الخلية 320px) */
        float: right !important;
        color: #000 !important;
    }

    /* الحقول الرمادية: الحجم ثابت زي مهو، تحريك يمين شوية لمحاذاة حافة الشريط الأخضر */
    .field-value,
    select.field-value.field-value-dropdown {
        height: 46px !important; /* تقليل ارتفاع الخلايا الرمادية شوية صغيرين (كان 50) */
        min-height: 46px !important; /* تقليل ارتفاع الخلايا الرمادية شوية صغيرين (كان 50) */
        padding: 7px 18px !important; /* padding متناسب مع الارتفاع الجديد */
        font-size: 18px !important; /* تقليل حجم شوية صغيرين عن القيمة السابقة (آيفون 15 برو ماكس) */
        font-weight: 400 !important; /* إزالة البولد من بيانات الحقول جوا البلوكات الرمادية */
        background-color: #f2f2f2 !important;
        border: 1px solid #c9c9c9 !important;
        border-radius: 5px !important;
        color: #555 !important;
        text-align: right !important; /* النص في الجهة اليمنى */
        direction: rtl !important; /* اتجاه الكتابة يمين لشمال ب force */
        margin-left: 320px !important; /* الحجم ثابت تماماً - متحركش */
        margin-right: -14px !important; /* تحريك يمين شوية لمحاذاة حافة الشريط الأخضر (نزيل فراغ padding اليمين الزائد) */
        max-width: none !important;
        width: auto !important; /* عدم السماح بعرض 100% عشان ما يعدلش الشمال، واليمين يملأ المساحة حتى الـ margin-left */
        display: flex !important;
        align-items: center !important;
        /* المهم جداً: في direction: rtl، flex-start = اليمين بصرياً (عكس العادة) */
        justify-content: flex-start !important;
        /* إزالة أي خط تحت الأرقام أو النصوص جوا الخلايا الرمادية فقط - بدون أي تعديل على الشرايط الخضراء أو الجداول */
        text-decoration: none !important;
        text-decoration-line: none !important;
        border-bottom: 1px solid #c9c9c9 !important; /* نحافظ على الحدود الخارجية للخلية نفسها، بس نزيل الخط اللي تحت النص جواها */
        background-image: none !important;
        box-shadow: none !important; /* أي خط أو ظل تحت الخلية اللي بيبقى شكل خط تحت الارقام */
    }

    /* ===== استثناء للخلية متعددة القيم (أنشطة المنشأة وأعضاء مجلس الإدارة) — لما بتكون أكتر من سطر */
    .field-value.field-value-multi {
        height: auto !important; /* خلي الارتفاع يتغير حسب عدد الـ tags (عضوين أو أكتر) */
        min-height: 46px !important; /* أقل ارتفاع ممكن هو الارتفاع الأصلي 46 */
        padding: 7px 14px !important; /* padding عريض شوية عشان يتناسب مع الـ tags */
        flex-wrap: wrap !important;
        gap: 5px 8px !important;
        align-content: center !important;
    }
    .field-value.field-value-multi .multi-tag {
        font-size: 17px !important;
        padding: 5px 11px !important;
        line-height: 1.4 !important;
        background: #f3f3f3 !important;
        color: #333333 !important;
        border: 1px solid #d0d0d0 !important;
        -webkit-text-fill-color: #333333 !important;
    }
    .field-value.field-value-multi .tag-green,
    .field-value.field-value-multi .tag-blue {
        background: #f3f3f3 !important;
        color: #333333 !important;
        border: 1px solid #d0d0d0 !important;
        -webkit-text-fill-color: #333333 !important;
    }
    .field-value.field-value-multi .multi-sep {
        font-size: 17px !important;
    }

    /* طبقة أمان ثالثة: أي عنصر داخل الحقل (مثلاً span) يروح يمين بـ 100% force + إزالة أي خط تحت أي عناصر جوا الخلايا الرمادية فقط */
    .field-value > *,
    .field-value span,
    .field-value div {
        margin-left: auto !important;
        margin-right: 0 !important;
        text-align: right !important;
        direction: rtl !important;
        /* إزالة أي خط تحت الأرقام جوا الخلايا الرمادية فقط */
        text-decoration: none !important;
        text-decoration-line: none !important;
        border-bottom: none !important;
        background-image: none !important;
    }

    /* ===== Dropdown الخاص بأعضاء مجلس الإدارة: تعديل خاص يتناسب مع 4 أو 5 أو 6 أسماء (تقليل العرض + الارتفاع) ===== */
    /* زي الـ specificity عالي بكتابة الكلاس اللي فيه الكلاسين مع بعض عشان يتغلب على القاعدة العامة فوق */
    form select.field-value.field-value-dropdown,
    .cert-data-section select.field-value.field-value-dropdown,
    select.field-value.field-value-dropdown {
        height: 40px !important; /* تأكيد 100% تقليل ارتفاع البلوك الأبيض بتاع أسماء الأعضاء (آيفون 15 برو ماكس) */
        min-height: 40px !important; /* تأكيد 100% تقليل ارتفاع البلوك الأبيض بتاع أسماء الأعضاء */
        padding: 4px 18px 4px 50px !important; /* padding متناسب مع الارتفاع الأصغر */
        /* === تصغير عرض البلوك الأبيض يكون على قد الاسم بالظبط (4-6 أسماء) بدلاً من العرض الكبير === */
        width: 310px !important; /* عرض ثابت مناسب لأي اسم من 4 لـ 6 أسماء */
        max-width: 310px !important;
        margin-left: auto !important; /* شمال يبقى مسافة مناسبة عشان العرض يصير على قد الاسم */
        margin-right: -14px !important; /* الحافة اليمنى تظل في نفس محاذاة باقي الخلايا */
        min-width: 310px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important; /* نفس الإصلاح للـ dropdown */
        direction: rtl !important;
        text-align: right !important;
        background-position: 14px center !important;
        background-color: #fff !important; /* خلفيته بيضاء زي مهو */
        color: #333 !important;
        font-weight: 400 !important; /* إزالة البولد من بيانات dropdown برضه */
    }

    /* === جدول التقييم: زي الأصل — 3 أعمدة (معايير يمين، نجوم وسط، نسبة شمال) === */
    .rating-table-wrapper {
        padding: 0 !important;
    }

    .rating-table {
        max-width: 100% !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        border-collapse: collapse;
        display: table !important;
    }

    .rating-table thead {
        display: table-header-group !important;
    }

    .rating-table thead tr {
        background-color: #f3f4f6 !important;
    }

    .rating-table th {
        display: table-cell !important;
        padding: 14px 10px !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        color: #333 !important;
        text-align: right !important;
        border-bottom: 2px solid #e5e5e5 !important;
        white-space: nowrap !important;
    }

    .rating-table th:first-child {
        text-align: center !important;
    }

    .rating-table th:last-child {
        text-align: right !important;
        padding-right: 18px !important;
    }

    .rating-table tbody {
        display: table-row-group !important;
    }

    .rating-table tr {
        display: table-row !important;
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin-bottom: 0 !important;
    }

    .rating-table td {
        display: table-cell !important;
        width: auto !important;
        max-width: none !important;
        padding: 14px 10px !important;
        border-bottom: 1px solid #ececec !important;
        font-size: 14px !important;
        text-align: right !important;
        position: static !important;
        padding-right: 10px !important;
        min-height: auto !important;
        white-space: nowrap !important;
        color: #333 !important;
        font-weight: 500 !important;
    }

    .rating-table td::before {
        display: none !important;
        content: none !important;
    }

    .rating-table td:last-child {
        padding-right: 18px !important;
        text-align: right !important;
    }

    .rating-table td:first-child {
        text-align: center !important;
        padding-left: 0 !important;
        padding-right: 10px !important;
    }

    .star {
        font-size: 22px !important;
        color: #dadada !important;
    }

    .star.active {
        color: #fbbf24 !important;
    }

    .count-cell {
        color: #111 !important;
        font-weight: 700 !important;
        font-size: 15px !important;
    }

    .criterion-name {
        font-weight: 600 !important;
        color: #222 !important;
        font-size: 15px !important;
    }

    .star-rating {
        font-size: 17px;
    }

    /* قسم الشهادة — زر تنزيل في المنتصف */
    .certificate-body {
        padding: 22px 20px 26px 20px !important;
        position: relative !important;
        z-index: 5 !important; /* عشان ما يختفيش تحت الشريط الكحلي أو أي عناصر تانية فوقه */
    }

    .certificate-logo-wrapper {
        margin-left: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 18px !important;
        position: relative !important;
        z-index: 6 !important; /* طبقة أعلى من أي عناصر تانية عشان اللوجو يظهر ثابت ومش بيختفي */
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .certificate-logo {
        width: 70px !important;
        height: 70px !important;
        display: block !important; /* عشان ما يختفيش (مش none) */
        visibility: visible !important; /* ظاهر 100% ثابت */
        opacity: 1 !important; /* شفافية كاملة، مش مخفي */
        position: relative !important;
        z-index: 7 !important; /* أعلى طبقة للصورة نفسها عشان تظهر فوق أي حاجة تانية */
    }

    .certificate-badge-title {
        font-size: 17px;
    }

    .certificate-badge-subtitle {
        font-size: 12px;
    }

    .certificate-meta-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .main-footer {
        margin-right: 18px !important; /* نفس margin اليمين بتاع الشريط الأخضر فوق بالظبط */
        margin-left: -195px !important; /* نفس margin الشمال بتاع الشريط الأخضر فوق (يمتد بعد لوجو تنظيم) */
        width: calc(100% + 213px) !important; /* نفس العرض بتاع الشريط الأخضر فوق بالظبط */
        padding: 14px 20px 14px 24px !important; /* نفس padding بتاع الشريط الأخضر فوق */
    }

    .copyright-text {
        font-size: 12px !important;
        font-weight: 400 !important; /* إزالة البولد من النص */
        color: #000000 !important; /* تغيير اللون إلى الأسود تماماً */
        line-height: 1.6;
        text-align: right !important;
        direction: rtl !important;
    }

    /* إزالة إعدادات tight على الموبايل وارجاعها للوضع الطبيعي */
    .cert-data-section {
        margin-top: 150px !important;
    }
    .tight-top-spacing {
        margin-top: 0;
    }
    .maarifa-tight-section,
    .maarifa-tight-section + .tight-top-spacing,
    .maarifa-tight-section + .tight-top-spacing + .tight-top-spacing {
        margin-top: 0;
    }
}

/* --- Small Phone (iPhone SE, Galaxy A قديمة حتى 480 بكسل) — نفس ترتيب الهيدر الجديد بالظبط بس أحجام أصغر --- */
@media (max-width: 480px) {
    html, body {
        width: 100%;
        overflow-x: auto; /* السكرول أفقي طبيعي عشان المستخدم يقدر يودي الصفحة يمين وشمال طبيعي لو محتاج */
        overflow-y: auto; /* السكرول عمودي طبيعي */
        -webkit-overflow-scrolling: touch; /* سكرول سلس على آيفون وجميع أجهزة الموبايل */
    }
    /* ===== إخفاء جميع أجزاء الديسكتوب (الأزرار + نموذج التعديل + الباركود) تماماً في الشاشات الصغيرة (آيفون SE) ===== */
    .desktop-only,
    .admin-toolbar,
    .edit-form-section,
    .qr-section,
    .toolbar-left,
    .toolbar-right {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    .page-container {
        padding: 0;
        background: #fff;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: visible; /* تسمح بالسكرول في كل الاتجاهات بدون قطع */
    }

    .main-header {
        display: block;
        padding: 18px 12px 16px 12px;
        gap: 0;
        position: relative;
        min-height: 340px;
    }

    /* 1️⃣ لوجو وزارة البلديات: فوق يمين الصفحة (header-right حسب HTML) */
    .header-right {
        display: block;
        width: auto;
        float: right;
        clear: none;
        margin: 0;
        padding: 0;
        text-align: right;
    }

    /* 2️⃣ اسم المؤسسة + العنوان: عرض كامل (~98%) عشان اسم الشركة يمتد من يمين الصفحة كله لليسار في سطر واحد، ومع مسافة كبيرة من اسم الوزارة (68px) */
    .header-center {
        display: block;
        width: 98%;
        float: right;
        clear: both;
        margin-top: 68px;
        padding: 0;
        text-align: right;
    }

    /* 3️⃣ لوجو تنظيم مشغلي المدن الرسمي — حجم أكبر بكثير ويخرج جزء كبير منه خارج حدود الشاشة (للشاشات الصغيرة) */
    .header-left {
        display: block;
        position: absolute;
        left: -180px;
        bottom: -110px;
        top: auto;
        width: 105%;
        text-align: left;
        margin-top: 0;
        padding-left: 0;
        float: none;
        background: transparent !important;
        z-index: 1;
    }

    .ministry-official-logo {
        height: 98px !important;
        max-width: 100%;
        float: right;
        background: transparent !important;
    }

    .balady-official-logo {
        height: 175px !important;
        max-width: 100%;
        width: 100% !important;
        object-fit: contain;
        object-position: left center;
        background: transparent !important;
        mix-blend-mode: multiply;
        isolation: isolate;
        opacity: 1;
        display: block;
    }

    /* اسم الشركة + المعلومات — أول حرف في الجملة (م) يبدأ من منتصف كلمة الإسكان في لوجو الوزارة (للشاشات الصغيرة) */
    .header-center {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: flex-start;
        width: auto;
        margin: 0;
        padding: 0;
        position: absolute;
        right: 130px;
        left: auto;
        top: 185px;
        text-align: right;
    }

    /* اسم الشركة: أول حرف (م) منتصف كلمة الإسكان — موضع جديد شمال شوية (للشاشات الصغيرة) */
    .center-title {
        font-size: 22px !important;
        font-weight: 400 !important;
        margin: 0 0 14px 0 !important;
        letter-spacing: 0;
        text-align: right;
        align-self: flex-end;
        padding: 0;
        line-height: 1.25;
        color: #89ad2b;
        direction: rtl;
        white-space: nowrap;
        word-break: keep-all;
        display: block;
    }

    /* المعلومات التفصيلية: في المنتصف الأفقي تحت جملة مؤسسة جسور اللي فوقها (للشاشات الصغيرة) */
    .center-subtitle {
        font-size: 16px !important;
        line-height: 1.7;
        text-align: center;
        font-weight: 400 !important;
        padding: 0;
        color: #0c7a5f;
        margin: 0 !important;
        display: block;
        width: 100%;
        align-self: center;
    }

    .ministry-logo,
    .logo-container {
        margin: 0;
        padding: 0;
    }

    .main-header::after {
        content: "";
        display: table;
        clear: both;
    }

    /* الشريط الأخضر: اليمين ثابت زي مهو، والشمال يمتد شمالاً ويتوقف بعد لوجو تنظيم (للشاشات الصغيرة) */
    .section-header {
        min-height: 43px; /* ارتفاع الشريط اللي فوق - ثابت (للشاشات الصغيرة) */
        border-radius: 12px 12px 0 0;
        margin-right: 16px; /* ثابت تماماً زي مهو */
        margin-left: -170px; /* شمال يمتد ويتوقف بعد لوجو تنظيم في الشاشات الصغيرة */
        width: calc(100% + 186px);
        padding: 0 18px 0 22px !important; /* إرجاع padding الأصلي لأن النص هنا مش المطلوب تعديله */
    }

    /* الشريط الأخضر الخاص بـ قسم الشهادة (فوق لوجو أكروبات) - تقليل ارتفاعه شوية صغيرين (للشاشات الصغيرة) */
    .form-section:nth-of-type(2) .section-header,
    section.form-section:last-of-type .section-header {
        min-height: 33px !important; /* تقليل ارتفاع الشريط الاخضر الخاص بتنزيل شوية صغيرين */
        height: 33px !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        line-height: 33px !important; /* النص يبقى في منتصف الارتفاع الصغير */
    }

    .form-section:nth-of-type(2) .section-title,
    section.form-section:last-of-type .section-title {
        font-size: 13px !important; /* تصغير حجم الخط شوية عشان يتناسب مع ارتفاع الشريط الصغير */
    }

    .section-title {
        font-size: 15px !important; /* تكبير حجم الكلام داخل الشريط الأخضر (للشاشات الصغيرة) */
        font-weight: 400 !important; /* إزالة البولد من عنوان الشريط الأخضر (للشاشات الصغيرة) */
    }

    .section-body {
        padding: 20px 18px 24px 48px !important;
        margin-right: 16px !important; /* ثابت تماماً زي مهو */
        margin-left: -170px !important;
        width: calc(100% + 186px) !important;
    }

    /* الحقول في عمود واحد زي الأصل (مش عمودين) */
    .form-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 18px 0;
    }

    .form-group,
    .form-group.full-row-only {
        width: 100%;
    }

    .field-label {
        font-size: 14px !important; /* إرجاع الحجم الأصلي لقصد كان قبل التصغير (مش عنوان الشريط) */
        font-weight: 400 !important; /* إزالة البولد من عناوين الحقول فوق البلوكات (للشاشات الصغيرة) */
        margin-bottom: 6px !important;
        text-align: right !important;
        direction: rtl !important;
        margin-right: -12px !important; /* تحريك الـ Label يمين بنفس مقدار الخلية الرمادية تحت (-12px) عشان يبقى في نفس المحاذاة بالظبط */
        margin-left: 0 !important;
        padding: 0 !important;
        width: calc(100% - 290px) !important; /* نفس عرض الخلية الرمادية تحتها بالظبط (100% - margin-left بتاع الخلية 290px) */
        float: right !important;
        color: #000 !important;
    }

    /* الحقول الرمادية: الحجم ثابت زي مهو، تحريك يمين شوية لمحاذاة حافة الشريط الأخضر (للشاشات الصغيرة) */
    .field-value,
    select.field-value.field-value-dropdown {
        height: 43px !important; /* تقليل ارتفاع الخلايا الرمادية شوية صغيرين (كان 46) */
        min-height: 43px !important; /* تقليل ارتفاع الخلايا الرمادية شوية صغيرين (كان 46) */
        padding: 5px 16px !important; /* padding متناسب مع الارتفاع الجديد */
        font-size: 17px !important; /* تقليل حجم شوية صغيرين عن القيمة السابقة (آيفون SE) */
        font-weight: 400 !important; /* إزالة البولد من بيانات الحقول جوا البلوكات الرمادية (للشاشات الصغيرة) */
        background-color: #f2f2f2 !important;
        border: 1px solid #c9c9c9 !important;
        border-radius: 5px !important;
        color: #555 !important;
        text-align: right !important; /* النص في الجهة اليمنى */
        direction: rtl !important; /* اتجاه الكتابة يمين لشمال ب force */
        margin-left: 290px !important; /* الحجم ثابت تماماً - متحركش (للشاشات الصغيرة) */
        margin-right: -12px !important; /* تحريك يمين شوية لمحاذاة حافة الشريط الأخضر (للشاشات الصغيرة) */
        max-width: none !important;
        width: auto !important; /* عدم السماح بعرض 100% عشان ما يعدلش الشمال */
        display: flex !important;
        align-items: center !important;
        /* المهم جداً: في direction: rtl، flex-start = اليمين بصرياً (عكس العادة) */
        justify-content: flex-start !important;
        /* إزالة أي خط تحت الأرقام أو النصوص جوا الخلايا الرمادية فقط - بدون أي تعديل على الشرايط الخضراء أو الجداول (للشاشات الصغيرة) */
        text-decoration: none !important;
        text-decoration-line: none !important;
        border-bottom: 1px solid #c9c9c9 !important; /* نحافظ على الحدود الخارجية للخلية نفسها، بس نزيل الخط اللي تحت النص جواها */
        background-image: none !important;
        box-shadow: none !important; /* أي خط أو ظل تحت الخلية اللي بيبقى شكل خط تحت الارقام */
    }

    /* ===== استثناء للخلية متعددة القيم في شاشات آيفون SE (أصغر) ===== */
    .field-value.field-value-multi {
        height: auto !important;
        min-height: 43px !important;
        padding: 6px 12px !important;
        flex-wrap: wrap !important;
        gap: 4px 6px !important;
        align-content: center !important;
    }
    .field-value.field-value-multi .multi-tag {
        font-size: 16px !important;
        padding: 4px 9px !important;
        line-height: 1.4 !important;
    }
    .field-value.field-value-multi .multi-sep {
        font-size: 16px !important;
    }

    /* طبقة أمان ثالثة: أي عنصر داخل الحقل يروح يمين بـ 100% force + إزالة أي خط تحت أي عناصر جوا الخلايا الرمادية فقط (للشاشات الصغيرة) */
    .field-value > *,
    .field-value span,
    .field-value div {
        margin-left: auto !important;
        margin-right: 0 !important;
        text-align: right !important;
        direction: rtl !important;
        /* إزالة أي خط تحت الأرقام جوا الخلايا الرمادية فقط */
        text-decoration: none !important;
        text-decoration-line: none !important;
        border-bottom: none !important;
        background-image: none !important;
    }

    /* ===== Dropdown الخاص بأعضاء مجلس الإدارة: تعديل خاص يتناسب مع 4 أو 5 أو 6 أسماء (تقليل العرض + الارتفاع - للشاشات الصغيرة) ===== */
    /* زي الـ specificity عالي عشان يتغلب على القاعدة العامة فوق */
    form select.field-value.field-value-dropdown,
    .cert-data-section select.field-value.field-value-dropdown,
    select.field-value.field-value-dropdown {
        height: 38px !important; /* تأكيد 100% تقليل ارتفاع البلوك الأبيض بتاع أسماء الأعضاء (آيفون SE) */
        min-height: 38px !important; /* تأكيد 100% تقليل ارتفاع البلوك الأبيض بتاع أسماء الأعضاء (آيفون SE) */
        padding: 4px 16px 4px 46px !important; /* padding متناسب مع الارتفاع الأصغر (للشاشات الصغيرة) */
        /* === تصغير عرض البلوك الأبيض يكون على قد الاسم بالظبط (4-6 أسماء) بدلاً من العرض الكبير (للشاشات الصغيرة) === */
        width: 285px !important; /* عرض ثابت مناسب لأي اسم من 4 لـ 6 أسماء (للشاشات الصغيرة) */
        max-width: 285px !important;
        margin-left: auto !important; /* شمال يبقى مسافة مناسبة عشان العرض يصير على قد الاسم */
        margin-right: -12px !important; /* الحافة اليمنى تظل في نفس محاذاة باقي الخلايا (للشاشات الصغيرة) */
        min-width: 285px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important; /* نفس الإصلاح للـ dropdown */
        direction: rtl !important;
        text-align: right !important;
        background-position: 12px center !important;
        background-color: #fff !important; /* خلفيته بيضاء زي مهو */
        color: #333 !important;
        font-weight: 400 !important; /* إزالة البولد من بيانات dropdown برضه (للشاشات الصغيرة) */
    }

    /* جدول التقييم على الشاشات الصغيرة جداً */
    .rating-table-wrapper {
        padding: 0 !important;
    }

    .rating-table {
        max-width: 100% !important;
        width: 100% !important;
        display: table !important;
    }

    .rating-table thead {
        display: table-header-group !important;
    }

    .rating-table th {
        display: table-cell !important;
        padding: 12px 6px !important;
        font-size: 12px !important;
        white-space: normal !important;
        line-height: 1.5;
    }

    .rating-table tbody {
        display: table-row-group !important;
    }

    .rating-table tr {
        display: table-row !important;
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin-bottom: 0 !important;
    }

    .rating-table td {
        display: table-cell !important;
        width: auto !important;
        max-width: none !important;
        padding: 12px 6px !important;
        border-bottom: 1px solid #ececec !important;
        font-size: 12px !important;
        position: static !important;
        padding-right: 6px !important;
        min-height: auto !important;
        white-space: normal !important;
    }

    .rating-table td::before {
        display: none !important;
        content: none !important;
    }

    .rating-table td:last-child {
        padding-right: 10px !important;
    }

    .star {
        font-size: 18px !important;
    }

    .certificate-body {
        padding: 18px 14px 22px 14px !important;
        position: relative !important;
        z-index: 5 !important;
    }

    .certificate-logo-wrapper {
        margin-left: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 16px !important;
        position: relative !important;
        z-index: 6 !important;
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .certificate-logo {
        width: 60px !important;
        height: 60px !important;
        display: block !important; /* عشان ما يختفيش (مش none) */
        visibility: visible !important; /* ظاهر 100% ثابت */
        opacity: 1 !important; /* شفافية كاملة، مش مخفي */
        position: relative !important;
        z-index: 7 !important; /* أعلى طبقة للصورة نفسها عشان تظهر فوق أي حاجة تانية */
    }

    .main-footer {
        margin-right: 16px !important; /* نفس margin اليمين بتاع الشريط الأخضر فوق (للشاشات الصغيرة) */
        margin-left: -170px !important; /* نفس margin الشمال بتاع الشريط الأخضر فوق (للشاشات الصغيرة) */
        width: calc(100% + 186px) !important; /* نفس العرض بتاع الشريط الأخضر فوق (للشاشات الصغيرة) */
        padding: 12px 18px 12px 22px !important; /* نفس padding بتاع الشريط الأخضر فوق (للشاشات الصغيرة) */
    }

    .copyright-text {
        font-size: 11px;
        font-weight: 400 !important; /* إزالة البولد من النص (للشاشات الصغيرة) */
        color: #000000 !important; /* تغيير اللون إلى الأسود تماماً (للشاشات الصغيرة) */
        text-align: right !important;
        direction: rtl !important;
    }

    .cert-data-section {
        margin-top: 125px !important;
    }
    .tight-top-spacing {
        margin-top: 0;
    }
    .maarifa-tight-section,
    .maarifa-tight-section + .tight-top-spacing,
    .maarifa-tight-section + .tight-top-spacing + .tight-top-spacing {
        margin-top: 0;
    }
}
