#purchase-operation-header{display:grid;gap:16px;min-width:0}#purchase-operation-header[hidden]{display:none}#purchase-operation-header fieldset{margin:0;border:1px solid #ccd9de;border-radius:9px;padding:14px;min-width:0}#purchase-operation-header legend{font-weight:600}#purchase-operation-header .purchase-contact-row{grid-column:1/-1;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:0}#purchase-operation-header .commission-fields{grid-column:1/-1;margin:0}#purchase-operation-header label{min-width:0}#purchase-operation-header input,#purchase-operation-header select{width:100%;min-width:0}#purchase-layout-supplier #person-label,#purchase-layout-supplier #order-supplier-notes-label{grid-column:1/-1}#purchase-layout-notes label:has(#order-notes){grid-column:span 2}
.purchase-order-layout #purchase-operation-items .table-wrap{overflow:visible}.purchase-order-layout #purchase-operation-items table{display:block;min-width:0;width:100%}.purchase-order-layout #purchase-operation-items thead{display:none}.purchase-order-layout #purchase-operation-rows{display:grid;gap:14px}.purchase-order-layout #purchase-operation-rows tr{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;border:1px solid #ccd9de;border-radius:9px;padding:14px;background:var(--panel,#fff)}.purchase-order-layout #purchase-operation-items td{display:block;min-width:0;padding:0;border:0;white-space:normal}.purchase-order-layout #purchase-operation-items td:before{content:attr(data-purchase-label);display:block;font-weight:600;font-size:12px;margin-bottom:7px}.purchase-order-layout #purchase-operation-items td:first-child{grid-column:1/-1;font-weight:600;color:#2e5a6c}.purchase-order-layout #purchase-operation-items td:first-child:before{display:inline;content:'Item ';font-size:inherit}.purchase-order-layout #purchase-operation-items td:nth-child(3){grid-column:span 2}.purchase-order-layout #purchase-operation-items td:last-child{grid-column:span 2;display:flex;gap:8px;align-items:end;justify-content:flex-end;flex-wrap:wrap}.purchase-order-layout #purchase-operation-items td:last-child:before{display:none}.purchase-order-layout #purchase-operation-items tfoot{display:block;padding:16px;margin-top:14px;background:#eff5f5;border-radius:8px}.purchase-order-layout #purchase-operation-items tfoot tr{display:flex;justify-content:flex-end;gap:16px}.purchase-order-layout #purchase-operation-items tfoot td:before{display:none}.purchase-operation-item-head{display:flex;justify-content:flex-end;margin:4px 0 12px}
@media(max-width:1024px){#purchase-operation-header input,#purchase-operation-header select,.purchase-order-layout #purchase-operation-items input,.purchase-order-layout #purchase-operation-items select{font-size:16px;min-height:44px}#purchase-operation-header .purchase-contact-row{grid-template-columns:repeat(2,minmax(0,1fr))}.purchase-order-layout #purchase-operation-items button{min-height:44px;white-space:normal}}
@media(max-width:700px){#purchase-operation-header .po-item-fields{grid-template-columns:repeat(2,minmax(0,1fr))}#purchase-layout-notes label:has(#order-notes){grid-column:1/-1}.purchase-order-layout #purchase-operation-rows tr{grid-template-columns:repeat(2,minmax(0,1fr))}.purchase-order-layout #purchase-operation-items td:nth-child(3){grid-column:1/-1}}
@media(max-width:480px){#purchase-operation-header .po-item-fields,#purchase-operation-header .purchase-contact-row,.purchase-order-layout #purchase-operation-rows tr{grid-template-columns:minmax(0,1fr)}.purchase-order-layout #purchase-operation-items td:nth-child(3),.purchase-order-layout #purchase-operation-items td:last-child{grid-column:1/-1}.purchase-order-layout #purchase-operation-items td:last-child button{flex:1}.purchase-operation-item-head button{width:100%}}

#purchase-operation-header .po-payment-option{display:flex;flex-direction:row;align-items:center;gap:8px;min-height:36px}#purchase-operation-header .po-payment-option input{width:18px;min-width:18px;height:18px;min-height:18px;flex:none}#purchase-operation-header .purchase-conditions-hint{font-size:12px;color:#71809d;margin:0}@media(max-width:1024px){#purchase-operation-header .po-payment-option{min-height:44px}}
/* Match the purchase-order card: type/material, reference/unit/quantity, price/subtotal. */
.purchase-order-layout #purchase-operation-rows tr{grid-template-areas:'number number number' 'type material material' 'reference unit quantity' 'price total .' 'actions actions actions'}
.purchase-order-layout #purchase-operation-rows td:nth-child(1){grid-area:number}.purchase-order-layout #purchase-operation-rows td:nth-child(2){grid-area:reference}.purchase-order-layout #purchase-operation-rows td:nth-child(3){grid-area:material}.purchase-order-layout #purchase-operation-rows td:nth-child(4){grid-area:quantity}.purchase-order-layout #purchase-operation-rows td:nth-child(5){grid-area:unit}.purchase-order-layout #purchase-operation-rows td:nth-child(6){grid-area:price}.purchase-order-layout #purchase-operation-rows td:nth-child(7){grid-area:total}.purchase-order-layout #purchase-operation-rows td:nth-child(8){grid-area:actions;display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end}.purchase-order-layout #purchase-operation-rows td:nth-child(8):before{display:none}.purchase-order-layout #purchase-operation-rows td[data-purchase-type-cell]{grid-area:type;display:block}.purchase-order-layout #purchase-operation-rows td[data-purchase-type-cell]:before{display:block}.purchase-order-layout #purchase-operation-rows td:nth-child(7){padding-top:0}.purchase-order-layout #purchase-operation-rows .purchase-reference-grades{font-size:12px;min-height:36px}
#purchase-stock-variants-dialog{width:min(1000px,calc(100vw - 20px));max-height:92dvh;overflow:auto;padding:24px}#purchase-stock-variants-dialog input[type=number]{width:120px;min-width:0}#purchase-stock-error{color:#b12d2d}#purchase-stock-variants-dialog .dialog-actions{position:sticky;bottom:-24px;background:var(--panel,#fff);padding:12px 0;flex-wrap:wrap}#purchase-stock-variants-dialog input{font:inherit}
@media(max-width:700px){.purchase-order-layout #purchase-operation-rows tr{grid-template-areas:'number number' 'type type' 'material material' 'reference unit' 'quantity price' 'total total' 'actions actions'}#purchase-stock-variants-dialog .table-wrap{overflow:visible}#purchase-stock-variants-dialog table,#purchase-stock-variants-dialog tbody{display:block;min-width:0;width:100%}#purchase-stock-variants-dialog thead{display:none}#purchase-stock-variants-dialog tr{display:block;border:1px solid #ccd9de;border-radius:9px;padding:12px;margin-bottom:12px}#purchase-stock-variants-dialog td{display:grid;grid-template-columns:minmax(95px,1fr) minmax(0,1.5fr);gap:8px;border:0;padding:7px 0;min-width:0;overflow-wrap:anywhere}#purchase-stock-variants-dialog td:before{content:attr(data-label);font-size:12px;font-weight:600}#purchase-stock-variants-dialog input[type=number]{width:100%;min-height:44px;font-size:16px}#purchase-stock-variants-dialog input[type=checkbox]{width:22px;height:22px}#purchase-stock-variants-dialog .dialog-actions button{min-height:44px}}
@media(max-width:480px){.purchase-order-layout #purchase-operation-rows tr{grid-template-areas:'number' 'type' 'material' 'reference' 'unit' 'quantity' 'price' 'total' 'actions'}}

/* Match purchase orders: one item per row, with contained horizontal scrolling. */
.purchase-order-layout #purchase-operation-items .table-wrap{overflow-x:auto;max-width:100%;position:relative;overscroll-behavior-x:contain}
.purchase-order-layout #purchase-operation-items table{display:table;min-width:1260px;width:100%;border-collapse:collapse}
.purchase-order-layout #purchase-operation-items thead{display:table-header-group}
.purchase-order-layout #purchase-operation-rows{display:table-row-group}
.purchase-order-layout #purchase-operation-items thead tr,.purchase-order-layout #purchase-operation-rows tr{display:grid;grid-template-columns:42px 130px minmax(240px,1fr) 115px 65px 110px 110px 115px 310px;grid-template-areas:'number type material reference unit quantity price total actions';gap:0;border:0;border-radius:0;padding:0;margin:0;background:transparent}
.purchase-order-layout #purchase-operation-items thead th{padding:12px 8px;background:#f4f6fa;font-size:11px;color:#65758b;text-align:left}
.purchase-order-layout #purchase-operation-items thead th:nth-child(1){grid-area:number}.purchase-order-layout #purchase-operation-items thead th:nth-child(2){grid-area:reference}.purchase-order-layout #purchase-operation-items thead th:nth-child(3){grid-area:material}.purchase-order-layout #purchase-operation-items thead th:nth-child(4){grid-area:quantity}.purchase-order-layout #purchase-operation-items thead th:nth-child(5){grid-area:unit}.purchase-order-layout #purchase-operation-items thead th:nth-child(6){grid-area:price}.purchase-order-layout #purchase-operation-items thead th:nth-child(7){grid-area:total}.purchase-order-layout #purchase-operation-items thead th:nth-child(8){grid-area:actions}.purchase-order-layout #purchase-operation-items thead th:nth-child(9){grid-area:type}
.purchase-order-layout #purchase-operation-items #purchase-operation-rows td{display:block;padding:10px 8px;border-bottom:1px solid #d5dfea;align-content:center;min-width:0}
.purchase-order-layout #purchase-operation-items #purchase-operation-rows td:before{display:none}
.purchase-order-layout #purchase-operation-items #purchase-operation-rows td:nth-child(8){display:flex;align-items:center;justify-content:flex-start;flex-wrap:nowrap;gap:5px}
.purchase-order-layout #purchase-operation-rows :is(input,select){width:100%;min-width:0;box-sizing:border-box}
.purchase-order-layout #purchase-operation-rows button{width:auto;flex:none;white-space:nowrap;font-size:11px;padding:7px 8px;margin:0;min-height:36px}
.purchase-order-layout #purchase-operation-items tfoot{display:table-footer-group}.purchase-order-layout #purchase-operation-items tfoot tr{display:table-row}.purchase-order-layout #purchase-operation-items tfoot :is(td,th){display:table-cell;padding:14px;background:#eff5f5}
@media(max-width:1024px){.purchase-order-layout #purchase-operation-rows :is(input,select){font-size:16px;min-height:44px}.purchase-order-layout #purchase-operation-rows button{min-height:44px}}
/* Compact purchase payment composition, independent from expense forms. */
#purchase-details #purchase-operation-payments{padding:16px;background:#fbfcfe}
#purchase-operation-payments>label{display:grid;grid-template-columns:minmax(140px,220px) minmax(0,1fr);gap:6px 16px;align-items:center;font-weight:600}
#purchase-operation-payments>label>input{grid-column:1;grid-row:2;background:#edf5f5;color:#284f5e;font-size:18px;font-weight:700}
#purchase-operation-payments>label>small{grid-column:2;grid-row:2;font-weight:400;color:#607084}
#purchase-operation-allocations .expense-payment-block{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:12px 14px;padding:14px;background:#fff;align-items:end}
#purchase-operation-allocations .expense-payment-block>label{grid-column:span 6;margin:0;gap:5px;font-size:12px;font-weight:600;color:#40536d}
#purchase-operation-allocations label:has([data-purchase-payment=amount]){grid-column:span 4}
#purchase-operation-allocations label:has([data-purchase-payment=count]){grid-column:span 2}
#purchase-operation-allocations label:has([data-purchase-payment=terms]),#purchase-operation-allocations label:has([data-purchase-payment=due]){grid-column:span 3}
#purchase-operation-allocations :is(input,select){min-height:40px;font-weight:400}
#purchase-operation-allocations .purchase-schedule-preview{grid-column:1/-1;margin:0;padding:10px 12px;border-left:3px solid #7394a1;background:#f1f6f8;border-radius:5px;color:#415a6d;white-space:pre-line;line-height:1.6}
#purchase-operation-allocations [data-purchase-remove-payment]{grid-column:1/-1;justify-self:end;width:auto;margin:0;padding:7px 12px;font-size:12px}
#purchase-operation-payments>p{color:#607084;max-width:85ch;margin-bottom:0}
@media(max-width:1024px){#purchase-operation-allocations :is(input,select,button){min-height:44px}#purchase-operation-allocations :is(input,select){font-size:16px}}
@media(max-width:600px){#purchase-operation-payments>label{grid-template-columns:minmax(0,1fr)}#purchase-operation-payments>label>small{grid-column:1;grid-row:3}#purchase-operation-allocations .expense-payment-block{grid-template-columns:repeat(2,minmax(0,1fr));padding:12px;gap:12px}#purchase-operation-allocations .expense-payment-block>label{grid-column:1/-1}#purchase-operation-allocations label:has([data-purchase-payment=count]),#purchase-operation-allocations label:has([data-purchase-payment=terms]){grid-column:span 1}#purchase-operation-allocations [data-purchase-remove-payment]{justify-self:stretch}#purchase-details #purchase-operation-payments{padding:12px}}
#purchase-open-receipt{max-width:100%;white-space:normal;margin:0 0 12px;min-height:44px}#purchase-open-receipt[hidden],#order-form button[type=submit][hidden]{display:none!important}

#purchase-operation-identity{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,2fr);gap:12px;align-items:start}#purchase-operation-identity[hidden]{display:none}#purchase-operation-identity label{min-width:0}#purchase-operation-identity input{width:100%;min-width:0}
@media(max-width:480px){#purchase-operation-identity{grid-template-columns:repeat(2,minmax(0,1fr))}#purchase-operation-identity label:last-child{grid-column:1/-1}}
