/* =====================================================================
   نظام غرفة تجارة وصناعة عُمان - فرع ظفار
   التنسيقات الرئيسية (يدوية - Bootstrap RTL مخصص)
   ===================================================================== */

:root {
    --brand: #16324f;
    --brand-2: #1e4468;
    --brand-ink: #0e2439;
    /* الأزرق الغامق الموحّد: خلفية الترويسة ورؤوس الجداول (كان لون شريط المسار) */
    --brand-deep: #122a42;
    --accent: #b8860b;
    --line: #e3e8ee;
    --bg: #f2f4f7;
    --ink: #1d2939;
    --muted: #667085;
}

/* ------------------------- الخطوط المحلية ------------------------- */
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('./fonts/cairo-400.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891,
                   U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011,
                   U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('./fonts/cairo-latin-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('./fonts/cairo-500.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891,
                   U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011,
                   U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('./fonts/cairo-600.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891,
                   U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011,
                   U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('./fonts/cairo-700.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891,
                   U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011,
                   U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('./fonts/cairo-latin-700.woff2') format('woff2');
}

* { -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
    font-family: 'Cairo', "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
}

a { text-decoration: none; }

/* ------------------------- الهيكل العام ------------------------- */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.page-content {
    flex: 1;
    padding: 18px 20px 26px;
}

/* ------------------------- الترويسة الرئيسية ------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: var(--brand-deep);
    color: #fff;
    box-shadow: 0 1px 6px rgba(16, 24, 40, .16);
}

.header-top {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 18px;
    height: 58px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    color: #fff;
}

.header-brand .brand-mark {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    padding: 0;
    border-radius: 7px;
    background: #fff;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.35);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}
.header-brand .brand-mark:hover,
.header-brand .brand-mark:focus-visible {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 5px 14px rgba(0,0,0,.35);
    outline: none;
}
.header-brand .brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.header-brand .brand-title {
    line-height: 1.3;
    white-space: nowrap;
    transition: opacity .15s ease;
}
.header-brand .brand-title:hover { opacity: .85; }
.header-brand .brand-title strong { display: block; font-size: 13px; color: #fff; }
.header-brand .brand-title span { font-size: 11.5px; color: #fff; font-weight: 700; }

/* روابط التنقل داخل الترويسة */
.header-nav {
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 6px 0;
}
.header-nav::-webkit-scrollbar { display: none; }

.nav-link-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 13px;
    border-radius: 6px;
    color: #cfd9e4;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: background .15s, color .15s;
}

.nav-link-item:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.nav-link-item.active {
    background: #fff;
    color: var(--brand-ink);
    font-weight: 700;
}

/* منطقة الحساب يمين الترويسة */
.header-user { flex: 0 0 auto; margin-right: auto; }

.header-nav-toggle {
    display: none;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18);
    color: #fff;
    border-radius: 6px;
    width: 36px;
    height: 34px;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* شريط المسار السفلي للترويسة */
.header-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 18px;
    background: var(--brand-deep);
    border-top: 1px solid rgba(255,255,255,.09);
    font-size: 12px;
}
.header-sub .breadcrumb {
    margin: 0;
    background: transparent;
    padding: 0;
    font-size: 12px;
}
.header-sub .breadcrumb-item a { color: #b9c6d4; }
.header-sub .breadcrumb-item.active { color: #fff; font-weight: 600; }
.header-sub .breadcrumb-item + .breadcrumb-item::before { color: #7d90a5; }
.header-sub-meta { color: #a9b8c8; white-space: nowrap; }

/* ------------------------- بطاقة المستخدم في الترويسة ------------------------- */
.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 10px 4px 4px;
    border-radius: 24px;
    color: #fff;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.14);
}
.user-chip:hover { background: rgba(255,255,255,.18); color: #fff; }
.user-chip::after { opacity: .7; }

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
}

.user-meta { line-height: 1.25; text-align: right; }
.user-meta strong { display: block; font-size: 12.5px; color: #fff; white-space: nowrap; }
.user-meta small { font-size: 10.5px; color: #a9b8c8; }

.dropdown-menu {
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13px;
    padding: 6px;
}
.dropdown-item { border-radius: 5px; padding: 6px 10px; font-size: 13px; }

/* ------------------------- التذييل ------------------------- */
.app-footer {
    background: var(--brand);
    border-top: 1px solid var(--brand-ink);
    padding: 10px 20px;
    font-size: 12px;
    color: #c7d5e4;
    display: flex;
    justify-content: center;
    text-align: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.app-footer .text-secondary { color: #93a7bd !important; }
.app-footer-wish { color: #d8e3ee; font-weight: 700; text-align: center; }

/* ------------------------- البطاقات ------------------------- */
.card {
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
    background: #fff;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 12px 16px;
    font-weight: 700;
    font-size: 13.5px;
}

/* بطاقات الإحصائيات — تصميم عادي بسيط */
.stat-card {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    padding: 14px 16px;
    height: 100%;
}
.stat-card .stat-label {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 2px;
}
.stat-card .stat-value {
    font-size: 25px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--ink);
    letter-spacing: -.5px;
}
.stat-card .stat-value small,
.stat-card .stat-value span {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}
.stat-card .stat-sub {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 3px;
}
.stat-card .stat-icon { display: none; }
.stat-green, .stat-gold, .stat-blue, .stat-red { border-right: none; }

/* ------------------------- الجداول ------------------------- */
.table { margin-bottom: 0; font-size: 12.5px; }
.table > :not(caption) > * > * { padding: .5rem .55rem; vertical-align: middle; }

.table thead th {
    background: var(--brand-deep);
    border-bottom: 1.5px solid var(--brand-ink);
    color: #eaf1f8;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    text-transform: none;
}

/* ------------------------- شريط نمط يوم الاقتراع ------------------------- */
.polls-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
}

/* ------------------------- خلية الترشيح ------------------------- */
.table tbody tr:hover { background: #fafbfc; }
.table td { border-color: #eef1f5; }

.cell-code {
    font-family: Consolas, "Courier New", monospace;
    font-weight: 700;
    letter-spacing: .3px;
    direction: ltr;
    unicode-bidi: embed;
    white-space: nowrap;
}

.cell-name {
    font-weight: 700;
    color: var(--brand-ink);
    min-width: 110px;
    max-width: 190px;
    line-height: 1.55;
    white-space: normal;
}

/* السماح للخلايا بالانكماش (تجاوب الجداول بدل التمرير الأفقي) */
.table td { white-space: normal; word-break: break-word; }

.cell-nowrap, .cell-code, .table td .ltr { white-space: nowrap; }
.badge-soft, .badge-member, .cell-nowrap .badge-soft { white-space: nowrap; }

/* جدول سجل الشركات: كثيف ومتجاوب */
.tbl-companies { font-size: 12px; }
.tbl-companies thead th { font-size: 10.5px; white-space: normal; }
.tbl-companies > :not(caption) > * > * { padding: .42rem .42rem; }
.tbl-companies .badge-soft { font-size: 10.5px; padding: .16rem .4rem; }
.tbl-companies .form-select-sm { font-size: 11px; padding: .1rem .25rem; }
.tbl-companies .btn-group .btn { padding: .18rem .34rem; }
/* اسم الشركة: توسيط النص على عمود البيانات (سجل الشركات وتقرير الشركات) */
.tbl-companies .cell-name { max-width: 185px; text-align: center; }

.table-compact td, .table-compact th { padding: .5rem .6rem !important; }

/* ------------------------- الشارات ------------------------- */
/* كل الشارات: خلفية بيضاء ناصعة ونص أسود غامق (موحّدة) */
.badge-soft {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 5px;
    display: inline-block;
    line-height: 1.35;
    background: #fff;
    color: #111;
    border: 1px solid #cfd8e3;
}
.badge-yes,
.badge-no,
.badge-fail,
.badge-wait,
.badge-part,
.badge-poll,
.badge-sec,
.badge-grade {
    background: #fff;
    color: #111;
    border: 1px solid #cfd8e3;
}

.badge-member {
    background: #fff;
    color: #111;
    border: 1px solid #cfd8e3;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 5px;
    display: inline-block;
    line-height: 1.35;
}

/* أرقام قابلة للنقر في جدول المستخدمين (المناطق / الشركات) */
.count-link {
    color: var(--brand);
    font-weight: 800;
    text-decoration: none;
    border-bottom: 1px dotted rgba(22, 50, 79, .45);
    padding: 0 2px;
}
.count-link:hover { color: var(--brand-ink); border-bottom-style: solid; }
a.badge-soft { cursor: pointer; }
a.badge-soft:hover { text-decoration: none; border-color: var(--brand); color: var(--brand-ink); }

/* ------------------------- قائمة إدراج الشركات ------------------------- */
.assign-list {
    max-height: 330px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.assign-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 6px 10px;
    border-bottom: 1px solid #f1f4f8;
    cursor: pointer;
}
.assign-item:last-child { border-bottom: 0; }
.assign-item:hover { background: #f8fafc; }
.assign-item .assign-name { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.assign-item .assign-meta { font-size: 11px; color: var(--muted); }

/* ------------------------- الأزرار ------------------------- */
.btn { font-size: 13px; font-weight: 600; border-radius: 6px; }
.btn-sm { font-size: 12px; padding: .3rem .65rem; }

.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }

.btn-gold { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-gold:hover, .btn-gold:focus { background: #9a7109; border-color: #9a7109; color: #fff; }

.btn-ghost { background: #fff; border: 1px solid var(--line); color: #344054; }
.btn-ghost:hover { background: #f7f9fb; border-color: #cfd6de; }

/* ------------------------- عناصر التحكم ------------------------- */
.form-control, .form-select {
    font-size: 13px;
    border-color: #d5dbe3;
    border-radius: 6px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-2);
    box-shadow: 0 0 0 .18rem rgba(30,68,104,.13);
}
.form-label { font-size: 12.5px; font-weight: 700; color: #344054; margin-bottom: 4px; }
.input-group-text { font-size: 13px; background: #f7f9fb; border-color: #d5dbe3; }

/* ------------------------- مصفوفة الصلاحيات ------------------------- */
.perm-table { min-width: 560px; }
.perm-table thead th {
    text-align: center;
    background: var(--brand-deep);
    color: #eaf1f8;
    font-size: 12px;
    vertical-align: middle;
}
.perm-table thead th:first-child { text-align: right; }
.perm-table td:first-child {
    font-weight: 700;
    font-size: 12.5px;
    color: var(--brand-ink);
    background: #fcfdfe;
    min-width: 210px;
}
.perm-table td:not(:first-child) { text-align: center; width: 78px; }

.perm-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--brand-2);
}
.perm-table tr.row-muted td:first-child { color: var(--muted); font-weight: 600; }
.perm-na { color: #c8d0da; font-weight: 700; }

/* ------------------------- شبكة الولايات ------------------------- */
.wil-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fcfdfe;
}
.wil-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--brand-ink);
    cursor: pointer;
    padding: 3px 0;
    user-select: none;
}
.wil-item input { width: 16px; height: 16px; accent-color: var(--brand-2); cursor: pointer; }
.wil-item input:disabled { cursor: not-allowed; }

/* ------------------------- الرسوم البيانية ------------------------- */
.bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 9px;
    font-size: 12.5px;
}
.bar-label { width: 78px; flex: 0 0 78px; color: #475467; font-weight: 600; }
.bar-track {
    flex: 1;
    height: 14px;
    background: #eef1f5;
    border-radius: 3px;
    overflow: hidden;
}
.bar-fill {
    display: block;
    height: 100%;
    min-width: 4px;
    background: var(--brand-2);
    border-radius: 3px;
    transition: width .5s ease;
}
.bar-fill.alt { background: var(--accent); }
.bar-value { width: 46px; text-align: left; font-weight: 700; color: var(--brand-ink); }

/* ------------------------- شريط التقدم ------------------------- */
.progress { height: 8px; border-radius: 4px; background: #eef1f5; }
.progress-bar { background: var(--brand-2); }

/* ------------------------- لوحة الاتصال ------------------------- */
.call-card { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 14px; }
.call-card .call-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.call-card h6 { font-size: 13.5px; font-weight: 800; margin: 0 0 3px; color: var(--brand-ink); }
.call-meta { font-size: 11.5px; color: var(--muted); }
.call-body {
    background: #f8fafc;
    border: 1px solid #eef1f5;
    border-radius: 6px;
    padding: 9px 10px;
    font-size: 12.5px;
    line-height: 2;
}
.call-body b { color: #344054; }
.call-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* عدّاد الأصوات الجزئية (أرقام إنجليزية) */
.call-partial .vote-stepper {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 2px 4px;
    background: #fff;
}
.vs-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f6f8fb;
    color: var(--brand-ink);
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.vs-btn:hover:not(:disabled) { background: var(--brand); border-color: var(--brand); color: #fff; }
.vs-btn:disabled { opacity: .4; cursor: not-allowed; }
.vs-view {
    min-width: 40px;
    text-align: center;
    font-size: 14px;
    font-weight: 800;
    color: var(--brand-ink);
    font-family: Arial, Helvetica, sans-serif;
}
.vs-view .vs-max { color: var(--muted); }
.vs-hint { font-size: 11px; color: var(--muted); margin-top: 3px; }
.call-partial.is-full .vs-hint { color: #15803d; font-weight: 700; }
.vs-note { display: none; font-size: 11px; font-weight: 700; color: #15803d; margin-top: 2px; }
.call-partial.is-full .vs-note { display: block; }

/* البطاقة المكتملة (اكتملت حصة الأصوات) */
.call-card.is-done { border: 2px solid #16a34a; background: #fbfffc; }
.done-flag {
    display: none;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 800;
}
.call-card.is-done .done-flag { display: inline-flex; }
.call-card.is-done .call-body { opacity: .8; }
.btn-reopen { display: none; }
.call-card.is-done .btn-save { display: none; }
.call-card.is-done .btn-reopen { display: inline-flex; }

/* ------------------------- الواجهة الفارغة ------------------------- */
.empty-state {
    text-align: center;
    padding: 44px 20px;
    color: var(--muted);
    border: 1px dashed #d5dbe3;
    border-radius: 8px;
    background: #fcfdfe;
}
.empty-state i { font-size: 34px; color: #c2cbd6; display: block; margin-bottom: 10px; }

/* ------------------------- نافذة المنبثقة ------------------------- */
.modal-content { border: none; border-radius: 10px; overflow: hidden; }
.modal-header { background: var(--brand); color: #fff; border: none; padding: 13px 18px; }
.modal-header .btn-close { filter: brightness(0) invert(1); opacity: .75; }
.modal-title { font-size: 14.5px; font-weight: 700; }
.modal-body { padding: 18px; }
.modal-footer { border-top: 1px solid var(--line); padding: 12px 18px; background: #fcfdfe; }

/* ------------------------- الدخول ------------------------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(rgba(14,36,57,.94), rgba(14,36,57,.94)),
        repeating-linear-gradient(45deg, #16324f 0 22px, #14304b 22px 44px);
    padding: 24px;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 18px 46px rgba(0,0,0,.34);
    overflow: hidden;
}
.login-head {
    background: var(--brand);
    color: #fff;
    padding: 22px 24px 18px;
    text-align: center;
}
.login-head .lh-mark {
    width: 52px; height: 52px;
    margin: 0 auto 10px;
    padding: 0;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 10px rgba(0,0,0,.3);
    cursor: pointer;
    transition: transform .15s ease;
}
.login-head .lh-mark:hover,
.login-head .lh-mark:focus-visible { transform: scale(1.06); outline: none; }
.login-head .lh-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-head h1 { font-size: 15px; margin: 0; font-weight: 800; }
.login-head p { font-size: 12px; margin: 4px 0 0; color: #fff; font-weight: 700; }
.login-body { padding: 22px 24px 26px; }

/* ------------------------- أدوات مساعدة ------------------------- */
.section-title {
    font-size: 14.5px;
    font-weight: 800;
    color: var(--brand-ink);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title i { color: var(--accent); }

.filter-bar {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
}

.table-responsive { max-height: none; }

.dtable-wrap { overflow-x: auto; }

.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }

/* حقول الأرقام (هاتف / رقم السجل / حساب): يبدأ الرقم من اليمين مع بقاء الترتيب صحيحاً */
input[type="tel"],
input[type="number"],
input.ltr,
input[inputmode="numeric"] {
    direction: ltr;
    text-align: right;
}

.text-muted-2 { color: var(--muted); }

/* ------------------------- التنقل بين الصفحات ------------------------- */
.pagination { --bs-pagination-color: var(--brand-deep); --bs-pagination-focus-color: var(--brand-deep); }
.pagination .page-link {
    color: var(--brand-deep);
    background: #fff;
    border-color: #cfd8e3;
    font-weight: 700;
}
.pagination .page-link:hover,
.pagination .page-link:focus {
    color: #fff;
    background: var(--brand-deep);
    border-color: var(--brand-deep);
}
.pagination .page-item.active .page-link {
    color: #fff;
    background: var(--brand-deep);
    border-color: var(--brand-deep);
}
.pagination .page-item.disabled .page-link {
    color: #98a2b3;
    background: #f6f8fb;
    border-color: #e4e9f0;
}

/* ------------------------- الاستجابة ------------------------- */
@media (max-width: 991.98px) {
    .page-content { padding: 14px 12px 20px; }

    .header-top { flex-wrap: wrap; height: auto; padding: 9px 12px; gap: 10px; }
    .header-brand { flex: 1; min-width: 0; }
    .header-brand .brand-title strong { font-size: 12.5px; white-space: normal; line-height: 1.4; }
    .header-nav-toggle { display: inline-flex; order: 2; }
    .header-user { order: 3; }

    .header-nav {
        order: 4;
        flex-basis: 100%;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 6px 0 4px;
        border-top: 1px solid rgba(255,255,255,.1);
        max-height: 60vh;
        overflow-y: auto;
    }
    .header-nav.show { display: flex; }
    .nav-link-item { padding: 10px 12px; font-size: 13.5px; }
    .nav-link-item.active { background: rgba(255,255,255,.16); color: #fff; }
    .header-sub { padding: 6px 12px; }
    .header-sub-meta { display: none; }
    .user-meta { display: none; }
}

@media (max-width: 575.98px) {
    .stat-card .stat-value { font-size: 22px; }
    .header-brand .brand-title span { display: none; }
}

/* ------------------------- الطباعة ------------------------- */
/* ترويسة التقرير: تظهر في عرض الطباعة فقط */
.print-only { display: none; }
body.print-mode .print-only { display: block; }
body.print-mode { background: #eef1f5; }
/* معاينة الطباعة على الشاشة: تُخفى العناصر غير المطبوعة فقط (تبقى الترويسة للتنقل) */
body.print-mode .no-print { display: none !important; }

.print-head {
    background: #fff;
    border: 1px solid #d5dde6;
    border-bottom: 2px solid var(--brand-deep);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 14px;
}
.print-head .ph-brand { font-size: 11px; color: #667085; }
.print-head .ph-title { font-size: 17px; font-weight: 800; color: #111; margin: 3px 0 6px; }
.print-head .ph-meta { display: flex; flex-wrap: wrap; gap: 3px 18px; font-size: 12px; color: #344054; }
.print-head .ph-meta b { color: #111; }
.print-head .ph-date { font-size: 11px; color: #667085; margin-top: 6px; }

@page wide-page { size: A4 landscape; margin: 8mm; }

@media print {
    @page { margin: 10mm 8mm; }

    /* الجداول العريضة تُطبع أفقياً (المزيد من العرض للأعمدة) */
    body.print-wide { page: wide-page; }

    .site-header, .app-footer, .no-print, .btn, .pagination, .page-link,
    .filter-bar, .polls-bar, .modal, .modal-backdrop, .dropdown-menu, .alert,
    .empty-state, .call-actions, .card-footer, .vs-hint, .vs-note, .nav-tabs,
    .header-nav-toggle { display: none !important; }

    html, body { background: #fff !important; }
    .app-shell, .app-main { display: block !important; }
    .page-content { padding: 0 !important; margin: 0 !important; }

    /* الطباعة: يُطبع قسم التقرير الحالي فقط (لا كل الأقسام) */
    .tab-content > .tab-pane { display: none !important; opacity: 0 !important; }
    .tab-content > .tab-pane.active { display: block !important; opacity: 1 !important; }

    .print-only { display: block !important; }
    .print-head {
        border: 0 !important;
        border-bottom: 2px solid #122a42 !important;
        border-radius: 0 !important;
        padding: 0 0 8px !important;
        margin-bottom: 10px !important;
    }

    .card { border: 1px solid #b7c1cd !important; box-shadow: none !important; border-radius: 0 !important; break-inside: auto; }
    .card-header {
        background: #eef2f7 !important; color: #111 !important; font-weight: 700 !important;
        border-bottom: 1px solid #b7c1cd !important;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .card-body { padding: 8px !important; }
    .stat-card { border: 1px solid #b7c1cd !important; box-shadow: none !important; }
    .row { --bs-gutter-x: 10px; --bs-gutter-y: 10px; }

    .dtable-wrap, .table-responsive { overflow: visible !important; }
    .table { width: 100% !important; margin-bottom: 0 !important; font-size: 10px !important; }
    .tbl-companies { font-size: 9px !important; }
    .table td, .table th {
        padding: 3px 4px !important; white-space: normal !important;
        word-break: normal; overflow-wrap: break-word; line-height: 1.35;
    }
    /* عناوين الجداول: لا تُقطع الكلمات (كانت تتقطّع حرفاً حرفاً في الأعمدة الضيقة) */
    .table thead th {
        word-break: keep-all; overflow-wrap: normal; hyphens: none; line-height: 1.3;
    }
    .tbl-companies > :not(caption) > * > * { padding: 2px 3px !important; }
    .table thead th, .perm-table thead th {
        background: #122a42 !important; color: #fff !important;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .table tfoot td { background: #eef2f7 !important; font-weight: 700 !important; }

    /* الطباعة: نفس شكل الشارات على الشاشة (بيضاء بنص غامق) */
    .badge-soft, .badge-member, .badge-grade, .badge-part, .badge-yes, .badge-no, .badge-fail, .badge-poll, .badge-wait, .badge-sec {
        background: #fff !important; color: #111 !important;
        box-shadow: none !important; padding: 0 3px !important;
        border: 1px solid #b7c1cd !important;
    }
    .progress { border: 1px solid #b7c1cd !important; }
    .progress-bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    /* أعمدة الإجراءات لا تُطبع */
    td.no-print, th.no-print { display: none !important; }
}

/* ------------------------- نافذة محمد الشنفري ------------------------- */
.emad-modal .modal-dialog { max-width: 380px; }

.emad-card {
    position: relative;
    border: 0;
    border-radius: 16px;
    padding: 24px 22px 18px;
    text-align: center;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(14, 36, 57, .28);
}

/* قصاصات الاحتفال */
.emad-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.emad-bit {
    position: absolute;
    top: -14px;
    display: block;
    animation-name: emadFall;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}
@keyframes emadFall {
    0%   { transform: translateY(0) rotate(0deg);       opacity: 1; }
    100% { transform: translateY(360px) rotate(540deg); opacity: 0; }
}

.emad-close {
    position: absolute;
    inset-inline-end: 12px;
    top: 12px;
    z-index: 6;
    opacity: .55;
}
.emad-close:hover { opacity: 1; }

.emad-photo-wrap { position: relative; width: 132px; height: 132px; margin: 2px auto 14px; }
.emad-photo {
    position: relative;
    z-index: 1;
    width: 132px;
    height: 132px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 8px 24px rgba(14, 36, 57, .22);
    cursor: pointer;
    transition: transform .18s ease;
}
.emad-photo:hover { transform: scale(1.04) rotate(-1.5deg); }
.emad-ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px dashed rgba(184, 134, 11, .75);
    animation: emadSpin 16s linear infinite;
}
@keyframes emadSpin { to { transform: rotate(360deg); } }

.emad-name { font-size: 19px; font-weight: 800; color: var(--brand-ink); margin: 0 0 3px; }
.emad-role { font-size: 12px; color: var(--muted); margin: 0 0 14px; }

.emad-wish-box {
    position: relative;
    background: #f7f9fb;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.emad-wish { font-size: 13.5px; font-weight: 600; color: var(--brand-ink); line-height: 1.95; margin: 0; }
.emad-wish.pop { animation: emadPop .45s ease; }
@keyframes emadPop { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.emad-quote { position: absolute; inset-inline-start: 8px; top: 6px; font-size: 20px; color: rgba(22, 50, 79, .18); }

.emad-actions { display: flex; gap: 8px; justify-content: center; }

/* حركة دخول النافذة */
.emad-modal.fade .modal-dialog { transform: scale(.92); transition: transform .25s ease-out; }
.emad-modal.show .modal-dialog { transform: scale(1); }
.emad-modal.show .emad-photo { animation: emadZoom .5s ease; }
@keyframes emadZoom { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ------------------------- بديل الصورة عند عدم وجود ملف الصورة ------------------------- */
.photo-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(150deg, #1b4064, var(--brand-deep));
    color: #fff;
    font-weight: 800;
    line-height: 1;
    user-select: none;
}
.header-brand .brand-mark .photo-fallback { font-size: 17px; }
.login-head .lh-mark .photo-fallback { font-size: 24px; }
.emad-photo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(150deg, #1b4064, var(--brand-deep));
    color: #fff;
    font-size: 46px;
    font-weight: 800;
    line-height: 1;
    user-select: none;
}

@media (max-width: 575.98px) {
    .emad-modal .modal-dialog { margin: 12px auto; }
    .emad-photo-wrap, .emad-photo { width: 112px; height: 112px; }
    .emad-photo-fallback { font-size: 38px; }
}

/* ------------------------- اختيار التاريخ من التقويم ------------------------- */
.date-pick { position: relative; }

.date-pick-btn {
    width: 100%;
    height: 31px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 0 10px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #344054;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-align: start;
    transition: border-color .15s ease, background .15s ease;
}
.date-pick-btn i { font-size: 15px; color: var(--brand); }
.date-pick-btn:hover { background: #f7f9fb; border-color: #cfd6de; }
.date-pick-btn:focus-visible { outline: 2px solid rgba(22, 50, 79, .35); outline-offset: 1px; }
.date-pick .date-pick-label { flex: 1; }

.date-pick.active .date-pick-btn { border-color: var(--brand); box-shadow: inset 0 0 0 1px rgba(22, 50, 79, .22); }
.date-pick.active .date-pick-label { font-weight: 700; color: var(--brand-ink); }

/* حقل التاريخ الأصلي: مخفي بصرياً ويُفتح منه التقويم */
.date-pick-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.date-pick-clear {
    position: absolute;
    inset-inline-end: 5px;
    top: 50%;
    transform: translateY(-50%);
    padding: 3px 5px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
}
.date-pick-clear:hover { color: var(--brand-ink); background: rgba(22, 50, 79, .07); }
.date-pick.active .date-pick-btn { padding-inline-end: 30px; }

/* ------------------------- نافذة التأكيد العصرية ------------------------- */
.ui-dialog .modal-dialog { max-width: 420px; }

.ui-dialog-content {
    border: 0;
    border-radius: 16px;
    box-shadow: 0 26px 70px rgba(14, 36, 57, .30);
    overflow: hidden;
}

.ui-dialog-body { padding: 22px 24px 2px; }

.ui-dialog-title { font-size: 15px; font-weight: 800; color: var(--brand-ink); margin: 0 0 8px; }
.ui-dialog-msg { font-size: 13px; line-height: 1.95; color: #475467; margin: 0; }

.ui-dialog-footer {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 18px 24px 22px;
}
.ui-dialog-footer .btn { min-width: 108px; }

/* حركة دخول هادئة */
.ui-dialog.fade .modal-dialog { transform: translateY(10px) scale(.97); transition: transform .22s ease-out; }
.ui-dialog.show .modal-dialog { transform: none; }

@media (max-width: 575.98px) {
    .ui-dialog .modal-dialog { max-width: none; margin: 12px; }
    .ui-dialog-body { padding: 20px 18px 2px; }
    .ui-dialog-footer { padding: 14px 18px 18px; }
    .ui-dialog-footer .btn { min-width: 90px; }
}
