/* Shared sticky page/header and To Top behavior for authenticated web pages. */
.wms-app-shell {
    --wms-app-sticky-top: 0px;
    --wms-page-toolbar-height: 0px;
    --wms-table-sticky-top: 0px;
    --wms-sticky-stack-budget: 30vh;
    --wms-sticky-toolbar-budget: 30vh;
    --wms-sticky-content-min-height: 50vh;
    --wms-to-top-bottom: 28px;
    --wms-sticky-z-table: 99;
    --wms-sticky-z-toolbar: 100;
    --wms-sticky-z-to-top: 98;
}

.wms-app-shell .wms-sticky-table-offset {
    height: 0;
    left: -10000px;
    pointer-events: none;
    position: fixed;
    top: 0;
    visibility: hidden;
    width: 1px;
}

.wms-app-shell .wms-sticky-page {
    --wms-toolbar-sticky-top: var(--wms-app-sticky-top);
    min-width: 0;
}

.wms-app-shell [data-wms-sticky-toolbar-anchor] {
    display: block;
    height: 0;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
}

.wms-app-shell.wms-managed-nav-fixed #nav-menu.wms-managed-nav-fixed-element {
    left: 0;
    position: fixed !important;
    right: 0;
    top: 0;
    width: 100%;
}

.wms-app-shell.wms-managed-nav-fixed #content {
    margin-top: var(--wms-managed-nav-height) !important;
}

/* Compatibility owner for long authenticated pages that do not declare a
   table registration. The shared runtime selects one primary action bar and
   keeps the legacy breadcrumb layer opaque below the managed navigation. */
.wms-app-shell .wms-legacy-detail-header.wms-legacy-detail-header-active {
    background: #fff;
    border-bottom: 1px solid #c8d0d8;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .10);
    position: sticky !important;
    top: var(--wms-managed-nav-height, 0px) !important;
    width: 100% !important;
    z-index: 102 !important;
}

.wms-app-shell .wms-legacy-detail-action.wms-legacy-detail-action-active {
    background: #fff;
    border: 1px solid #c8d0d8;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .10);
    left: auto !important;
    max-width: calc(100vw - (2 * var(--wms-safe-inline)));
    padding: 4px;
    position: fixed !important;
    right: var(--wms-safe-inline) !important;
    top: calc(var(--wms-managed-nav-height, 0px) + 4px) !important;
    width: auto !important;
    z-index: 103 !important;
}

.wms-app-shell .wms-sticky-toolbar {
    background: #fff;
    position: sticky;
    top: var(--wms-toolbar-sticky-top);
    z-index: var(--wms-sticky-z-toolbar);
}

.wms-app-shell .wms-sticky-toolbar.wms-sticky-toolbar-bounded {
    max-height: var(--wms-sticky-toolbar-local-budget, var(--wms-sticky-toolbar-budget));
    overscroll-behavior: contain;
    overflow-x: hidden;
    overflow-y: auto;
}

.wms-app-shell .wms-sticky-toolbar > .widget-title,
.wms-app-shell .wms-sticky-toolbar > .widget-content,
.wms-app-shell .wms-sticky-toolbar .billing-detail-context-panel {
    background: #fff;
}

.wms-app-shell .wms-sticky-page.wms-sticky-active .wms-sticky-toolbar {
    border-bottom: 1px solid #c8d0d8;
    box-shadow: 0 3px 8px rgba(31, 45, 61, 0.18);
}

.wms-app-shell .wms-list-sticky-toolbar {
    clear: both;
}

.wms-app-shell .wms-list-sticky-toolbar .widget-title {
    height: auto !important;
    min-height: 36px;
}

.wms-app-shell .wms-list-sticky-toolbar .widget-title::after {
    clear: both;
    content: "";
    display: table;
}

.wms-app-shell .wms-sticky-page .wms-table-viewport,
.wms-app-shell .wms-sticky-page .table-responsive {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

.wms-app-shell .wms-sticky-page .wms-table-shell[data-wms-fixed-table-layout="true"] {
    table-layout: fixed;
    width: 100%;
}

.wms-app-shell .wms-sticky-page .wms-table-shell[data-wms-fixed-table-layout="true"] > tbody > tr > td {
    max-width: 0;
}

.wms-app-shell .wms-sticky-section-toggle {
    align-items: center;
    display: inline-flex;
    gap: 5px;
    white-space: nowrap;
}

.wms-app-shell .wms-sticky-section-toggle:focus {
    outline: 3px solid #f6c344;
    outline-offset: 2px;
}

.wms-app-shell [data-wms-sticky-section][hidden],
.wms-app-shell .wms-sticky-section-collapsed {
    display: none !important;
}

.wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-search-option {
    float: left;
    max-width: calc(100% - 180px);
    padding: 5px 8px 0;
}

.wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-search-form,
.wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-date-controls,
.wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-search-actions {
    align-items: center;
    display: flex;
    gap: 6px;
}

.wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-search-form {
    flex-wrap: wrap;
    margin: 0;
}

.wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-customer {
    flex: 0 1 245px;
    min-width: 220px;
}

.wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-customer .select2-container {
    max-width: 100%;
    width: 100% !important;
}

.wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-date-controls {
    flex: 0 1 auto;
    flex-wrap: nowrap;
}

.wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-date-controls > .form-control {
    margin: 0;
    width: auto;
}

.wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-date-controls > .datepicker {
    width: 184px;
}

.wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-search-actions {
    flex: 0 0 auto;
}

.wms-app-shell #arAgingStickyToolbar .widget-title {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
}

.wms-app-shell #arAgingStickyToolbar .wms-ar-aging-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
    padding: 4px 8px;
}

.wms-app-shell #arAgingStickyToolbar .wms-ar-aging-context {
    background: #fff;
    border-top: 1px solid #e5e5e5;
    padding: 7px 12px 5px;
    text-align: center;
}

.wms-app-shell #arAgingStickyToolbar .wms-ar-aging-context h4,
.wms-app-shell #arAgingStickyToolbar .wms-ar-aging-context p {
    margin: 0 0 3px;
}

.wms-app-shell #arAgingSummaryPage #arAgingTable {
    font-size: 13px;
    margin-bottom: 0;
    min-width: 900px;
}

.wms-app-shell #arAgingSummaryPage .wms-ar-aging-note {
    font-size: 11px;
    margin-top: 0;
    padding: 7px 12px;
}

.wms-app-shell #inventoryListPage[data-wms-loading="true"],
.wms-app-shell #inventoryListPage[data-wms-loading="true"] .inventorylisttable {
    overflow-anchor: none;
}

.wms-app-shell.wms-inventory-list-loading {
    overflow-anchor: none;
}

.wms-app-shell .wms-sticky-page .tablesorter-sticky-wrapper {
    box-sizing: border-box;
    z-index: var(--wms-sticky-z-table) !important;
}

.wms-app-shell .wms-sticky-page .tablesorter-stickyHeader {
    background: #fff;
}

.wms-app-shell .wms-static-sticky-wrapper {
    box-sizing: border-box;
    display: none;
    max-width: 100vw;
    overflow: hidden;
    position: fixed;
    z-index: var(--wms-sticky-z-table);
}

.wms-app-shell .wms-static-sticky-wrapper.wms-static-sticky-visible {
    display: block;
}

.wms-app-shell .wms-static-sticky-table {
    background: #fff;
    box-sizing: border-box;
    margin: 0;
    position: relative;
    table-layout: fixed;
}

.wms-app-shell .wms-static-sticky-table thead th,
.wms-app-shell .wms-static-sticky-table thead td {
    box-sizing: border-box;
    position: static;
}

.wms-app-shell .wms-to-top {
    bottom: var(--wms-to-top-bottom);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: block;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    right: 18px;
    transform: translateY(8px);
    transition: opacity 120ms ease, transform 120ms ease;
    visibility: hidden;
    z-index: var(--wms-sticky-z-to-top);
}

.wms-app-shell .wms-to-top.wms-to-top-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    visibility: visible;
}

.wms-app-shell .wms-to-top:focus {
    outline: 3px solid #f6c344;
    outline-offset: 2px;
}

.wms-app-shell .wms-scroll-pin-managed {
    display: none !important;
}

.wms-app-shell .wms-scroll-pin-managed.wms-scroll-pin-visible {
    display: block !important;
}

.wms-app-shell .wms-sticky-page .billing-report-pin.wms-scroll-pin-managed {
    top: calc(var(--wms-app-sticky-top) + 8px) !important;
    z-index: 101 !important;
}

.wms-app-shell .wms-billing-detail-context {
    padding: 0 12px;
}

.wms-app-shell .wms-billing-detail-context > .row-fluid {
    background: #fff;
    display: flow-root;
}

.wms-app-shell .wms-billing-detail-context .billing-detail-heading-row {
    align-items: center;
    background: #fff;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

.wms-app-shell .wms-billing-detail-context .billing-detail-heading-row h2 {
    margin-bottom: 8px;
    margin-top: 8px;
}

.wms-app-shell .wms-billing-detail-context .billing-detail-heading-actions {
    align-items: center;
    display: flex;
    flex: 0 1 auto;
    gap: 8px;
    margin-left: auto;
}

.wms-app-shell .wms-billing-detail-context .billing-report-pin.wms-scroll-pin-managed {
    position: static !important;
    right: auto !important;
    top: auto !important;
    white-space: nowrap;
    z-index: auto !important;
}

.wms-app-shell .wms-billing-detail-context .billing-detail-essential-meta {
    display: inline-block;
    margin-left: 10px;
    white-space: nowrap;
}

.wms-app-shell .wms-billing-detail-context .billing-detail-context-panel {
    border: 1px solid #d9dde2;
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
}

.wms-app-shell .wms-billing-detail-context .billing-detail-lot-context {
    padding: 8px 10px;
}

.wms-app-shell .wms-billing-detail-context .billing-detail-lot-context .table {
    margin-bottom: 0;
}

.wms-app-shell .wms-billing-detail-context .billing-detail-lot-toggle {
    margin-left: 0;
}

.wms-app-shell .billingbox .widget-content {
    overflow-x: auto;
    overflow-y: visible;
}

.wms-app-shell .wms-billing-summary-table {
    border-color: #000;
    margin-bottom: 0;
    min-width: 760px;
    table-layout: auto;
}

.wms-app-shell .wms-billing-summary-table > thead > tr > th,
.wms-app-shell .wms-billing-summary-table > tbody > tr > td,
.wms-app-shell .wms-billing-summary-table > tfoot > tr > td {
    border-color: #000;
}

.wms-app-shell .wms-billing-summary-scroll {
    margin-bottom: 20px;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

.wms-app-shell .billingbox .wms-billing-code-table {
    border-color: #000;
    border-collapse: collapse;
    margin-bottom: 0;
    min-width: 960px;
    table-layout: auto;
    width: 100%;
}

.wms-app-shell .billingbox .wms-billing-code-table > thead > tr > th,
.wms-app-shell .billingbox .wms-billing-code-table > tbody > tr > td,
.wms-app-shell .billingbox .wms-billing-code-table > tfoot > tr > td {
    border-color: #000;
    box-sizing: border-box;
    vertical-align: middle;
}

.wms-app-shell .billingbox .wms-billing-code-table .wms-billing-description-cell {
    min-width: 220px;
    overflow-wrap: anywhere;
}

.wms-app-shell .billingbox .wms-billing-code-table .wms-billing-qty-actions {
    align-items: center;
    display: flex;
    gap: 6px;
    justify-content: space-between;
    min-width: 82px;
}

.wms-app-shell .billingbox .wms-billing-code-table .wms-billing-qty-actions > span {
    margin-left: 0 !important;
}

.wms-app-shell .billingbox .wms-billing-code-table input[type="number"] {
    min-width: 72px;
}

.wms-app-shell .wms-collapsible-reference {
    border-radius: 6px;
    margin: 0 0 12px;
    overflow: hidden;
}

.wms-app-shell .wms-collapsible-reference-header {
    margin: 0;
}

.wms-app-shell .wms-collapsible-reference-toggle {
    align-items: center;
    background: inherit;
    border: 0;
    color: inherit;
    display: flex;
    font: inherit;
    font-weight: 700;
    gap: 6px;
    min-height: 34px;
    padding: 7px 12px;
    text-align: left;
    width: 100%;
}

.wms-app-shell .wms-collapsible-reference-toggle:focus {
    outline: 3px solid #f6c344;
    outline-offset: -3px;
}

.wms-app-shell .wms-collapsible-reference-toggle .wms-reference-badge {
    margin-left: 4px;
}

.wms-app-shell .wms-collapsible-reference-toggle .wms-reference-caret {
    margin-left: auto;
}

.wms-app-shell .wms-collapsible-reference-body[hidden] {
    display: none !important;
}

.wms-app-shell .billing-runtime-panel {
    background: #f7fbff;
    border: 1px solid #9cb9d8;
}

.wms-app-shell .billing-runtime-header {
    background: #1f4e79;
    color: #fff;
    font-size: 13px;
}

.wms-app-shell .billing-runtime-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    padding: 10px 12px;
}

.wms-app-shell .billing-runtime-card {
    background: #fff;
    border: 1px solid #c9d9e8;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    min-width: 0;
    padding: 9px 10px;
}

.wms-app-shell .billing-runtime-title {
    color: #173f63;
    font-weight: 700;
    margin-bottom: 5px;
}

.wms-app-shell .billing-runtime-row {
    margin-top: 3px;
    overflow-wrap: anywhere;
}

.wms-app-shell .billing-runtime-label {
    color: #5b6b79;
    font-weight: 700;
}

.wms-app-shell .billing-runtime-policy {
    border-top: 1px solid #e3edf5;
    color: #475569;
    margin-top: 6px;
    padding-top: 5px;
}

.wms-app-shell .system-automation-panel {
    background: #fffaf0;
    border: 1px solid #d8b46a;
}

.wms-app-shell .system-automation-header {
    background: #8a5a12;
    color: #fff;
    font-size: 13px;
}

.wms-app-shell .system-automation-body {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
}

.wms-app-shell .system-automation-subheading {
    color: #6f470e;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 12px 0;
}

.wms-app-shell .system-managed-engine-grid {
    border-bottom: 1px solid #ead4a4;
}

.wms-app-shell .system-managed-engine-card {
    border-color: #d8b46a;
}

.wms-app-shell .system-automation-card {
    background: #fff;
    border: 1px solid #ead4a4;
    border-radius: 6px;
    font-size: 12px;
    max-width: 360px;
    min-width: 260px;
    padding: 8px 10px;
}

.wms-app-shell .system-automation-card .system-code {
    color: #7a3b00;
    font-weight: 700;
}

.wms-app-shell .system-automation-card .system-meta {
    color: #6b7280;
    line-height: 1.35;
    margin-top: 3px;
}

@media (max-width: 991px) {
    .wms-app-shell #inboundNoticeStickyToolbar .search-panel {
        margin-bottom: 8px;
        padding: 8px;
    }

    .wms-app-shell #inboundNoticeStickyToolbar .form-inline,
    .wms-app-shell #invoiceManagementStickyToolbar .form-inline {
        align-items: flex-end;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin: 0;
        width: 100%;
    }

    .wms-app-shell #inboundNoticeStickyToolbar .form-group {
        flex: 1 1 150px;
        margin: 0 !important;
    }

    .wms-app-shell #inboundNoticeStickyToolbar .form-group:first-child {
        flex-basis: 220px;
    }

    .wms-app-shell #inboundNoticeStickyToolbar .form-group label {
        display: block;
    }

    .wms-app-shell #inboundNoticeStickyToolbar .form-control {
        max-width: 100%;
        width: 100% !important;
    }

    .wms-app-shell #inventoryListStickyToolbar .listOption > .row,
    .wms-app-shell #billingListStickyToolbar .listOption > .row {
        align-items: flex-end;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin: 0;
    }

    .wms-app-shell #inventoryListStickyToolbar .listOption > .row > [class*="col-"],
    .wms-app-shell #billingListStickyToolbar .listOption > .row > [class*="col-"] {
        float: none !important;
        margin: 0;
        padding: 0 !important;
        width: auto;
    }

    .wms-app-shell #inventoryListStickyToolbar .listOption > .row > .col-md-2,
    .wms-app-shell #billingListStickyToolbar .listOption > .row > .col-md-1 {
        flex: 0 1 auto;
    }

    .wms-app-shell #billingListStickyToolbar .listOption > .row > .col-md-2 {
        flex: 1 1 180px;
        min-width: 150px;
    }

    .wms-app-shell #billingListStickyToolbar .listOption > .row > .col-md-3 {
        flex: 1 1 250px;
    }

    .wms-app-shell #inventoryListStickyToolbar .listOption > .row > .col-md-8 {
        flex: 1 1 100%;
    }

    .wms-app-shell #inventoryListStickyToolbar .btn-block,
    .wms-app-shell #inventoryListStickyToolbar .savegrp,
    .wms-app-shell #billingListStickyToolbar .btn-block,
    .wms-app-shell #billingListStickyToolbar .savegrp {
        margin: 0;
        padding-top: 0 !important;
    }

    .wms-app-shell #invoiceManagementStickyToolbar .widget-title {
        padding-bottom: 6px;
    }

    .wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-search-option {
        float: none !important;
        max-width: 100%;
        padding: 5px 8px 0 !important;
        width: 100%;
    }

    .wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-customer {
        flex: 1 1 240px;
        padding: 0;
        width: auto;
    }

    .wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-date-controls {
        flex: 1 1 auto;
    }

    .wms-app-shell #arAgingStickyToolbar .wms-ar-aging-actions {
        margin-left: 0;
    }
}

@media (max-width: 767px) {
    .wms-app-shell #invoiceManagementStickyToolbar .wms-invoice-date-controls {
        flex-basis: 100%;
        flex-wrap: wrap;
    }

    .wms-app-shell .billing-runtime-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .wms-app-shell .system-automation-card {
        max-width: 100%;
        min-width: 0;
        width: 100%;
    }

    .wms-app-shell .wms-to-top {
        bottom: 20px;
        min-width: 38px;
        padding-left: 10px;
        padding-right: 10px;
        right: 10px;
    }

    .wms-app-shell .wms-to-top-label {
        border: 0;
        clip: rect(0 0 0 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        width: 1px;
    }

    .wms-app-shell .wms-billing-detail-context {
        padding: 0 8px;
    }

    .wms-app-shell .wms-billing-detail-context .billing-detail-heading-row {
        align-items: stretch;
        display: block;
    }

    /* In the stacked (block) header the desktop margin-left:auto pushed the button group off the right edge,
       where it was hidden (layout audit WMS-DEV 12801). Put it on its own full-width, wrapping line. */
    .wms-app-shell .wms-billing-detail-context .billing-detail-heading-actions {
        flex-wrap: wrap;
        margin-left: 0;
        width: 100%;
    }

    .wms-app-shell .wms-billing-detail-context .savegrp {
        justify-content: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wms-app-shell .wms-to-top {
        transition: none;
    }
}

@media print {
    .wms-app-shell .wms-to-top,
    .wms-app-shell .wms-sticky-table-offset {
        display: none !important;
    }

    .wms-app-shell .wms-sticky-toolbar {
        position: static !important;
    }
}
