dialog:has(.order-detail-sheet){width:min(1100px,calc(100% - 32px));max-width:1100px}
.order-detail-sheet{min-width:0}.order-detail-sheet .wholesale-heading{justify-content:space-between;gap:10px}.order-detail-sheet .wholesale-heading h3{margin:0;font-size:20px}.order-detail-caption{padding:12px;background:#edf3f9;line-height:1.6;overflow-wrap:anywhere}
.order-detail-products{padding:12px}.order-detail-products h3{margin:0 0 10px}.order-detail-products table{width:100%;min-width:620px;border-collapse:collapse}.order-detail-products th{background:#e6edf6;font-weight:400;white-space:nowrap}.order-detail-products td,.order-detail-products th{border:1px solid #b8c9da;padding:7px 9px;font-size:13px}.order-detail-products button{font-size:13px;padding:3px 6px}
.order-detail-products table:not(:has(th:nth-child(4))){min-width:0;table-layout:fixed}.order-detail-products table:not(:has(th:nth-child(4))) th:first-child{width:66%}.order-detail-products table:not(:has(th:nth-child(4))) button{white-space:normal;text-align:left}
.order-detail-other{border-top:1px solid #b8c9da}.order-detail-other>summary{padding:12px;background:#d6def2;cursor:pointer;font-weight:bold}.order-detail-other>div{padding:12px}.order-detail-other .chain-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:600px){dialog:has(.order-detail-sheet) .modal-head{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:8px}dialog:has(.order-detail-sheet) .modal-head h2{grid-column:1/-1;grid-row:2;overflow-wrap:anywhere}dialog:has(.order-detail-sheet) .modal-back{grid-column:1;grid-row:1}dialog:has(.order-detail-sheet) .modal-head select{grid-column:2;grid-row:1;width:100%;max-width:140px;justify-self:end}dialog:has(.order-detail-sheet) [data-action="close-modal"]{grid-column:3;grid-row:1}.order-detail-sheet .wholesale-heading{justify-content:flex-start}.order-detail-sheet .wholesale-number{overflow-wrap:anywhere}.order-detail-other .chain-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.order-detail-products,.order-detail-caption,.order-detail-other>div{padding:10px}}
@media print{dialog:has(.order-detail-sheet){width:100%;max-width:none}.order-detail-other{display:none}.order-detail-products table{min-width:0}}
@media(max-width:600px){.freight-arrears-panel table{min-width:0;table-layout:fixed;width:100%}.order-detail-products .freight-arrears-panel table:not(:has(th:nth-child(4))) th:first-child,.freight-arrears-panel th:first-child{width:44%}.freight-arrears-panel th:nth-child(2){width:24%}.freight-arrears-panel th,.freight-arrears-panel td{padding:4px;font-size:12px;white-space:normal}.freight-arrears-panel button{max-width:100%;font-size:12px;padding:3px;overflow-wrap:anywhere;white-space:normal;line-height:1.4}}
#modal:has(.product-chain-block){width:min(1000px,calc(100vw - 24px));max-width:1000px}
#modal .product-chain-block{max-width:100%;overflow-x:auto;padding:10px;margin-top:8px;border:1px solid var(--line);border-radius:8px;background:#f8fafb}
#modal .product-chain-categories{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));grid-template-rows:repeat(var(--chain-rows,2),minmax(64px,auto));min-width:700px;gap:8px}
#modal .product-chain-categories .chain-card{min-width:0;flex-direction:column;align-items:center;justify-content:center;min-height:64px;padding:8px;gap:5px;white-space:normal}
#modal .product-chain-categories .chain-card span,#modal .product-chain-categories .chain-card strong{max-width:100%;white-space:normal;overflow-wrap:normal;word-break:normal;font-size:13px;line-height:1.3}
@media print{#modal .product-chain-block{overflow:visible}#modal .product-chain-categories{min-width:0}}
#modal .product-chain-categories [aria-expanded="true"]{border-color:#d20b0b;background:#fff0f0}
.chain-grid>.chain-card[aria-pressed="true"]{border-color:#d20b0b;background:#fff0f0}
#modal .product-chain-overview>.chain-caption{margin-bottom:6px}
#modal .product-chain-section{margin-top:8px;padding-top:6px;border-top:1px solid #b8c9da}
#modal .product-chain-section>h3{margin-bottom:6px;font-size:14px}
.product-basic-information{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:12px;margin:0 0 14px}
.product-basic-information>div{min-width:0}.product-basic-information dt{font-size:12px;color:var(--muted)}.product-basic-information dd{margin:4px 0 0;font-size:14px;overflow-wrap:anywhere}
@media(max-width:600px){.product-basic-information{grid-template-columns:minmax(0,1fr)}}
.order-confirmations{display:contents}
/* Evidence and confirmation actions stay distinct from ordinary document tools. */
#modal .evidence-required,#modal label:is([for="sale-evidence"],[for="document-evidence"]){color:#b91c1c;font-weight:700}
#modal :is([data-action="logistics-evidence"],[data-action="evidence-camera"],label[for="evidence-file"],[data-action="confirmation-photo-submit"],[data-action="sale-confirm-delivery"],[data-action="ship-task"],[data-action="purchase-confirm"],[data-action="purchase-recount"],[data-action="document-confirm"][data-operation="dispatch"],[data-action="document-confirm"][data-operation="receive"],[data-action="execute-document"][data-operation="dispatch"],[data-action="execute-document"][data-operation="receive"],#delivery-form button.primary,#purchase-action-form>button.primary){background:#b91c1c;color:#fff;border-color:#b91c1c;font-weight:700;min-height:44px}
#modal :is([data-action="logistics-evidence"],[data-action="evidence-camera"],label[for="evidence-file"],[data-action="confirmation-photo-submit"],[data-action="sale-confirm-delivery"],[data-action="ship-task"],[data-action="purchase-confirm"],[data-action="purchase-recount"],[data-action="document-confirm"][data-operation="dispatch"],[data-action="document-confirm"][data-operation="receive"],[data-action="execute-document"][data-operation="dispatch"],[data-action="execute-document"][data-operation="receive"],#delivery-form button.primary,#purchase-action-form>button.primary):hover:not(:disabled){background:#991b1b}
#modal [data-action="confirmation-photo-submit"]:disabled{background:#fee2e2;color:#991b1b;border-color:#b91c1c;opacity:1}
#modal [data-action="open-evidence"]:not([data-kind="product"]),#modal input:is(#sale-evidence,#document-evidence)::file-selector-button{background:#b91c1c;color:#fff;border:1px solid #b91c1c;font-weight:700;padding:10px 15px;border-radius:8px}
