.wms-initial-guide {
    display: flex;
    align-items: flex-start;
    gap: .8rem;
    margin-bottom: 1rem;
    padding: .82rem .95rem;
    border: 1px solid #cfe0ea;
    border-radius: 12px;
    background: #f7fbfd;
    color: #42586a;
}

.wms-initial-guide__icon {
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--wms-primary-soft);
    color: var(--wms-primary);
}

.wms-initial-guide strong {
    display: block;
    margin-bottom: .18rem;
    color: #273646;
    font-size: .78rem;
}

.wms-initial-guide p {
    margin: 0;
    color: var(--wms-muted);
    font-size: .71rem;
    line-height: 1.45;
}

.wms-initial-filter-card {
    margin-bottom: 1rem;
}

.wms-initial-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 1rem;
    overflow: hidden;
    border: 1px solid var(--wms-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--wms-shadow);
}

.wms-initial-summary > div {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    column-gap: .72rem;
    padding: .85rem 1rem;
    border-right: 1px solid var(--wms-border-soft);
}

.wms-initial-summary > div:last-child {
    border-right: 0;
}

.wms-initial-summary__icon {
    display: inline-flex;
    grid-row: 1 / span 3;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--wms-primary-soft);
    color: var(--wms-primary);
}

.wms-initial-summary small,
.wms-initial-summary em {
    color: var(--wms-muted);
    font-size: .64rem;
    font-style: normal;
    line-height: 1.3;
}

.wms-initial-summary strong {
    margin: .08rem 0;
    color: #273646;
    font-size: .9rem;
    line-height: 1.2;
}

.wms-initial-card-actions {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.wms-initial-card-actions .btn[disabled] {
    cursor: not-allowed;
    opacity: .55;
}

.wms-initial-table {
    min-width: 920px;
}

.wms-initial-table thead th {
    padding: .72rem .9rem;
    border-bottom: 1px solid var(--wms-border);
    background: #f8fafb;
    color: #6a7888;
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .065em;
    text-transform: uppercase;
    white-space: nowrap;
}

.wms-initial-table tbody td {
    padding: .78rem .9rem;
    border-color: var(--wms-border-soft);
    color: #344354;
    vertical-align: middle;
}

.wms-initial-table tbody tr:hover {
    background: #fbfcfd;
}

.wms-initial-table td > small,
.wms-initial-table td div > small {
    display: block;
    margin-top: .2rem;
    color: var(--wms-muted);
    font-size: .65rem;
    line-height: 1.35;
}

.wms-initial-material-code {
    display: flex;
    min-width: 210px;
    align-items: center;
    gap: .68rem;
}

.wms-initial-material-code > span {
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--wms-primary-soft);
    color: var(--wms-primary);
}

.wms-initial-material-code strong {
    color: #273646;
    font-size: .78rem;
}

.wms-initial-material-code small {
    max-width: 280px;
    font-family: Consolas, Monaco, monospace;
    overflow-wrap: anywhere;
}

.wms-status-badge.is-warning {
    background: var(--wms-warning-soft);
    color: #805609;
}

.wms-status-badge.is-warning > span {
    background: #d69419;
}

@media (max-width: 1199.98px) {
    .wms-initial-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .wms-initial-summary > div:nth-child(2) {
        border-right: 0;
    }

    .wms-initial-summary > div:nth-child(-n+2) {
        border-bottom: 1px solid var(--wms-border-soft);
    }
}

@media (max-width: 767.98px) {
    .wms-initial-summary {
        grid-template-columns: 1fr;
    }

    .wms-initial-summary > div,
    .wms-initial-summary > div:nth-child(2) {
        border-right: 0;
        border-bottom: 1px solid var(--wms-border-soft);
    }

    .wms-initial-summary > div:last-child {
        border-bottom: 0;
    }

    .wms-initial-card-actions {
        align-items: flex-end;
        flex-direction: column;
    }
}

.wms-initial-freeze-note {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    padding: .65rem .9rem;
    border-bottom: 1px solid var(--wms-border-soft);
    background: #fffaf0;
    color: #6f5a2c;
    font-size: .68rem;
    line-height: 1.45;
}

.wms-initial-freeze-note.is-frozen {
    background: #f6fbfd;
    color: #456270;
}

.wms-initial-freeze-note i {
    margin-top: .08rem;
    color: var(--wms-primary);
}

.wms-initial-batch-code {
    max-width: 255px;
    overflow: hidden;
    font-family: Consolas, Monaco, monospace;
    font-size: .73rem !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wms-number-cell.is-changed {
    color: #a66a00;
}

.wms-initial-snapshot-table {
    min-width: 1220px;
}

/* 1.4B.003 - operator-friendly placement */
.wms-placement-panel {
    margin-bottom: 1rem;
    border-color: #bdd8e7;
}

.wms-placement-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .7rem;
    margin-bottom: 1rem;
}

.wms-placement-metrics > div {
    padding: .72rem .85rem;
    border: 1px solid var(--wms-border-soft);
    border-radius: 10px;
    background: #f8fbfc;
}

.wms-placement-metrics small {
    display: block;
    margin-bottom: .18rem;
    color: var(--wms-muted);
    font-size: .64rem;
}

.wms-placement-metrics strong {
    color: #273646;
    font-size: .88rem;
}

.wms-placement-form {
    padding-top: .2rem;
}

.wms-placement-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: .45rem;
}

.wms-placement-history {
    margin-top: 1rem;
    padding-top: .85rem;
    border-top: 1px solid var(--wms-border-soft);
}

.wms-placement-history h3 {
    margin: 0 0 .55rem;
    color: #344354;
    font-size: .78rem;
}

.wms-placement-history th {
    color: #6a7888;
    font-size: .62rem;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.wms-placement-history td {
    font-size: .7rem;
}

.wms-placement-history td small {
    display: block;
    margin-top: .12rem;
    color: var(--wms-muted);
}

.wms-placement-history code {
    color: #456270;
    font-size: .63rem;
}

.wms-initial-placement-table {
    min-width: 1460px;
}

.wms-initial-placement-table tr.is-selected {
    background: #f2f9fc;
}

.wms-number-cell.is-pending {
    color: #7a8895;
    font-size: .72rem;
}

.wms-status-badge.is-muted {
    background: #eef3f6;
    color: #637282;
}

.wms-status-badge.is-muted > span {
    background: #8a99a7;
}

@media (max-width: 991.98px) {
    .wms-placement-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .wms-placement-metrics {
        grid-template-columns: 1fr;
    }
}

/* 1.4B.003A - placement modal + cascading physical location selector */
.wms-placement-modal .modal-dialog {
    max-width: 1080px;
}

.wms-placement-modal .modal-content {
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 18px 48px rgba(35, 55, 72, .2);
}

.wms-placement-modal__header {
    align-items: flex-start;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--wms-border-soft);
    background: #fbfdfe;
}

.wms-placement-modal__header h2 {
    margin: .1rem 0 .18rem;
    color: #273646;
    font-size: 1rem;
    font-weight: 700;
}

.wms-placement-modal__header small {
    display: block;
    color: var(--wms-muted);
    font-size: .68rem;
}

.wms-placement-modal__footer {
    padding: .8rem 1.15rem;
    border-top: 1px solid var(--wms-border-soft);
    background: #fbfdfe;
}

.wms-placement-location-box,
.wms-placement-qty-box {
    margin-top: 1rem;
    padding: .9rem;
    border: 1px solid var(--wms-border-soft);
    border-radius: 12px;
    background: #fff;
}

.wms-placement-location-box {
    background: #f9fcfd;
}

.wms-placement-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .8rem;
}

.wms-placement-section-heading h3 {
    margin: .08rem 0 0;
    color: #344354;
    font-size: .82rem;
    font-weight: 700;
}

.wms-placement-location-box .form-label,
.wms-placement-qty-box .form-label {
    color: #455768;
    font-size: .68rem;
    font-weight: 700;
}

.wms-placement-location-box .form-control,
.wms-placement-qty-box .form-control {
    min-height: 40px;
    border-color: #cfdae2;
    border-radius: 8px;
    background: #fff;
    font-size: .76rem;
}

.wms-placement-location-box select.form-control:disabled {
    background: #f2f5f7;
    color: #8a98a5;
}

#wms_location_scan_feedback.is-success {
    color: #16804c;
}

#wms_location_scan_feedback.is-error {
    color: #b04a3e;
}

.wms-placement-qty-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: .8rem;
}

.wms-placement-qty-box .btn {
    min-height: 40px;
    white-space: nowrap;
}

.wms-placement-history {
    margin-top: 1rem;
    padding: .9rem;
    border: 1px solid var(--wms-border-soft);
    border-radius: 12px;
    background: #fff;
}

.wms-placement-history .wms-placement-section-heading {
    margin-bottom: .65rem;
}

.wms-placement-history-empty {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .75rem;
    border-radius: 9px;
    background: #f7fafb;
    color: var(--wms-muted);
    font-size: .7rem;
}

.wms-detail-action {
    border-color: #cfdde5;
    color: #406078;
    background: #f8fbfc;
}

.wms-detail-action:hover {
    border-color: #b9d1de;
    color: var(--wms-primary);
    background: #f1f8fb;
}

@media (max-width: 767.98px) {
    .wms-placement-modal .modal-dialog {
        margin: .5rem;
    }

    .wms-placement-section-heading,
    .wms-placement-qty-box {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .wms-placement-section-heading {
        flex-direction: column;
    }
}

/* 1.4B.004 - lightweight JS modal, compact actions, reversal history */
.wms-placement-modal .modal-dialog {
    max-width: 920px;
}

.wms-placement-modal .modal-body {
    padding: .85rem 1rem;
}

.wms-placement-modal__header,
.wms-placement-modal__footer {
    padding-left: 1rem;
    padding-right: 1rem;
}

.wms-placement-location-box,
.wms-placement-qty-box,
.wms-placement-history {
    margin-top: .75rem;
    padding: .75rem;
}

.wms-placement-metrics {
    gap: .5rem;
}

.wms-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-width: 36px;
    height: 34px;
    padding: 0;
    border-radius: 9px;
}

.wms-action-icon i {
    margin: 0;
    font-size: .82rem;
}

.wms-placement-history-table tr.is-reversed {
    opacity: .65;
    background: #fafafa;
}

.wms-placement-history-table tr.is-reversed strong {
    text-decoration: line-through;
}

.wms-history-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
}

.wms-placement-modal .btn-close {
    flex: 0 0 auto;
    margin: 0;
    padding: .55rem;
    border: 0;
    background-color: transparent;
}

.wms-placement-modal .modal-footer .btn {
    min-width: 104px;
}

/* ========================================================================== */
/* Initial Stock Excel Import                                                 */
/* ========================================================================== */
.wms-import-open {
    white-space: nowrap;
}

.wms-import-modal .modal-dialog {
    max-width: min(1180px, calc(100vw - 32px));
}

.wms-import-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid #dbe7ef;
    border-radius: 12px;
    background: #f7fbfd;
    margin-bottom: 16px;
}

.wms-import-info div {
    display: grid;
    gap: 3px;
}

.wms-import-info span {
    color: #718096;
    font-size: 12px;
}

.wms-import-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.wms-import-summary > div {
    border: 1px solid #e3ebf1;
    border-radius: 10px;
    padding: 11px 13px;
    background: #fff;
    display: grid;
    gap: 2px;
}

.wms-import-summary small {
    color: #7a8995;
    font-size: 11px;
}

.wms-import-summary strong {
    font-size: 18px;
}

.wms-import-preview-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 8px;
}

.wms-import-preview-head h3 {
    margin: 2px 0 0;
    font-size: 15px;
}

.wms-import-preview-table-wrap {
    max-height: 420px;
    border: 1px solid #e4ebf0;
    border-radius: 10px;
}

.wms-import-preview-table {
    margin-bottom: 0;
}

.wms-import-preview-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f6f9fb;
}

.wms-import-preview-table td small {
    display: block;
    color: #83919c;
    font-size: 10px;
    margin-top: 2px;
}

@media (max-width: 767.98px) {
    .wms-import-info,
    .wms-import-preview-head {
        align-items: stretch;
        flex-direction: column;
    }

    .wms-import-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ========================================================================== */
/* 1.4B.005C - Initial Stock index polishing V2 (UI only)                    */
/* ========================================================================== */
.wms-initial-placement-table {
    min-width: 960px;
    table-layout: fixed;
}

.wms-initial-placement-table .wms-col-code {
    width: 150px;
}

.wms-initial-placement-table .wms-col-description {
    width: 300px;
}

.wms-initial-placement-table .wms-col-uom {
    width: 72px;
}

.wms-initial-placement-table .wms-col-number {
    width: 98px;
}

.wms-initial-placement-table .wms-col-status {
    width: 138px;
}

.wms-initial-placement-table .wms-col-action {
    position: sticky;
    right: 0;
    width: 50px;
    min-width: 50px;
    max-width: 50px;
    padding-left: .35rem;
    padding-right: .45rem;
    text-align: center !important;
    box-shadow: -8px 0 12px -12px rgba(37, 57, 73, .55);
}

.wms-initial-placement-table thead .wms-col-action {
    z-index: 5;
    background: #f8fafb;
}

.wms-initial-placement-table tbody .wms-col-action {
    z-index: 3;
    background: #fff;
}

.wms-initial-placement-table tbody tr:hover .wms-col-action {
    background: #fbfcfd;
}

.wms-initial-placement-table tbody tr.is-selected .wms-col-action {
    background: #f2f9fc;
}

.wms-material-code-cell {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: .55rem;
}

.wms-material-code-cell strong {
    min-width: 0;
    overflow: hidden;
    color: #273646;
    font-size: .74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wms-initial-material__icon {
    display: inline-flex;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--wms-primary-soft);
    color: var(--wms-primary);
}

.wms-material-description {
    min-width: 0;
}

.wms-material-description strong,
.wms-material-description small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wms-material-description strong {
    color: #344354;
    font-size: .74rem;
    font-weight: 600;
}

.wms-material-description small {
    margin-top: .12rem;
    color: var(--wms-muted);
    font-size: .61rem;
}

.wms-initial-placement-table tbody td {
    padding-top: .56rem;
    padding-bottom: .56rem;
}

.wms-initial-placement-table .wms-col-uom .wms-cell-title,
.wms-initial-placement-table .wms-col-number .wms-number-cell {
    font-size: .74rem;
}

.wms-compact-note {
    margin-top: .08rem !important;
    font-size: .58rem !important;
    line-height: 1.15 !important;
}

.wms-compact-note.is-changed {
    color: #a66a00 !important;
}

.wms-initial-placement-table .wms-col-status .wms-status-badge {
    max-width: 100%;
    font-size: .61rem;
    white-space: nowrap;
}

@media (max-width: 1199.98px) {
    .wms-initial-placement-table {
        min-width: 900px;
    }

    .wms-initial-placement-table .wms-col-code {
        width: 138px;
    }

    .wms-initial-placement-table .wms-col-description {
        width: 260px;
    }

    .wms-initial-placement-table .wms-col-number {
        width: 92px;
    }

    .wms-initial-placement-table .wms-col-status {
        width: 128px;
    }
}

