/* ==========================================================================
   ds-legacy.css — Unified Design System · توحيد الأصناف الخاصة بكل قسم
   الأصناف القديمة (btn-tb-*, header-*, tab-*, clay-btn-*) كانت تعطي كل قسم
   تدرجات وألواناً مختلفة. هنا تُربط كلها بنفس مكوّنات النظام (دون تغيير أسمائها
   أو سلوكها، حتى لا يتأثر JavaScript).
   الدلالة اللونية: أساسي=أزرق · نجاح/تصدير Excel=أخضر · حذف=أحمر · محايد=رمادي.
   ========================================================================== */

/* ---------- أزرار أشرطة الأدوات (btn-tb-*) → لكل زر لون باستيل خاص وواضح ---------- */
html:root:root body .btn[class*="btn-tb-"],
html:root:root body #stageSelectorBtn.btn,
html:root:root body #btnAutoDistribute.btn,
html:root:root body .tt-view-btn-group>.btn,
html:root:root body .btn.subj-ref-purple-btn,
html:root:root body .btn.clay-btn-close {
    background: var(--ds-surface) !important;
    background-image: none !important;
    color: var(--ds-secondary-text) !important;
    border: 1px solid var(--ds-border-strong) !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    transform: none !important;
    animation: none !important;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease !important;
}

html:root:root body .btn[class*="btn-tb-"] i,
html:root:root body #stageSelectorBtn i,
html:root:root body .btn[class*="btn-tb-"] svg {
    color: inherit !important;
    filter: none !important;
}

html:root:root body .btn[class*="btn-tb-"]:hover,
html:root:root body .btn[class*="btn-tb-"]:focus,
html:root:root body .btn[class*="btn-tb-"].show,
html:root:root body #stageSelectorBtn.btn:hover,
html:root:root body #stageSelectorBtn.btn:active,
html:root:root body #stageSelectorBtn.btn.show,
html:root:root body #btnAutoDistribute.btn:hover,
html:root:root body #btnAutoDistribute.btn:active,
html:root:root body .tt-view-btn-group>.btn:hover,
html:root:root body .btn.clay-btn-close:hover {
    background-image: none !important;
    transform: none !important;
    box-shadow: none !important;
    filter: brightness(0.96) !important;
}

html:root:root body .btn[class*="btn-tb-"]:active {
    transform: none !important;
    box-shadow: none !important;
}

/* 1. ديمەنێ خشتەی (View) → أزرق سماوي (Sky Blue +10%) */
html:root:root body .btn.btn-tb-view {
    background: #c5e5f7 !important;
    border-color: rgba(2, 132, 199, 0.45) !important;
    color: #075985 !important;
}

html:root:root body .btn.btn-tb-view:hover,
html:root:root body .btn.btn-tb-view.show {
    background: #a4daf7 !important;
    color: #0c4a6e !important;
}

/* 2. رێکخستن / رێزبەندی (Sort) → تركواز بحري (Marine Teal +10%) */
html:root:root body .btn.btn-tb-sort {
    background: #b5efe4 !important;
    border-color: rgba(13, 148, 136, 0.45) !important;
    color: #115e59 !important;
}

html:root:root body .btn.btn-tb-sort:hover,
html:root:root body .btn.btn-tb-sort.show {
    background: #88ead9 !important;
    color: #134e4a !important;
}

/* 3. سەرەتایی / المرحلة (Stage Selector) → نيلي ملكي (Royal Indigo +10%) */
html:root:root body .btn.btn-tb-stage,
html:root:root body #stageSelectorBtn.btn {
    background: #dbddfc !important;
    border-color: rgba(79, 70, 229, 0.45) !important;
    color: #3730a3 !important;
}

html:root:root body .btn.btn-tb-stage:hover,
html:root:root body #stageSelectorBtn.btn:hover,
html:root:root body #stageSelectorBtn.btn.show {
    background: #cfd4fc !important;
    color: #312e81 !important;
}

/* 4. حقل البحث (Search Input) → لافندر ناعم (Soft Lavender +10%) */
html:root:root body .search-panel .form-control,
html:root:root body #searchInput {
    background-color: #e6ddfd !important;
    border: 1.5px solid rgba(139, 92, 246, 0.48) !important;
    color: var(--ds-text) !important;
}

html:root:root body .search-panel .form-control:focus,
html:root:root body #searchInput:focus {
    background-color: #ffffff !important;
    border-color: #6d28d9 !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.22) !important;
}

html:root:root body .search-panel i.fa-search {
    color: #6d28d9 !important;
}

/* 5. خشتێ نوێ / حفظ (New / Save) → أزرق أساسي بارز (Royal Blue +10%) */
html:root:root body .btn.btn-tb-new,
html:root:root body .btn.clay-btn-save-violet,
html:root:root body .btn.subj-ref-purple-btn {
    background: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: #ffffff !important;
}

html:root:root body .btn.btn-tb-new:hover,
html:root:root body .btn.clay-btn-save-violet:hover,
html:root:root body .btn.subj-ref-purple-btn:hover {
    background: #1e40af !important;
    border-color: #1e40af !important;
    color: #ffffff !important;
    filter: none !important;
}

/* 5b. رێڤەبرنا دەوامان / إدارة الدوامات (Shifts Manager) → تركواز بحري (Marine Teal +10%) */
html:root:root body .btn.btn-tb-shifts {
    background: #b5efe4 !important;
    border-color: rgba(13, 148, 136, 0.48) !important;
    color: #115e59 !important;
}

html:root:root body .btn.btn-tb-shifts:hover {
    background: #88ead9 !important;
    color: #134e4a !important;
}

/* 6. ماموستا (Teachers) → سيان محيطي (Ocean Cyan +10%) */
html:root:root body .btn.btn-tb-teacher {
    background: #b7edf5 !important;
    border-color: rgba(8, 145, 178, 0.45) !important;
    color: #155e75 !important;
}

html:root:root body .btn.btn-tb-teacher:hover {
    background: #92e7f3 !important;
    color: #164e63 !important;
}

/* 7. پول (Classes) → بنفسجي جمشتي (Amethyst Purple +10%) */
html:root:root body .btn.btn-tb-class,
html:root:root body .btn.btn-tb-purple {
    background: #e5d3fd !important;
    border-color: rgba(147, 51, 234, 0.45) !important;
    color: #6b21a8 !important;
}

html:root:root body .btn.btn-tb-class:hover,
html:root:root body .btn.btn-tb-class.show,
html:root:root body .btn.btn-tb-purple:hover {
    background: #dcc2fd !important;
    color: #581c87 !important;
}

/* 8. دابەشکرنا نصابی (Auto Distribute / Nisab) → برتقالي يوسفي (Tangerine Orange +10%) */
html:root:root body .btn.btn-tb-nisab,
html:root:root body #btnAutoDistribute.btn {
    background: #fcdbbd !important;
    border-color: rgba(234, 88, 12, 0.48) !important;
    color: #9a3412 !important;
}

html:root:root body .btn.btn-tb-nisab:hover,
html:root:root body #btnAutoDistribute.btn:hover {
    background: #fcc897 !important;
    color: #7c2d12 !important;
}

/* 9. هێلان و هەور (Cloud & Save) → أزرق كوبالت (Cobalt Sapphire +10%) */
html:root:root body .btn.btn-tb-cloud {
    background: #c5dafc !important;
    border-color: rgba(37, 99, 235, 0.45) !important;
    color: #1e40af !important;
}

html:root:root body .btn.btn-tb-cloud:hover,
html:root:root body .btn.btn-tb-cloud.show {
    background: #adcdfc !important;
    color: #1e3a8a !important;
}

/* 10. ئەكسێل (Excel) → أخضر زمردي (Emerald Forest Green +10%) */
html:root:root body .btn.btn-tb-excel {
    background: #c4f1d4 !important;
    border-color: rgba(22, 163, 74, 0.48) !important;
    color: #166534 !important;
}

html:root:root body .btn.btn-tb-excel:hover {
    background: #a7edc0 !important;
    color: #14532d !important;
}

/* 11. HTML → عنبر ذهبي (Golden Honey Amber +10%) */
html:root:root body .btn.btn-tb-html {
    background: #fae4b0 !important;
    border-color: rgba(217, 119, 6, 0.50) !important;
    color: #92400e !important;
}

html:root:root body .btn.btn-tb-html:hover,
html:root:root body .btn.btn-tb-html.show {
    background: #f9d97a !important;
    color: #78350f !important;
}

/* 12. چاپکرن (Print) → فوشيا أوركيد (Orchid Magenta +10%) */
html:root:root body .btn.btn-tb-print {
    background: #f3d1fa !important;
    border-color: rgba(192, 38, 211, 0.45) !important;
    color: #86198f !important;
}

html:root:root body .btn.btn-tb-print:hover,
html:root:root body .btn.btn-tb-print.show {
    background: #efbcf9 !important;
    color: #701a75 !important;
}

/* 13. رێکخستن (Settings) → أزرق أردوازي فولاذي (Slate Steel +10%) */
html:root:root body .btn.btn-tb-settings {
    background: #d3dae4 !important;
    border-color: rgba(71, 85, 105, 0.48) !important;
    color: #1e293b !important;
}

html:root:root body .btn.btn-tb-settings:hover {
    background: #bfc9d7 !important;
    color: #0f172a !important;
}

/* 14. ژێبرن / حذف (Delete) → أحمر قرمزي (Crimson Coral Red +10%) */
html:root:root body .btn.btn-tb-delete,
html:root:root body .btn.clay-quick-btn-danger {
    background: #facbcb !important;
    border-color: rgba(220, 38, 38, 0.48) !important;
    color: #991b1b !important;
    box-shadow: none !important;
    background-image: none !important;
}

html:root:root body .btn.btn-tb-delete:hover,
html:root:root body .btn.btn-tb-delete.show,
html:root:root body .btn.clay-quick-btn-danger:hover {
    background: #fab6b6 !important;
    color: #7f1d1d !important;
}

/* أزرار إضافية في صفحة الجدول الأسبوعي (+10%) */
html:root:root body .btn.btn-tb-lock-all {
    background: #fbccd3 !important;
    border-color: rgba(225, 29, 72, 0.45) !important;
    color: #9f1239 !important;
}

html:root:root body .btn.btn-tb-duplicate {
    background: #fae4b0 !important;
    border-color: rgba(217, 119, 6, 0.48) !important;
    color: #92400e !important;
}

html:root:root body .btn.btn-tb-period-opt {
    background: #b5efe4 !important;
    border-color: rgba(13, 148, 136, 0.45) !important;
    color: #115e59 !important;
}

html:root:root body .btn.btn-tb-rest-teachers {
    background: #dcf1b4 !important;
    border-color: rgba(101, 163, 13, 0.48) !important;
    color: #3f6212 !important;
}

html:root:root body .btn.btn-tb-pastel-colors {
    background: #f8d0e4 !important;
    border-color: rgba(219, 39, 119, 0.45) !important;
    color: #9d174d !important;
}

/* مجموعة عرض الجدول (View switch) */
html:root:root body .tt-view-btn-group {
    background: var(--ds-surface-3) !important;
    border: 1px solid var(--ds-border) !important;
    box-shadow: none !important;
    padding: 2px !important;
}

html:root:root body .tt-view-btn-group>.btn {
    border-color: transparent !important;
    background: transparent !important;
}

html:root:root body .tt-view-btn-group>.btn-check:checked+.btn,
html:root:root body .tt-view-btn-group>.btn.active {
    background: var(--ds-surface) !important;
    color: var(--ds-primary-text) !important;
    box-shadow: var(--ds-shadow-xs) !important;
}

/* ---------- رأس الصفحة: شريط علوي متوازن ومجمّع بوضوح ---------- */
html:root:root body .btn.header-circle-btn {
    background: var(--ds-surface) !important;
    background-image: none !important;
    border: 1px solid var(--ds-border) !important;
    color: var(--ds-secondary-text) !important;
    box-shadow: none !important;
    transform: none !important;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease !important;
}

html:root:root body .btn.header-circle-btn i {
    color: inherit !important;
    font-size: 0.8rem !important;
    filter: none !important;
    transform: none !important;
}

/* قلم إعادة التسمية داخل كبسولة الجدول */
html:root:root body .btn.header-circle-rename {
    background: rgba(14, 165, 233, 0.1) !important;
    border-color: rgba(14, 165, 233, 0.22) !important;
    color: #0284c7 !important;
}

html:root:root body .btn.header-circle-rename:hover {
    background: #e0f2fe !important;
    border-color: rgba(2, 132, 199, 0.4) !important;
    color: #0369a1 !important;
}

/* سلة حذف الجدول داخل كبسولة الجدول */
html:root:root body .btn.header-circle-delete {
    background: rgba(239, 68, 68, 0.09) !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
    color: #dc2626 !important;
}

html:root:root body .btn.header-circle-delete:hover {
    background: #fee2e2 !important;
    border-color: rgba(220, 38, 38, 0.4) !important;
    color: #b91c1c !important;
}

/* ترس الإعدادات داخل كبسولة النظام */
html:root:root body .btn.header-circle-settings {
    background: var(--ds-surface) !important;
    border-color: var(--ds-border) !important;
    color: #b45309 !important;
}

html:root:root body .btn.header-circle-settings:hover {
    background: #fef3c7 !important;
    border-color: rgba(217, 119, 6, 0.4) !important;
    color: #92400e !important;
}

/* كرة اللغة داخل كبسولة النظام */
html:root:root body .btn.header-circle-lang {
    background: var(--ds-surface) !important;
    border-color: var(--ds-border) !important;
    color: #7e22ce !important;
}

html:root:root body .btn.header-circle-lang:hover {
    background: #f3e8ff !important;
    border-color: rgba(147, 51, 234, 0.35) !important;
    color: #6b21a8 !important;
}

/* زر الورق الموحد داخل كبسولة النظام */
html:root:root body .btn.header-paper-btn {
    background: var(--ds-surface) !important;
    border: 1px solid var(--ds-border) !important;
    color: var(--ds-secondary-text) !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 11px !important;
    border-radius: 999px !important;
    font-size: 0.77rem !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    box-shadow: none !important;
}

html:root:root body .btn.header-paper-btn:hover {
    background: var(--ds-surface-3) !important;
    color: var(--ds-text) !important;
}

html:root:root body .btn.header-paper-btn.is-a4 {
    background: #e0f2fe !important;
    border-color: rgba(2, 132, 199, 0.35) !important;
    color: #0369a1 !important;
}

html:root:root body .btn.header-paper-btn.is-a3 {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
}

/* زر الجدول النشط داخل كبسولة الجدول */
html:root:root body .btn.header-active-schedule-btn {
    background: var(--ds-surface) !important;
    background-image: none !important;
    border: 1px solid rgba(59, 130, 246, 0.25) !important;
    color: var(--ds-text) !important;
    box-shadow: var(--ds-shadow-xs) !important;
    transform: none !important;
    filter: none !important;
    min-width: 0 !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 3px 12px !important;
    border-radius: 999px !important;
}

html:root:root body .btn.header-active-schedule-btn:hover {
    background: #eff6ff !important;
    border-color: rgba(37, 99, 235, 0.42) !important;
    color: #1d4ed8 !important;
}

html:root:root body .header-active-schedule-btn .header-schedule-icon-badge {
    width: 22px !important;
    height: 22px !important;
    background: #2563eb !important;
    color: #ffffff !important;
    box-shadow: none !important;
    font-size: 0.7rem !important;
}

/* مبدّل المظهر المدمج مع كبسولة النظام */
html:root:root body .header-theme-clay-track {
    background: #fef3c7 !important;
    background-image: none !important;
    border: 1px solid rgba(217, 119, 6, 0.35) !important;
    box-shadow: none !important;
    width: 54px !important;
    height: 30px !important;
    padding: 2px !important;
}

html:root:root body .header-theme-checkbox:checked+.header-theme-clay-track {
    background: #e0e7ff !important;
    border-color: rgba(79, 70, 229, 0.42) !important;
}

html:root:root body .theme-knob-clay {
    background: #ffffff !important;
    background-image: none !important;
    box-shadow: var(--ds-shadow-xs) !important;
    border: 1px solid var(--ds-border) !important;
    width: 24px !important;
    height: 24px !important;
    top: 2px !important;
    left: 3px !important;
    font-size: 0.74rem !important;
}

html:root:root body .header-theme-checkbox:checked+.header-theme-clay-track .theme-knob-clay {
    left: calc(100% - 27px) !important;
}

html:root:root body .theme-track-icons {
    padding: 0 7px !important;
}

html:root:root body .theme-track-icons .track-icon-sun,
html:root:root body .theme-track-icons .track-icon-moon {
    font-size: 0.72rem !important;
}

html:root:root body .theme-knob-icon-sun {
    color: #d97706 !important;
}

html:root:root body .theme-knob-icon-moon {
    color: #4f46e5 !important;
}

/* ---------- التبويبات الرئيسية: لون خاص ومختلف لكل قسم من الأقسام التسعة ---------- */
html:root:root body .custom-main-tabs .nav-link,
html:root:root body .custom-main-tabs .nav-link[class*="tab-"] {
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    transform: none !important;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease !important;
}

html:root:root body .custom-main-tabs .nav-link[class*="tab-"] i {
    color: inherit !important;
    filter: none !important;
}

/* 1. دابەشکرنا وانان (Distribution) → نيلي (Indigo +10%) */
html:root:root body .custom-main-tabs .nav-link.tab-distribution {
    background: #dbddfc !important;
    color: #3730a3 !important;
    border: 1px solid rgba(79, 70, 229, 0.38) !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-distribution:hover {
    background: #cfd4fc !important;
    color: #312e81 !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-distribution.active {
    background: #4338ca !important;
    color: #ffffff !important;
    border-color: #4338ca !important;
}

/* 2. خشتێ حەفتیانە (Timetable) → أزرق سماوي (Sky Blue +10%) */
html:root:root body .custom-main-tabs .nav-link.tab-timetable {
    background: #c5e5f7 !important;
    color: #075985 !important;
    border: 1px solid rgba(2, 132, 199, 0.38) !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-timetable:hover {
    background: #a4daf7 !important;
    color: #0c4a6e !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-timetable.active {
    background: #0369a1 !important;
    color: #ffffff !important;
    border-color: #0369a1 !important;
}

/* 3. ماموستایێن جێگر (Substitute) → بنفسجي جمشتي (Amethyst Purple +10%) */
html:root:root body .custom-main-tabs .nav-link.tab-substitute {
    background: #e5d3fd !important;
    color: #5b21b6 !important;
    border: 1px solid rgba(124, 58, 237, 0.38) !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-substitute:hover {
    background: #dcc2fd !important;
    color: #4c1d95 !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-substitute.active {
    background: #6d28d9 !important;
    color: #ffffff !important;
    border-color: #6d28d9 !important;
}

/* 4. خشتێ چاڤدێریێ (Supervision) → أخضر زمردي (Emerald Green +10%) */
html:root:root body .custom-main-tabs .nav-link.tab-supervision {
    background: #b9eed6 !important;
    color: #065f46 !important;
    border: 1px solid rgba(5, 150, 105, 0.38) !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-supervision:hover {
    background: #94e8c4 !important;
    color: #064e3b !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-supervision.active {
    background: #047857 !important;
    color: #ffffff !important;
    border-color: #047857 !important;
}

/* 5. ڕێبەرێن پۆلان (Class Mentors) → وردي قرمزي (Strawberry Rose +10%) */
html:root:root body .custom-main-tabs .nav-link.tab-mentors {
    background: #fbccd3 !important;
    color: #9f1239 !important;
    border: 1px solid rgba(225, 29, 72, 0.38) !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-mentors:hover {
    background: #fbb8c2 !important;
    color: #881337 !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-mentors.active {
    background: #be123c !important;
    color: #ffffff !important;
    border-color: #be123c !important;
}

/* 6. نصاب وانان (Nisab) → عنبر ذهبي (Golden Amber +10%) */
html:root:root body .custom-main-tabs .nav-link.tab-nisab {
    background: #fae4b0 !important;
    color: #92400e !important;
    border: 1px solid rgba(217, 119, 6, 0.40) !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-nisab:hover {
    background: #f9d97a !important;
    color: #78350f !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-nisab.active {
    background: #b45309 !important;
    color: #ffffff !important;
    border-color: #b45309 !important;
}

/* 7. فۆڕما ڕێکخستنا میلاکی (Milak) → تركواز بحري (Marine Teal +10%) */
html:root:root body .custom-main-tabs .nav-link.tab-milak {
    background: #b5efe4 !important;
    color: #115e59 !important;
    border: 1px solid rgba(13, 148, 136, 0.38) !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-milak:hover {
    background: #88ead9 !important;
    color: #134e4a !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-milak.active {
    background: #0f766e !important;
    color: #ffffff !important;
    border-color: #0f766e !important;
}

/* 8. ئامار و داتا (Statistics) → فوشيا أوركيد (Orchid Magenta +10%) */
html:root:root body .custom-main-tabs .nav-link.tab-statistics {
    background: #f3d1fa !important;
    color: #86198f !important;
    border: 1px solid rgba(192, 38, 211, 0.38) !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-statistics:hover {
    background: #efbcf9 !important;
    color: #701a75 !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-statistics.active {
    background: #a21caf !important;
    color: #ffffff !important;
    border-color: #a21caf !important;
}

/* 9. پەڕێ تۆمارێ (بەرگ) (Teacher Covers) → برتقالي محروق (Tangerine Orange +10%) */
html:root:root body .custom-main-tabs .nav-link.tab-teacher-covers {
    background: #fcdbbd !important;
    color: #9a3412 !important;
    border: 1px solid rgba(234, 88, 12, 0.38) !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-teacher-covers:hover {
    background: #fcc897 !important;
    color: #7c2d12 !important;
}

html:root:root body .custom-main-tabs .nav-link.tab-teacher-covers.active {
    background: #c2410c !important;
    color: #ffffff !important;
    border-color: #c2410c !important;
}

/* ---------- أي أزرار/روابط .btn أو .dropdown-toggle ما زال عليها تدرّج ---------- */
html:root:root body .btn.dropdown-toggle {
    background-image: none;
}

html:root:root body .btn.btn-primary,
html:root:root body .btn.btn-success,
html:root:root body .btn.btn-warning,
html:root:root body .btn.btn-danger,
html:root:root body .btn.btn-info,
html:root:root body .btn.btn-secondary,
html:root:root body .btn.btn-light,
html:root:root body .btn.btn-outline-secondary {
    background-image: none !important;
}

/* ---------- بطاقات الرأس/الأدوات القديمة ---------- */
html:root:root body .substitute-header-card,
html:root:root body .timetable-toolbar-wrapper,
html:root:root body .supervision-header-card,
html:root:root body .mentors-toolbar-card,
html:root:root body .class-mentors-dashboard {
    background: var(--ds-surface) !important;
    background-image: none !important;
    border: 1px solid var(--ds-border) !important;
    border-radius: var(--ds-radius-lg) !important;
    box-shadow: var(--ds-shadow-sm) !important;
}

html:root:root body .clay-pill,
html:root:root body .clay-meta-pill,
html:root:root body .clay-badge,
html:root:root body .clay-capsule,
html:root:root body .clay-school-pill,
html:root:root body .clay-loc-pill {
    box-shadow: none !important;
    background-image: none !important;
}

/* ---------- الحالة الفارغة (Empty State) القديمة ← ds-empty ---------- */
html:root:root body .empty-state {
    background: var(--ds-surface-2) !important;
    background-image: none !important;
    border: 1px dashed var(--ds-border-strong) !important;
    border-radius: var(--ds-radius-lg) !important;
    box-shadow: none !important;
    color: var(--ds-text-muted) !important;
}

html:root:root body .empty-state i {
    color: var(--ds-primary) !important;
    opacity: .6;
}

/* ==========================================================================
   شارات الأيقونات (كانت تدرّجات ملوّنة مختلفة لكل قسم) ← بلاط أيقونة موحّد
   ========================================================================== */
html:root:root body [class*="icon-badge"],
html:root:root body [class*="icon-circle"],
html:root:root body [class*="arrow-badge"],
html:root:root body .clay-badge-icon,
html:root:root body .clay-merged-header-icon,
html:root:root body .subj-ref-green-badge,
html:root:root body .tt-context-clay-badge,
html:root:root body .clay-pair-connector-badge,
html:root:root body .clay-lock-icon {
    background: var(--ds-primary-soft) !important;
    background-image: none !important;
    border: 1px solid rgba(63, 120, 194, .18) !important;
    box-shadow: none !important;
    filter: none !important;
    color: var(--ds-primary) !important;
    text-shadow: none !important;
}

html:root:root body [class*="icon-badge"] i,
html:root:root body [class*="icon-circle"] i,
html:root:root body [class*="arrow-badge"] i,
html:root:root body .clay-badge-icon i,
html:root:root body .clay-merged-header-icon i,
html:root:root body .tt-context-clay-badge i,
html:root:root body .clay-pair-connector-badge i {
    color: var(--ds-primary) !important;
    filter: none !important;
    text-shadow: none !important;
}

html:root:root body .badge,
html:root:root body #mergedPairsCountBadge {
    background-image: none !important;
}

/* ==========================================================================
   بطاقات المؤشرات KPI (الإشراف / المرشدون) ← بطاقة بيضاء موحّدة
   ========================================================================== */
html:root:root body .sup-kpi-clay-card,
html:root:root body .mentor-stat-clay-card,
html:root:root body .sup-clay-card,
html:root:root body .sup-day-card-luxury,
html:root:root body .clay-pair-deck-card-blue,
html:root:root body .clay-pair-deck-card-green,
html:root:root body .clay-merged-card,
html:root:root body .distribution-toolbar-card {
    background: var(--ds-surface) !important;
    background-image: none !important;
    border: 1px solid var(--ds-border) !important;
    border-radius: var(--ds-radius-lg) !important;
    box-shadow: var(--ds-shadow-sm) !important;
    filter: none !important;
    transform: none !important;
}

html:root:root body .sup-kpi-title,
html:root:root body .mentor-stat-title {
    color: var(--ds-text-muted) !important;
    font-size: var(--ds-fs-sm) !important;
    font-weight: var(--ds-fw-medium) !important;
    text-shadow: none !important;
}

html:root:root body .sup-kpi-val,
html:root:root body .mentor-stat-val {
    color: var(--ds-text) !important;
    font-weight: var(--ds-fw-bold) !important;
    text-shadow: none !important;
}

html:root:root body .sup-kpi-val i {
    color: var(--ds-primary) !important;
    filter: none !important;
}

/* رؤوس أيام الإشراف (كل يوم بلون) ← رأس موحّد */
html:root:root body .sup-day-header,
html:root:root body .sup-day-header[class*="sup-day-"] {
    background: var(--ds-surface-2) !important;
    background-image: none !important;
    color: var(--ds-text) !important;
    border: 0 !important;
    border-bottom: 1px solid var(--ds-border) !important;
    border-radius: var(--ds-radius-lg) var(--ds-radius-lg) 0 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

html:root:root body .sup-day-header .sup-day-title,
html:root:root body .sup-day-header .sup-day-title span,
html:root:root body .sup-day-header .day-title-text {
    color: var(--ds-text) !important;
    text-shadow: none !important;
}

/* أشرطة/كبسولات/نصائح قديمة ← سطح ناعم موحّد */
html:root:root body .clay-controls-bar,
html:root:root body .clay-hint-pill,
html:root:root body .tt-select-clay-capsule,
html:root:root body .clay-feature-icon-badge {
    background: var(--ds-surface-2) !important;
    background-image: none !important;
    border: 1px solid var(--ds-border) !important;
    box-shadow: none !important;
    filter: none !important;
}

html:root:root body .validation-card-success {
    background: var(--ds-success-soft) !important;
    background-image: none !important;
    border: 1px solid rgba(47, 158, 110, .25) !important;
    box-shadow: none !important;
    color: var(--ds-success-text) !important;
}

html:root:root body .sup-status-pill {
    box-shadow: none !important;
    background-image: none !important;
}

/* أزرار إضافة / تبديل مجموعات (btn-check) / حالة active */
html:root:root body .btn.sup-footer-add-btn,
html:root:root body button.sup-footer-add-btn {
    background: var(--ds-surface) !important;
    background-image: none !important;
    border: 1px solid var(--ds-border-strong) !important;
    color: var(--ds-primary-text) !important;
    box-shadow: none !important;
    transform: none !important;
}

html:root:root body .btn.sup-footer-add-btn:hover,
html:root:root body button.sup-footer-add-btn:hover {
    background: var(--ds-primary-soft) !important;
}

html:root:root body label.btn,
html:root:root body .btn-check+.btn,
html:root:root body .btn.active {
    background-image: none !important;
}

html:root:root body .btn.active {
    box-shadow: none !important;
}

/* قواعد قديمة مقيّدة بمعرّف تبويب (#xxx-tab-pane) تحتاج أولوية مكافئة */
html:root:root body :is(#distribution-tab-pane, #timetable-tab-pane, #substitute-tab-pane, #supervision-tab-pane, #class-mentors-tab-pane, #nisab-tab-pane, #milak-tab-pane, #statistics-tab-pane, #teacher-covers-tab-pane) :is(.tt-select-icon-badge, .tt-context-clay-badge, .tt-select-arrow-badge) {
    background: var(--ds-primary-soft) !important;
    background-image: none !important;
    border: 1px solid rgba(63, 120, 194, .18) !important;
    box-shadow: none !important;
    color: var(--ds-primary-text) !important;
    filter: none !important;
}

html:root:root body .tt-context-clay-badge {
    color: var(--ds-primary-text) !important;
    font-weight: var(--ds-fw-medium);
}

html:root:root body .tt-context-clay-badge i,
html:root:root body .tt-select-icon-badge i {
    color: var(--ds-primary) !important;
    filter: none !important;
}

/* نافذة المعلم: القاعدة القديمة كانت تضيف فاصلاً متقطعاً + 3rem لكل حقل داخلي
   (#teacherForm .row > [class*="col-"]). نُبقيها للأعمدة الرئيسية فقط وننفيها للحقول المتداخلة. */
html:root:root body #teacherForm .row .row>[class*="col-"] {
    border-bottom: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* نافذة المعلم: على التابلت واللابتوب الصغير يبقى العمودان جنباً إلى جنب بدل أن يُرصّا
   فوق بعض (كان يضاعف الارتفاع). على الهاتف (<768px) يبقيان عموديين. */
@media (min-width: 768px) {
    html:root:root body #teacherForm>.row>.col-xl-4 {
        flex: 0 0 auto;
        width: 36%;
    }

    html:root:root body #teacherForm>.row>.col-xl-8 {
        flex: 0 0 auto;
        width: 64%;
    }
}

/* عنوان التطبيق: كان لوناً داكناً ثابتاً (يختفي في الداكن) */
html:root:root body .header-app-title {
    color: var(--ds-text) !important;
    text-shadow: none !important;
}

/* ==========================================================================
   الوضع الداكن — ألوان نص/خلفيات صلبة في الأقسام كانت مصمَّمة للفاتح فقط
   ========================================================================== */
html:root:root body[data-bs-theme="dark"] .text-dark,
html:root:root body[data-bs-theme="dark"] .text-black,
html:root:root body[data-bs-theme="dark"] .text-body,
html:root:root body[data-bs-theme="dark"] .text-secondary-emphasis,
html:root:root body[data-bs-theme="dark"] .text-dark-emphasis {
    color: var(--ds-text) !important;
}

html:root:root body[data-bs-theme="dark"] .text-secondary,
html:root:root body[data-bs-theme="dark"] .text-muted {
    color: var(--ds-text-muted) !important;
}

html:root:root body[data-bs-theme="dark"] .text-primary {
    color: var(--ds-primary-text) !important;
}

html:root:root body[data-bs-theme="dark"] .text-success {
    color: var(--ds-success-text) !important;
}

html:root:root body[data-bs-theme="dark"] .text-danger {
    color: var(--ds-danger-text) !important;
}

html:root:root body[data-bs-theme="dark"] .text-warning {
    color: var(--ds-warning-text) !important;
}

/* أسطح فاتحة ثابتة (bg-white / bg-light ...) */
html:root:root body[data-bs-theme="dark"] .bg-white,
html:root:root body[data-bs-theme="dark"] .bg-body {
    background-color: var(--ds-surface) !important;
}

html:root:root body[data-bs-theme="dark"] .bg-light,
html:root:root body[data-bs-theme="dark"] .bg-body-tertiary,
html:root:root body[data-bs-theme="dark"] .bg-body-secondary {
    background-color: var(--ds-surface-2) !important;
}

html:root:root body[data-bs-theme="dark"] .border-light,
html:root:root body[data-bs-theme="dark"] .border-light-subtle,
html:root:root body[data-bs-theme="dark"] .border-secondary-subtle {
    border-color: var(--ds-border) !important;
}

/* الجداول وبطاقات الرأس والخلايا */
html:root:root body[data-bs-theme="dark"] .card-header,
html:root:root body[data-bs-theme="dark"] table th,
html:root:root body[data-bs-theme="dark"] table td {
    color: var(--ds-text) !important;
}

html:root:root body[data-bs-theme="dark"] table th {
    background-color: var(--ds-surface-2) !important;
}

html:root:root body[data-bs-theme="dark"] .table td:not([style*="background"]):not([class*="bg-"]) {
    background-color: transparent;
}

html:root:root body[data-bs-theme="dark"] .badge.bg-light,
html:root:root body[data-bs-theme="dark"] .badge.text-dark {
    background-color: var(--ds-secondary-soft) !important;
    color: var(--ds-secondary-text) !important;
}

/* رسائل التحقق/الفارغ القديمة */
html:root:root body[data-bs-theme="dark"] .validation-item-text,
html:root:root body[data-bs-theme="dark"] .validation-card-success {
    color: var(--ds-success-text) !important;
}

html:root:root body[data-bs-theme="dark"] .clay-empty-card-state {
    background: var(--ds-surface-2) !important;
    color: var(--ds-text-muted) !important;
    border-color: var(--ds-border) !important;
}

html:root:root body[data-bs-theme="dark"] .sup-day-body,
html:root:root body[data-bs-theme="dark"] .sup-clay-body {
    background: var(--ds-surface) !important;
    background-image: none !important;
}

html:root:root body[data-bs-theme="dark"] .sup-day-footer {
    background: var(--ds-surface-2) !important;
    border-color: var(--ds-border) !important;
}

html:root:root body[data-bs-theme="dark"] table thead,
html:root:root body[data-bs-theme="dark"] table thead tr {
    background-color: var(--ds-surface-2) !important;
}

html:root:root body[data-bs-theme="dark"] tr[style*="fce4d6" i] {
    background-color: var(--ds-surface-3) !important;
}

html:root:root body[data-bs-theme="dark"] .card-header div,
html:root:root body[data-bs-theme="dark"] .card-header span {
    color: var(--ds-text) !important;
}

html:root:root body[data-bs-theme="dark"] th [style*="color:#000" i],
html:root:root body[data-bs-theme="dark"] th [style*="color: #000" i],
html:root:root body[data-bs-theme="dark"] td [style*="color:#000" i],
html:root:root body[data-bs-theme="dark"] td [style*="color: #000" i] {
    color: var(--ds-text) !important;
}

/* ألوان الأزرار والتبويبات والرأس وحقل البحث في الوضع الداكن (+10%) */
html:root:root body[data-bs-theme="dark"] .btn.btn-tb-view {
    background: rgba(14, 165, 233, 0.26) !important;
    border-color: rgba(56, 189, 248, 0.45) !important;
    color: #7dd3fc !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-sort {
    background: rgba(20, 184, 166, 0.26) !important;
    border-color: rgba(45, 212, 191, 0.45) !important;
    color: #5eead4 !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-stage,
html:root:root body[data-bs-theme="dark"] #stageSelectorBtn.btn {
    background: rgba(99, 102, 241, 0.28) !important;
    border-color: rgba(129, 140, 248, 0.48) !important;
    color: #a5b4fc !important;
}

html:root:root body[data-bs-theme="dark"] .search-panel .form-control,
html:root:root body[data-bs-theme="dark"] #searchInput {
    background-color: rgba(139, 92, 246, 0.24) !important;
    border-color: rgba(167, 139, 250, 0.45) !important;
    color: var(--ds-text) !important;
}

html:root:root body[data-bs-theme="dark"] .search-panel i.fa-search {
    color: #c4b5fd !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-shifts {
    background: rgba(20, 184, 166, 0.26) !important;
    border-color: rgba(45, 212, 191, 0.45) !important;
    color: #5eead4 !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-teacher {
    background: rgba(6, 182, 212, 0.26) !important;
    border-color: rgba(34, 211, 238, 0.45) !important;
    color: #67e8f9 !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-class,
html:root:root body[data-bs-theme="dark"] .btn.btn-tb-purple {
    background: rgba(168, 85, 247, 0.26) !important;
    border-color: rgba(192, 132, 252, 0.45) !important;
    color: #d8b4fe !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-nisab,
html:root:root body[data-bs-theme="dark"] #btnAutoDistribute.btn {
    background: rgba(249, 115, 22, 0.26) !important;
    border-color: rgba(251, 146, 60, 0.45) !important;
    color: #fdba74 !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-cloud {
    background: rgba(59, 130, 246, 0.28) !important;
    border-color: rgba(96, 165, 250, 0.48) !important;
    color: #93c5fd !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-excel {
    background: rgba(34, 197, 94, 0.26) !important;
    border-color: rgba(74, 222, 128, 0.45) !important;
    color: #86efac !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-html {
    background: rgba(245, 158, 11, 0.26) !important;
    border-color: rgba(251, 191, 36, 0.45) !important;
    color: #fcd34d !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-print {
    background: rgba(217, 70, 239, 0.26) !important;
    border-color: rgba(232, 121, 249, 0.45) !important;
    color: #f0abfc !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-settings {
    background: rgba(148, 163, 184, 0.26) !important;
    border-color: rgba(148, 163, 184, 0.45) !important;
    color: #cbd5e1 !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-delete,
html:root:root body[data-bs-theme="dark"] .btn.clay-quick-btn-danger {
    background: rgba(239, 68, 68, 0.26) !important;
    border-color: rgba(248, 113, 113, 0.45) !important;
    color: #fca5a5 !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-lock-all {
    background: rgba(244, 63, 94, 0.26) !important;
    border-color: rgba(251, 113, 133, 0.45) !important;
    color: #fda4af !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-duplicate {
    background: rgba(245, 158, 11, 0.26) !important;
    border-color: rgba(251, 191, 36, 0.45) !important;
    color: #fcd34d !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-period-opt {
    background: rgba(20, 184, 166, 0.26) !important;
    border-color: rgba(45, 212, 191, 0.45) !important;
    color: #5eead4 !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-rest-teachers {
    background: rgba(132, 204, 22, 0.26) !important;
    border-color: rgba(163, 230, 53, 0.45) !important;
    color: #bef264 !important;
}

html:root:root body[data-bs-theme="dark"] .btn.btn-tb-pastel-colors {
    background: rgba(236, 72, 153, 0.26) !important;
    border-color: rgba(244, 114, 182, 0.45) !important;
    color: #f9a8d4 !important;
}

/* رأس الصفحة في الوضع الداكن */
html:root:root body[data-bs-theme="dark"] .top-header-card .header-group-schedule {
    background: rgba(15, 23, 42, 0.72) !important;
    border-color: rgba(96, 165, 250, 0.25) !important;
}

html:root:root body[data-bs-theme="dark"] .top-header-card .header-group-system {
    background: rgba(15, 23, 42, 0.72) !important;
    border-color: var(--ds-border) !important;
}

html:root:root body[data-bs-theme="dark"] .btn.header-circle-rename {
    background: rgba(14, 165, 233, 0.16) !important;
    border-color: rgba(56, 189, 248, 0.3) !important;
    color: #7dd3fc !important;
}

html:root:root body[data-bs-theme="dark"] .btn.header-circle-delete {
    background: rgba(239, 68, 68, 0.16) !important;
    border-color: rgba(248, 113, 113, 0.3) !important;
    color: #fca5a5 !important;
}

html:root:root body[data-bs-theme="dark"] .btn.header-circle-settings {
    background: var(--ds-surface-2) !important;
    border-color: var(--ds-border) !important;
    color: #fcd34d !important;
}

html:root:root body[data-bs-theme="dark"] .btn.header-circle-lang {
    background: var(--ds-surface-2) !important;
    border-color: var(--ds-border) !important;
    color: #d8b4fe !important;
}

html:root:root body[data-bs-theme="dark"] .btn.header-paper-btn {
    background: var(--ds-surface-2) !important;
    border-color: var(--ds-border) !important;
    color: var(--ds-secondary-text) !important;
}

html:root:root body[data-bs-theme="dark"] .btn.header-paper-btn.is-a4 {
    background: rgba(14, 165, 233, 0.2) !important;
    border-color: rgba(56, 189, 248, 0.38) !important;
    color: #7dd3fc !important;
}

html:root:root body[data-bs-theme="dark"] .btn.header-paper-btn.is-a3 {
    background: #2563eb !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
}

html:root:root body[data-bs-theme="dark"] .btn.header-active-schedule-btn {
    background: var(--ds-surface-2) !important;
    border-color: rgba(96, 165, 250, 0.35) !important;
    color: #e2e8f0 !important;
}

html:root:root body[data-bs-theme="dark"] .btn.header-active-schedule-btn:hover {
    background: rgba(59, 130, 246, 0.22) !important;
    color: #ffffff !important;
}

html:root:root body[data-bs-theme="dark"] .header-theme-clay-track {
    background: rgba(99, 102, 241, 0.22) !important;
    border-color: rgba(129, 140, 248, 0.42) !important;
}

/* التبويبات الرئيسية التسعة في الوضع الداكن (غير النشطة فقط، والنشط يبقى بلونه الزاهي) (+10%) */
html:root:root body[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-distribution:not(.active) {
    background: rgba(99, 102, 241, 0.26) !important;
    color: #c7d2fe !important;
    border-color: rgba(129, 140, 248, 0.42) !important;
}

html:root:root body[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-timetable:not(.active) {
    background: rgba(14, 165, 233, 0.26) !important;
    color: #bae6fd !important;
    border-color: rgba(56, 189, 248, 0.42) !important;
}

html:root:root body[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-substitute:not(.active) {
    background: rgba(168, 85, 247, 0.26) !important;
    color: #e9d5ff !important;
    border-color: rgba(192, 132, 252, 0.42) !important;
}

html:root:root body[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-supervision:not(.active) {
    background: rgba(16, 185, 129, 0.26) !important;
    color: #a7f3d0 !important;
    border-color: rgba(52, 211, 153, 0.42) !important;
}

html:root:root body[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-mentors:not(.active) {
    background: rgba(244, 63, 94, 0.26) !important;
    color: #fecdd3 !important;
    border-color: rgba(251, 113, 133, 0.42) !important;
}

html:root:root body[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-nisab:not(.active) {
    background: rgba(245, 158, 11, 0.26) !important;
    color: #fde68a !important;
    border-color: rgba(251, 191, 36, 0.42) !important;
}

html:root:root body[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-milak:not(.active) {
    background: rgba(20, 184, 166, 0.26) !important;
    color: #99f6e4 !important;
    border-color: rgba(45, 212, 191, 0.42) !important;
}

html:root:root body[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-statistics:not(.active) {
    background: rgba(217, 70, 239, 0.26) !important;
    color: #f5d0fe !important;
    border-color: rgba(232, 121, 249, 0.42) !important;
}

html:root:root body[data-bs-theme="dark"] .custom-main-tabs .nav-link.tab-teacher-covers:not(.active) {
    background: rgba(234, 88, 12, 0.26) !important;
    color: #fed7aa !important;
    border-color: rgba(251, 146, 60, 0.42) !important;
}

html:root:root body[data-bs-theme="dark"] .custom-main-tabs .nav-link[class*="tab-"].active {
    color: #ffffff !important;
}

html:root:root body[data-bs-theme="dark"] .theme-knob-clay {
    background: var(--ds-surface) !important;
    border-color: var(--ds-border-strong) !important;
}

/* ============================================================
 * Global Top Header Card — 3-Zone Balanced & Multi-Device Architecture
 * Desktop (≥1200px): Brand (Start) | Schedule Capsule (Center) | System Tray (End)
 * Laptop/iPad Landscape (992px-1199px): Clean 3-zone flex space-between
 * Portrait Tablet (768px-991px): Brand + System Tray on top row, Schedule Capsule centered below
 * Mobile (≤767px): Compact 3-row header (Brand -> Full Schedule Capsule -> Nowrap System Tray)
 * ============================================================ */
html:root:root body .top-header-card {
    padding: 10px 14px !important;
    border-radius: 18px !important;
}

html:root:root body .top-header-card > div:first-child {
    width: 100% !important;
    gap: 10px 14px !important;
}

html:root:root body .top-header-card .app-branding {
    gap: 10px !important;
    min-width: 0;
}

html:root:root body .top-header-card .header-app-title {
    font-size: 1.08rem !important;
    white-space: nowrap;
}

html:root:root body .top-header-card .header-group-schedule {
    display: inline-flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 4px !important;
    padding: 3px !important;
    background: var(--ds-surface-2) !important;
    border: 1px solid rgba(59, 130, 246, 0.22) !important;
    border-radius: 999px !important;
    box-shadow: var(--ds-shadow-xs) !important;
    max-width: 100%;
}

html:root:root body .top-header-card .header-group-system {
    display: inline-flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 5px !important;
    padding: 3px !important;
    background: var(--ds-surface-2) !important;
    border: 1px solid var(--ds-border) !important;
    border-radius: 999px !important;
    box-shadow: var(--ds-shadow-xs) !important;
    width: fit-content !important;
    max-width: 100%;
}

html:root:root body .top-header-card .header-group-schedule > .dropdown,
html:root:root body .top-header-card .header-group-system > .dropdown {
    display: inline-flex !important;
    align-items: center !important;
    flex-shrink: 0;
}

html:root:root body .top-header-card .header-divider {
    display: none !important;
}

html:root:root body .top-header-card .btn.header-active-schedule-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    padding: 3px 12px !important;
    min-height: 32px !important;
    height: 32px !important;
    max-width: 100%;
}

html:root:root body .top-header-card #activeScheduleLabel {
    margin: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 210px !important;
}

html:root:root body .top-header-card .btn.header-active-schedule-btn.dropdown-toggle::after,
html:root:root body .top-header-card #paperSizeDropdownBtn.dropdown-toggle::after {
    margin-inline-start: 3px !important;
    margin-inline-end: 0 !important;
    vertical-align: middle !important;
}

html:root:root body .top-header-card .dropdown-menu .dropdown-item {
    gap: 8px !important;
}

@media (min-width: 1200px) {
    html:root:root body .top-header-card > div:first-child {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
        align-items: center !important;
        gap: 14px !important;
    }

    html:root:root body .top-header-card .app-branding {
        justify-self: start !important;
    }

    html:root:root body .top-header-card .header-controls {
        display: contents !important;
    }

    html:root:root body .top-header-card .header-group-schedule {
        justify-self: center !important;
    }

    html:root:root body .top-header-card .header-group-system {
        justify-self: end !important;
    }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    html:root:root body .top-header-card > div:first-child {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    html:root:root body .top-header-card .header-controls {
        display: contents !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    html:root:root body .top-header-card > div:first-child {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
    }

    html:root:root body .top-header-card .header-controls {
        display: contents !important;
    }

    html:root:root body .top-header-card .app-branding {
        order: 1;
    }

    html:root:root body .top-header-card .header-group-system {
        order: 2;
    }

    html:root:root body .top-header-card .header-group-schedule {
        order: 3;
        width: 100% !important;
        justify-content: center !important;
    }
}

@media (max-width: 767.98px) {
    html:root:root body .top-header-card {
        padding: 10px !important;
    }

    html:root:root body .top-header-card > div:first-child {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    html:root:root body .top-header-card .app-branding {
        justify-content: center !important;
    }

    html:root:root body .top-header-card .header-app-title {
        font-size: 1rem !important;
    }

    html:root:root body .top-header-card .header-controls {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        width: 100% !important;
    }

    html:root:root body .top-header-card .header-group-schedule {
        width: 100% !important;
        justify-content: space-between !important;
        gap: 5px !important;
        flex: none !important;
    }

    html:root:root body .top-header-card #scheduleDropdownContainer {
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    html:root:root body .top-header-card #scheduleDropdownBtn {
        width: 100% !important;
        justify-content: space-between !important;
        padding: 3px 10px !important;
    }

    html:root:root body .top-header-card #activeScheduleLabel {
        max-width: none !important;
        width: auto !important;
        flex: 1 1 auto !important;
        text-align: start !important;
    }

    html:root:root body .top-header-card .header-group-system {
        align-self: center !important;
        justify-content: center !important;
        flex-wrap: nowrap !important;
        gap: 5px !important;
        width: auto !important;
    }

    html:root:root body .main-tabs-card {
        padding: 6px 8px !important;
    }

    html:root:root body .custom-main-tabs {
        scroll-snap-type: x proximity;
        gap: 6px !important;
    }

    html:root:root body .custom-main-tabs .nav-link {
        scroll-snap-align: start;
        min-height: 36px !important;
        padding: 5px 12px !important;
    }
}