.required::after {
    content: ' *';
    color: #dc3545;
}

/* ---------------------------------------------------------------- */
/* Select2 (search-enabled dropdowns — company/product/license-key   */
/* pickers) styled to match this theme's plain .form-select, so a    */
/* Select2 field sitting next to a native <select> in the same row   */
/* (e.g. Product beside License Type on the Order form) looks like   */
/* one consistent set of controls instead of two different widgets.  */
/* ---------------------------------------------------------------- */
.select2-container--default .select2-selection--single {
    height: 42px;
    border: 1px solid #eeeeee;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 0 16px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0;
    line-height: normal;
    color: #8a92a6;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #8a92a6;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
    right: 12px;
}

.select2-container--default.select2-container--disabled .select2-selection--single {
    background-color: #f5f6fa;
    cursor: not-allowed;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #eeeeee;
}

body.dark-mode .select2-container--default .select2-selection--single {
    background-color: #161d31;
    border-color: #2b3852;
}

body.dark-mode .select2-container--default .select2-selection--single .select2-selection__rendered,
body.dark-mode .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #d3d7e6;
}

body.dark-mode .select2-container--default.select2-container--disabled .select2-selection--single {
    background-color: #212d47;
}

body.dark-mode .select2-dropdown {
    background-color: #161d31;
    border-color: #2b3852;
}

body.dark-mode .select2-container--default .select2-results__option {
    color: #d3d7e6;
}

body.dark-mode .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #2b3852;
}

body.dark-mode .select2-search--dropdown .select2-search__field {
    background-color: #212d47;
    color: #d3d7e6;
    border-color: #2b3852;
}

/* ---------------------------------------------------------------- */
/* Guard against wide tables/content pushing the page wider than the */
/* viewport — the sidebar is position:fixed, so page-level horizontal */
/* scroll would leave content sliding underneath it. Any overflow    */
/* must stay contained inside .table-responsive, not the page.       */
/* ---------------------------------------------------------------- */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

.table-responsive {
    border-radius: 10px;
}

/* ---------------------------------------------------------------- */
/* Responsive sidebar (mobile & tablet) — PUSH, never overlay.      */
/* When the menu opens, the content area shrinks and shifts right   */
/* by exactly the sidebar's width, so the sidebar never sits on top */
/* of (or hides) the page content.                                  */
/* ---------------------------------------------------------------- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 905;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%) !important;
        width: 240px !important;
        max-width: 240px !important;
        transition: transform 0.25s ease !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        transition: margin-left 0.25s ease, width 0.25s ease !important;
    }

    body.sidebar-mobile-open .sidebar {
        transform: translateX(0) !important;
    }

    /* Vendor theme hides all nav-link <span> text (icons + labels) whenever
       .sidebar-mini is present, regardless of actual rendered width — override
       it so labels are always visible while the drawer is forced open. */
    body.sidebar-mobile-open .sidebar.sidebar-mini .nav-item .nav-link span,
    body.sidebar-mobile-open .sidebar.sidebar-mini .navbar-brand .logo-title {
        opacity: 1 !important;
        transform: none !important;
        width: auto !important;
    }

    body.sidebar-mobile-open .main-content {
        margin-left: 240px !important;
        width: calc(100% - 240px) !important;
    }

    body.sidebar-mobile-open .sidebar-backdrop {
        display: block;
    }

    .sub-header,
    .content-inner {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 85vw !important;
        max-width: 85vw !important;
    }

    body.sidebar-mobile-open .main-content {
        margin-left: 85vw !important;
        width: calc(100% - 85vw) !important;
    }
}

@media (max-width: 575.98px) {
    .card-body {
        padding: 1rem;
    }

    .dataTables_filter input {
        min-width: 0;
    }
}

/* ---------------------------------------------------------------- */
/* DataTables — modern styling (Hope UI ships no DataTables theme)  */
/* ---------------------------------------------------------------- */
.dataTables_wrapper {
    padding-top: 0.25rem;
}

.dataTables_wrapper .row:first-child {
    align-items: center;
    margin-bottom: 1.25rem;
}

.dataTables_length label,
.dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #6a7c9a;
    margin-bottom: 0;
    width: 100%;
}

.dataTables_length select {
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    border: 1px solid #e2e7f1;
    border-radius: 8px;
    background-color: #fff;
    font-size: 0.85rem;
    color: #3b4863;
    box-shadow: none;
}

.dataTables_filter {
    text-align: right;
}

.dataTables_filter input {
    border: 1px solid #e2e7f1;
    border-radius: 30px;
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    font-size: 0.85rem;
    min-width: 240px;
    background: #f8f9fc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236a7c9a' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E") no-repeat 0.75rem center;
    margin-left: 0 !important;
    transition: box-shadow .15s ease, border-color .15s ease;
}

.dataTables_filter input:focus {
    outline: none;
    border-color: var(--bs-primary, #3a57e8);
    box-shadow: 0 0 0 0.2rem rgba(58, 87, 232, 0.12);
    background-color: #fff;
}

table.dataTable {
    border-collapse: separate !important;
    border-spacing: 0;
}

table.dataTable thead th {
    background-color: #f5f7fc;
    color: #6a7c9a;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: none !important;
    padding: 0.85rem 1rem !important;
    white-space: nowrap;
}

table.dataTable thead th:first-child {
    border-top-left-radius: 10px;
}

table.dataTable thead th:last-child {
    border-top-right-radius: 10px;
}

table.dataTable tbody td {
    padding: 0.9rem 1rem !important;
    font-size: 0.9rem;
    color: #3b4863;
    vertical-align: middle;
    border-bottom: 1px solid #eef1f8 !important;
}

table.dataTable tbody tr:last-child td {
    border-bottom: none !important;
}

table.dataTable.table-hover tbody tr:hover td {
    background-color: rgba(58, 87, 232, 0.04);
}

table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
    position: relative;
    cursor: pointer;
}

table.dataTable thead th.sorting:before,
table.dataTable thead th.sorting:after,
table.dataTable thead th.sorting_asc:before,
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:before,
table.dataTable thead th.sorting_desc:after {
    font-size: 0.7rem !important;
    opacity: 0.35;
    right: 0.75rem !important;
    bottom: auto !important;
    top: 50% !important;
    transform: translateY(-50%);
}

table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:before {
    opacity: 1;
    color: var(--bs-primary, #3a57e8);
}

.dataTables_info {
    color: #8895ab;
    font-size: 0.82rem;
    padding-top: 1rem !important;
}

.dataTables_paginate {
    padding-top: 0.75rem !important;
}

.dataTables_paginate .paginate_button {
    box-sizing: border-box;
    min-width: 2.1rem;
    height: 2.1rem;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin-left: 0.25rem !important;
    padding: 0 0.6rem !important;
    border-radius: 8px !important;
    border: 1px solid transparent !important;
    color: #3b4863 !important;
    background: transparent !important;
    font-size: 0.85rem;
    transition: all .15s ease;
}

.dataTables_paginate .paginate_button.current,
.dataTables_paginate .paginate_button.current:hover {
    background: var(--bs-primary, #3a57e8) !important;
    border-color: var(--bs-primary, #3a57e8) !important;
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(58, 87, 232, 0.25);
}

.dataTables_paginate .paginate_button:hover:not(.disabled):not(.current) {
    background: rgba(58, 87, 232, 0.08) !important;
    border-color: rgba(58, 87, 232, 0.08) !important;
    color: var(--bs-primary, #3a57e8) !important;
}

.dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
}

.dataTables_processing {
    border-radius: 10px;
}

@media (max-width: 767.98px) {
    .dataTables_filter {
        text-align: left;
        margin-top: 0.75rem;
    }

    .dataTables_filter input {
        width: 100%;
    }
}

/* ---------------------------------------------------------------- */
/* Keep the topbar (hamburger, search, dark-mode toggle, avatar) on a */
/* single row at every breakpoint — never let it wrap onto a second   */
/* line, which previously happened around the tablet width where the */
/* search box and profile caption both switch on at once.             */
/* ---------------------------------------------------------------- */
.navbar-inner {
    flex-wrap: nowrap;
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .global-search-form {
        max-width: 220px !important;
    }
}

/* ---------------------------------------------------------------- */
/* Global search on mobile — the inline topbar search box has no room */
/* next to the hamburger/avatar, so it's hidden by default and opens  */
/* as a full-width overlay bar via the search icon button instead.    */
/* ---------------------------------------------------------------- */
@media (max-width: 767.98px) {
    .global-search-form {
        display: none;
        max-width: none !important;
    }

    #mobileSearchCloseBtn {
        display: flex !important;
    }

    body.search-mobile-open .navbar-inner > .sidebar-toggle,
    body.search-mobile-open .navbar-inner > .navbar-collapse {
        display: none !important;
    }

    body.search-mobile-open .global-search-form {
        display: flex !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0.5rem 0;
        background: #fff;
        align-items: center;
    }
}

body.dark-mode.search-mobile-open .global-search-form {
    background-color: #1c273c !important;
}

/* ---------------------------------------------------------------- */
/* Dark mode overrides (persisted via localStorage, toggled on body) */
/* ---------------------------------------------------------------- */
body.dark-mode {
    background-color: #161d31;
    color: #d3d7e6;
}

body.dark-mode .main-content,
body.dark-mode .content-inner,
body.dark-mode .sidebar,
body.dark-mode .iq-navbar,
body.dark-mode .navbar-collapse,
body.dark-mode .card,
body.dark-mode .modal-content,
body.dark-mode .offcanvas,
body.dark-mode .dropdown-menu,
body.dark-mode .table {
    background-color: #1c273c !important;
    color: #d3d7e6 !important;
    border-color: #2b3852 !important;
}

body.dark-mode .sidebar .nav-link,
body.dark-mode .sidebar .item-name,
body.dark-mode .card-header,
body.dark-mode .card-title,
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3,
body.dark-mode h4, body.dark-mode h5, body.dark-mode h6,
body.dark-mode label, body.dark-mode p {
    color: #d3d7e6 !important;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: #161d31 !important;
    color: #d3d7e6 !important;
    border-color: #2b3852 !important;
}

body.dark-mode .table thead th {
    background-color: #212d47 !important;
    color: #d3d7e6 !important;
}

body.dark-mode .table td,
body.dark-mode .table th {
    border-color: #2b3852 !important;
}

body.dark-mode a.nav-link:hover,
body.dark-mode .card:hover {
    background-color: #212d47 !important;
}

body.dark-mode .border,
body.dark-mode .border-bottom,
body.dark-mode .border-top {
    border-color: #2b3852 !important;
}

body.dark-mode .dataTables_filter input,
body.dark-mode .dataTables_length select {
    background-color: #161d31 !important;
    color: #d3d7e6 !important;
    border-color: #2b3852 !important;
}

body.dark-mode table.dataTable thead th {
    background-color: #212d47 !important;
    color: #9aa7c2 !important;
}

body.dark-mode table.dataTable tbody td {
    color: #d3d7e6 !important;
    border-color: #2b3852 !important;
}

body.dark-mode table.dataTable.table-hover tbody tr:hover td {
    background-color: rgba(58, 87, 232, 0.12) !important;
}

body.dark-mode .dataTables_info,
body.dark-mode .dataTables_length label,
body.dark-mode .dataTables_filter label {
    color: #8895ab;
}

body.dark-mode .dataTables_paginate .paginate_button {
    color: #d3d7e6 !important;
}
