@import url("https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;600;700;800&display=swap");

html[dir="rtl"],
html[dir="rtl"] body,
.portal-locale-ar,
.portal-locale-ur {
    font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif !important;
    letter-spacing: 0 !important;
    font-feature-settings: "kern";
    text-rendering: optimizeLegibility;
}

html[dir="rtl"] body,
.portal-dir-rtl {
    direction: rtl;
    text-align: right;
    font-size: 14px;
    line-height: 1.75;
}

.portal-dir-rtl .page-wrapper,
.portal-dir-rtl .content,
.portal-dir-rtl .card,
.portal-dir-rtl .modal-content {
    font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif !important;
}

.portal-dir-rtl h1,
.portal-dir-rtl h2,
.portal-dir-rtl h3,
.portal-dir-rtl h4,
.portal-dir-rtl h5,
.portal-dir-rtl h6,
.portal-dir-rtl p,
.portal-dir-rtl label,
.portal-dir-rtl .form-label,
.portal-dir-rtl .text-muted,
.portal-dir-rtl .card-title,
.portal-dir-rtl .breadcrumb,
.portal-dir-rtl .dropdown-item,
.portal-dir-rtl .menu-title,
.portal-dir-rtl .sidebar .menu-title span {
    letter-spacing: 0 !important;
}

.portal-dir-rtl .main-wrapper {
    direction: rtl;
}

@media (min-width: 992px) {
    .portal-dir-rtl .sidebar {
        right: 0 !important;
        left: auto !important;
        border-right: 0 !important;
        border-left: 1px solid #ededed !important;
    }

    .portal-dir-rtl .page-wrapper {
        margin: 0 252px 0 0 !important;
    }

    .portal-dir-rtl .header {
        right: 252px !important;
        left: 0 !important;
    }

    .portal-dir-rtl.mini-sidebar .page-wrapper {
        margin-right: 72px !important;
        margin-left: 0 !important;
    }

    .portal-dir-rtl.mini-sidebar .header {
        right: 72px !important;
        left: 0 !important;
    }

    .portal-dir-rtl.mini-sidebar.expand-menu .page-wrapper,
    .portal-dir-rtl.expand-menu.mini-sidebar .page-wrapper {
        margin-right: 252px !important;
        margin-left: 0 !important;
    }

    .portal-dir-rtl.mini-sidebar.expand-menu .header,
    .portal-dir-rtl.expand-menu.mini-sidebar .header {
        right: 252px !important;
        left: 0 !important;
    }
}

@media (max-width: 991.98px) {
    .portal-dir-rtl .header {
        right: 0 !important;
        left: 0 !important;
    }

    .portal-dir-rtl .page-wrapper {
        margin: 0 !important;
        padding-top: 50px;
    }

    .portal-dir-rtl .sidebar {
        right: 0 !important;
        left: auto !important;
        margin-right: -575px !important;
        margin-left: 0 !important;
        border-right: 0 !important;
        border-left: 1px solid #ededed !important;
    }

    .portal-dir-rtl.slide-nav .sidebar,
    .portal-dir-rtl .slide-nav .sidebar,
    body.portal-dir-rtl.slide-nav .sidebar {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    .portal-dir-rtl .header .mobile_btn {
        right: 12px !important;
        left: auto !important;
    }

    .portal-dir-rtl .header .mobile-user-menu {
        left: 12px !important;
        right: auto !important;
    }
}

.portal-dir-rtl .sidebar .sidebar-logo {
    right: 0;
    left: auto;
}

.portal-dir-rtl .sidebar .sidebar-profile {
    flex-direction: row-reverse;
    text-align: right;
}

.portal-dir-rtl .sidebar .sidebar-profile-info {
    margin-left: 0 !important;
    margin-right: .5rem !important;
    text-align: right !important;
}

.portal-dir-rtl #header-search .portal-language-switcher {
    display: none !important;
}

.portal-dir-rtl .header .main-header,
.portal-dir-rtl .header .header-user .user-menu {
    direction: rtl;
}

.portal-dir-rtl .header .header-user .user-menu {
    justify-content: space-between;
}

.portal-dir-rtl .header #header-search {
    margin-right: 0 !important;
    margin-left: auto !important;
}

.portal-dir-rtl .header #toggle_btn i,
.portal-dir-rtl .header #toggle_btn .ti {
    transform: rotate(180deg);
}

.portal-dir-rtl .sidebar,
.portal-dir-rtl .sidebar .sidebar-menu,
.portal-dir-rtl .sidebar .sidebar-menu > ul,
.portal-dir-rtl .sidebar .sidebar-menu ul li a {
    direction: rtl;
    text-align: right;
    min-height: 42px;
    gap: .55rem;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
}

.portal-dir-rtl .sidebar .sidebar-menu ul li a,
.portal-dir-rtl .sidebar a,
.portal-dir-rtl .nav-list,
.portal-dir-rtl .header-user .nav {
    flex-direction: row-reverse;
}

.portal-dir-rtl .sidebar .sidebar-menu ul li a i,
.portal-dir-rtl .sidebar a i {
    margin-right: 0 !important;
    margin-left: .5rem !important;
    font-size: 17px;
    width: 18px;
    text-align: center;
    flex: 0 0 18px;
}

.portal-dir-rtl .sidebar .menu-arrow {
    margin-left: 0 !important;
    margin-right: auto !important;
    transform: rotate(180deg);
}

.portal-dir-rtl .sidebar .menu-title {
    text-align: right;
    padding-right: 14px;
    padding-left: 8px;
}

.portal-dir-rtl .sidebar .menu-title span {
    font-size: 11px;
    font-weight: 800;
    color: #8b95a5;
}

.portal-dir-rtl .sidebar .submenu ul {
    padding-right: 29px;
    padding-left: 0;
}

.portal-dir-rtl .sidebar .submenu ul li a {
    font-weight: 500;
    color: #4b5565;
}

.portal-dir-rtl .sidebar .sidebar-menu ul li a.active,
.portal-dir-rtl .sidebar .sidebar-menu ul li a:hover {
    background: rgba(242, 101, 34, .08);
    color: #d35400;
}

.portal-dir-rtl .page-wrapper {
    direction: rtl;
}

.portal-dir-rtl .content {
    letter-spacing: 0 !important;
}

.portal-dir-rtl .header,
.portal-dir-rtl .header .header-left,
.portal-dir-rtl .header .header-user,
.portal-dir-rtl .header .nav {
    direction: rtl;
}

.portal-dir-rtl .header .dropdown-menu,
.portal-dir-rtl .header .notification-dropdown {
    font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif !important;
}

.portal-dir-rtl .page-breadcrumb {
    gap: .75rem;
}

.portal-dir-rtl .page-breadcrumb,
.portal-dir-rtl .card-header,
.portal-dir-rtl .card-body,
.portal-dir-rtl .modal-header,
.portal-dir-rtl .modal-body,
.portal-dir-rtl .modal-footer,
.portal-dir-rtl .dropdown-menu,
.portal-dir-rtl .table {
    direction: rtl;
    text-align: right;
}

.portal-dir-rtl .page-breadcrumb h2,
.portal-dir-rtl .card-header h4,
.portal-dir-rtl .card-header h5,
.portal-dir-rtl .modal-title {
    font-weight: 800;
    line-height: 1.45;
}

.portal-dir-rtl .text-muted,
.portal-dir-rtl .fs-12,
.portal-dir-rtl .fs-13 {
    line-height: 1.7;
}

.portal-dir-rtl .breadcrumb-item + .breadcrumb-item {
    padding-left: 0;
    padding-right: var(--bs-breadcrumb-item-padding-x);
}

.portal-dir-rtl .breadcrumb-item + .breadcrumb-item::before {
    float: right;
    padding-right: 0;
    padding-left: var(--bs-breadcrumb-item-padding-x);
    transform: rotate(180deg);
}

.portal-dir-rtl .dropdown-menu-end {
    right: auto !important;
    left: 0 !important;
}

.portal-dir-rtl .header .dropdown-menu-end {
    inset-inline-start: 0 !important;
    inset-inline-end: auto !important;
}

.portal-dir-rtl .header .dropdown-menu-start {
    inset-inline-start: auto !important;
    inset-inline-end: 0 !important;
}

.portal-dir-rtl .dropdown-menu-start {
    right: 0 !important;
    left: auto !important;
}

.portal-dir-rtl .dropdown-toggle::after {
    margin-left: 0;
    margin-right: .35em;
}

.portal-dir-rtl .btn,
.portal-dir-rtl .dropdown-item,
.portal-dir-rtl .badge,
.portal-dir-rtl .form-control,
.portal-dir-rtl .form-select,
.portal-dir-rtl .select2-container,
.portal-dir-rtl .select2-selection,
.portal-dir-rtl textarea,
.portal-dir-rtl input,
.portal-dir-rtl button {
    font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif !important;
    letter-spacing: 0 !important;
}

.portal-dir-rtl .btn {
    font-weight: 700;
    line-height: 1.45;
    min-height: 38px;
    white-space: nowrap;
}

.portal-dir-rtl .btn-sm {
    min-height: 32px;
}

.portal-dir-rtl .form-control,
.portal-dir-rtl .form-select,
.portal-dir-rtl textarea,
.portal-dir-rtl input[type="text"],
.portal-dir-rtl input[type="search"],
.portal-dir-rtl input[type="email"],
.portal-dir-rtl input[type="tel"],
.portal-dir-rtl input[type="number"] {
    text-align: right;
}

.portal-dir-rtl input[type="number"],
.portal-dir-rtl input[type="date"],
.portal-dir-rtl input[type="datetime-local"],
.portal-dir-rtl input[type="time"],
.portal-dir-rtl .text-monospace,
.portal-dir-rtl .font-monospace,
.portal-dir-rtl .badge,
.portal-dir-rtl .avatar,
.portal-dir-rtl .leave-summary-value,
.portal-dir-rtl .request-summary-value,
.portal-dir-rtl td[data-technical],
.portal-dir-rtl .technical-value {
    direction: ltr;
    unicode-bidi: plaintext;
}

.portal-dir-rtl input[type="date"],
.portal-dir-rtl input[type="datetime-local"],
.portal-dir-rtl input[type="time"] {
    text-align: right;
}

.portal-dir-rtl .card,
.portal-dir-rtl .modal-content,
.portal-dir-rtl .dropdown-menu,
.portal-dir-rtl .table-responsive {
    letter-spacing: 0 !important;
}

.portal-dir-rtl .card-header .d-flex,
.portal-dir-rtl .page-breadcrumb.d-flex,
.portal-dir-rtl .modal-header,
.portal-dir-rtl .modal-footer {
    gap: .65rem;
}

.portal-dir-rtl .modal-footer {
    justify-content: flex-start;
}

.portal-dir-rtl .table {
    vertical-align: middle;
}

.portal-dir-rtl .table th {
    font-weight: 800;
    white-space: nowrap;
}

.portal-dir-rtl .table td,
.portal-dir-rtl .table th {
    text-align: right;
}

.portal-dir-rtl .table td .btn,
.portal-dir-rtl .table .btn {
    min-width: 32px;
}

.portal-dir-rtl .avatar,
.portal-dir-rtl .avatar img {
    object-fit: cover;
}

.portal-dir-rtl .breadcrumb {
    flex-wrap: wrap;
    row-gap: .35rem;
}

.portal-dir-rtl .breadcrumb-item {
    display: inline-flex;
    align-items: center;
}

.portal-dir-rtl .input-group > .form-control,
.portal-dir-rtl .input-group > .form-select {
    border-radius: 0 .375rem .375rem 0;
}

.portal-dir-rtl .input-group > .input-group-text,
.portal-dir-rtl .input-group > .btn:last-child {
    border-radius: .375rem 0 0 .375rem;
}

.portal-dir-rtl .table-responsive {
    direction: rtl;
}

.portal-dir-rtl table.table {
    text-align: right;
}

.portal-dir-rtl .table th,
.portal-dir-rtl .table td {
    text-align: right;
    vertical-align: middle;
    line-height: 1.65;
}

.portal-dir-rtl .table th {
    font-weight: 800;
    color: #475467;
}

.portal-dir-rtl .table td {
    color: #111827;
}

.portal-dir-rtl .table .text-end {
    text-align: left !important;
}

.portal-dir-rtl .table .text-start {
    text-align: right !important;
}

.portal-dir-rtl .d-flex:not(.flex-column) > .me-1,
.portal-dir-rtl .me-1 {
    margin-right: 0 !important;
    margin-left: .25rem !important;
}

.portal-dir-rtl .d-flex:not(.flex-column) > .me-2,
.portal-dir-rtl .me-2 {
    margin-right: 0 !important;
    margin-left: .5rem !important;
}

.portal-dir-rtl .d-flex:not(.flex-column) > .me-3,
.portal-dir-rtl .me-3 {
    margin-right: 0 !important;
    margin-left: 1rem !important;
}

.portal-dir-rtl .ms-1 {
    margin-left: 0 !important;
    margin-right: .25rem !important;
}

.portal-dir-rtl .ms-2 {
    margin-left: 0 !important;
    margin-right: .5rem !important;
}

.portal-dir-rtl .ms-3 {
    margin-left: 0 !important;
    margin-right: 1rem !important;
}

.portal-dir-rtl .ps-3,
.portal-dir-rtl .ps-4 {
    padding-left: 0 !important;
    padding-right: 1rem !important;
}

.portal-dir-rtl .pe-3,
.portal-dir-rtl .pe-4 {
    padding-right: 0 !important;
    padding-left: 1rem !important;
}

.portal-dir-rtl .modal-header .btn-close {
    margin: 0 auto 0 0;
}

.portal-dir-rtl .select2-container--default .select2-selection--single .select2-selection__rendered {
    text-align: right;
    padding-right: 12px;
    padding-left: 28px;
}

.portal-dir-rtl .select2-container--default .select2-selection--single .select2-selection__arrow {
    right: auto;
    left: 8px;
}

.portal-dir-rtl .dataTables_filter,
.portal-dir-rtl .dataTables_length,
.portal-dir-rtl .dataTables_info,
.portal-dir-rtl .dataTables_paginate {
    direction: rtl;
    text-align: right;
}

.portal-dir-rtl .pagination {
    direction: ltr;
}

.portal-dir-rtl .notification-dropdown,
.portal-dir-rtl .profile-dropdown .dropdown-menu,
.portal-dir-rtl .portal-language-switcher .dropdown-menu {
    text-align: right;
}

.portal-dir-rtl .portal-language-switcher .btn {
    min-width: 78px;
    max-width: 92px;
    padding-inline: 10px;
    white-space: nowrap;
}

.portal-dir-rtl .portal-language-switcher .dropdown-item {
    min-height: 38px;
    font-weight: 600;
}

.portal-dir-rtl .header .portal-language-switcher {
    position: relative;
}

.portal-dir-rtl .header .portal-language-switcher .dropdown-menu {
    right: auto !important;
    left: 0 !important;
    min-width: 156px;
    max-width: min(190px, calc(100vw - 24px));
    overflow: hidden;
    transform: none !important;
    margin-top: 8px !important;
}

.portal-dir-rtl .header .portal-language-switcher .dropdown-item {
    display: flex;
    flex-direction: row-reverse;
    gap: .75rem;
    min-width: 0;
    padding: .55rem .75rem;
}

.portal-dir-rtl .header .portal-language-switcher .dropdown-item span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-dir-rtl .header .portal-language-switcher .dropdown-item .text-muted {
    flex: 0 0 auto;
}

.portal-dir-rtl .notification-dropdown .d-flex,
.portal-dir-rtl .profile-dropdown .d-flex {
    flex-direction: row-reverse;
}

.portal-dir-rtl .btn .ti,
.portal-dir-rtl .btn i,
.portal-dir-rtl .dropdown-item i,
.portal-dir-rtl .breadcrumb i {
    line-height: 1;
}

.portal-dir-rtl .page-breadcrumb .btn,
.portal-dir-rtl .card-header .btn,
.portal-dir-rtl .modal-footer .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
}

.portal-dir-rtl .page-breadcrumb .btn i,
.portal-dir-rtl .card-header .btn i,
.portal-dir-rtl .modal-footer .btn i {
    margin: 0 !important;
}

.portal-dir-rtl .workflow-step,
.portal-dir-rtl .timeline,
.portal-dir-rtl .activity-feed {
    direction: rtl;
    text-align: right;
}

@media (max-width: 991.98px) {
    .portal-dir-rtl .header-user .nav {
        flex-direction: row-reverse;
    }

    .portal-dir-rtl .page-breadcrumb {
        text-align: right;
    }
}

/* Final RTL shell normalization for ESS portal pages. Keep this block last so
   theme customizer classes cannot pull Arabic layouts back to the LTR shell. */
html[dir="rtl"] body.portal-dir-rtl {
    direction: rtl !important;
    text-align: right !important;
}

@media (min-width: 992px) {
    html[dir="rtl"] body.portal-dir-rtl .main-wrapper {
        direction: rtl !important;
    }

    html[dir="rtl"] body.portal-dir-rtl .sidebar {
        right: 0 !important;
        left: auto !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
        border-right: 0 !important;
        border-left: 1px solid rgba(226, 232, 240, .16) !important;
    }

    html[dir="rtl"] body.portal-dir-rtl .page-wrapper {
        margin-right: 252px !important;
        margin-left: 0 !important;
        width: calc(100% - 252px) !important;
    }

    html[dir="rtl"] body.portal-dir-rtl .header {
        right: 252px !important;
        left: 0 !important;
        width: calc(100% - 252px) !important;
    }

    html[dir="rtl"] body.portal-dir-rtl.mini-sidebar .page-wrapper {
        margin-right: 72px !important;
        margin-left: 0 !important;
        width: calc(100% - 72px) !important;
    }

    html[dir="rtl"] body.portal-dir-rtl.mini-sidebar .header {
        right: 72px !important;
        left: 0 !important;
        width: calc(100% - 72px) !important;
    }

    html[dir="rtl"] body.portal-dir-rtl.mini-sidebar.expand-menu .page-wrapper,
    html[dir="rtl"] body.portal-dir-rtl.expand-menu.mini-sidebar .page-wrapper {
        margin-right: 252px !important;
        margin-left: 0 !important;
        width: calc(100% - 252px) !important;
    }

    html[dir="rtl"] body.portal-dir-rtl.mini-sidebar.expand-menu .header,
    html[dir="rtl"] body.portal-dir-rtl.expand-menu.mini-sidebar .header {
        right: 252px !important;
        left: 0 !important;
        width: calc(100% - 252px) !important;
    }
}

@media (max-width: 991.98px) {
    html[dir="rtl"] body.portal-dir-rtl .page-wrapper,
    html[dir="rtl"] body.portal-dir-rtl .header {
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    html[dir="rtl"] body.portal-dir-rtl .sidebar {
        right: 0 !important;
        left: auto !important;
        margin-right: -575px !important;
        margin-left: 0 !important;
    }

    html[dir="rtl"] body.portal-dir-rtl.slide-nav .sidebar {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
}

html[dir="rtl"] body.portal-dir-rtl .sidebar .sidebar-logo,
html[dir="rtl"] body.portal-dir-rtl .sidebar .sidebar-header,
html[dir="rtl"] body.portal-dir-rtl .sidebar .sidebar-inner,
html[dir="rtl"] body.portal-dir-rtl .sidebar .sidebar-menu {
    direction: rtl !important;
    text-align: right !important;
}

html[dir="rtl"] body.portal-dir-rtl .sidebar .sidebar-profile {
    flex-direction: row !important;
    justify-content: flex-start !important;
    text-align: right !important;
}

html[dir="rtl"] body.portal-dir-rtl .sidebar .sidebar-profile-info {
    margin-right: .5rem !important;
    margin-left: 0 !important;
    text-align: right !important;
}

html[dir="rtl"] body.portal-dir-rtl .sidebar .sidebar-menu ul li a {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-direction: row !important;
    direction: rtl !important;
    text-align: right !important;
    gap: .65rem !important;
}

html[dir="rtl"] body.portal-dir-rtl .sidebar .sidebar-menu ul li a i {
    order: 0 !important;
    margin-right: 0 !important;
    margin-left: .35rem !important;
}

html[dir="rtl"] body.portal-dir-rtl .sidebar .sidebar-menu ul li a span:not(.menu-arrow) {
    order: 1 !important;
    text-align: right !important;
}

html[dir="rtl"] body.portal-dir-rtl .sidebar .sidebar-menu ul li a .menu-arrow {
    order: 2 !important;
    margin-right: auto !important;
    margin-left: 0 !important;
}

html[dir="rtl"] body.portal-dir-rtl .sidebar .submenu ul {
    padding-right: 2.35rem !important;
    padding-left: 0 !important;
}

html[dir="rtl"] body.portal-dir-rtl .sidebar .menu-title {
    text-align: right !important;
    padding-right: 1rem !important;
    padding-left: .5rem !important;
}

html[dir="rtl"] body.portal-dir-rtl #sidebar,
html[dir="rtl"] body.portal-dir-rtl .sidebar:not(.sidebar-horizontal),
html[dir="rtl"] body.portal-dir-rtl .sidebar:not(.sidebar-horizontal)::before,
html[dir="rtl"] body.portal-dir-rtl .sidebar:not(.sidebar-horizontal) .sidebar-logo,
html[dir="rtl"] body.portal-dir-rtl .sidebar:not(.sidebar-horizontal) .sidebar-header,
html[dir="rtl"] body.portal-dir-rtl .sidebar:not(.sidebar-horizontal) .sidebar-inner,
html[dir="rtl"] body.portal-dir-rtl .sidebar:not(.sidebar-horizontal) .slimScrollDiv {
    border-radius: 0 !important;
}

html[dir="rtl"] body.portal-dir-rtl .sidebar:not(.sidebar-horizontal) {
    overflow: hidden !important;
}

html[dir="rtl"] body.portal-dir-rtl .page-wrapper,
html[dir="rtl"] body.portal-dir-rtl .content,
html[dir="rtl"] body.portal-dir-rtl .page-breadcrumb,
html[dir="rtl"] body.portal-dir-rtl .card,
html[dir="rtl"] body.portal-dir-rtl .modal-content {
    font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif !important;
    direction: rtl !important;
    text-align: right !important;
}

html[dir="rtl"] body.portal-dir-rtl .page-breadcrumb .breadcrumb {
    justify-content: flex-start !important;
}

html[dir="rtl"] body.portal-dir-rtl .page-breadcrumb h1,
html[dir="rtl"] body.portal-dir-rtl .page-breadcrumb h2,
html[dir="rtl"] body.portal-dir-rtl .page-breadcrumb h3,
html[dir="rtl"] body.portal-dir-rtl .page-breadcrumb h4,
html[dir="rtl"] body.portal-dir-rtl .page-breadcrumb h5,
html[dir="rtl"] body.portal-dir-rtl .page-breadcrumb h6,
html[dir="rtl"] body.portal-dir-rtl .page-breadcrumb .breadcrumb,
html[dir="rtl"] body.portal-dir-rtl .page-breadcrumb .breadcrumb-item,
html[dir="rtl"] body.portal-dir-rtl .content h1,
html[dir="rtl"] body.portal-dir-rtl .content h2,
html[dir="rtl"] body.portal-dir-rtl .content h3,
html[dir="rtl"] body.portal-dir-rtl .content h4,
html[dir="rtl"] body.portal-dir-rtl .content h5,
html[dir="rtl"] body.portal-dir-rtl .content h6 {
    font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif !important;
    letter-spacing: 0 !important;
}

/* RTL header composition */
html[dir="rtl"] body.portal-dir-rtl .header .main-header {
    direction: rtl !important;
    display: flex !important;
    align-items: center !important;
    flex-direction: row !important;
    gap: 12px !important;
    padding-inline: 16px !important;
}

html[dir="rtl"] body.portal-dir-rtl .header .header-left {
    order: 0 !important;
    margin-right: 0 !important;
    margin-left: 12px !important;
}

html[dir="rtl"] body.portal-dir-rtl .header .mobile_btn {
    order: 1 !important;
    position: static !important;
    margin: 0 !important;
    inset: auto !important;
}

html[dir="rtl"] body.portal-dir-rtl .header .header-user {
    order: 2 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
}

html[dir="rtl"] body.portal-dir-rtl .header .header-user .user-menu {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-direction: row !important;
    gap: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
}

html[dir="rtl"] body.portal-dir-rtl .header #header-search {
    order: 1 !important;
    flex: 1 1 560px !important;
    min-width: 220px !important;
    max-width: 680px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    margin-right: 0 !important;
    margin-left: auto !important;
}

html[dir="rtl"] body.portal-dir-rtl .header #header-search .input-group {
    flex: 1 1 auto !important;
    min-width: 180px !important;
    max-width: 420px !important;
    margin: 0 !important;
}

html[dir="rtl"] body.portal-dir-rtl .header #header-search .input-group .form-control {
    text-align: right !important;
    border-radius: 0 8px 8px 0 !important;
}

html[dir="rtl"] body.portal-dir-rtl .header #header-search .input-group .input-group-text {
    border-radius: 8px 0 0 8px !important;
}

html[dir="rtl"] body.portal-dir-rtl .header #header-search #toggle_btn {
    margin: 0 !important;
    flex: 0 0 auto !important;
}

html[dir="rtl"] body.portal-dir-rtl .header .header-user .user-menu > .d-flex.align-items-center:not(#header-search) {
    order: 2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex: 0 0 auto !important;
    gap: 8px !important;
    margin-right: auto !important;
    margin-left: 0 !important;
}

html[dir="rtl"] body.portal-dir-rtl .header .btn-menubar {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
}

html[dir="rtl"] body.portal-dir-rtl .header .portal-language-switcher .btn {
    width: auto !important;
    min-width: 78px !important;
    padding-inline: 10px !important;
    gap: 6px !important;
}

html[dir="rtl"] body.portal-dir-rtl .header .portal-language-switcher .btn i,
html[dir="rtl"] body.portal-dir-rtl .header .portal-language-switcher .btn span {
    margin: 0 !important;
}

html[dir="rtl"] body.portal-dir-rtl .header .notification_item,
html[dir="rtl"] body.portal-dir-rtl .header .profile-dropdown {
    margin: 0 !important;
}

html[dir="rtl"] body.portal-dir-rtl .header .profile-dropdown > a {
    min-width: 42px !important;
    justify-content: center !important;
}

html[dir="rtl"] body.portal-dir-rtl .header .dropdown-menu-end,
html[dir="rtl"] body.portal-dir-rtl .header .notification-dropdown,
html[dir="rtl"] body.portal-dir-rtl .header .profile-dropdown .dropdown-menu {
    right: auto !important;
    left: 0 !important;
}

@media (max-width: 1199.98px) {
    html[dir="rtl"] body.portal-dir-rtl .header #header-search {
        flex-basis: 420px !important;
        max-width: 520px !important;
    }

    html[dir="rtl"] body.portal-dir-rtl .header #header-search .input-group {
        max-width: 320px !important;
    }
}

@media (max-width: 767.98px) {
    html[dir="rtl"] body.portal-dir-rtl .header .main-header {
        padding-inline: 10px !important;
        gap: 8px !important;
    }

    html[dir="rtl"] body.portal-dir-rtl .header #header-search .input-group {
        display: none !important;
    }

    html[dir="rtl"] body.portal-dir-rtl .header #header-search {
        flex: 0 0 auto !important;
        min-width: auto !important;
        margin-left: 0 !important;
    }
}

/* Move the floating theme customizer trigger away from the right-side RTL menu. */
html[dir="rtl"] body.portal-dir-rtl .sidebar-contact {
    right: auto !important;
    left: -350px !important;
}

html[dir="rtl"] body.portal-dir-rtl .sidebar-contact.open {
    right: auto !important;
    left: 0 !important;
}

html[dir="rtl"] body.portal-dir-rtl .sidebar-contact .toggle-theme {
    right: auto !important;
    left: 350px !important;
    border-radius: 0 3px 3px 0 !important;
}

html[dir="rtl"] body.portal-dir-rtl .sidebar-themesettings.offcanvas.offcanvas-end {
    right: auto !important;
    left: 0 !important;
    transform: translateX(-100%) !important;
}

html[dir="rtl"] body.portal-dir-rtl .sidebar-themesettings.offcanvas.offcanvas-end.show,
html[dir="rtl"] body.portal-dir-rtl .sidebar-themesettings.offcanvas.offcanvas-end.open {
    transform: translateX(0) !important;
}

/* Safety net for older standalone pages that still render the legacy shell. */
html[dir="rtl"] body {
    direction: rtl !important;
    font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif !important;
    letter-spacing: 0 !important;
}

html[dir="rtl"] body .main-wrapper {
    direction: rtl !important;
}

html[dir="rtl"] body .sidebar:not(.sidebar-horizontal),
html[dir="rtl"] body #sidebar {
    right: 0 !important;
    left: auto !important;
    border-radius: 0 !important;
}

html[dir="rtl"] body .sidebar:not(.sidebar-horizontal)::before,
html[dir="rtl"] body .sidebar:not(.sidebar-horizontal) .sidebar-logo,
html[dir="rtl"] body .sidebar:not(.sidebar-horizontal) .sidebar-header,
html[dir="rtl"] body .sidebar:not(.sidebar-horizontal) .sidebar-inner,
html[dir="rtl"] body .sidebar:not(.sidebar-horizontal) .slimScrollDiv {
    border-radius: 0 !important;
}

html[dir="rtl"] body .sidebar .sidebar-menu,
html[dir="rtl"] body .sidebar .sidebar-menu > ul,
html[dir="rtl"] body .sidebar .sidebar-menu ul li a,
html[dir="rtl"] body .sidebar .menu-title {
    direction: rtl !important;
    text-align: right !important;
}

html[dir="rtl"] body .sidebar .sidebar-menu ul li a {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: .6rem !important;
}

html[dir="rtl"] body .sidebar .sidebar-menu ul li a i {
    margin-right: 0 !important;
    margin-left: .55rem !important;
}

html[dir="rtl"] body .sidebar .sidebar-menu ul li a span:not(.menu-arrow) {
    flex: 1 1 auto !important;
    text-align: right !important;
}

html[dir="rtl"] body .sidebar .sidebar-menu ul li a .menu-arrow {
    margin-right: auto !important;
    margin-left: 0 !important;
}

html[dir="rtl"] body .page-wrapper,
html[dir="rtl"] body .header {
    margin-right: 252px !important;
    margin-left: 0 !important;
}

html[dir="rtl"] body.mini-sidebar .page-wrapper,
html[dir="rtl"] body.mini-sidebar .header {
    margin-right: 80px !important;
    margin-left: 0 !important;
}

html[dir="rtl"] body .header .main-header {
    direction: rtl !important;
    display: flex !important;
    align-items: center !important;
    flex-direction: row !important;
    gap: 12px !important;
    padding-inline: 16px !important;
}

html[dir="rtl"] body .header .header-left {
    order: 0 !important;
    margin-right: 0 !important;
    margin-left: 12px !important;
}

html[dir="rtl"] body .header .mobile_btn {
    order: 1 !important;
    position: static !important;
    margin: 0 !important;
    inset: auto !important;
}

html[dir="rtl"] body .header .header-user {
    order: 2 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
}

html[dir="rtl"] body .header .header-user .user-menu,
html[dir="rtl"] body .header .nav.user-menu.nav-list {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-direction: row !important;
    gap: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
}

html[dir="rtl"] body .header #header-search {
    order: 1 !important;
    flex: 1 1 560px !important;
    min-width: 220px !important;
    max-width: 680px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    margin-right: 0 !important;
    margin-left: auto !important;
}

html[dir="rtl"] body .header #header-search .input-group {
    flex: 1 1 auto !important;
    min-width: 180px !important;
    max-width: 420px !important;
    margin: 0 !important;
}

html[dir="rtl"] body .header #header-search .input-group .form-control {
    text-align: right !important;
    border-radius: 0 8px 8px 0 !important;
}

html[dir="rtl"] body .header #header-search .input-group .input-group-text {
    border-radius: 8px 0 0 8px !important;
}

html[dir="rtl"] body .header .header-user .user-menu > .d-flex.align-items-center:not(#header-search) {
    order: 2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex: 0 0 auto !important;
    gap: 8px !important;
    margin-right: auto !important;
    margin-left: 0 !important;
}

html[dir="rtl"] body .header .btn-menubar {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
}

html[dir="rtl"] body .header .portal-language-switcher .btn {
    width: auto !important;
    min-width: 78px !important;
    padding-inline: 10px !important;
    gap: 6px !important;
}

html[dir="rtl"] body .header .dropdown-menu-end,
html[dir="rtl"] body .header .notification-dropdown,
html[dir="rtl"] body .header .profile-dropdown .dropdown-menu {
    right: auto !important;
    left: 0 !important;
}

html[dir="rtl"] body .sidebar-contact {
    right: auto !important;
    left: -350px !important;
}

html[dir="rtl"] body .sidebar-contact.open {
    right: auto !important;
    left: 0 !important;
}

html[dir="rtl"] body .sidebar-contact .toggle-theme {
    right: auto !important;
    left: 350px !important;
    border-radius: 0 3px 3px 0 !important;
}

@media (max-width: 991.98px) {
    html[dir="rtl"] body .page-wrapper,
    html[dir="rtl"] body .header {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    html[dir="rtl"] body .sidebar:not(.sidebar-horizontal) {
        transform: translateX(100%) !important;
    }

    html[dir="rtl"] body.slide-nav .sidebar:not(.sidebar-horizontal) {
        transform: translateX(0) !important;
    }
}

@media (max-width: 767.98px) {
    html[dir="rtl"] body .header .main-header {
        padding-inline: 10px !important;
        gap: 8px !important;
    }

    html[dir="rtl"] body .header #header-search .input-group {
        display: none !important;
    }

    html[dir="rtl"] body .header #header-search {
        flex: 0 0 auto !important;
        min-width: auto !important;
        margin-left: 0 !important;
    }
}

/* Final RTL header normalization: keep legacy horizontal menus out of the header flow. */
html[dir="rtl"] body .header .header-user .user-menu > .sidebar-horizontal,
html[dir="rtl"] body .header .header-user .user-menu > [id^="horizontal-"],
html[dir="rtl"] body .header .header-user .user-menu > #horizontal-single,
html[dir="rtl"] body .header .header-user .user-menu > #horizontal-overlay,
html[dir="rtl"] body .header .header-user .user-menu > #horizontal-box,
html[dir="rtl"] body .header .header-user .user-menu > #horizontal-sidemenu {
    display: none !important;
}

html[dir="rtl"] body .header .main-header {
    direction: rtl !important;
    display: grid !important;
    grid-template-columns: auto auto minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
}

html[dir="rtl"] body .header .header-left {
    grid-column: 1 !important;
}

html[dir="rtl"] body .header .mobile_btn {
    grid-column: 2 !important;
}

html[dir="rtl"] body .header .header-user {
    grid-column: 3 !important;
    min-width: 0 !important;
    width: 100% !important;
}

html[dir="rtl"] body .header .header-user .user-menu,
html[dir="rtl"] body .header .nav.user-menu.nav-list {
    display: grid !important;
    grid-template-columns: minmax(260px, 1fr) auto !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
}

html[dir="rtl"] body .header #header-search {
    grid-column: 1 !important;
    order: initial !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
}

html[dir="rtl"] body .header #header-search .input-group {
    width: min(520px, 100%) !important;
    max-width: 520px !important;
    min-width: 220px !important;
}

html[dir="rtl"] body .header .header-user .user-menu > .d-flex.align-items-center:not(#header-search) {
    grid-column: 2 !important;
    order: initial !important;
    justify-self: end !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    width: auto !important;
    max-width: none !important;
    min-width: max-content !important;
    margin: 0 !important;
    flex: none !important;
}

html[dir="rtl"] body .header .header-user .user-menu > .d-flex.align-items-center:not(#header-search) > * {
    flex: 0 0 auto !important;
}

html[dir="rtl"] body .header .portal-language-switcher,
html[dir="rtl"] body .header .notification_item,
html[dir="rtl"] body .header .profile-dropdown {
    display: block !important;
    visibility: visible !important;
}

html[dir="rtl"] body .header .portal-language-switcher .btn {
    min-width: 70px !important;
}

@media (max-width: 1199.98px) {
    html[dir="rtl"] body .header .header-user .user-menu,
    html[dir="rtl"] body .header .nav.user-menu.nav-list {
        grid-template-columns: minmax(160px, 1fr) auto !important;
    }

    html[dir="rtl"] body .header #header-search .input-group {
        width: min(360px, 100%) !important;
        min-width: 160px !important;
    }
}

@media (max-width: 767.98px) {
    html[dir="rtl"] body .header .main-header {
        grid-template-columns: auto minmax(0, 1fr) !important;
    }

    html[dir="rtl"] body .header .header-left {
        display: none !important;
    }

    html[dir="rtl"] body .header .mobile_btn {
        grid-column: 1 !important;
    }

    html[dir="rtl"] body .header .header-user {
        grid-column: 2 !important;
    }

    html[dir="rtl"] body .header .header-user .user-menu,
    html[dir="rtl"] body .header .nav.user-menu.nav-list {
        grid-template-columns: auto 1fr !important;
    }

    html[dir="rtl"] body .header #header-search {
        grid-column: 1 !important;
        width: auto !important;
    }

    html[dir="rtl"] body .header .header-user .user-menu > .d-flex.align-items-center:not(#header-search) {
        grid-column: 2 !important;
        min-width: 0 !important;
    }
}

/* Header placement hard reset for RTL.
   The base theme uses a left sidebar margin model. In RTL we pin the header
   between the viewport left edge and the right-side sidebar to avoid double
   offset white gaps. */
html[dir="rtl"] body.portal-dir-rtl .header,
html[dir="rtl"] body .header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 252px !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

html[dir="rtl"] body.portal-dir-rtl.mini-sidebar .header,
html[dir="rtl"] body.mini-sidebar .header {
    right: 80px !important;
    left: 0 !important;
    width: auto !important;
    margin: 0 !important;
}

html[dir="rtl"] body.portal-dir-rtl.mini-sidebar.expand-menu .header,
html[dir="rtl"] body.portal-dir-rtl.expand-menu.mini-sidebar .header,
html[dir="rtl"] body.mini-sidebar.expand-menu .header,
html[dir="rtl"] body.expand-menu.mini-sidebar .header {
    right: 252px !important;
    left: 0 !important;
    width: auto !important;
    margin: 0 !important;
}

html[dir="rtl"] body.portal-dir-rtl .header .main-header,
html[dir="rtl"] body .header .main-header {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 52px !important;
    box-sizing: border-box !important;
    background: inherit !important;
}

html[dir="rtl"] body.portal-dir-rtl .header .header-user,
html[dir="rtl"] body .header .header-user {
    min-width: 0 !important;
    overflow: visible !important;
}

html[dir="rtl"] body.portal-dir-rtl .header .header-user .user-menu,
html[dir="rtl"] body.portal-dir-rtl .header .nav.user-menu.nav-list,
html[dir="rtl"] body .header .header-user .user-menu,
html[dir="rtl"] body .header .nav.user-menu.nav-list {
    min-width: 0 !important;
    overflow: visible !important;
}

html[dir="rtl"] body.portal-dir-rtl .header #header-search,
html[dir="rtl"] body .header #header-search {
    min-width: 0 !important;
    overflow: visible !important;
}

html[dir="rtl"] body.portal-dir-rtl .header #header-search .input-group,
html[dir="rtl"] body .header #header-search .input-group {
    min-width: 220px !important;
}

@media (max-width: 991.98px) {
    html[dir="rtl"] body.portal-dir-rtl .header,
    html[dir="rtl"] body .header,
    html[dir="rtl"] body.portal-dir-rtl.mini-sidebar .header,
    html[dir="rtl"] body.mini-sidebar .header {
        right: 0 !important;
        left: 0 !important;
        width: auto !important;
        margin: 0 !important;
    }
}

/* Keep the account menu anchored to the avatar in RTL layouts. */
html[dir="rtl"] body .header .profile-dropdown,
html[dir="rtl"] body.portal-dir-rtl .header .profile-dropdown {
    position: relative !important;
}

html[dir="rtl"] body .header .profile-dropdown .dropdown-menu,
html[dir="rtl"] body.portal-dir-rtl .header .profile-dropdown .dropdown-menu {
    inset: calc(100% + 8px) auto auto 0 !important;
    right: auto !important;
    left: 0 !important;
    transform: none !important;
    min-width: 320px !important;
    max-width: min(360px, calc(100vw - 24px)) !important;
    text-align: right !important;
    direction: rtl !important;
}

html[dir="rtl"] body .header .profile-dropdown .dropdown-item,
html[dir="rtl"] body.portal-dir-rtl .header .profile-dropdown .dropdown-item {
    direction: rtl !important;
    text-align: right !important;
    justify-content: flex-start !important;
    gap: 8px !important;
}

html[dir="rtl"] body .header .profile-dropdown .dropdown-item i,
html[dir="rtl"] body.portal-dir-rtl .header .profile-dropdown .dropdown-item i {
    margin-left: 8px !important;
    margin-right: 0 !important;
}

html[dir="rtl"] body .header .profile-dropdown .card-header .d-flex,
html[dir="rtl"] body.portal-dir-rtl .header .profile-dropdown .card-header .d-flex {
    direction: rtl !important;
    text-align: right !important;
}

/* Keep notification dropdown close to the bell and readable in RTL. */
html[dir="rtl"] body .header .notification_item,
html[dir="rtl"] body.portal-dir-rtl .header .notification_item {
    position: relative !important;
}

html[dir="rtl"] body .header .notification_item .notification-dropdown,
html[dir="rtl"] body.portal-dir-rtl .header .notification_item .notification-dropdown {
    inset: calc(100% + 8px) auto auto 0 !important;
    right: auto !important;
    left: 0 !important;
    transform: none !important;
    width: min(440px, calc(100vw - 24px)) !important;
    min-width: min(440px, calc(100vw - 24px)) !important;
    max-height: calc(100vh - 110px) !important;
    overflow: hidden !important;
    direction: rtl !important;
    text-align: right !important;
}

html[dir="rtl"] body .header .notification_item .noti-content,
html[dir="rtl"] body.portal-dir-rtl .header .notification_item .noti-content {
    max-height: 420px !important;
    overflow-y: auto !important;
    padding-inline-end: 2px !important;
}

html[dir="rtl"] body .header .notification_item .notification-dropdown .d-flex,
html[dir="rtl"] body.portal-dir-rtl .header .notification_item .notification-dropdown .d-flex {
    direction: rtl !important;
}

html[dir="rtl"] body .header .notification_item .notification-dropdown .avatar,
html[dir="rtl"] body.portal-dir-rtl .header .notification_item .notification-dropdown .avatar {
    margin-left: 8px !important;
    margin-right: 0 !important;
}
