/* 3.3: dialog controls remain outside the scrolling content. */
#dialog{padding:0;overflow:hidden;max-height:94dvh;max-width:min(1500px,96vw)}
#dialog[open]{display:flex;flex-direction:column}
.dialog-top{flex:0 0 48px;display:flex;justify-content:flex-end;align-items:center;padding:4px 12px;background:#fff;border-bottom:1px solid #e2e8ef;z-index:10}
#dialog .close{position:static;margin:0;width:40px;height:40px;flex-shrink:0}
#dialogBody{overflow-y:auto;min-height:0;padding:20px 24px;overscroll-behavior:contain}
.fold-toggle{float:right;margin:0 0 0 8px}.vendor-stage{display:block;font-size:12px;color:#75511d;line-height:1.5}
.unit-stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:12px}.unit-form input[type=checkbox]{width:auto}
@media(max-width:760px){
 header{flex-wrap:wrap;gap:10px}.header-right{flex-wrap:wrap;gap:6px}.brand span small{font-size:10px}
 main{padding:12px 8px}.heading h1{font-size:24px}.toolbar{flex-wrap:wrap;gap:8px}nav{flex-wrap:wrap;gap:8px;overflow:visible}nav button{padding:10px;font-size:13px}
 .filterbar{flex-wrap:wrap;gap:8px}.filterbar input,.filterbar select{min-width:0;max-width:100%;flex:1 1 140px}
 .board{min-width:0;display:block;padding:0}.board thead{display:none}.board tbody{display:block}
 .board .order-overview{display:grid;grid-template-columns:1fr 1fr;background:#fff;border:1px solid #a9bed3;border-radius:10px 10px 0 0;margin-top:14px;padding:12px;gap:8px}
 .board .order-overview td{display:block;border:0!important;padding:4px!important;box-shadow:none!important}
 .board .order-overview td:first-child{display:none}.board .order-overview td:nth-child(2){grid-column:1/-1}
 .board .order-overview td:last-child{grid-column:1/-1}.board .order-progress-row,.board .order-progress-row>td{display:block;width:100%}
 .board .order-progress-row>td{border-width:1px;padding:10px}.progress-track{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.progress-heading{flex-wrap:wrap}.progress-deadline{margin:0}
 #dialog,#dialog:has(.sku-table){width:98vw;max-width:98vw;max-height:96dvh}
 #dialogBody{padding:12px}.dialog-top{padding:2px 8px}.timeline{grid-template-columns:1fr 1fr}.settings-grid{grid-template-columns:1fr}
 .sku-table,.production-panel table{min-width:0;width:100%}.sku-table thead,.production-panel thead{display:none}
 .sku-table tbody,.production-panel tbody{display:block}.sku-table tr,.production-panel tr{display:block}
 .sku-table td,.production-panel td{display:block;width:100%;max-width:none;padding:9px 12px!important;white-space:normal}
 .sku-group td{position:relative}.sku-group label{flex-wrap:wrap;padding-right:75px}.fold-toggle{position:absolute;right:5px;top:5px;font-size:12px}
 .sku-child{border:1px solid #dce3ea;margin-bottom:10px;border-radius:8px}.sku-child td{border-bottom:0}
 .sku-table label{white-space:normal}.table-wrap{max-width:100%;overflow-x:auto}.detail-actions{flex-wrap:wrap}.detail-actions button{max-width:100%}
 input,select,textarea{font-size:16px!important;max-width:100%;box-sizing:border-box}button{min-height:40px}
 #previewDialog{width:98vw;padding:10px}.preview-tools{position:sticky;top:0;flex-wrap:wrap;z-index:10;background:white}
 .unit-stats-grid{grid-template-columns:1fr}
}
