/* Shared entry row layout. Calculations, fields and submission stay in their existing forms. */
@media screen {
 body .erp-entry-row-scroll{display:block;max-width:100%;min-width:0;overflow-x:auto;overscroll-behavior-x:contain}
 body :is(#workspace,dialog) table.erp-entry-row-table{display:table!important;width:100%!important;min-width:var(--erp-entry-min-width,720px)!important;table-layout:fixed!important;border-collapse:collapse}
 body :is(#workspace,dialog) table.erp-entry-row-table thead{display:table-header-group!important}
 body :is(#workspace,dialog) table.erp-entry-row-table tbody{display:table-row-group!important}
 body :is(#workspace,dialog) table.erp-entry-row-table tfoot{display:table-footer-group!important}
 body :is(#workspace,dialog) table.erp-entry-row-table tr{display:table-row!important}
 body :is(#workspace,dialog) table.erp-entry-row-table :is(th,td){display:table-cell!important;position:static!important;width:auto!important;max-width:none!important;min-width:0!important;padding:5px 7px!important;vertical-align:top!important;white-space:nowrap!important;word-break:normal!important;overflow-wrap:normal!important}
 body :is(#workspace,dialog) table.erp-entry-row-table td:before{display:none!important}
 body :is(#workspace,dialog) table.erp-entry-row-table th{white-space:normal!important}
 body :is(#workspace,dialog) table.erp-entry-row-table :is(th,td):first-child{width:22%!important}
 body :is(#workspace,dialog) table.erp-entry-row-table :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea){box-sizing:border-box;min-width:85px!important;max-width:100%!important;width:100%!important;margin:0!important;font-size:14px!important;min-height:34px!important;padding:5px 7px!important}
 body :is(#workspace,dialog) table.erp-entry-row-table td:first-child:has(input){min-width:190px!important}
 body :is(#workspace,dialog) table.erp-entry-row-table button{white-space:nowrap!important;margin:2px 0!important}
 body :is(#workspace,dialog) table.erp-entry-row-table .jw-create{display:block!important}
 body :is(#workspace,dialog) table.erp-entry-row-table .erp-combobox-native{display:none!important}
 body .erp-entry-row-scroll[hidden],body :is(#workspace,dialog) table.erp-entry-row-table[hidden],body :is(#workspace,dialog) table.erp-entry-row-table [hidden]{display:none!important}
}
@media screen and (max-width:700px){
 body :is(#workspace,dialog) table.erp-entry-row-table :is(input:not([type=checkbox]):not([type=radio]),select,textarea){font-size:16px!important;min-height:40px!important}
 body :is(#workspace,dialog) table.erp-entry-row-table button{min-height:40px!important}
}

/* Own order: common fields above one horizontal row per garment. */
.compact-own-entry .jw-grid{display:grid!important;grid-template-columns:1fr 1fr 1fr 1.4fr;gap:10px!important;align-items:start}
.compact-own-entry [data-company-note]{display:none}
.compact-own-entry label{font-size:13px!important;margin:0!important;min-width:0}
.compact-own-entry :is(input,select,textarea){box-sizing:border-box;width:100%;min-width:0!important;min-height:34px!important;font-size:14px!important;padding:6px!important;margin:3px 0!important}
.compact-own-entry .order-entry-lines{overflow-x:auto}
.compact-own-entry .order-entry-line{display:grid!important;grid-template-columns:minmax(190px,2fr) 100px 65px 75px 70px 85px 100px 65px;gap:8px!important;align-items:end!important;min-width:880px;padding:8px 0!important}
.compact-own-entry .order-entry-itemName{display:none!important}
.compact-own-entry [data-saved-colour]{display:none!important}
.compact-own-entry [data-variant-status]{grid-column:1/-1}
.compact-own-entry [data-variant-status]:empty{display:none}
.compact-own-entry button{font-size:13px!important;padding:7px 10px!important;min-height:34px!important;margin:4px 0!important}
.compact-own-entry .own-entry-extra{margin-top:12px;border-top:1px solid #ddd;padding-top:10px}
.compact-own-entry .own-extra-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding:14px 0}
.compact-own-entry h3{font-size:16px;margin:12px 0 4px}
.compact-own-entry [data-total]{display:inline-block;margin:8px 18px}
@media(max-width:700px){.compact-own-entry .jw-grid{grid-template-columns:1fr 1fr}.compact-own-entry .own-extra-fields{grid-template-columns:1fr}}
/* Shared compact dimensions for Size / Qty; values and calculations unchanged. */
@media screen {
 body :is(input,select).erp-short-size{width:68px!important;min-width:0!important;max-width:100%!important;box-sizing:border-box;padding-left:5px!important;padding-right:5px!important}
 body :is(input,select).erp-short-qty{width:80px!important;min-width:0!important;max-width:100%!important;box-sizing:border-box;padding-left:5px!important;padding-right:5px!important}
 body .erp-short-field{min-width:0!important}
 body :is(#workspace,dialog) table.erp-entry-row-table :is(th,td).erp-short-cell-size{width:68px!important;min-width:0!important}
 body :is(#workspace,dialog) table.erp-entry-row-table :is(th,td).erp-short-cell-qty{width:80px!important;min-width:0!important}
 body :is(#workspace,dialog) table.erp-entry-row-table .erp-short-cell-size :is(input,select){min-width:0!important;width:100%!important}
 body :is(#workspace,dialog) table.erp-entry-row-table .erp-short-cell-qty :is(input,select){min-width:0!important;width:100%!important}
 #order-entry-view .compact-own-entry .order-entry-line{grid-template-columns:minmax(200px,1fr) 100px 68px 80px 80px 90px 100px 65px!important;min-width:880px;gap:8px!important}
 #order-entry-view .compact-own-entry .order-entry-line>*{grid-column:auto!important}
 #order-entry-view .compact-own-entry .order-entry-line [data-variant-status]:not(:empty){grid-column:1/-1!important}
}

/* Shared screen-only entry density. Preserve field values, responsive tables and print layouts. */
@media screen {
 html body :is(main,#workspace,dialog) :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=color]):not([type=image]):not([type=button]):not([type=submit]):not([type=reset]),select:not(.erp-combobox-native):not([multiple]):not([size])):not([hidden]) {
  box-sizing:border-box!important;min-width:0!important;max-width:var(--erp-field-max-width,100%)!important;
  height:32px!important;min-height:32px!important;padding:4px 7px!important;margin:2px 0!important;
  font-size:14px!important;line-height:20px!important;border-radius:5px!important;
 }
 html body :is(main,#workspace,dialog) input[type=number]:not([hidden]){--erp-field-max-width:120px;width:100%!important;max-width:120px!important;flex-shrink:1!important}
 html body :is(main,#workspace,dialog) textarea{box-sizing:border-box;max-width:100%;padding:6px 8px!important;font-size:14px!important;line-height:1.4;resize:vertical}
 html body :is(main,#workspace,dialog) label:has(> :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea)){gap:4px!important;line-height:1.3}
 html body :is(main,#workspace,dialog) :is(td,th):has(> :is(input:not([type=checkbox]):not([type=radio]),select,textarea)){padding-top:3px!important;padding-bottom:3px!important}
 html body :is(main,#workspace,dialog) :is(form,[data-matrix-editor],[data-invoice-screen]) button{min-height:32px;padding:5px 10px;font-size:14px}
 html body :is(main,#workspace,dialog) [data-matrix-editor] table.matrix-table{width:100%!important;max-width:1100px;min-width:620px;table-layout:fixed!important}
 html body :is(main,#workspace,dialog) [data-matrix-editor] table.matrix-table th:first-child{width:140px}
 html body :is(main,#workspace,dialog) [data-matrix-editor] table.matrix-table thead th:nth-child(2){width:60px}
 html body :is(main,#workspace,dialog) [data-matrix-editor] table.matrix-table thead th:last-child{width:80px}
 html body :is(main,#workspace,dialog) [data-matrix-editor] input[data-matrix-cell]{--erp-field-max-width:96px;max-width:96px!important;margin:0!important}
}
@media screen and (max-width:700px), screen and (pointer:coarse) {
 html body :is(main,#workspace,dialog) :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=color]):not([type=image]):not([type=button]):not([type=submit]):not([type=reset]),select:not(.erp-combobox-native):not([multiple]):not([size])):not([hidden]){height:40px!important;min-height:40px!important;font-size:16px!important;padding:7px!important;line-height:24px!important}
 html body :is(main,#workspace,dialog) textarea{font-size:16px!important}
 html body :is(main,#workspace,dialog) :is(form,[data-matrix-editor],[data-invoice-screen]) button{min-height:40px}
}

/* DC external styles required by CSP. */

.dc-choice-field{display:flex;position:relative;width:100%;min-width:0}.dc-keyboard-form table.dc-line-table .dc-choice-field input{padding-right:30px!important}.dc-keyboard-form .dc-choice-field .dc-choice-arrow{position:absolute;right:1px;top:1px;bottom:1px;width:28px!important;min-width:0!important;margin:0!important;padding:0!important;min-height:0!important;background:#e6efd2;color:#173c2c;border:0;font-size:18px!important}.dc-rate-status{display:block;white-space:normal;font-size:12px;line-height:1.3;margin-top:4px}

.dc-keyboard-form .delivery-card-wrap{overflow-x:auto;width:100%}
.dc-keyboard-form table.dc-line-table{display:table!important;width:100%!important;min-width:850px!important;table-layout:fixed!important;border-collapse:collapse}
.dc-keyboard-form table.dc-line-table thead{display:table-header-group!important}.dc-keyboard-form table.dc-line-table tbody{display:table-row-group!important}
.dc-keyboard-form table.dc-line-table tr{display:table-row!important}.dc-keyboard-form table.dc-line-table th,.dc-keyboard-form table.dc-line-table td{display:table-cell!important;padding:6px 4px!important;min-width:0!important;border-bottom:1px solid #cbd5c8!important;vertical-align:top;white-space:normal!important}
.dc-keyboard-form table.dc-line-table td::before{display:none!important}.dc-keyboard-form table.dc-line-table th:first-child{width:26%}.dc-keyboard-form table.dc-line-table th:nth-child(4){width:16%}.dc-keyboard-form table.dc-line-table th:last-child{width:32px}
.dc-keyboard-form table.dc-line-table input{width:100%!important;min-width:0!important;max-width:100%;box-sizing:border-box;padding:8px 5px!important;font-size:13px!important;margin:0!important}.dc-keyboard-form table.dc-line-table input[type=number]{appearance:textfield;text-align:right}.dc-keyboard-form input::-webkit-inner-spin-button{appearance:none}
.dc-keyboard-form table.dc-line-table select,.dc-keyboard-form .delivery-value{display:none!important}.dc-keyboard-form:not(.dc-show-mapping) .dc-line-table td:nth-child(5),.dc-keyboard-form:not(.dc-show-mapping) .dc-line-table th:nth-child(5){display:none!important}
.dc-keyboard-form table.dc-line-table [data-colour-editor][hidden]{display:none!important}.dc-keyboard-form [data-colour-editor]:not([hidden]){display:block}.dc-keyboard-form [data-new-colour]{display:block!important;float:none!important;clear:both;width:100%;max-width:100%;min-width:0;box-sizing:border-box;margin:6px 0 0;padding:7px 4px;font-size:13px;white-space:normal;line-height:1.2}.dc-keyboard-form table.dc-line-table [data-colour-editor]:not([hidden]){display:flex!important;flex-direction:column!important;position:static!important;float:none!important;clear:both;padding-top:6px;min-width:0;width:100%;max-width:100%;box-sizing:border-box;gap:4px}.dc-keyboard-form [data-save-colour],.dc-keyboard-form [data-cancel-colour]{display:block;width:100%;min-width:0;max-width:100%;box-sizing:border-box;margin:5px 0;padding:7px 4px;font-size:13px;white-space:normal}.dc-keyboard-form [data-remove]{padding:6px;font-size:20px;background:transparent;color:#344a3b}.dc-keyboard-form [data-dc-amount]{text-align:right;white-space:nowrap!important;font-variant-numeric:tabular-nums}
.dc-keyboard-form input:focus{outline:2px solid #315c38!important;background:#f3f8df!important}.dc-entry-choices{position:fixed;z-index:2147483647;overflow:auto;background:#fff;color:#173c2c;border:1px solid #66826b;box-shadow:0 5px 18px #0003;border-radius:4px}.dc-entry-choices button{font-size:16px;min-height:42px;line-height:1.35;display:block;width:100%;text-align:left;border:0;border-radius:0;background:#fff;color:#173c2c;padding:9px 12px;margin:0;white-space:normal}.dc-entry-choices button[aria-selected=true]{background:#e6efd2;color:#173c2c}.dc-entry-status{font-size:13px}
.dc-keyboard-form{display:block!important;min-width:0}
.dc-keyboard-form .dc-compact-header{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px 12px}
.dc-keyboard-form .dc-compact-header label,.dc-keyboard-form .dc-extra-grid label{display:flex!important;flex-direction:column;min-width:0;margin:0!important;font-size:12px!important;gap:3px}
.dc-keyboard-form .dc-compact-header input,.dc-keyboard-form .dc-compact-header select,.dc-keyboard-form .dc-compact-header .searchable-select{width:100%!important;min-width:0!important;max-width:100%!important;margin:0!important;box-sizing:border-box}
.dc-keyboard-form .dc-compact-header input,.dc-keyboard-form .dc-compact-header select{padding:6px 8px!important;min-height:34px!important;font-size:14px!important}
.dc-keyboard-form [data-master-fields]{display:contents!important}
.dc-keyboard-form.dc-has-party-picker [data-master-fields]>label:first-child{display:none!important}
.dc-keyboard-form .dc-more{margin:8px 0!important;padding:6px 8px!important;font-size:13px}
.dc-keyboard-form .dc-extra-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;padding-top:8px}
.dc-keyboard-form .dc-extra-grid>details,.dc-keyboard-form [data-pending-order-picker]{grid-column:1/-1}
.dc-keyboard-form>p:empty,.dc-keyboard-form [data-number-status]{display:none}
.dc-keyboard-form>p{margin:4px 0!important;font-size:12px}
.dc-keyboard-form [data-add-top][hidden]{display:none!important}
.dc-keyboard-form .delivery-card-wrap{overflow:auto;max-height:43vh;min-height:145px}
.dc-keyboard-form table.dc-line-table{min-width:0!important}
.dc-keyboard-form table.dc-line-table th{position:sticky;top:0;background:#edf2e5;z-index:2;font-size:12px}
.dc-keyboard-form table.dc-line-table th:first-child{width:29%}
.dc-keyboard-form table.dc-line-table th:nth-child(2),.dc-keyboard-form table.dc-line-table th:nth-child(3){width:8%}
.dc-keyboard-form table.dc-line-table th:nth-child(4){width:14%}
.dc-keyboard-form table.dc-line-table th:nth-child(6),.dc-keyboard-form table.dc-line-table th:nth-child(8){width:7%}
.dc-keyboard-form table.dc-line-table th:nth-child(7),.dc-keyboard-form table.dc-line-table th:nth-child(9){width:10%}
.dc-keyboard-form table.dc-line-table th:last-child{width:28px}
.dc-keyboard-form table.dc-line-table [data-dc-input=product]{font-size:14px!important;font-weight:600}
.dc-keyboard-form [data-new-colour]{padding:2px!important;margin:3px 0 0!important;min-height:24px!important;font-size:11px!important}
.dc-keyboard-form .dc-save-bar{position:sticky;bottom:0;z-index:3;background:#f8faf3;border-top:1px solid #b6c4af;display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:8px 0}
.dc-keyboard-form .dc-save-bar button{margin:0!important;padding:8px 12px!important;min-height:36px!important;font-size:14px!important}
.dc-keyboard-form .dc-save-bar p{flex-basis:100%;margin:0;font-size:12px}
.dc-keyboard-form .dc-save-bar p:empty{display:none}
@media(max-width:700px){
 .dc-keyboard-form .dc-compact-header,.dc-keyboard-form .dc-extra-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .dc-keyboard-form .dc-address{grid-column:1/-1}
 .dc-keyboard-form .delivery-card-wrap{max-height:48vh}
 .dc-keyboard-form table.dc-line-table,.dc-keyboard-form table.dc-line-table tbody{display:block!important}
 .dc-keyboard-form table.dc-line-table thead{display:none!important}
 .dc-keyboard-form table.dc-line-table tr{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;border:1px solid #b6c4af;padding:8px;margin-bottom:8px;border-radius:6px}
 .dc-keyboard-form table.dc-line-table td{display:block!important;padding:0!important;border:0!important;grid-column:span 2}
 .dc-keyboard-form table.dc-line-table td:first-child,.dc-keyboard-form table.dc-line-table td:nth-child(5){grid-column:1/-1}
 .dc-keyboard-form table.dc-line-table td:nth-child(2),.dc-keyboard-form table.dc-line-table td:nth-child(3){grid-column:span 1}
 .dc-keyboard-form table.dc-line-table td:last-child{grid-column:4;text-align:right}
 .dc-keyboard-form table.dc-line-table td::before{display:block!important;content:attr(data-label);font-size:11px;font-weight:600;margin-bottom:3px}
 .dc-keyboard-form:not(.dc-show-mapping) table.dc-line-table td:nth-child(5){display:none!important}
}
body #workspace .dc-keyboard-form table.dc-line-table input{width:100%!important;min-width:0!important;max-width:100%!important;min-height:34px!important;height:34px!important;box-sizing:border-box}
body #workspace .dc-keyboard-form table.dc-line-table td{max-width:none!important;width:auto!important}

/* Order review: one scroll area, persistent controls, lazy item choices. */
dialog.order-review-dialog[open]{display:flex;flex-direction:column;box-sizing:border-box;width:92vw!important;max-width:1400px!important;height:90vh;height:90dvh;max-height:90vh;max-height:90dvh;padding:0!important;overflow:hidden!important}
.order-review-dialog>.order-review-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 18px;border-bottom:1px solid #ced8cf;flex:none;background:white}
.order-review-dialog .order-review-header h2{margin:0;font-size:18px}
.order-review-dialog>form{display:flex;flex-direction:column;min-height:0;flex:1;overflow:hidden;margin:0}
.order-review-dialog .order-review-body{min-height:0;flex:1;overflow:auto;overscroll-behavior:contain;padding:16px 20px}
.order-review-dialog .order-review-footer{flex:none;background:white;border-top:1px solid #ced8cf;padding:10px 18px;text-align:left;margin:0;color:inherit}
.order-review-dialog .order-review-footer label{display:block;margin:0 0 8px}
.order-review-dialog .order-review-footer [data-error]:empty{display:none}
@media(max-width:600px){dialog.order-review-dialog[open]{width:96vw!important}.order-review-dialog .order-review-body{padding:10px}.order-review-dialog .order-review-header,.order-review-dialog .order-review-footer{padding:10px}.order-review-dialog .order-review-footer label{font-size:12px}}

/* Own-order fields fit the available workspace; set options have their own row. */
@media screen {
 #order-entry-view .compact-own-entry .order-entry-lines{overflow:visible;min-width:0}
 #order-entry-view .compact-own-entry .order-entry-line{min-width:0;max-width:100%;box-sizing:border-box;grid-template-columns:minmax(140px,2fr) minmax(100px,1.2fr) repeat(2,minmax(60px,.7fr)) repeat(2,minmax(65px,.8fr)) minmax(78px,.9fr) 65px!important;align-items:start!important;padding:10px!important}
 #order-entry-view .compact-own-entry .order-entry-line .order-entry-item{grid-column:auto!important}
 #order-entry-view .compact-own-entry .order-entry-line [data-set-choice]{grid-column:1/-1!important;display:flex!important;flex-direction:row!important;flex-wrap:wrap;align-items:center;gap:8px}
 #order-entry-view .compact-own-entry [data-set-choice] select{width:auto!important;max-width:100%;flex:1 1 180px;height:36px!important;min-height:36px!important}
 #order-entry-view .compact-own-entry .order-entry-line button{margin-top:20px!important;max-width:100%;white-space:normal}
 #order-entry-view .compact-own-entry .order-entry-line .order-entry-remove{grid-column:auto!important;justify-self:stretch}
 #order-entry-view .compact-own-entry .own-entry-extra summary{cursor:pointer;font-weight:600;padding:6px 0}
 #order-entry-view .compact-own-entry .order-entry-line :is(input,select){width:100%!important}
 @container(max-width:950px){
  #order-entry-view .compact-own-entry .order-entry-line{grid-template-columns:repeat(4,minmax(0,1fr))!important}
  #order-entry-view .compact-own-entry .order-entry-line .order-entry-item{grid-column:span 2!important}
  #order-entry-view .compact-own-entry .order-entry-line .order-entry-colour{grid-column:span 2!important}
  #order-entry-view .compact-own-entry .order-entry-line button{margin-top:0!important}
 }
 @media(max-width:950px){
  #order-entry-view .compact-own-entry .order-entry-line{grid-template-columns:repeat(4,minmax(0,1fr))!important}
  #order-entry-view .compact-own-entry .order-entry-line :is(.order-entry-item,.order-entry-colour){grid-column:span 2!important}
  #order-entry-view .compact-own-entry .order-entry-line button{margin-top:0!important}
 }
 @media(max-width:480px){
  #order-entry-view .compact-own-entry .order-entry-line{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  #order-entry-view .compact-own-entry .order-entry-line .order-entry-colour{grid-column:1/-1!important}
  #order-entry-view .compact-own-entry .order-entry-line :is(input,select,button){min-height:44px!important}
 }
}

[data-make-invoice] [data-manual-items]{max-height:40vh;overflow:auto;scroll-padding:8px}
[data-make-invoice] [data-manual-id]{margin:4px 0;padding:5px 8px;min-width:0}
[data-make-invoice] .invoice-item-row,[data-make-invoice]>.fields{display:grid;grid-template-columns: minmax(11em,2.4fr) repeat(6,minmax(0,1fr)) auto;gap:5px;align-items:end}
[data-make-invoice]>.fields{grid-template-columns:repeat(4,minmax(0,1fr))}
[data-make-invoice] .invoice-item-row label,[data-make-invoice]>.fields label{min-width:0;margin:0}
[data-make-invoice] .invoice-item-row :is(input,select),[data-make-invoice]>.fields :is(input,select){width:100%;min-width:0;box-sizing:border-box}
[data-make-invoice] [data-manual-id]>.invoice-description,[data-make-invoice] [data-direct-name]:not([hidden]){display:inline-block;width:min(46%,30rem);margin:2px 8px 2px 0}
[data-make-invoice] [hidden]{display:none!important}
@media(max-width:850px){[data-make-invoice] .invoice-item-row{grid-template-columns:repeat(4,minmax(0,1fr))}[data-make-invoice] .invoice-item-row label:first-child{grid-column:span 2}[data-make-invoice]>.fields{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:550px){[data-make-invoice] [data-manual-items]{max-height:52vh}[data-make-invoice] .invoice-item-row{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(min-width:851px){[data-make-invoice]>.fields{grid-template-columns:repeat(5,minmax(0,1fr))}}
[data-make-invoice] [data-manual-id]>label:has([data-item-use]),[data-make-invoice] [data-manual-id]>label:has([data-item-hsn]){width:min(30%,11rem)}
