/* Desktop icon rail. Collapsed until hover or keyboard focus. Phones and tablets keep the full menu. */

@media (min-width: 992px) and (hover: hover) and (pointer: fine) {
    .container-fluid > .row > .aside {
        --sidebar-rail: 4.5rem;
        --sidebar-open: 19rem;
        --sidebar-icon: 1.25rem;
        --sidebar-inset: 0.4rem;
        --sidebar-ease: cubic-bezier(0.16, 1, 0.3, 1);
        --sidebar-time: 0.22s;

        position: sticky;
        top: 0;
        align-self: flex-start;
        z-index: 1030;
        height: 100vh;
        max-height: 100vh;
        overflow: visible;
        flex: 0 0 var(--sidebar-rail) !important;
        width: var(--sidebar-rail) !important;
        min-width: var(--sidebar-rail) !important;
        max-width: var(--sidebar-rail) !important;
        padding-right: 0 !important;
        padding-left: 0 !important;
    }

    .container-fluid > .row > .col-lg-9 {
        flex: 1 1 auto;
        width: auto;
        max-width: none;
    }

    .container-fluid > .row > .aside::after {
        content: "";
        position: absolute;
        z-index: 3;
        inset: 0 auto 0 0;
        width: 100%;
        pointer-events: none;
        border-right: 1px solid rgba(255, 255, 255, 0.08);
        transition: width var(--sidebar-time) var(--sidebar-ease);
    }

    .container-fluid > .row > .aside > header,
    .container-fluid > .row > .aside > .aside-collapse {
        position: relative;
        z-index: 1;
        background-color: var(--bs-dark);
        width: 100% !important;
        overflow-x: hidden;
        transition:
            width var(--sidebar-time) var(--sidebar-ease),
            padding var(--sidebar-time) var(--sidebar-ease);
    }

    .container-fluid > .row > .aside > header {
        flex: 0 0 auto;
        justify-content: flex-start;
        margin-top: 0 !important;
        padding: 0.45rem 0.5rem 0.25rem calc((var(--sidebar-rail) - 1.75rem) / 2) !important;
    }

    .container-fluid > .row > .aside > .aside-collapse {
        flex: 1 1 auto;
        height: auto !important;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: none;
    }

    .container-fluid > .row > .aside > .aside-collapse::-webkit-scrollbar {
        width: 0;
        height: 0;
    }

    .container-fluid > .row > .aside:hover > header,
    .container-fluid > .row > .aside:focus-within > header,
    .container-fluid > .row > .aside:hover > .aside-collapse,
    .container-fluid > .row > .aside:focus-within > .aside-collapse,
    .container-fluid > .row > .aside:hover::after,
    .container-fluid > .row > .aside:focus-within::after {
        width: var(--sidebar-open) !important;
    }

    .container-fluid > .row > .aside:hover::after,
    .container-fluid > .row > .aside:focus-within::after {
        box-shadow: 18px 0 36px rgba(0, 0, 0, 0.28);
    }

    .aside .header-brand {
        display: flex;
        align-items: center;
        min-width: 0;
    }

    .aside .header-brand .h2 {
        position: relative;
        align-items: center;
        gap: 0.75rem;
        margin: 0;
        min-height: 1.75rem;
        font-size: 1.05rem;
        font-weight: 600;
        line-height: 1;
        min-width: 0;
    }

    .aside .header-brand p {
        display: none !important;
        min-width: 0;
        overflow: hidden;
        white-space: normal;
        opacity: 0;
        transition: opacity 0.16s ease;
    }

    .container-fluid > .row > .aside:hover > header,
    .container-fluid > .row > .aside:focus-within > header {
        padding: 1rem 0.85rem 0.75rem !important;
    }

    .aside:hover .header-brand,
    .aside:focus-within .header-brand,
    .aside:hover .header-brand .h2,
    .aside:focus-within .header-brand .h2 {
        width: 100%;
    }

    .aside:hover .sidebar-brand-marks,
    .aside:focus-within .sidebar-brand-marks {
        flex: 1 1 auto;
        width: 100%;
        height: auto;
        margin-left: 0;
    }

    .aside:hover .sidebar-brand-mark--rail,
    .aside:focus-within .sidebar-brand-mark--rail {
        position: absolute;
        width: 1.75rem;
        height: 1.75rem;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.18s ease, visibility 0s linear 0.18s;
    }

    .aside:hover .sidebar-brand-mark--open,
    .aside:focus-within .sidebar-brand-mark--open {
        position: relative;
        inset: auto;
        width: 100%;
        height: auto;
        aspect-ratio: 2421 / 580;
        object-fit: contain;
        opacity: 1;
        visibility: visible;
        transition: opacity 0.18s ease, visibility 0s linear 0s;
    }

    .aside .nav.nav-pills {
        width: 100%;
        padding: 0.35rem var(--sidebar-inset) 0.75rem !important;
    }

    .aside .nav-pills > .nav-item {
        width: 100%;
    }

    .aside .nav-pills > .nav-item > .nav-link {
        position: relative;
        justify-content: flex-start;
        gap: 0.75rem !important;
        width: 100%;
        min-height: 2.75rem;
        padding: 0.45rem 0.7rem 0.45rem calc((var(--sidebar-rail) - var(--sidebar-icon)) / 2 - var(--sidebar-inset)) !important;
        overflow: hidden;
        border-radius: 0.7rem;
    }

    .aside .nav-link svg {
        display: block;
        flex: 0 0 var(--sidebar-icon);
        width: var(--sidebar-icon);
        height: var(--sidebar-icon);
        margin: 0;
        transform: none;
    }

    .aside .nav-link > span {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: clip;
        opacity: 0;
        transition: opacity 0.16s ease;
    }

    .aside:hover .nav-link > span,
    .aside:focus-within .nav-link > span {
        opacity: 1;
    }

    .aside .nav-link:has(> .badge) {
        padding-right: 4.8rem !important;
    }

    .aside .nav-link > .badge {
        position: absolute;
        top: 50%;
        right: 0.7rem;
        width: auto !important;
        max-width: none;
        margin: 0 !important;
        transform: translateY(-50%);
        opacity: 0;
        transition: opacity 0.16s ease;
    }

    .aside:hover .nav-link > .badge,
    .aside:focus-within .nav-link > .badge {
        opacity: 1;
    }

    .aside .nav > .nav-item:has(> small) {
        display: grid;
        grid-template-rows: 0fr;
        margin: 0 !important;
        overflow: hidden;
        transition:
            grid-template-rows var(--sidebar-time) var(--sidebar-ease),
            margin var(--sidebar-time) var(--sidebar-ease);
    }

    .aside:hover .nav > .nav-item:has(> small),
    .aside:focus-within .nav > .nav-item:has(> small) {
        grid-template-rows: 1fr;
        margin: 0.8rem 0 0.15rem !important;
    }

    .aside .nav-item > small {
        min-height: 0;
        margin-left: 0.85rem !important;
        overflow: hidden;
        opacity: 0;
        transition: opacity 0.16s ease;
    }

    .aside:hover .nav-item > small,
    .aside:focus-within .nav-item > small {
        opacity: 1;
    }

    .aside:not(:hover):not(:focus-within) .sub-menu {
        display: none !important;
    }

    .aside .to-top {
        flex: 1 1 auto;
        height: auto !important;
        min-height: 0;
    }

    .aside footer .overflow-hidden {
        overflow: visible !important;
    }

    .aside .profile-container {
        position: relative;
        align-items: center;
        overflow: visible !important;
        min-height: 3.25rem;
        padding: 0.5rem 0.75rem 0.5rem calc((var(--sidebar-rail) - 2rem) / 2) !important;
        background: transparent;
        border-radius: 0.7rem;
        transition: background-color 0.2s ease;
    }

    .aside:hover .profile-container,
    .aside:focus-within .profile-container {
        background: rgb(19, 20, 21);
    }

    .aside .profile-container > a.col-10 {
        flex: 1 1 auto;
        align-items: center;
        width: auto !important;
        min-width: 0;
        overflow: visible;
    }

    .aside .profile-container small {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
    }

    .aside .profile-container img {
        display: block;
        flex: 0 0 2rem;
        width: 2rem !important;
        min-width: 2rem !important;
        max-width: 2rem;
        height: 2rem;
        border-radius: 50%;
        object-fit: cover;
    }

    .aside .profile-container > a[data-controller="notification"] {
        position: absolute;
        top: 50%;
        right: 0.85rem;
        height: auto !important;
        margin: 0 !important;
        transform: translateY(-50%);
    }

    .aside .profile-container small,
    .aside .profile-container > a[data-controller="notification"] {
        opacity: 0;
        transition: opacity 0.16s ease;
    }

    .aside:not(:hover):not(:focus-within) .profile-container > a[data-controller="notification"] {
        pointer-events: none;
    }

    .aside:hover .profile-container small,
    .aside:focus-within .profile-container small,
    .aside:hover .profile-container > a[data-controller="notification"],
    .aside:focus-within .profile-container > a[data-controller="notification"] {
        opacity: 1;
    }
}

@media (min-width: 992px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: reduce) {
    .container-fluid > .row > .aside > header,
    .container-fluid > .row > .aside > .aside-collapse,
    .container-fluid > .row > .aside::after,
    .aside .nav > .nav-item:has(> small),
    .aside .nav-link > span,
    .aside .nav-link > .badge,
    .aside .nav-item > small,
    .aside .header-brand p,
    .aside .sidebar-brand-marks,
    .aside .sidebar-brand-mark,
    .aside .profile-container,
    .aside .profile-container small,
    .aside .profile-container > a[data-controller="notification"] {
        transition: none;
    }
}

.sidebar-brand-mark,
.sidebar-brand-marks {
    display: none;
}

.aside .sidebar-brand-marks {
    position: relative;
    display: block;
    flex: 0 0 1.75rem;
    width: 1.75rem;
    height: 1.75rem;
    transition:
        width 0.22s cubic-bezier(0.16, 1, 0.3, 1),
        height 0.22s cubic-bezier(0.16, 1, 0.3, 1),
        flex-basis 0.22s cubic-bezier(0.16, 1, 0.3, 1),
        margin-left 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.aside .sidebar-brand-mark {
    display: block !important;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.aside .sidebar-brand-mark--rail {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.18s ease, visibility 0s linear 0s;
}

.aside .sidebar-brand-mark--open {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0s linear 0.18s;
}

@media (max-width: 991.98px) {
    body.menu-open .aside > header {
        flex-wrap: wrap;
    }

    body.menu-open .aside .header-brand,
    body.menu-open .aside .header-brand .h2,
    body.menu-open .aside .sidebar-brand-marks {
        flex: 1 1 100%;
        width: 100%;
        height: auto;
        margin-left: 0;
    }

    body.menu-open .aside .sidebar-brand-mark--rail {
        position: absolute;
        width: 1.75rem;
        height: 1.75rem;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.18s ease, visibility 0s linear 0.18s;
    }

    body.menu-open .aside .sidebar-brand-mark--open {
        position: relative;
        inset: auto;
        width: 100%;
        height: auto;
        aspect-ratio: 2421 / 580;
        object-fit: contain;
        opacity: 1;
        visibility: visible;
        transition: opacity 0.18s ease, visibility 0s linear 0s;
    }
}

@media (min-width: 992px) and (hover: none),
       (min-width: 992px) and (pointer: coarse) {
    .aside .header-brand,
    .aside .header-brand .h2,
    .aside .sidebar-brand-marks {
        width: 100%;
        height: auto;
        flex-basis: auto;
        margin-left: 0;
    }

    .aside .sidebar-brand-mark--rail {
        position: absolute;
        width: 1.75rem;
        height: 1.75rem;
        opacity: 0;
        visibility: hidden;
    }

    .aside .sidebar-brand-mark--open {
        position: relative;
        inset: auto;
        width: 100%;
        height: auto;
        aspect-ratio: 2421 / 580;
        object-fit: contain;
        opacity: 1;
        visibility: visible;
    }
}

@media (prefers-reduced-motion: reduce) {
    .aside .sidebar-brand-marks,
    .aside:hover .sidebar-brand-marks,
    .aside:focus-within .sidebar-brand-marks,
    body.menu-open .aside .sidebar-brand-marks,
    .aside .sidebar-brand-mark,
    .aside:hover .sidebar-brand-mark,
    .aside:focus-within .sidebar-brand-mark,
    body.menu-open .aside .sidebar-brand-mark {
        transition: none;
    }
}

.aside .header-brand .h2 {
    gap: 0.75rem;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    min-width: 0;
}

.aside .sidebar-brand-text {
    display: none !important;
}

.sidebar-brand-name {
    line-height: 1.1;
}

.sidebar-brand-expansion {
    max-width: 16rem;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.3;
    opacity: 0.75;
    white-space: normal;
}

.form-signin .sidebar-brand-text {
    align-items: center;
    text-align: center;
}

.workspace-head {
    display: contents;
}

.workspace-head__lead {
    padding: 0 1rem 0.35rem;
}

.workspace-head__title,
.workspace-head__title small {
    display: none;
}

@media (max-width: 991.98px) {
    .workspace-head__lead:not(:has(.workspace-head__crumbs)) {
        display: none;
    }
}

.workspace-head__meta:not(:has(.workspace-head__crumbs)):not(:has(.workspace-search > *)) {
    display: none;
}

.workspace-head__crumbs .breadcrumb {
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.2;
}

.workspace-head__crumbs .breadcrumb-item,
.workspace-head__crumbs .breadcrumb-item a {
    color: #6c757d;
    text-decoration: none;
}

.workspace-head__crumbs .breadcrumb-item a:hover {
    color: #343a40;
    text-decoration: underline;
}

.workspace-head__crumbs .breadcrumb-item.active {
    color: #495057;
}

.workspace-search:empty {
    display: none;
}

.workspace-head .command-bar button#wms-add-departments,
.workspace-head .command-bar button#wms-add-employees,
.workspace-head .command-bar button#wms-add-clients,
.workspace-head .command-bar button#wms-add-contacts,
.workspace-head .command-bar button#wms-add-structures,
.workspace-head .command-bar button#wms-add-cells {
    display: inline-flex;
    align-items: center;
    width: auto;
    padding: 0.55rem 1.15rem;
    border-radius: 0.5rem;
    color: #fff;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
}

.workspace-head .command-bar button#wms-add-departments,
.workspace-head .command-bar button#wms-add-clients,
.workspace-head .command-bar button#wms-add-structures {
    border: 1px solid #14663b;
    background: #1b7a48;
    box-shadow: 0 1px 2px rgba(18, 70, 40, 0.22);
}

.workspace-head .command-bar button#wms-add-departments:hover,
.workspace-head .command-bar button#wms-add-departments:focus,
.workspace-head .command-bar button#wms-add-clients:hover,
.workspace-head .command-bar button#wms-add-clients:focus,
.workspace-head .command-bar button#wms-add-structures:hover,
.workspace-head .command-bar button#wms-add-structures:focus {
    border-color: #115432;
    background: #15663c;
    color: #fff;
    text-decoration: none;
}

.workspace-head .command-bar button#wms-add-employees,
.workspace-head .command-bar button#wms-add-contacts,
.workspace-head .command-bar button#wms-add-cells {
    border: 1px solid #154e73;
    background: #1a5f8a;
    box-shadow: 0 1px 2px rgba(16, 52, 78, 0.22);
}

.workspace-head .command-bar button#wms-add-employees:hover,
.workspace-head .command-bar button#wms-add-employees:focus,
.workspace-head .command-bar button#wms-add-contacts:hover,
.workspace-head .command-bar button#wms-add-contacts:focus,
.workspace-head .command-bar button#wms-add-cells:hover,
.workspace-head .command-bar button#wms-add-cells:focus {
    border-color: #114263;
    background: #154f74;
    color: #fff;
    text-decoration: none;
}

.wms-table-tabs {
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
}

.wms-table-tabs__list {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 0.2rem;
    margin: 0 0 -1px;
    padding: 0 0.15rem;
    overflow: visible;
    list-style: none;
}

.wms-table-tabs__item {
    flex: 0 0 auto;
}

.wms-table-tabs__tab {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0;
    padding: 0.48rem 1.05rem 0.42rem;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 0.45rem 0.45rem 0 0;
    background: #eef1f4;
    color: #5e6c84;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
}

.wms-table-tabs__tab:hover {
    background: #f6f8fa;
    color: #343a40;
    text-decoration: none;
}

.wms-table-tabs__tab.active {
    position: relative;
    z-index: 1;
    background: #fff;
    color: #1f7a4d;
    border-color: #dde2eb;
}

.wms-table-tabs__tab.active::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 1px;
    background: #fff;
}

.wms-table-tabs__panels {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border: 1px solid #dde2eb;
    border-radius: 0 0.5rem 0.5rem 0.5rem;
    background: #fff;
}

.wms-table-tabs:has(.wms-table-tabs__item:first-child .active) .wms-table-tabs__panels {
    border-top-left-radius: 0;
}

.wms-table-tabs__panel {
    min-height: 0;
}

.wms-table-tabs__panel.active {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    padding: 0.65rem;
}

.wms-table-tabs .wms-grid {
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

@media (min-width: 992px) {
    body:has(.workspace) {
        overflow: hidden;
    }

    .container-fluid > .row {
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        height: 100vh;
    }

    .container-fluid > .row > .col-lg-9 {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: none !important;
        height: 100vh;
        overflow: hidden;
    }

    .container-fluid > .row > .col-lg-9 > .container-xl {
        max-width: none;
        height: 100%;
        min-height: 0;
    }

    .container-fluid > .row > .col-lg-9 .workspace-limit {
        display: flex;
        flex-direction: column;
        max-width: none;
        height: 100%;
        min-height: 0;
        overflow: hidden;
        padding-top: 0.65rem !important;
        padding-right: 1.25rem;
        padding-bottom: 0.75rem !important;
        padding-left: 1.25rem;
    }

    .workspace-head {
        display: grid;
        flex: 0 0 auto;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 1rem;
        row-gap: 0.35rem;
        min-width: 0;
        margin-bottom: 0.5rem;
        padding: 0.6rem 0.85rem;
        border-radius: 0.375rem;
        background: #fff;
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    }

    .workspace-head__lead {
        display: flex;
        grid-column: 1;
        grid-row: 1;
        align-items: center;
        gap: 0.85rem;
        min-width: 0;
        padding: 0;
    }

    .workspace-head__title {
        display: block;
        flex: 0 1 auto;
        min-width: 0;
    }

    .workspace-head__crumbs {
        min-width: 0;
        overflow: hidden;
    }

    .workspace-head__crumbs .breadcrumb {
        flex-wrap: nowrap;
    }

    .workspace-head__heading {
        font-size: 1.35rem;
        font-weight: 700;
        line-height: 1.25;
    }

    .workspace-head__title small {
        display: none;
    }

    .workspace-head__meta {
        display: flex;
        grid-column: 1;
        grid-row: 2;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.45rem;
        min-width: 0;
        padding: 0;
    }

    .workspace-head .command-bar-wrapper {
        grid-column: 2;
        grid-row: 1;
        position: static;
        align-self: center;
        justify-self: end;
        width: auto;
        margin: 0;
    }

    .workspace-head:has(.workspace-search > *) .command-bar-wrapper {
        grid-row: 1 / span 2;
    }

    .workspace-head .command-bar-wrapper .layout {
        gap: 0.5rem;
        min-height: 0;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    .workspace-search {
        width: min(100%, 32rem);
        max-width: 32rem;
    }

    .workspace-head .command-bar .btn {
        display: inline-flex;
        align-items: center;
        width: auto;
        padding: 0.55rem 1.15rem;
        border: 1px solid #14663b;
        border-radius: 0.5rem;
        background: #1b7a48;
        color: #fff;
        font-weight: 600;
        line-height: 1.2;
        text-decoration: none;
        box-shadow: 0 1px 2px rgba(18, 70, 40, 0.22);
    }

    .workspace-head .command-bar .btn:hover,
    .workspace-head .command-bar .btn:focus {
        background: #15663c;
        border-color: #115432;
        color: #fff;
        text-decoration: none;
    }

    .workspace-body {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
        overflow: auto;
    }

    .workspace-body > #post-form {
        margin-bottom: 0 !important;
    }

    .workspace-body > #post-form:has(.wms-grid) {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
        height: auto !important;
        overflow: hidden;
    }

    .workspace-body .wms-table-tabs {
        flex: 1 1 auto;
        min-height: 0;
    }

    .workspace-body .wms-table-tabs__panels {
        flex: 1 1 auto;
        min-height: 0;
    }

    .workspace-body .wms-table-tabs__panel.active {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
        height: 100%;
    }

    .workspace-body .wms-table-tabs__panel.active .wms-grid {
        flex: 1 1 auto;
        min-height: 0;
    }

    .workspace-body > #post-form:not(:has(.wms-grid)) {
        height: auto !important;
    }

    .workspace-section {
        margin-bottom: 0.75rem;
    }

    .workspace-section__title {
        margin: 0 0 0.35rem;
        font-size: 0.95rem;
        font-weight: 600;
        line-height: 1.3;
    }

    .workspace-section .bg-white {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem 1.25rem !important;
        padding: 0.85rem 1rem !important;
        margin-bottom: 0 !important;
    }

    .workspace-section .bg-white > .form-group.grid,
    .workspace-section .bg-white > .form-group:has(select),
    .workspace-section .bg-white > .form-group:has(textarea) {
        grid-column: 1 / -1;
    }

    .workspace-section .form-group {
        margin-bottom: 0;
        min-width: 0;
    }

    .workspace-section .input-group,
    .workspace-section .input-icon,
    .workspace-section .form-control {
        width: 100%;
        max-width: none;
    }

    .workspace-section__commands {
        display: flex;
        justify-content: flex-end;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }
}
