

.supplier-po-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 18px 0;
}

.supplier-po-update-meta input,
.supplier-po-form-layout input,
.supplier-po-form-layout select,
.supplier-po-form-layout textarea {
  min-height: 24px;
  border: 1px solid #aeb4bc;
  border-radius: 0;
  padding: 2px 4px;
  background: #fff;
  color: #000;
  font-size: 13px;
}

#supplierPoSubject .supplier-control,
#supplierPoRemarks .supplier-control {
  min-height: 48px;
}

.supplier-po-remarks-input {
  cursor: text;
  caret-color: #000;
}


#supplier-po-detail .supplier-po-items-table th {
  background: #fff;
  color: #000;
  font-weight: 400;
  border: 0;
  border-bottom: 1px solid #cfd5db;
}

#supplier-po-detail .supplier-po-items-table td {
  height: 25px;
  padding: 1px 4px;
  border: 1px solid #b8bdc5;
  background: #f9f9f9;
}

#supplier-po-detail .supplier-po-items-table .supplier-control {
  min-height: 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#supplier-po-detail .supplier-po-items-table .supplier-po-sap-input.invalid {
  background: #fff4f4;
  color: #b42318;
  outline: 1px solid #f04438;
}

#supplier-po-detail .supplier-po-sap-desc {
  min-width: 300px;
}

#supplier-po-detail .supplier-po-items-table .supplier-po-col-row {
  width: 42px;
  max-width: 42px;
  text-align: center;
}

#supplier-po-detail .supplier-po-items-table .supplier-po-col-go {
  width: 34px;
  max-width: 34px;
  padding-inline: 2px;
  text-align: center;
}

#supplier-po-detail .supplier-po-items-table .supplier-po-col-sap-no {
  width: 170px;
  min-width: 170px;
}

#supplier-po-detail .supplier-po-items-table .supplier-po-col-sap-desc,
#supplier-po-detail .supplier-po-items-table .supplier-po-sap-desc {
  width: 300px;
  min-width: 300px;
  white-space: normal;
}

#supplier-po-detail .supplier-po-items-table .supplier-po-col-id {
  width: 46px;
  max-width: 46px;
}

#supplier-po-detail .supplier-po-items-table .supplier-po-col-qty,
#supplier-po-detail .supplier-po-items-table .supplier-po-col-received,
#supplier-po-detail .supplier-po-items-table .supplier-po-col-total {
  width: 66px;
  max-width: 66px;
}

#supplier-po-detail .supplier-po-items-table .supplier-po-col-date {
  width: 116px;
  max-width: 116px;
}

#supplier-po-detail .supplier-po-items-table .supplier-po-col-track {
  width: 130px;
  max-width: 130px;
}

#supplier-po-detail .supplier-po-items-table .supplier-po-col-id,
#supplier-po-detail .supplier-po-items-table .supplier-po-col-qty,
#supplier-po-detail .supplier-po-items-table .supplier-po-col-received,
#supplier-po-detail .supplier-po-items-table .supplier-po-col-total {
  text-align: center;
}

#supplier-po-detail .supplier-po-items-table .supplier-po-col-sap-no .supplier-control {
  min-width: 162px;
  overflow: visible;
  text-overflow: clip;
}

#supplier-po-detail .supplier-po-items-table .supplier-po-col-date .supplier-control {
  min-width: 108px;
}


#supplier-po-detail .supplier-po-items-table .supplier-po-col-sap-no .ts-control {
  background: #fff;
  border-color: #cccccc;
}

#supplier-po-detail .supplier-po-items-table td.supplier-po-col-qty input.supplier-control {
  background: #fff;
  border: 1px solid #cccccc;
  border-radius: 4px;
  text-align: center;
}


.supplier-po-grid-wrap {
  max-height: 560px;
}


#supplierPoImportFileName,
#supplierPoImportFilePath {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#supplierPoImportFilePath {
  color: #3d5968;
  font-size: 12px;
}


.supplier-po-screen {
  width: min(100%, 1180px);
  display: none;
  background: #ffffff;
}

.supplier-po-screen:target {
  display: block;
}

body:has(.supplier-po-screen:target) .dashboard {
  display: none;
}

.supplier-po-screen.supplier-po-active-fallback,
.supplier-po-screen.goods-received-active-fallback,
.supplier-po-screen.goods-issue-active-fallback,
.supplier-po-screen.warehouse-transfer-active-fallback,
.supplier-po-screen.inventory-adjustment-active-fallback {
  display: block;
}

body:has(.supplier-po-screen.supplier-po-active-fallback) .dashboard,
body:has(.supplier-po-screen.goods-received-active-fallback) .dashboard,
body:has(.supplier-po-screen.goods-issue-active-fallback) .dashboard,
body:has(.supplier-po-screen.warehouse-transfer-active-fallback) .dashboard,
body:has(.supplier-po-screen.inventory-adjustment-active-fallback) .dashboard {
  display: none;
}

/*
 * Prevent one-frame overlap when opening a desktop register detail.
 * The list fallback class is cleared by the hashchange handler one tick after
 * :target changes, so without this guard both list and detail can paint together.
 */
body:has(#supplier-po-detail:target) #supplier-po.supplier-po-active-fallback,
body:has(#goods-received-detail:target) #goods-received.goods-received-active-fallback,
body:has(#goods-issue-detail:target) #goods-issue.goods-issue-active-fallback,
body:has(#warehouse-transfer-detail:target) #warehouse-transfer.warehouse-transfer-active-fallback,
body:has(#inventory-adjustment-detail:target) #inventory-adjustment.inventory-adjustment-active-fallback {
  display: none !important;
}

.supplier-po-screen table th,
.supplier-po-screen table td {
  font-size: 12px;
  padding: 3px 6px;
}


/* ==========================================================================
   supplier-po — 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) {
  #supplier-po .item-master-panel .grid-wrap {
    border-top: 0;
    max-height: none;
    overflow: visible;
    background: transparent;
  }
  #supplier-po .item-master-panel .grid-wrap > table {
    min-width: 0;
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }
  #supplier-po .item-master-panel .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;
  }
  #supplier-po .item-master-panel .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);
  }
  #supplier-po .item-master-panel .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;
  }
  #supplier-po .item-master-panel .grid-wrap > table > tbody > tr > td:last-child {
    border-bottom: 0;
  }
  #supplier-po .item-master-panel .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;
  }
  #supplier-po .item-master-panel .grid-wrap > table > tbody > tr > td.open-cell {
    order: -1;
    justify-content: flex-end;
    border-bottom: 1px solid #eef1f4;
    padding-bottom: 8px;
  }
  #supplier-po .item-master-panel .grid-wrap > table > tbody > tr > td.open-cell::before {
    content: "Open";
    margin-right: auto;
    color: #17436c;
  }
  #supplier-po .item-master-panel .grid-wrap > table > tbody > tr > td.open-cell a,
  #supplier-po .item-master-panel .grid-wrap > table > tbody > tr > td.open-cell button {
    font-size: 16px;
    line-height: 1;
    padding: 2px 8px;
  }
  #supplier-po .item-master-panel .grid-wrap > table > tbody > tr > td[colspan] {
    display: block;
    text-align: center;
    color: #6a7785;
  }
  #supplier-po .item-master-panel .grid-wrap > table > tbody > tr > td[colspan]::before {
    content: "";
  }
}
