body {
    margin: 0;
    direction: rtl;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #eef2f7;
    color: #1f2937;
}
.container {
    width: min(1180px, 96%);
    margin: 0 auto;
    padding: 24px 0;
}
/* ===== سايدبار ثابت ===== */
:root {
    --sidebar-width: 264px;
}
body.has-sidebar {
    min-height: 100vh;
}
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #1a3d5c, #14304a 60%, #102640);
    box-shadow: -6px 0 24px rgba(15, 30, 48, 0.18);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
    position: relative;
}
.sidebar-brand-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(201, 162, 39, 0.18);
    color: #c9a227;
}
.sidebar-brand-icon .icon {
    width: 22px;
    height: 22px;
}
.sidebar-brand-text {
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    line-height: 1.5;
}
.sidebar-close {
    display: none;
    position: absolute;
    left: 12px;
    top: 18px;
    background: transparent;
    border: none;
    color: #cbd8e6;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
}
.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 12px;
    flex: 1 1 auto;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 12px;
    border-radius: 10px;
    color: #b9c9db;
    text-decoration: none;
    font-weight: 600;
    font-size: 14.5px;
    border-left: 3px solid transparent;
    transition: background .15s ease, color .15s ease;
}
.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}
.sidebar-link.active {
    background: rgba(201, 162, 39, 0.14);
    color: #fff;
    border-left-color: #c9a227;
}
.sidebar-icon {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8fa8c2;
    transition: color .15s ease;
}
.sidebar-icon .icon {
    width: 19px;
    height: 19px;
}
.sidebar-link:hover .sidebar-icon,
.sidebar-link.active .sidebar-icon {
    color: #c9a227;
}
.sidebar-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.sidebar-user-avatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #c9a227;
    color: #14304a;
    font-weight: 800;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.sidebar-user-info strong {
    color: #fff;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}
.sidebar-user-info span {
    color: #8fa8c2;
    font-size: 11px;
}
.sidebar-logout {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    color: #f0b4b4;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}
.sidebar-logout:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #fecaca;
}
.sidebar-logout .icon {
    width: 18px;
    height: 18px;
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1100;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    background: #14304a;
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 32, 0.5);
    z-index: 999;
}
.sidebar-overlay.active {
    display: block;
}

.main-content {
    margin-right: var(--sidebar-width);
}

/* ===== الشريط العلوي (Topbar) ===== */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px min(2%, 24px);
    background: #fff;
    border-bottom: 1px solid #e5eaf1;
}
.topbar-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(31, 71, 104, 0.1);
    color: #1f4768;
}
.topbar-icon .icon {
    width: 19px;
    height: 19px;
}
.topbar-title h1 {
    margin: 0;
    font-size: 18px;
    color: #1f2937;
}
.breadcrumb {
    margin-top: 2px;
    font-size: 12.5px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}
.breadcrumb a {
    color: #94a3b8;
    text-decoration: none;
}
.breadcrumb a:hover {
    color: #1f4768;
}
.breadcrumb-current {
    color: #1f4768;
    font-weight: 600;
}
.topbar-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}
.topbar-date {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 8px;
    background: #f4f7fb;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
}
.topbar-date .icon {
    width: 14px;
    height: 14px;
}

@media (min-width: 961px) {
    .topbar {
        position: sticky;
        top: 0;
        z-index: 50;
    }
}

footer {
    padding: 0;
    color: #94a3b8;
    font-size: 13px;
    border-top: 1px solid #e2e8f0;
    margin-top: 20px;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 20px 0 30px;
}
.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.footer-brand-icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(31, 71, 104, 0.1);
    color: #1f4768;
}
.footer-brand-icon .icon {
    width: 17px;
    height: 17px;
}
.footer-brand strong {
    display: block;
    color: #475569;
    font-size: 13.5px;
}
.footer-brand p {
    margin: 2px 0 0;
    font-size: 12px;
    color: #94a3b8;
}
.footer-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}
.footer-top-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #1f4768;
    text-decoration: none;
    font-weight: 600;
    font-size: 12.5px;
}
.footer-top-link:hover {
    text-decoration: underline;
}
.footer-top-link .icon {
    width: 13px;
    height: 13px;
}

@media (max-width: 960px) {
    .main-content {
        margin-right: 0;
    }
    .sidebar {
        transform: translateX(100%);
        transition: transform .25s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-toggle {
        display: flex;
    }
    .sidebar-close {
        display: block;
    }
    body.has-sidebar .main-content {
        padding-top: 58px;
    }
}

@media print {
    .sidebar,
    .sidebar-toggle,
    .sidebar-overlay {
        display: none !important;
    }
    .main-content {
        margin-right: 0 !important;
    }
}
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 20px;
    padding: 20px;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}
.stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #eef5ff;
}
.stat-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(31, 71, 104, 0.12);
    color: #1f4768;
}
.stat-icon .icon {
    width: 19px;
    height: 19px;
}
.stat-text {
    min-width: 0;
}
.stat-text h3 {
    margin: 0 0 2px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}
.stat-text p,
.stat p {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #1f2937;
    white-space: nowrap;
}
.stat p.large {
    font-size: 16px;
}

.stat-deposit { background: #ecfdf5; }
.stat-deposit .stat-icon { background: #d1fae5; color: #059669; }

.stat-withdrawal { background: #fff7ed; }
.stat-withdrawal .stat-icon { background: #ffedd5; color: #c2410c; }

.stat-expense { background: #fef2f2; }
.stat-expense .stat-icon { background: #fee2e2; color: #b91c1c; }

.stat-balance { background: #eff6ff; }
.stat-balance .stat-icon { background: #dbeafe; color: #1d4ed8; }

.stat-phases { background: #f5f3ff; }
.stat-phases .stat-icon { background: #ede9fe; color: #6d28d9; }

.stat-progress { background: #ecfeff; }
.stat-progress .stat-icon { background: #cffafe; color: #0e7490; }

.stat-neutral { background: #f8fafc; }
.stat-neutral .stat-icon { background: #e2e8f0; color: #475569; }
form input,
form select,
form textarea {
    width: 100%;
    padding: 9px 12px;
    margin-top: 4px;
    margin-bottom: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 14.5px;
    background: #fbfcfe;
    box-sizing: border-box;
    font-family: inherit;
}
form input:focus,
form select:focus,
form textarea:focus {
    outline: none;
    border-color: #1f4768;
    box-shadow: 0 0 0 3px rgba(31, 71, 104, 0.15);
}
form textarea {
    min-height: 90px;
    resize: vertical;
}
form label {
    font-weight: 600;
    font-size: 14px;
    color: #334155;
}
form button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border: none;
    border-radius: 10px;
    background: #1f4768;
    color: white;
    cursor: pointer;
    font-size: 15px;
    transition: background .2s ease, transform .2s ease;
}
.btn.secondary {
    background: #f4f7fb;
    color: #1f4768;
    border: 1px solid #d7e1ec;
}
.btn:hover {
    background: #173b5a;
    transform: translateY(-1px);
}
.btn.secondary:hover {
    background: #e7eef8;
}
.admin-hero {
    background: linear-gradient(135deg, #1f4768, #3868a1);
    color: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 24px;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 10px;
}
.page-header h2 {
    margin: 0;
    font-size: 26px;
}
.page-header p {
    margin: 6px 0 0;
    color: #6b7280;
    max-width: 720px;
}
.page-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.table-actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.table-actions button {
    white-space: nowrap;
}
.table-actions .inline-form {
    display: inline-flex;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #d7e1ec;
    background: #f4f7fb;
    color: #1f4768;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
    flex: 0 0 auto;
}
.icon-btn:hover {
    background: #e2ecf9;
    border-color: #c3d3e8;
}
.icon-btn.danger {
    color: #991b1b;
    border-color: #f3c6c6;
}
.icon-btn.danger:hover {
    background: #fee2e2;
    border-color: #f3aaaa;
}
.icon-btn .icon {
    width: 15px;
    height: 15px;
}

.attachments-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    position: relative;
}
.attachment-chip .icon-btn {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #0369a1;
}
.attachment-chip .icon-btn:hover {
    background: #e0f2fe;
}
.attachment-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: #fee2e2;
    color: #991b1b;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-inline-start: -6px;
}
.attachment-remove:hover {
    background: #fecaca;
}
.muted {
    color: #94a3b8;
}
.field-hint {
    margin: -8px 0 8px;
    font-size: 12px;
    color: #94a3b8;
}

.btn-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #2b5a86, #1f4768);
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(31, 71, 104, 0.35);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-add:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(31, 71, 104, 0.45);
}
.btn-add:active {
    transform: translateY(0) scale(0.97);
}
.btn-add .icon {
    width: 22px;
    height: 22px;
    stroke-width: 2.5;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.quick-actions {
    padding: 20px;
}
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
.quick-links a {
    display: block;
    padding: 14px 18px;
    border-radius: 10px;
    background: #eef5ff;
    color: #1f4768;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
}
.quick-links a:hover {
    background: #dbe8ff;
}
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 14px;
    overflow: hidden;
    font-size: 13.5px;
}
table th,
table td {
    text-align: right;
    padding: 9px 12px;
    border-bottom: 1px solid #e8edf3;
}
table th {
    font-size: 12.5px;
    background: #f1f5f9;
    font-weight: 700;
    color: #334155;
}

.table-actions button {
    margin-left: 8px;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: grid;
    place-items: center;
    padding: 16px;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-card {
    width: min(660px, 100%);
    max-height: min(88vh, 760px);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.18);
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex: 0 0 auto;
    padding: 22px 26px 12px;
}

.modal-header h2 {
    margin: 0;
    font-size: 22px;
}

.modal-close {
    border: none;
    background: transparent;
    color: #334155;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.modal-section {
    display: grid;
    gap: 6px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 26px 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    position: sticky;
    bottom: 0;
    background: #ffffff;
    margin: 10px -26px 0;
    padding: 14px 26px;
    border-top: 1px solid #eef1f5;
}

.hidden {
    display: none !important;
}

body.modal-open {
    overflow: hidden;
}
.alert {
    padding: 14px 16px;
    background: #dff6dd;
    border-radius: 8px;
    margin-bottom: 18px;
    color: #166534;
}
.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

.btn.small {
    padding: 8px 14px;
    font-size: 13px;
}
.btn.secondary.danger {
    color: #991b1b;
    border-color: #f3c6c6;
}
.btn.secondary.danger:hover {
    background: #fee2e2;
}

.inline-form {
    display: inline-block;
    margin: 0;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    background: #f8fafc;
    border: 1px solid #e8edf3;
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 10px;
}
.filter-bar > div:not(.filter-actions) {
    flex: 1 1 120px;
    min-width: 90px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.filter-bar label {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    color: #64748b;
    cursor: help;
}
.filter-bar input,
.filter-bar select {
    width: 100%;
    padding: 6px 8px;
    margin: 0;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #ffffff;
    font-size: 12.5px;
    box-sizing: border-box;
}
.filter-actions {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    margin-inline-start: auto;
}
.filter-actions .btn {
    padding: 7px 14px;
    font-size: 13px;
}
@media (max-width: 640px) {
    .filter-bar {
        align-items: flex-end;
    }
    .filter-bar > div:not(.filter-actions) {
        flex: 1 1 100%;
    }
    .filter-actions {
        flex: 1 1 100%;
        margin-inline-start: 0;
        padding-top: 8px;
        border-top: 1px solid #e2e8f0;
    }
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #e2e8f0;
    color: #475569;
}
.badge-active {
    background: #dcfce7;
    color: #166534;
}
.badge-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.document-title-cell {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.document-file-icon {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2f7;
    color: #1f4768;
}
.document-file-icon .icon {
    width: 16px;
    height: 16px;
}
.document-desc {
    margin: 2px 0 0;
    color: #94a3b8;
    font-size: 12px;
    max-width: 320px;
}
.field-hint-inline {
    font-weight: 400;
    color: #94a3b8;
    font-size: 12.5px;
}

.progress-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.progress-bar-wrap {
    display: inline-block;
    width: 90px;
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    vertical-align: middle;
}
.progress-bar-wrap.progress-bar-small {
    width: 70px;
    height: 8px;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2b5a86, #1f4768);
    border-radius: 999px;
}
.progress-bar-label {
    font-size: 12px;
    font-weight: 700;
    color: #1f4768;
    vertical-align: middle;
}

.progress-gauge {
    text-align: center;
}
.progress-gauge .progress-gauge-value {
    font-size: 34px;
    font-weight: 800;
    color: #1f4768;
    margin-bottom: 8px;
}
.progress-gauge .progress-bar-wrap {
    width: 100%;
    height: 14px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
}
.pagination a {
    color: #1f4768;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    background: #eef5ff;
}
.pagination a:hover {
    background: #dbe8ff;
}
.pagination-info {
    color: #64748b;
    font-size: 14px;
}

.login-body {
    margin: 0;
    direction: rtl;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1f4768, #2b5a86);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-wrap {
    width: min(420px, 92%);
}
.login-logo {
    display: flex;
    justify-content: center;
    margin: -8px 0 8px;
}
.login-logo img {
    width: 150px;
    height: auto;
}
.login-card {
    padding: 32px 28px;
}
.login-card h2 {
    margin: 0 0 4px;
}
.login-card p {
    margin: 0 0 24px;
    color: #6b7280;
}
.login-card form button {
    width: 100%;
    padding: 13px 22px;
    margin-top: 4px;
    font-size: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    margin: 4px 0 16px;
}
.checkbox-label input {
    width: auto;
    margin: 0;
}

.modal-card-wide {
    width: min(820px, 100%);
}
#permissionsGrid h3 {
    margin: 4px 0 4px;
}
#permissionsGrid .hint {
    margin: 0 0 12px;
    color: #6b7280;
    font-size: 13px;
}
.permissions-table-wrap {
    overflow-x: auto;
}
.permissions-table {
    border-radius: 10px;
}
.permissions-table th,
.permissions-table td {
    text-align: center;
    padding: 10px 12px;
}
.permissions-table td:first-child,
.permissions-table th:first-child {
    text-align: right;
}
.permissions-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.table-scroll {
    overflow-x: auto;
}

/* ===== صفحة التحقق من الشهادة (verify.php) ===== */
.verify-card {
    width: min(480px, 100%);
}
.verify-result {
    margin-bottom: 20px;
}
.verify-result strong {
    display: block;
    margin-bottom: 6px;
    font-size: 16px;
}
.verify-result p {
    margin: 0;
    color: inherit;
}
.verify-ok {
    background: #dcfce7;
    color: #166534;
}
.verify-table {
    width: 100%;
    border-collapse: collapse;
}
.verify-table th,
.verify-table td {
    text-align: right;
    padding: 10px 8px;
    border-bottom: 1px solid #e8edf3;
    font-size: 14px;
}
.verify-table th {
    color: #64748b;
    font-weight: 600;
    width: 40%;
}

/* ===== شهادة المساهمة القابلة للطباعة (certificate.php) ===== */
.certificate-body {
    margin: 0;
    direction: rtl;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #dfe6ee;
    min-height: 100vh;
}
.certificate-toolbar {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 18px;
}
.certificate-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto 40px;
    background: #fbf7ec;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
    box-sizing: border-box;
    padding: 8mm;
}
.certificate-frame-outer {
    border: 1px solid #c9a227;
    padding: 4px;
    height: calc(297mm - 16mm);
    box-sizing: border-box;
}
.certificate-frame-inner {
    position: relative;
    border: 2px solid #1f5c46;
    height: 100%;
    box-sizing: border-box;
    padding: 9mm 14mm;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.certificate-watermark {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 130px;
    font-weight: 800;
    color: #1f5c46;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}
.certificate-corner-motif {
    position: absolute;
    top: 8mm;
    left: 10mm;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201, 162, 39, 0.22), rgba(201, 162, 39, 0) 70%);
    border: 1px solid rgba(201, 162, 39, 0.35);
    z-index: 0;
}

.certificate-frame-inner > * {
    position: relative;
    z-index: 1;
}

.basmala {
    text-align: center;
    font-family: 'Amiri', 'Traditional Arabic', serif;
    font-size: 20px;
    font-weight: 700;
    color: #1f5c46;
    margin: 0 0 6mm;
}

.certificate-topline {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #56514a;
    border-bottom: 1px dashed #d9cfa8;
    padding-bottom: 6mm;
    margin-bottom: 5mm;
}
.certificate-topline .ref-number {
    font-weight: 700;
    color: #1f5c46;
}

.cert-title {
    text-align: center;
    margin: 0;
    font-size: 32px;
    font-weight: 800;
    color: #1f5c46;
    letter-spacing: 1px;
}
.title-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 8px 0 7mm;
}
.title-divider span {
    display: block;
    height: 1px;
    width: 70px;
    background: #c9a227;
}
.title-divider .diamond {
    width: 8px;
    height: 8px;
    background: #c9a227;
    transform: rotate(45deg);
    flex: none;
}

.cert-narrative {
    text-align: center;
}
.cert-narrative p {
    font-size: 14px;
    color: #3f3a33;
    line-height: 1.9;
    margin: 0 0 4mm;
}

.cert-name-box {
    text-align: center;
    background: #eaf3ee;
    border: 1px solid #cfe3d7;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 24px;
    font-weight: 800;
    color: #1f5c46;
    margin: 0 auto 5mm;
    display: inline-block;
    min-width: 60%;
}

.cert-amount-line {
    font-size: 19px !important;
    font-weight: 800;
    color: #7a5b12;
    margin: 2mm 0 4mm !important;
}

.cert-thanks {
    margin-top: 5mm !important;
}

.cert-closing-phrase {
    font-weight: 700;
    color: #1f5c46;
    margin-top: 3mm !important;
}

.certificate-cancelled-note {
    text-align: center;
    color: #991b1b;
    font-weight: 700;
    margin: 0 0 6mm;
    padding: 8px;
    background: #fee2e2;
    border-radius: 6px;
}

.cert-approval-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: auto;
    padding-top: 6mm;
}
.cert-org-signature {
    font-size: 13.5px;
    color: #3f3a33;
    text-align: center;
}
.org-sig-name {
    margin: 0 0 4px;
    font-weight: 700;
    color: #1f5c46;
    border-top: 1px solid #94a3b8;
    padding-top: 8px;
}
.org-sig-location {
    margin: 0;
    color: #6b7280;
}
.cert-boxes {
    display: flex;
    gap: 10px;
}
.cert-box {
    width: 130px;
    min-height: 110px;
    border: 1px solid #d9cfa8;
    border-radius: 8px;
    background: #fffdf7;
    text-align: center;
    padding: 8px;
    box-sizing: border-box;
}
.cert-box-title {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 700;
    color: #56514a;
}
.cert-box img {
    display: block;
    margin: 0 auto;
}
.cert-box-hint {
    margin: 6px 0 0;
    font-size: 9px;
    color: #8a8474;
    line-height: 1.5;
}

.certificate-footer-warning {
    text-align: center;
    color: #991b1b;
    font-size: 11px;
    font-weight: 700;
    margin: 6mm 0 0;
}

@media print {
    .no-print {
        display: none !important;
    }
    .certificate-body {
        background: #fff;
    }
    .certificate-page {
        width: auto;
        min-height: 0;
        margin: 0;
        box-shadow: none;
    }
    .certificate-frame-outer {
        height: auto;
    }
    @page {
        size: A4;
        margin: 0;
    }
}

/* ===== أزرار التصدير (Excel / PDF) ===== */
.export-actions {
    display: flex;
    gap: 8px;
}
.export-actions .icon-btn.export-xlsx {
    color: #1f7a4d;
    border-color: #bfe3cf;
}
.export-actions .icon-btn.export-pdf {
    color: #b91c1c;
    border-color: #f3c9c9;
}

/* ===== تقرير قابل للطباعة/تصدير PDF (print_export.php) ===== */
.export-body {
    margin: 0;
    direction: rtl;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #eef1f5;
    min-height: 100vh;
}
.export-toolbar {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 18px;
}
.export-page {
    width: 277mm;
    margin: 0 auto 40px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    padding: 12mm;
}
.export-header {
    text-align: center;
    border-bottom: 2px solid #1f5c46;
    margin-bottom: 6mm;
    padding-bottom: 4mm;
}
.export-header h1 {
    margin: 0 0 4px;
    color: #1f5c46;
    font-size: 22px;
}
.export-subtitle {
    margin: 0 0 4px;
    color: #3f3a33;
    font-size: 13px;
}
.export-meta {
    margin: 0;
    color: #8a8474;
    font-size: 11px;
}
.export-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.export-table th, .export-table td {
    border: 1px solid #d0d7de;
    padding: 6px 8px;
    text-align: right;
}
.export-table thead th {
    background: #1f5c46;
    color: #fff;
    font-weight: 700;
}
.export-table tbody tr:nth-child(even) {
    background: #f7f9f8;
}
.export-table tfoot td {
    background: #eff3f1;
    font-weight: 800;
    border-top: 2px solid #1f5c46;
}
.export-num {
    text-align: left;
    font-variant-numeric: tabular-nums;
}

@media print {
    .export-body {
        background: #fff;
    }
    .export-page {
        width: auto;
        margin: 0;
        box-shadow: none;
        padding: 0;
    }
    .export-table {
        font-size: 11px;
    }
    .export-table thead {
        display: table-header-group;
    }
    .export-table tr {
        page-break-inside: avoid;
    }
    @page {
        size: A4 landscape;
        margin: 10mm;
    }
}

/* ===== أيقونة زر مفعّلة (تبديل) ===== */
.icon-btn.active-toggle {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

/* ===== المراسلات (messages.php / message_view.php) ===== */
.mailbox-tabs {
    display: flex;
    gap: 6px;
    margin-top: 14px;
    border-bottom: 1px solid #e5eaf1;
}
.mailbox-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    color: #64748b;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 2px solid transparent;
}
.mailbox-tab:hover {
    color: #1f4768;
}
.mailbox-tab.active {
    color: #1f4768;
    border-bottom-color: #1f4768;
}
.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.message-list {
    display: flex;
    flex-direction: column;
}
.message-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 6px;
    border-bottom: 1px solid #eef1f5;
    text-decoration: none;
    color: inherit;
}
.message-row:hover {
    background: #f8fafc;
}
.message-row-icon {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2f7;
    color: #1f4768;
}
.message-row-icon .icon {
    width: 15px;
    height: 15px;
}
.message-row-from {
    flex: 0 0 150px;
    font-size: 13.5px;
    color: #475569;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.message-row-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 10px;
    overflow: hidden;
}
.message-row-body strong {
    flex: 0 0 auto;
    font-size: 14px;
    color: #1f2937;
}
.message-row-snippet {
    color: #94a3b8;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.message-row-date {
    flex: 0 0 auto;
    color: #94a3b8;
    font-size: 12px;
}
.message-row.unread {
    background: #f0f6ff;
}
.message-row.unread .message-row-body strong,
.message-row.unread .message-row-from {
    color: #14304a;
    font-weight: 800;
}

.message-thread {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.message-bubble {
    border: 1px solid #e5eaf1;
    border-radius: 12px;
    padding: 14px 16px;
    background: #f8fafc;
}
.message-bubble.mine {
    background: #eff6ff;
    border-color: #dbeafe;
}
.message-bubble.current {
    border-color: #1f4768;
    box-shadow: 0 0 0 3px rgba(31, 71, 104, 0.08);
}
.message-bubble-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    font-size: 13px;
}
.message-bubble-date {
    margin-right: auto;
    color: #94a3b8;
    font-size: 12px;
}
.message-bubble-body {
    white-space: pre-wrap;
    line-height: 1.8;
    color: #334155;
    font-size: 14px;
}
.message-bubble-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #dbe3ec;
}

/* ===== المهام (tasks.php) ===== */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.priority-badge .icon {
    width: 11px;
    height: 11px;
}
.priority-low {
    background: #e0f2fe;
    color: #0369a1;
}
.priority-medium {
    background: #fef3c7;
    color: #92400e;
}
.priority-high {
    background: #fee2e2;
    color: #991b1b;
}
.status-badge.status-pending {
    background: #e2e8f0;
    color: #475569;
}
.status-badge.status-in_progress {
    background: #dbeafe;
    color: #1d4ed8;
}
.status-badge.status-done {
    background: #dcfce7;
    color: #166534;
}
tr.task-overdue td:first-child {
    border-right: 3px solid #dc2626;
}
tr.task-due-soon td:first-child {
    border-right: 3px solid #d97706;
}

/* ===== التقويم (calendar.php) ===== */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 16px 0 10px;
}
.calendar-nav h3 {
    margin: 0;
    min-width: 160px;
    text-align: center;
    color: #1f4768;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.calendar-weekday {
    text-align: center;
    font-weight: 700;
    font-size: 12.5px;
    color: #64748b;
    padding: 6px 0;
}
.calendar-cell {
    min-height: 100px;
    border: 1px solid #e5eaf1;
    border-radius: 8px;
    padding: 6px;
    background: #fbfcfe;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.calendar-cell.empty {
    border: none;
    background: transparent;
}
.calendar-cell.is-today {
    background: #eff6ff;
    border-color: #93c5fd;
}
.calendar-cell-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.calendar-day-num {
    font-weight: 700;
    font-size: 13px;
    color: #334155;
}
.is-today .calendar-day-num {
    color: #1d4ed8;
}
.calendar-day-add {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.calendar-day-add .icon {
    width: 13px;
    height: 13px;
}
.calendar-day-add:hover {
    background: #e2ecf9;
    color: #1f4768;
}
.calendar-cell-events {
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow-y: auto;
}
.calendar-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.calendar-chip .icon {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
}
.chip-task.priority-low {
    background: #e0f2fe;
    color: #0369a1;
}
.chip-task.priority-medium {
    background: #fef3c7;
    color: #92400e;
}
.chip-task.priority-high {
    background: #fee2e2;
    color: #991b1b;
}
.chip-phase-start {
    background: #dcfce7;
    color: #166534;
}
.chip-phase-end {
    background: #ede9fe;
    color: #6d28d9;
}
.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 16px;
    font-size: 12.5px;
    color: #64748b;
}
.calendar-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
}

/* ===== جرس التنبيهات (Notification Bell) ===== */
.notif-bell-wrap {
    position: relative;
}
.notif-bell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e5eaf1;
    background: #fff;
    color: #64748b;
    cursor: pointer;
}
.notif-bell:hover {
    background: #f4f7fb;
    color: #1f4768;
}
.notif-bell .icon {
    width: 17px;
    height: 17px;
}
.notif-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}
.notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 320px;
    max-height: 420px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5eaf1;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 30, 48, 0.15);
    z-index: 80;
    padding: 8px 0;
}
.notif-dropdown.open {
    display: block;
}
.notif-section {
    padding: 6px 14px 12px;
}
.notif-section + .notif-section {
    border-top: 1px solid #eef1f5;
}
.notif-section h4 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px 0 8px;
    font-size: 12.5px;
    color: #64748b;
}
.notif-section h4 .icon {
    width: 14px;
    height: 14px;
}
.notif-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 6px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
}
.notif-item:hover {
    background: #f4f7fb;
}
.notif-item strong {
    font-size: 13px;
    color: #1f2937;
}
.notif-item span {
    font-size: 11.5px;
    color: #94a3b8;
}
.notif-more {
    display: block;
    text-align: center;
    margin-top: 4px;
    padding: 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: #1f4768;
    text-decoration: none;
    border-radius: 8px;
}
.notif-more:hover {
    background: #f4f7fb;
}
.notif-empty {
    margin: 0;
    color: #94a3b8;
    font-size: 12.5px;
}

@media (max-width: 720px) {
    .message-row-from {
        display: none;
    }
    .calendar-cell {
        min-height: 70px;
    }
    .calendar-chip span {
        display: none;
    }
}

/* ===== نموذج بحقلين متجاورين (يُستخدم في نموذج الاجتماعات) ===== */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
}
.form-grid-2 label {
    margin-top: 0;
}

/* ===== الاجتماعات (meetings.php) ===== */
.meeting-number {
    display: inline-block;
    font-family: 'Cairo', monospace;
    font-size: 12.5px;
    font-weight: 700;
    color: #1f5c46;
    background: #eaf3ee;
    padding: 3px 9px;
    border-radius: 6px;
    direction: ltr;
}
.status-badge.status-scheduled {
    background: #dbeafe;
    color: #1d4ed8;
}
.status-badge.status-held {
    background: #dcfce7;
    color: #166534;
}
.status-badge.status-postponed {
    background: #fef3c7;
    color: #92400e;
}

/* ===== محضر الاجتماع القابل للطباعة (meeting_print.php) ===== */
.meeting-print-body {
    margin: 0;
    direction: rtl;
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #eef1f5;
    min-height: 100vh;
}
.meeting-print-toolbar {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 18px;
}
.meeting-print-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto 40px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    padding: 14mm 16mm;
}
.meeting-print-letterhead {
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 3px solid #1f5c46;
    padding-bottom: 12px;
    margin-bottom: 14px;
}
.meeting-print-letterhead img {
    width: 62px;
    height: auto;
    flex: 0 0 auto;
}
.meeting-print-letterhead-text {
    flex: 1 1 auto;
}
.meeting-print-letterhead-text h1 {
    margin: 0;
    font-size: 19px;
    color: #1f5c46;
}
.meeting-print-letterhead-text p {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: #6b7280;
}
.meeting-print-number {
    flex: 0 0 auto;
    text-align: center;
    background: #eaf3ee;
    border: 1px solid #cfe3d7;
    border-radius: 8px;
    padding: 6px 14px;
}
.meeting-print-number span {
    display: block;
    font-size: 10.5px;
    color: #6b7280;
}
.meeting-print-number strong {
    display: block;
    font-size: 13px;
    color: #1f5c46;
    direction: ltr;
}
.meeting-print-cancelled-note {
    text-align: center;
    color: #991b1b;
    font-weight: 700;
    margin: 0 0 10px;
    padding: 8px;
    background: #fee2e2;
    border-radius: 6px;
}
.meeting-print-title {
    text-align: center;
    color: #1f2937;
    font-size: 20px;
    margin: 4px 0 16px;
}
.meeting-print-meta {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 18px;
    font-size: 13px;
}
.meeting-print-meta th,
.meeting-print-meta td {
    border: 1px solid #e2e8f0;
    padding: 7px 10px;
    text-align: right;
}
.meeting-print-meta th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    width: 15%;
}
.meeting-print-meta td {
    width: 35%;
}
.meeting-print-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.meeting-print-section {
    margin-bottom: 16px;
}
.meeting-print-section h3 {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 8px;
    font-size: 14.5px;
    color: #1f5c46;
    border-bottom: 1px solid #d9e3dc;
    padding-bottom: 6px;
}
.meeting-print-section h3 .icon {
    width: 16px;
    height: 16px;
}
.count-badge {
    margin-right: auto;
    background: #eaf3ee;
    color: #1f5c46;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    padding: 1px 8px;
}
.meeting-print-list {
    margin: 0;
    padding-right: 20px;
    font-size: 13px;
    line-height: 1.9;
    color: #334155;
}
.meeting-print-empty {
    margin: 0;
    color: #94a3b8;
    font-size: 12.5px;
}
.meeting-print-notes {
    margin: 0;
    font-size: 13px;
    line-height: 1.8;
    color: #334155;
    white-space: pre-wrap;
}
.meeting-print-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 34px;
}
.meeting-print-sig-box {
    text-align: center;
    border-top: 1px solid #94a3b8;
    padding-top: 10px;
}
.meeting-print-sig-box .sig-title {
    margin: 0 0 4px;
    font-weight: 700;
    color: #1f5c46;
    font-size: 13px;
}
.meeting-print-sig-box .sig-name {
    margin: 0 0 14px;
    font-size: 13px;
    color: #334155;
}
.meeting-print-sig-box .sig-line {
    margin: 0;
    font-size: 12px;
    color: #94a3b8;
}
.meeting-print-footer {
    text-align: center;
    margin-top: 26px;
    font-size: 10.5px;
    color: #94a3b8;
}

@media print {
    .meeting-print-body {
        background: #fff;
    }
    .meeting-print-page {
        width: auto;
        min-height: 0;
        margin: 0;
        box-shadow: none;
    }
    @page {
        size: A4;
        margin: 10mm;
    }
}

@media (max-width: 720px) {
    .meeting-print-columns,
    .meeting-print-signatures {
        grid-template-columns: 1fr;
    }
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}
