:root{--pp-teal:#16877b;--pp-teal-dark:#0f6f66;--pp-line:#dfe9e7;--pp-bg:#f5f8f8;--pp-text:#203633;--pp-muted:#78908c}
.purchase-ui-list-page.active{height:calc(100dvh - 112px);min-height:0;overflow:hidden;display:flex!important;flex-direction:column;gap:14px;padding:18px 20px!important;background:var(--pp-bg)}
.purchase-ui-heading{display:flex;align-items:center;justify-content:space-between;min-height:40px;flex:0 0 auto}
.purchase-ui-heading h2{margin:0;color:#183c38;font-size:24px;letter-spacing:.2px}.purchase-ui-heading>div{display:flex;gap:10px}
.purchase-ui-filter-card{flex:0 0 auto;margin:0!important;padding:16px 18px!important;display:flex;align-items:end;gap:14px;border:1px solid var(--pp-line)!important;box-shadow:0 2px 8px rgba(25,74,69,.04)!important}
.purchase-ui-filter-card label{display:flex;flex-direction:column;gap:7px;min-width:150px;color:#506b67;font-size:13px;font-weight:600}.purchase-ui-filter-card label.wide-search{flex:1;min-width:220px}
.purchase-ui-filter-card input,.purchase-ui-filter-card select{height:38px;min-width:0;border:1px solid #d4e1df;border-radius:6px;background:#fff;color:var(--pp-text);padding:0 11px;outline:none}.purchase-ui-filter-card input:focus,.purchase-ui-filter-card select:focus{border-color:var(--pp-teal);box-shadow:0 0 0 3px rgba(22,135,123,.1)}
.purchase-ui-filter-card .date-range>span{display:flex;align-items:center;gap:7px}.purchase-ui-filter-card .date-range input{width:142px}.purchase-ui-filter-card .date-range i{font-style:normal;color:#829793}
.purchase-ui-filter-actions{display:flex;align-items:center;gap:8px;margin-left:auto;flex-wrap:nowrap}.purchase-ui-filter-actions button{white-space:nowrap;height:38px}
.purchase-ui-table-card{min-height:0;flex:1 1 auto;margin:0!important;padding:0!important;overflow:hidden;display:flex;flex-direction:column;border:1px solid var(--pp-line)!important;box-shadow:0 2px 8px rgba(25,74,69,.04)!important}
.purchase-ui-table-title{height:50px;flex:0 0 50px;display:flex;align-items:center;justify-content:space-between;padding:0 18px;border-bottom:1px solid #e8efee}.purchase-ui-table-title h3{margin:0;font-size:15px;color:#294743}
.purchase-ui-table-scroll{min-height:0;flex:1 1 auto;overflow:auto!important;margin:0!important}.purchase-ui-table-scroll table{margin:0;min-width:1180px;border-collapse:separate;border-spacing:0}.purchase-ui-table-scroll thead th{position:sticky;top:0;z-index:2;background:#f2f7f6;color:#5a7470;font-size:12px;font-weight:700;white-space:nowrap;border-bottom:1px solid var(--pp-line)}
.purchase-ui-table-scroll th,.purchase-ui-table-scroll td{height:48px;padding:9px 12px!important;vertical-align:middle;border-bottom:1px solid #edf2f1}.purchase-ui-table-scroll tbody tr:hover{background:#f7fbfa}.purchase-ui-table-scroll .num{text-align:right}.purchase-ui-table-scroll .check-col{width:42px;text-align:center}.purchase-ui-table-scroll .table-actions{display:flex;align-items:center;gap:8px;white-space:nowrap}
.purchase-ui-pagination{flex:0 0 50px;min-height:50px;display:flex;align-items:center;justify-content:flex-end;gap:7px;padding:0 16px;border-top:1px solid #e6eeec;background:#fff;color:#708783;font-size:12px}.purchase-ui-pagination button{min-width:30px;height:30px;border:1px solid #d7e4e2;border-radius:5px;background:#fff;color:#46635f}.purchase-ui-pagination button.active{background:var(--pp-teal);color:#fff;border-color:var(--pp-teal)}.purchase-ui-pagination button:disabled{opacity:.45}
.product-approved-kpis{flex:0 0 auto;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}.product-kpi{min-height:94px;background:#fff;border:1px solid var(--pp-line);border-radius:9px;padding:18px;display:flex;align-items:center;gap:15px;box-shadow:0 2px 8px rgba(25,74,69,.04)}.product-kpi>i{width:43px;height:43px;border-radius:9px;display:grid;place-items:center;font-style:normal;font-size:20px}.product-kpi.blue>i{background:#e8f1ff;color:#4c82e7}.product-kpi.green>i{background:#e8f6f0;color:#1f9b69}.product-kpi.orange>i{background:#fff2e5;color:#e88a23}.product-kpi.purple>i{background:#f1ebff;color:#8a62dd}.product-kpi div{flex:1;min-width:0;display:grid;grid-template-columns:1fr auto;align-items:end;column-gap:8px}.product-kpi span{grid-column:1/-1;color:#758b87;font-size:12px;white-space:nowrap}.product-kpi strong{font-size:25px;color:#1f3d39;line-height:1.25}.product-kpi small{color:#9aaca9;font-size:11px;white-space:nowrap}.product-kpi small b{color:#2c9b72}
.product-approved-tabs{flex:0 0 38px;display:flex;align-items:end;border-bottom:1px solid #dbe6e4}.product-approved-tabs button{height:38px;border:0;border-bottom:2px solid transparent;background:transparent;color:#708581;padding:0 20px;font-weight:600}.product-approved-tabs button.active{color:var(--pp-teal);border-color:var(--pp-teal)}.product-approved-tabs b{display:inline-grid;place-items:center;min-width:20px;height:18px;margin-left:5px;border-radius:10px;background:#e7efee;color:#6f8581;font-size:10px}.product-approved-tabs button.active b{background:#dff2ef;color:var(--pp-teal)}
.pp-status{display:inline-flex;align-items:center;gap:5px;padding:3px 9px;border-radius:12px;background:#e8f7f0;color:#21835d;font-size:12px}.pp-status:before{content:"";width:5px;height:5px;border-radius:50%;background:currentColor}.pp-status.off{background:#eef2f2;color:#81908e}.pp-status.warn{background:#fff2df;color:#bd721b}
.pp-link{border:0!important;background:transparent!important;padding:0!important;color:var(--pp-teal)!important;font-size:12px!important;box-shadow:none!important}.pp-link.danger{color:#c45b55!important}
body.purchase-ui-workspace-open main{overflow:hidden!important}.purchase-ui-workspace.active{height:calc(100dvh - 112px);min-height:0;overflow:hidden;display:flex!important;flex-direction:column;background:var(--pp-bg);padding:0!important}
.pp-work-head{height:62px;flex:0 0 62px;display:flex;align-items:center;gap:12px;padding:0 22px;background:#fff;border-bottom:1px solid var(--pp-line)}.pp-back{width:34px;height:34px;border:1px solid #d8e5e3;background:#fff;border-radius:6px;color:#496b66;font-size:18px}.pp-work-head h2{margin:0;font-size:20px;color:#1e403b}.pp-work-head .pp-status{margin-left:auto}
.pp-work-scroll{flex:1 1 auto;min-height:0;overflow:auto;padding:16px 22px 12px}.pp-editor-card{background:#fff;border:1px solid var(--pp-line);border-radius:8px;margin-bottom:14px}.pp-card-head{height:46px;display:flex;align-items:center;justify-content:space-between;padding:0 17px;border-bottom:1px solid #e8efee}.pp-card-head h3{margin:0;font-size:14px;color:#24443f}.pp-card-body{padding:16px 18px}
.pp-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 22px}.pp-form-grid label{display:flex;flex-direction:column;gap:7px;color:#59716d;font-size:12px;font-weight:600}.pp-form-grid label.wide{grid-column:1/-1}.pp-form-grid input,.pp-form-grid select,.pp-form-grid textarea{width:100%;min-height:38px;border:1px solid #d7e3e1;border-radius:6px;padding:8px 10px;background:#fff;color:#24443f}.pp-form-grid textarea{min-height:68px;resize:vertical}.pp-required{color:#d95d54}
.pp-detail-card{min-height:260px}.pp-detail-card .pp-card-body{padding:0}.pp-detail-scroll{overflow:auto;max-height:340px}.pp-detail-table{min-width:1160px;margin:0;table-layout:fixed}.pp-detail-table th:nth-child(1){width:42px}.pp-detail-table th:nth-child(2){width:54px}.pp-detail-table th:nth-child(3){width:180px}.pp-detail-table th:nth-child(4){width:220px}.pp-detail-table th:nth-child(5){width:155px}.pp-detail-table th:nth-child(6){width:135px}.pp-detail-table th:nth-child(7){width:145px}.pp-detail-table th:nth-child(8){width:135px}.pp-detail-table th:nth-child(9){width:70px}.pp-detail-table thead th{position:sticky;top:0;z-index:1;background:#f3f7f7;white-space:nowrap}.pp-detail-table input{height:33px;border:1px solid #d8e5e3;border-radius:5px;padding:0 8px;min-width:0;width:100%}.pp-detail-table .product-model-entry{display:flex;gap:5px}.pp-detail-table .product-model-entry input{width:130px}.pp-detail-table .qty-unit{display:flex;align-items:center;gap:5px}.pp-detail-table .qty-unit span{color:#788e8a;font-size:11px;white-space:nowrap}.pp-detail-table tfoot td{position:sticky;bottom:0;background:#f8fbfa;font-weight:700}
.pp-money-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:14px}.pp-money-summary>div{background:#fff;border:1px solid var(--pp-line);border-radius:8px;padding:14px 17px}.pp-money-summary span{display:block;color:#7b918d;font-size:12px}.pp-money-summary strong{display:block;color:#24423e;font-size:20px;margin-top:4px}.pp-money-summary>div:last-child strong{color:#d46b54}
.pp-work-footer{height:66px;flex:0 0 66px;display:flex;align-items:center;justify-content:flex-end;gap:10px;padding:0 22px;background:#fff;border-top:1px solid var(--pp-line);box-shadow:0 -4px 12px rgba(27,69,64,.04)}
.pp-account-list{display:grid;gap:10px}.pp-account-row{display:grid;grid-template-columns:1fr 1.5fr 1.2fr 1.2fr auto;gap:9px}.pp-account-row input{height:36px;border:1px solid #d7e3e1;border-radius:5px;padding:0 9px}
.purchase-ui-picker-layer{position:fixed;inset:0;z-index:1200;background:rgba(22,47,43,.42);display:grid;place-items:center;padding:30px}.pp-picker{width:min(1120px,94vw);height:min(720px,88vh);background:#fff;border-radius:10px;box-shadow:0 20px 60px rgba(17,47,43,.24);display:flex;flex-direction:column;overflow:hidden}.pp-picker-head{height:58px;flex:0 0 58px;display:flex;align-items:center;padding:0 20px;border-bottom:1px solid var(--pp-line)}.pp-picker-head h3{margin:0;font-size:17px;color:#23443f}.pp-picker-head button{margin-left:auto;border:0;background:transparent;font-size:24px;color:#77908b}.pp-picker-query{flex:0 0 62px;display:flex;align-items:center;gap:10px;padding:0 20px;background:#f8fbfa;border-bottom:1px solid var(--pp-line)}.pp-picker-query input,.pp-picker-query select{height:36px;border:1px solid #d7e4e1;border-radius:6px;padding:0 10px;background:#fff}.pp-picker-query input{flex:1}.pp-picker-main{min-height:0;flex:1 1 auto;display:grid;grid-template-columns:minmax(0,1fr) 320px}.pp-picker-results{min-width:0;display:flex;flex-direction:column;border-right:1px solid var(--pp-line)}.pp-picker-table-scroll{min-height:0;flex:1;overflow:auto}.pp-picker table{margin:0;min-width:720px}.pp-picker thead th{position:sticky;top:0;background:#f2f7f6;z-index:2}.pp-picker th,.pp-picker td{padding:9px 10px!important;border-bottom:1px solid #edf2f1}.pp-picker-pager{height:42px;flex:0 0 42px;display:flex;align-items:center;justify-content:center;gap:8px;border-top:1px solid #e8efee}.pp-picker-selected{min-height:0;display:flex;flex-direction:column;background:#fbfdfd}.pp-picker-selected h4{margin:0;padding:15px 16px 11px;color:#31524d}.pp-selected-list{min-height:0;flex:1;overflow:auto;padding:0 12px 12px}.pp-selected-item{display:grid;grid-template-columns:24px 1fr auto;gap:8px;align-items:center;padding:10px 7px;border-bottom:1px solid #e8efee}.pp-selected-item em{display:grid;place-items:center;width:22px;height:22px;border-radius:50%;background:#dff1ee;color:var(--pp-teal);font-style:normal;font-size:11px}.pp-selected-item b{display:block;font-size:12px}.pp-selected-item small{display:block;color:#839793;margin-top:2px}.pp-selected-item button{border:0;background:transparent;color:#bf625b}.pp-picker-footer{height:64px;flex:0 0 64px;display:flex;align-items:center;justify-content:space-between;padding:0 20px;border-top:1px solid var(--pp-line);background:#fff}.pp-picker-footer>div{display:flex;gap:10px}.pp-empty{padding:28px!important;text-align:center;color:#93a39f}
@media(max-width:1200px){.purchase-ui-filter-card{gap:9px}.purchase-ui-filter-card label{min-width:120px}.purchase-ui-filter-card .date-range input{width:120px}.purchase-ui-filter-actions{gap:5px}.product-approved-kpis{gap:9px}.product-kpi{padding:13px}.pp-form-grid{gap:10px 14px}}
@media(max-width:900px){.purchase-ui-list-page.active,.purchase-ui-workspace.active{height:auto;min-height:calc(100dvh - 70px);overflow:auto}.purchase-ui-filter-card{align-items:stretch;flex-wrap:wrap}.purchase-ui-filter-actions{width:100%;justify-content:flex-end}.product-approved-kpis{grid-template-columns:repeat(2,1fr)}.purchase-ui-table-card{min-height:480px}.pp-picker-main{grid-template-columns:1fr}.pp-picker-selected{display:none}.pp-form-grid{grid-template-columns:1fr}.pp-form-grid label.wide{grid-column:auto}}

/* The document number opens the shared purchase workspace. */
@layer purchase-documents {
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .purchase-ui-table-scroll table {
    min-width: 980px !important;
  }
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .purchase-ui-table-scroll td:last-child {
    position: static !important;
    box-shadow: none !important;
  }
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .purchase-ui-table-scroll th:last-child {
    right: auto !important;
    box-shadow: none !important;
  }
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .purchase-ui-table-scroll .pp-document-link {
    color: #0875ff !important;
    font: inherit !important;
    font-weight: 650 !important;
    padding: 0 !important;
    cursor: pointer;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
  }
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .pp-document-link:hover {
    text-decoration: underline;
  }
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .purchase-ui-table-scroll th:nth-child(1) {width: 32px !important}
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .purchase-ui-table-scroll th:nth-child(2) {width: 132px !important}
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .purchase-ui-table-scroll th:nth-child(3) {width: 94px !important}
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .purchase-ui-table-scroll th:nth-child(4) {width: 15% !important}
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .purchase-ui-table-scroll th:nth-child(5) {width: 90px !important}
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .purchase-ui-table-scroll th:nth-child(6) {width: 58px !important}
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .purchase-ui-table-scroll th:nth-child(7) {width: 104px !important}
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .purchase-ui-table-scroll th:nth-child(8) {width: 95px !important}
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .purchase-ui-table-scroll th:nth-child(9) {width: 102px !important}
  :is(#erpPurchaseOrders, #erpPurchaseReceipts) .purchase-ui-table-scroll th:last-child {
    width: auto !important;
    min-width: 0 !important;
  }
  #erpPurchaseReceipts .bb-order-table th.purchase-receipt-stock {width: 88px !important}
  #erpPurchaseReceipts .bb-order-table td:nth-child(5) {
    color: #466385 !important;
    font-weight: 400 !important;
  }
  #erpPurchaseReceipts .purchase-receipt-stock {
    text-align: center !important;
  }
  #purchaseUiWorkspace:is([data-return-page="erpPurchaseOrders"],[data-return-page="erpPurchaseReceipts"]) .pp-work-footer {
    justify-content: flex-start !important;
    gap: 8px !important;
  }
  #purchaseUiWorkspace .pp-document-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-inline-start: auto;
  }
  #purchaseUiWorkspace .pp-document-actions :is(button, a, summary),
  #purchaseUiWorkspace .pp-document-history {
    box-sizing: border-box;
    white-space: nowrap;
  }
  #purchaseUiWorkspace .pp-document-actions button,
  #purchaseUiWorkspace .pp-document-actions summary,
  #purchaseUiWorkspace .pp-document-history {
    min-width: 0 !important;
    padding-inline: 12px !important;
  }
  #purchaseUiWorkspace .pp-document-delete {
    color: #b42330 !important;
  }
  #purchaseUiWorkspace .pp-document-actions button:disabled {
    opacity: .5;
    cursor: default;
  }
  #purchaseUiWorkspace.pp-document-readonly .pp-detail-table :is(th,td):last-child,
  #purchaseUiWorkspace.pp-document-readonly .pp-detail-card button {
    display: none !important;
  }
  #purchaseUiWorkspace.pp-document-readonly .pp-work-scroll :is(input,select,textarea):disabled {
    opacity: 1;
    cursor: default;
  }
  #purchaseUiWorkspace .pp-document-export {
    position: relative;
  }
  #purchaseUiWorkspace .pp-document-export summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    cursor: pointer;
  }
  #purchaseUiWorkspace .pp-document-export summary::-webkit-details-marker {
    display: none;
  }
  #purchaseUiWorkspace .pp-document-export > div > a {
    text-decoration: none;
    display: flex;
    align-items: center;
  }
  #purchaseUiWorkspace .pp-document-export > div {
    position: absolute;
    right: 0;
    bottom: calc(100% + 6px);
    z-index: 10;
    display: grid;
    gap: 4px;
    min-width: max-content;
    padding: 6px;
    border: 1px solid #d8e6f5;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 4px 12px #17315c26;
  }
  @media (max-width: 1000px) {
    #purchaseUiWorkspace:is([data-return-page="erpPurchaseOrders"],[data-return-page="erpPurchaseReceipts"]) .pp-work-footer {
      flex: 0 0 auto !important;
      height: auto !important;
      padding-block: 8px !important;
      flex-wrap: wrap;
    }
    #purchaseUiWorkspace .pp-document-actions {
      justify-content: flex-end;
      flex-wrap: wrap;
    }
  }
}

/* Purchase order and receipt share a natural-height detail table. The workspace
   body scrolls to the summary and attachments, outside the detail scroller. */
@layer purchase-documents {
  #purchaseUiWorkspace:is([data-return-page="erpPurchaseOrders"],[data-return-page="erpPurchaseReceipts"]) .pp-work-scroll {
    display: flex !important;
    flex: 1 1 0 !important;
    flex-direction: column !important;
    min-height: 0 !important;
    overflow: auto !important;
    gap: 10px !important;
    padding-bottom: 12px !important;
  }
  #purchaseUiWorkspace:is([data-return-page="erpPurchaseOrders"],[data-return-page="erpPurchaseReceipts"]) .pp-work-scroll > .pp-editor-card {
    flex: 0 0 auto !important;
    margin: 0 !important;
  }
  #purchaseUiWorkspace .pp-detail-card {
    min-height: 0 !important;
  }
  #purchaseUiWorkspace .pp-detail-card > .pp-card-head {
    height: auto !important;
    min-height: 40px !important;
    flex: 0 0 auto !important;
    padding-block: 4px !important;
  }
  #purchaseUiWorkspace .pp-detail-card > .pp-card-body {
    display: block !important;
    flex: 0 0 auto !important;
    min-height: 0 !important;
    padding: 0 12px 10px !important;
  }
  #purchaseUiWorkspace .pp-detail-scroll {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: clamp(192px, 34dvh, 360px) !important;
    overflow: auto !important;
    overscroll-behavior: auto !important;
    scroll-padding-block: 36px;
    scrollbar-width: thin !important;
  }
  #purchaseUiWorkspace .pp-detail-scroll:focus-visible {
    outline: 2px solid #0866cc;
    outline-offset: 1px;
  }
  #purchaseUiWorkspace .pp-detail-table {
    display: table !important;
    width: 100% !important;
    min-width: 940px !important;
    height: auto !important;
    min-height: 0 !important;
    table-layout: fixed !important;
    border-spacing: 0 !important;
  }
  #purchaseUiWorkspace.pp-document-readonly .pp-detail-table {
    min-width: 855px !important;
  }
  #purchaseUiWorkspace .pp-detail-table thead {display: table-header-group !important}
  #purchaseUiWorkspace .pp-detail-table tbody {
    display: table-row-group !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  #purchaseUiWorkspace .pp-detail-table tbody::after {
    content: none !important;
    display: none !important;
  }
  #purchaseUiWorkspace .pp-detail-table tfoot {display: table-footer-group !important}
  #purchaseUiWorkspace .pp-detail-table :is(thead, tbody, tfoot) > tr {
    display: table-row !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }
  #purchaseUiWorkspace .pp-detail-table :is(th, td) {
    position: static !important;
    width: auto !important;
    height: 37px !important;
    min-height: 0 !important;
    padding: 3px 7px !important;
    vertical-align: middle !important;
    font-family: inherit !important;
    font-size: 13px !important;
    line-height: 18px !important;
  }
  #purchaseUiWorkspace .pp-detail-table thead th {
    position: sticky !important;
    inset: 0 auto auto !important;
    z-index: 3 !important;
    height: 36px !important;
    background: #eaf3fc !important;
    text-align: center !important;
  }
  #purchaseUiWorkspace .pp-detail-table thead th:nth-child(1) {width: 32px !important}
  #purchaseUiWorkspace .pp-detail-table thead th:nth-child(2) {width: 44px !important}
  #purchaseUiWorkspace .pp-detail-table thead th:nth-child(3) {width: 20% !important}
  #purchaseUiWorkspace .pp-detail-table thead th:nth-child(5) {width: 110px !important}
  #purchaseUiWorkspace .pp-detail-table thead th:nth-child(6) {width: 92px !important}
  #purchaseUiWorkspace .pp-detail-table thead th:nth-child(7) {width: 104px !important}
  #purchaseUiWorkspace .pp-detail-table thead th:nth-child(8) {width: 170px !important}
  #purchaseUiWorkspace .pp-detail-table thead th:nth-child(9) {width: 67px !important}
  #purchaseUiWorkspace .pp-detail-table .pur-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap !important;
  }
  #purchaseUiWorkspace .pp-detail-table .product-model-entry {
    align-items: center;
  }
  #purchaseUiWorkspace .pp-detail-table input:not([type="checkbox"]) {
    height: 29px !important;
    min-height: 29px !important;
    font-family: inherit !important;
    font-size: 13px !important;
    line-height: 19px !important;
  }
  #purchaseUiWorkspace .pp-detail-table input[type="checkbox"] {
    vertical-align: middle;
    margin: 0;
  }
  #purchaseUiWorkspace .pp-detail-table :is(.pur-tax-total, tfoot td) {
    font-variant-numeric: tabular-nums;
  }
  #purchaseUiWorkspace .pp-detail-table tfoot td {
    position: sticky !important;
    inset: auto auto 0 !important;
    z-index: 2 !important;
    height: 36px !important;
    background: #e9f3ff !important;
    color: #164377 !important;
    text-align: right !important;
  }
  #purchaseUiWorkspace .pp-detail-table tfoot td:nth-child(2) {
    text-align: left !important;
  }
  #purchaseUiWorkspace :is(.ba-summary-card, .bb-summary-card, .ba-order-attachments, .bb-order-attachments) {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  #purchaseUiWorkspace :is(.ba-summary-card, .bb-summary-card, .ba-order-attachments, .bb-order-attachments) .pp-card-head {
    height: auto !important;
    min-height: 38px !important;
    padding-block: 5px !important;
  }
  #purchaseUiWorkspace .pp-money-summary {
    gap: 8px !important;
    margin: 0 !important;
    padding: 0 12px 10px !important;
  }
  #purchaseUiWorkspace .pp-money-summary > div {
    min-width: 0;
    padding: 7px 10px !important;
    background: #f8fbff !important;
    border-radius: 6px !important;
  }
  #purchaseUiWorkspace .pp-money-summary span {
    color: #496789 !important;
    line-height: 17px;
  }
  #purchaseUiWorkspace .pp-money-summary strong {
    margin-top: 2px !important;
    font-size: 17px !important;
    line-height: 22px !important;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
  }
  #purchaseUiWorkspace :is(.ba-order-attachments, .bb-order-attachments) .pp-card-body {
    padding: 0 12px 10px !important;
  }
  #purchaseUiWorkspace :is(.ba-order-attachments, .bb-order-attachments) .unified-attachment-box {
    margin: 0 !important;
    padding: 8px 10px !important;
  }
}

/* The production lists and forms use the purchase workspace's layout. */
@layer production-documents {
  .batch2-outsource-page > .production-query-panel {
    padding: 14px 16px !important;
    margin: 0 0 12px !important;
    overflow: visible !important;
  }
  .production-query-panel h3 {
    margin: 0 0 12px !important;
    color: #213b5b;
    font-size: 16px;
  }
  .production-query-grid {
    display: grid;
    align-items: end;
    gap: 12px;
  }
  .production-document-query {
    grid-template-columns: minmax(260px, 1.5fr) minmax(150px, 1fr) minmax(170px, 1.15fr) auto;
  }
  .production-processor-query {
    grid-template-columns: minmax(160px, 1fr) minmax(180px, 2fr) auto;
  }
  .production-query-field {
    display: grid !important;
    gap: 5px;
    margin: 0 !important;
    min-width: 0;
    color: #415c7a;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
  }
  .production-query-dates {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 6px;
    align-items: center;
  }
  .production-query-grid :is(input, select, button) {
    box-sizing: border-box;
    height: 36px !important;
    min-height: 36px !important;
    margin: 0 !important;
    font: inherit;
  }
  .production-query-grid :is(input, select) {
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 9px !important;
  }
  .production-query-actions {
    display: flex;
    gap: 8px;
    white-space: nowrap;
  }
  #outsourceIssuePanel .production-issue-link {
    color: #0874f4 !important;
    font-size: inherit !important;
    font-weight: 650;
  }
  #purchaseUiWorkspace.pp-production-workspace {
    --pp-bg: #f0f8fd;
    --pp-line: #d7e6f6;
  }
  #purchaseUiWorkspace.pp-production-workspace :is(.pp-work-head, .pp-work-footer) {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 52px;
    padding: 8px 16px !important;
    flex-wrap: wrap;
  }
  #purchaseUiWorkspace.pp-production-workspace .pp-work-head {
    background: var(--pp-bg);
  }
  .pp-production-workspace .pp-work-head h2,
  .pp-production-workspace .pp-card-head h3 {
    color: #193859 !important;
  }
  .pp-production-workspace .pp-work-head .pp-status {
    margin-left: 0 !important;
  }
  #purchaseUiWorkspace.pp-production-workspace .pp-work-scroll {
    flex: 1 1 0 !important;
    display: block !important;
    min-height: 0 !important;
    overflow: auto !important;
    padding: 12px 16px !important;
  }
  #purchaseUiWorkspace.pp-production-workspace .pp-work-footer > :first-child {
    margin-right: auto;
  }
  .pp-production-workspace .pp-editor-card {
    border-radius: 12px;
  }
  .pp-production-workspace .production-workspace-fields {
    gap: 9px 20px;
  }
  .production-workspace-fields label {
    display: grid !important;
    grid-template-columns: 10.5rem minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    min-width: 0;
    margin: 0 !important;
    color: #345273;
    font-size: 13px;
  }
  .production-workspace-fields label > span {
    line-height: 1.4;
  }
  .production-workspace-fields label > span b {
    color: #bb3039;
  }
  .pp-production-workspace .production-workspace-fields :is(input, select, output),
  .pp-production-workspace .production-workspace-table input:not([type="radio"]) {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 6px 9px;
    border: 1px solid #cbdcf0;
    border-radius: 6px;
    background: #fff;
    color: #345273;
    font: inherit;
  }
  .production-workspace-fields output {
    display: block;
    overflow-wrap: anywhere;
  }
  .production-quantity-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(70px, .45fr);
    gap: 6px;
  }
  .production-doc-number, .production-unit-note {
    color: #536e89;
    font-size: 13px;
  }
  .production-unit-note {
    margin: 8px 12px;
    line-height: 1.45;
  }
  .pp-production-workspace .production-workspace-table {
    width: 100% !important;
    min-width: 660px !important;
    margin: 0 !important;
  }
  .pp-production-workspace .production-accounts-table {
    min-width: 740px !important;
  }
  .pp-production-workspace .production-workspace-table :is(td, th) {
    padding: 6px 8px !important;
    vertical-align: middle !important;
  }
  .pp-production-workspace .production-workspace-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #e9f2fc !important;
  }
  .pp-production-workspace .production-workspace-table tfoot td {
    color: #174c82;
    background: #e9f2fc !important;
    font-weight: 700;
  }
  .production-workspace-table .product-model-entry {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }
  .production-issue-table :is(th,td).num {
    text-align: right !important;
  }
  .production-issue-table :is(th,td):nth-child(3),
  .production-issue-table :is(th,td):nth-child(4) {
    width: 19%;
  }
  @media (max-width: 1100px) {
    .production-document-query { grid-template-columns: minmax(260px, 1.25fr) minmax(0, 1fr); }
    .production-workspace-fields label { grid-template-columns: 1fr; gap: 4px; }
  }
  @media (max-width: 700px) {
    .production-query-grid,
    .pp-production-workspace .production-workspace-fields {
      grid-template-columns: minmax(0, 1fr);
    }
    .pp-production-workspace .pp-card-head { gap: 6px; flex-wrap: wrap; }
  }
  .production-query-field .searchable-filter-wrap {
    grid-template-columns: minmax(0, 1fr) auto !important;
    min-width: 0 !important;
  }
  .production-query-field .searchable-filter-wrap > .mini-btn {
    width: auto !important;
    min-width: 48px !important;
  }
  .production-query-field .filter-suggest-menu {
    top: 38px;
  }
}

@layer production-documents {
  .pp-production-workspace .production-return-table { min-width: 890px !important; }
  .pp-production-workspace:has(.production-return-table) .production-workspace-fields label { grid-template-columns: 12rem minmax(0,1fr); }
  @media(max-width:1100px) {
    .pp-production-workspace:has(.production-return-table) .production-workspace-fields label { grid-template-columns: minmax(0,1fr); }
  }
  .production-return-table th.num,
  .production-return-table td.num { text-align: right !important; }
  .production-return-table .osr-priceunit { width: 100%; min-width: 65px; }
  .pp-return-material label small { display: block; font-weight: 400; }
  .pp-return-suggestion { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; color: #345273; }
  .pp-return-suggestion small { color: #536e89; }
  .pp-return-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
  @media(max-width:700px) { .pp-return-summary { grid-template-columns: repeat(2,minmax(0,1fr)); } }
  .pp-return-summary > div { min-width: 0; padding: 8px 11px; border: 1px solid #d6e5f8; border-radius: 7px; background: #f6faff; }
  .pp-return-summary span { display: block; margin-bottom: 3px; color: #536e89; }
  .pp-return-summary strong { font-size: 16px; color: #174c82; }
}

@layer document-draft-tabs {
  #workspaceTabs:has([data-document-draft-tab]) {
    display: flex !important;
    overflow-x: auto !important;
    scrollbar-width: thin;
  }
  #workspaceTabs [data-document-draft-tab] { flex: 0 0 auto; }
  main:has(.document-draft-modal-host > .document-draft-dialog),
  main:has(#salesEditorWorkspace .document-draft-dialog) { overflow: hidden !important; }
  main:has(.document-draft-modal-host > .document-draft-dialog) > .page.active,
  main:has(#salesEditorWorkspace .document-draft-dialog) > .page.active { display: none !important; }
  .document-draft-modal-host {
    height: calc(100dvh - 90px);
    min-height: 0;
  }
  .document-draft-modal-host:empty { display: none; }
  #modal.document-draft-dialog:not(.hidden) {
    position: relative !important;
    inset: auto !important;
    height: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    background: none !important;
    display: flex !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    z-index: auto !important;
    backdrop-filter: none !important;
  }
  .document-draft-modal-host #modal.document-draft-dialog .modal-card {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: none !important;
  }
  .document-draft-modal-host #modalBody {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: auto !important;
  }
  @media(max-width:768px) {
    #workspaceTabs:has([data-document-draft-tab]) { min-height: 34px !important; }
    .document-draft-modal-host { height: calc(100dvh - 150px); }
  }
}

@layer production-documents {
  .production-report-query {
    grid-template-columns: minmax(260px,1.4fr) minmax(145px,.85fr) minmax(180px,1.1fr) auto;
  }
  .production-query-field > label {
    margin: 0 !important;
    color: inherit !important;
    font: inherit !important;
  }
  .production-query-field select[hidden],
  .production-combo-options[hidden] { display: none !important; }
  .production-combo-control { position: relative; min-width: 0; }
  .production-combo-control > input {
    padding-inline-end: 36px !important;
    border: 1px solid #c9d9ed;
    border-radius: 6px;
    color: #345273;
    background: #fff;
  }
  .production-combo-control > .production-combo-toggle {
    position: absolute;
    top: 0;
    right: 1px;
    width: 34px !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #41678e !important;
    box-shadow: none !important;
  }
  .production-combo-options {
    position: absolute;
    inset: calc(100% + 4px) 0 auto;
    z-index: 30;
    max-height: min(244px,42vh);
    overflow: auto;
    padding: 4px;
    border: 1px solid #cfdef0;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 6px 16px rgb(22 55 92 / 14%);
  }
  .production-combo-options > :is(button,span) {
    display: block;
    width: 100%;
    min-height: 30px !important;
    height: auto !important;
    padding: 5px 8px !important;
    border: 0 !important;
    border-radius: 4px;
    color: #314e70 !important;
    background: #fff !important;
    text-align: left !important;
    line-height: 1.4;
    font-weight: 500;
    box-shadow: none !important;
  }
  .production-combo-options > button:is(:hover,.is-highlighted,[aria-selected="true"]) {
    background: #e8f3ff !important;
    color: #0869d9 !important;
  }
  #erpInProcess .production-wip-scroll {
    overflow-x: auto !important;
    margin-inline: 12px !important;
  }
  #erpInProcess .production-wip-scroll table { min-width: 1010px !important; }
  #erpInProcess .production-wip-scroll :is(th,td):first-child { padding-inline-start: 9px !important; }
  #erpInProcess .production-wip-scroll :is(th,td):last-child { text-align: right !important; }
  #erpInProcess .production-wip-scroll td:nth-child(2) { white-space: normal !important; min-width: 130px; }
  .production-issue-link {
    color: #0874f4 !important;
    font-size: inherit !important;
    font-weight: 650;
  }
  .production-doc-nowrap { white-space: nowrap !important; }
  .pp-production-workspace .production-wip-source { min-width: 940px !important; }
  #purchaseUiWorkspace .production-wip-source-scroll { max-height: clamp(225px,48dvh,510px) !important; }
  .pp-production-workspace .production-workspace-table :is(.production-line-no,.production-row-actions) { text-align: center !important; }
  .production-line-no { width: 48px; font-variant-numeric: tabular-nums; }
  .production-row-actions { width: 60px; }
  .pp-production-workspace :is(.production-issue-table,.production-return-table) th:not(.num) {
    text-align: center !important;
  }
  .pp-production-workspace :is(.production-issue-table,.production-return-table) td {
    border-inline-end: 1px solid #e1ecf8;
    font-variant-numeric: tabular-nums;
  }
  .pp-production-workspace :is(.production-issue-table,.production-return-table) input[type=number] {
    text-align: right !important;
  }
  .pp-production-workspace :is(.production-issue-table,.production-return-table) .qty-unit {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) minmax(2.2em,auto);
    align-items: center;
    gap: 6px;
    margin: 0;
  }
  .production-workspace-table .qty-unit span {
    color: #5b738e;
    white-space: nowrap;
  }
  .pp-production-workspace .production-workspace-table .os-model {
    font-weight: 600;
    color: #0869d9;
  }
  .pp-production-workspace .production-workspace-table tfoot td {
    position: sticky;
    bottom: 0;
    color: #174c82 !important;
  }
  .pp-production-attachments .unified-attachment-name b {
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  @media(max-width:1100px) {
    .production-report-query { grid-template-columns: repeat(2,minmax(0,1fr)); }
  }
  @media(max-width:700px) {
    .production-report-query { grid-template-columns: minmax(0,1fr); }
  }
}

/* Personnel tabs and employee workspace. */
#employees {
  --hr-blue: #0874f4;
  --hr-ink: #193859;
  --hr-label: #486483;
  --hr-border: #d7e6f6;
  --hr-bg: #f1f7fc;
  --pp-line: var(--hr-border);
  --pp-bg: var(--hr-bg);
}
#employees [hidden] { display: none !important; }
#employees .hr-overview, #employees .hr-profile { min-width: 0; }
#employees .hr-page-head, #employees .hr-tab-panel > .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}
#employees .hr-page-head { margin-bottom: 12px; }
#employees .hr-page-head h2 {
  margin: 0;
  color: var(--hr-ink);
  font-size: 24px;
  line-height: 1.25;
}
#employees .hr-tabs {
  display: flex;
  align-items: stretch;
  gap: 6px;
  overflow-x: auto;
  padding: 0 8px;
  background: #fff;
  border: 1px solid var(--hr-border);
  border-radius: 8px 8px 0 0;
}
#employees .hr-tabs button {
  flex: 0 0 auto;
  min-height: 40px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--hr-label);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: none;
}
#employees .hr-tabs button[aria-selected="true"] {
  border-bottom-color: var(--hr-blue);
  color: var(--hr-blue);
}
#employees .hr-tabs button:focus-visible { outline-offset: -4px; }
#employees .hr-tab-panel {
  min-width: 0;
  margin: 12px 0 0 !important;
  padding: 0 !important;
  border: 1px solid var(--hr-border) !important;
  background: #fff;
}
#employees .hr-tab-panel > .panel-head {
  margin: 0 !important;
  padding: 9px 14px !important;
  border-bottom: 1px solid var(--hr-border);
}
#employees .hr-tab-panel .panel-head :is(h3,p) { margin: 0; }
#employees .hr-tab-panel .panel-head p { color: var(--hr-label); }
#employees .hr-reminder-form { padding: 14px; }
#employees .hr-reminder-form label {
  display: grid;
  gap: 5px;
  width: min(15rem, 100%);
  color: var(--hr-label);
}
#employees .hr-reminder-form p { color: var(--hr-label); }
#employees .hr-table-scroll {
  min-width: 0;
  margin: 0 !important;
  overflow: auto !important;
}
#employees .hr-table-scroll table {
  width: 100% !important;
  min-width: 670px;
  margin: 0 !important;
  border-collapse: separate;
  border-spacing: 0;
}
#employees .hr-table-scroll th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eaf2fb !important;
  color: var(--hr-label) !important;
}
#employees .hr-table-scroll :is(th,td) {
  padding: 7px 10px !important;
  vertical-align: middle !important;
}
#employees .hr-table-scroll td { overflow-wrap: anywhere; }
#employees .hr-table-scroll td:last-child { position: static !important; }
#employees .hr-link {
  height: auto !important;
  min-height: 26px !important;
  padding: 2px 3px !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--hr-blue) !important;
  font: inherit;
  font-weight: 650;
  box-shadow: none !important;
}
#employees .hr-link:hover { text-decoration: underline; }
#employees .hr-danger { color: #b7232d !important; }
#employees .hr-profile {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--hr-profile-top, 114px));
  min-height: 0;
  overflow: hidden;
  background: var(--hr-bg);
  border: 1px solid var(--hr-border);
  border-radius: 10px;
}
#employees .hr-profile-head, #employees .hr-profile-footer {
  flex: 0 0 auto !important;
  flex-wrap: wrap;
  height: auto !important;
  min-height: 50px;
  padding: 8px 14px !important;
}
#employees .hr-profile-head h2 { margin: 0; color: var(--hr-ink); font-size: 20px; }
#employees .hr-profile-head .pp-back { flex: 0 0 34px; }
#employees .hr-profile-scroll {
  min-height: 0;
  padding: 10px 12px !important;
  overflow: auto !important;
}
#employees .hr-profile-footer > :first-child { margin-right: auto; }
#employees .pp-editor-card { margin-bottom: 10px; border-radius: 8px; }
#employees .pp-editor-card:last-child { margin-bottom: 0; }
#employees .pp-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  height: auto;
  min-height: 42px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--hr-border);
}
#employees .pp-card-head h3 { color: var(--hr-ink); font-size: 15px; margin: 0; }
#employees .pp-card-body { padding: 10px 12px; }
#employees .hr-info-grid, #employees .hr-fields {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px 20px;
  margin: 0;
}
#employees :is(.hr-info-grid > div,.hr-fields label) {
  display: grid;
  grid-template-columns: minmax(90px,7em) minmax(0,1fr);
  align-items: center;
  gap: 6px 12px;
  min-width: 0;
  margin: 0;
  color: var(--hr-label);
  font-size: 13px;
  font-weight: 600;
}
#employees :is(.hr-info-grid,.hr-fields) .hr-wide-field { grid-column: 1/-1; }
#employees .hr-info-grid dd {
  margin: 0;
  padding: 6px 9px;
  background: #f5f9fe;
  border: 1px solid #e6eef7;
  border-radius: 5px;
  color: var(--hr-ink);
  font-weight: 500;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
#employees .hr-fields :is(input,select) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 34px !important;
  height: 34px !important;
  margin: 0;
  padding: 0 8px;
}
#employees .hr-actions, #employees .hr-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}
#employees .hr-row-actions { flex-wrap: nowrap; }
#employees .hr-inline-editor {
  padding: 10px 12px;
  background: #f5f9fe;
  border-top: 1px solid var(--hr-border);
}
#employees .hr-inline-editor h4 { margin: 0 0 9px; color: var(--hr-ink); }
#employees .hr-inline-editor > .hr-actions { margin-top: 10px; }
#employees .hr-load-status { margin: 0; padding: 10px 12px; color: var(--hr-label); }
@media (min-width: 769px) {
  #employees .hr-tab-panel .hr-table-scroll { max-height: calc(100dvh - 245px); }
  #employees .hr-profile { min-height: 300px; }
}
@media (max-width: 768px) {
  #employees .hr-table-scroll table { display: table !important; }
  #employees .hr-table-scroll thead { display: table-header-group !important; }
  #employees .hr-table-scroll tbody { display: table-row-group !important; }
  #employees .hr-table-scroll tr { display: table-row !important; }
  #employees .hr-table-scroll :is(th,td) { display: table-cell !important; }
  #employees .hr-table-scroll td::before { display: none !important; }
  #employees .hr-profile { height: auto; overflow: visible; }
  #employees .hr-profile-scroll { overflow: visible !important; }
  #employees .hr-profile-footer { position: sticky; bottom: 66px; z-index: 3; }
  #employees .hr-info-grid, #employees .hr-fields { grid-template-columns: minmax(0,1fr); }
}
