


.sap-items-screen {
  width: min(100%, 1180px);
  display: none;
  background: #ffffff;
}

.sap-items-screen:target {
  display: block;
}

body:has(.sap-items-screen:target) .dashboard {
  display: none;
}



#sap-items .customer-header > .sap-items-utility-actions {
  position: static;
  width: auto;
  min-width: 0;
  height: auto;
  display: flex;
  grid-template-columns: none;
  align-items: center;
  align-self: start;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 0;
  overflow: visible;
}

.sap-items-grid-wrap {
  margin-top: 18px;
  max-height: 660px;
}

#sapItemsTable {
  table-layout: auto;
  min-width: 860px;
}

#sapItemsTable th,
#sapItemsTable td {
  padding: 2px 5px;
  font-size: 11px;
  line-height: 1.05;
  height: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sapItemsTable th:first-child,
#sapItemsTable td:first-child {
  width: 30px;
  padding-inline: 3px;
  text-align: center;
}

#sapItemsTable th:nth-child(2),
#sapItemsTable td:nth-child(2) {
  width: 120px;
}

#sapItemsTable th:nth-child(3),
#sapItemsTable td:nth-child(3) {
  min-width: 280px;
}

#sapItemsTable th:nth-child(4),
#sapItemsTable td:nth-child(4) {
  width: 70px;
}

#sapItemsTable th:nth-child(5),
#sapItemsTable td:nth-child(5) {
  width: 70px;
}

#sapItemsTable th:nth-child(6),
#sapItemsTable td:nth-child(6) {
  width: 54px;
  text-align: center;
}

#sapItemsTable th:nth-child(7),
#sapItemsTable td:nth-child(7) {
  width: 74px;
}

#sapItemsTable th:nth-child(8),
#sapItemsTable td:nth-child(8) {
  width: 82px;
}

#sapItemsTable th:nth-child(9),
#sapItemsTable td:nth-child(9) {
  width: 96px;
  text-align: center;
}

#sapItemsTable th:nth-child(10),
#sapItemsTable td:nth-child(10) {
  width: 112px;
}

#sapItemsTable .sap-items-col-sap-no {
  width: 120px;
}

#sapItemsTable .sap-items-col-desc {
  min-width: 280px;
}

#sapItemsTable .sap-items-col-group {
  min-width: 120px;
}

#sapItemsTable .sap-items-col-type {
  min-width: 130px;
}

#sapItemsTable .sap-items-col-qty,
#sapItemsTable .sap-items-col-total {
  width: 82px;
  text-align: right;
}

.sap-item-input {
  width: 100%;
  min-width: 120px;
  border: 1px solid #d6dde8;
  border-radius: 6px;
  padding: 5px 7px;
  font: inherit;
  font-size: 12px;
}

.sap-item-record-layout {
  display: grid;
  grid-template-columns: minmax(0, 660px) minmax(360px, 460px);
  gap: 12px;
  align-items: start;
  justify-content: start;
}

.sap-item-detail-grid {
  min-width: 0;
}

.sap-item-side-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.sap-item-side-column .sap-item-bin-location-panel {
  margin-top: 0;
}

.sap-item-bin-location-panel {
  position: relative;
}

.sap-item-bin-edit-toggle {
  position: absolute;
  top: 7px;
  right: 10px;
  min-width: 54px;
  padding: 3px 8px;
  font-size: 11px;
}

.sap-item-bin-edit {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.sap-item-bin-edit:not(.is-editing) {
  display: none !important;
}

.sap-item-bin-edit label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #103f52;
}

.sap-item-bin-edit .ts-wrapper {
  min-width: 0;
}

.sap-item-stock-panel {
  margin-top: 22px;
  width: min(460px, 100%);
  box-sizing: border-box;
  border: 1px solid #d6dde8;
  border-radius: 8px;
  background: #f8fbfc;
  padding: 8px 10px 10px;
}

.sap-item-stock-panel h2 {
  margin: 0 0 12px;
  font-size: 14px;
  color: #103f52;
}

.sap-item-stock-summary {
  display: block;
  margin: 0;
  font-size: 12px;
}

#sap-item-detail .utility-actions.customer-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: auto;
}

#sap-item-detail .utility-actions.customer-actions .exit-button {
  position: relative;
  top: auto;
  right: auto;
}

#printSapItemQrStickerButton {
  min-width: 118px;
  white-space: nowrap;
}

.sap-item-sticker-panel {
  width: min(320px, 92vw);
}

.sap-item-sticker-form {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 10px;
  align-items: center;
  margin: 12px 0 16px;
}

.sap-item-sticker-form label {
  color: #103f52;
  font-size: 13px;
  font-weight: 700;
}

.sap-item-stock-matrix-wrap {
  margin-top: 4px;
  overflow-x: hidden;
  border: 1px solid #d9e6ec;
  border-radius: 6px;
  background: #fff;
}

.sap-item-stock-matrix {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 11px;
}

.sap-item-stock-matrix th,
.sap-item-stock-matrix td {
  padding: 4px 3px;
  border-bottom: 1px solid #e4eef2;
  text-align: center;
  white-space: nowrap;
}

.sap-item-stock-matrix th {
  background: #eef7f8;
  color: #103f52;
  font-weight: 700;
}

.sap-item-stock-matrix th:nth-child(2),
.sap-item-stock-matrix td:nth-child(2) {
  width: 95px;
  text-align: left;
}

.sap-item-stock-matrix th:first-child,
.sap-item-stock-matrix td:first-child {
  width: 34px;
  padding-inline: 2px;
}

.sap-item-stock-matrix th:not(:first-child):not(:nth-child(2)),
.sap-item-stock-matrix td:not(:first-child):not(:nth-child(2)) {
  width: 50px;
}

.sap-item-stock-warehouse-head {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sap-item-stock-status-cell {
  font-weight: 700;
  color: #103f52;
}

.sap-item-stock-drill-cell .stock-history-button {
  min-width: 28px;
  width: 28px;
  height: 20px;
  padding: 0 3px;
  font-size: 10px;
}

.sap-item-stock-matrix tbody tr:last-child th,
.sap-item-stock-matrix tbody tr:last-child td {
  border-bottom: 0;
}


.sap-item-stock-matrix tbody tr:has(.stock-history-button[data-stock-history-type="Disassemble"]) .sap-item-stock-status-cell {
  font-size: 0;
}

.sap-item-stock-matrix tbody tr:has(.stock-history-button[data-stock-history-type="Disassemble"]) .sap-item-stock-status-cell::after {
  content: "Altered";
  font-size: 11px;
}

.sap-item-stock-matrix-total {
  font-weight: 800;
  color: #103f52;
}

.sap-item-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.sap-item-delete {
  border-color: #f1b5b5;
  background: #fff1f1;
  color: #9f1d1d;
}

.sap-item-open {
  min-width: 44px;
  padding-inline: 8px;
}

.sap-item-detail-grid {
  display: grid;
  grid-template-columns: 92px minmax(220px, 520px);
  gap: 10px 8px;
  padding: 22px 28px;
  align-items: center;
  max-width: 660px;
}

.sap-item-detail-grid label {
  color: #103f52;
  font-weight: 700;
  font-size: 13px;
}

.sap-item-detail-grid .sap-item-input {
  min-height: 34px;
}

#sap-item-detail.sap-item-detail-modal {
  position: fixed;
  inset: 34px 40px;
  z-index: 9000;
  display: block;
  width: auto;
  max-width: none;
  overflow: auto;
  border: 1px solid #b8d4df;
  box-shadow: 0 18px 45px rgba(15, 40, 55, 0.22);
}


.stock-history-button {
  min-width: 32px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid #9ec9d6;
  border-radius: 5px;
  background: #eaf6f9;
  color: #075c78;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.stock-history-button:hover,
.stock-history-button:focus-visible {
  background: #d6edf4;
  border-color: #61aabd;
}

.stock-history-modal {
  z-index: 9100;
  pointer-events: auto;
}

.stock-history-panel {
  width: min(980px, 96vw);
  z-index: 1;
}

.stock-history-wrap {
  max-height: min(58vh, 520px);
  overflow: auto;
  border: 1px solid #d9e6ec;
  border-radius: 6px;
}

.stock-history-wrap table {
  min-width: 820px;
}


/* ==========================================================================
   sap-items — mobile card presentation for the list table (module-scoped).
   Desktop unchanged; cards apply only at <=640px. Labels come from data-label.
   ========================================================================== */
@media (max-width: 640px) {
  #sap-items .sap-items-grid-wrap {
    border-top: 0;
    max-height: none;
    overflow: visible;
    background: transparent;
  }
  #sap-items .sap-items-grid-wrap > table {
    min-width: 0;
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }
  #sap-items .sap-items-grid-wrap > table > thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  #sap-items .sap-items-grid-wrap > table > tbody > tr {
    display: block;
    margin: 0 0 10px;
    padding: 6px 12px;
    border: 1px solid #d6dde3;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(22, 34, 42, 0.08);
  }
  #sap-items .sap-items-grid-wrap > table > tbody > tr > td {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 2px 14px;
    width: auto;
    min-width: 0;
    max-width: none;
    border: 0;
    border-bottom: 1px solid #eef1f4;
    padding: 7px 0;
    white-space: normal;
    text-align: right;
    overflow-wrap: break-word;
  }
  #sap-items .sap-items-grid-wrap > table > tbody > tr > td:last-child {
    border-bottom: 0;
  }
  #sap-items .sap-items-grid-wrap > table > tbody > tr > td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-weight: 600;
    color: #4a5764;
    text-align: left;
    white-space: nowrap;
  }
  #sap-items .sap-items-grid-wrap > table > tbody > tr > td.open-cell {
    order: -1;
    justify-content: flex-end;
    border-bottom: 1px solid #eef1f4;
    padding-bottom: 8px;
  }
  #sap-items .sap-items-grid-wrap > table > tbody > tr > td.open-cell::before {
    content: "Open";
    margin-right: auto;
    color: #17436c;
  }
  #sap-items .sap-items-grid-wrap > table > tbody > tr > td.open-cell a,
  #sap-items .sap-items-grid-wrap > table > tbody > tr > td.open-cell button {
    font-size: 16px;
    line-height: 1;
    padding: 2px 8px;
  }
  #sap-items .sap-items-grid-wrap > table > tbody > tr > td[colspan] {
    display: block;
    text-align: center;
    color: #6a7785;
  }
  #sap-items .sap-items-grid-wrap > table > tbody > tr > td[colspan]::before {
    content: "";
  }
}
