/* Shared form layout for desktop, tablet, mobile and dynamically opened dialogs. */
form,.control-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:16px;margin:18px 0 24px;min-width:0}
form>label,.control-row>label{display:flex;flex-direction:column;flex:0 1 240px;gap:8px;margin:0;min-width:0;max-width:100%}
form>label>input,form>label>select,.control-row>label>input,.control-row>label>select{width:100%;min-height:44px}
form>button,.control-row>button{align-self:flex-end;min-height:44px;margin:0;flex-shrink:0}
.control-row>input[type=file]{flex:1 1 320px;min-width:0}
.form-actions{display:flex;flex-wrap:wrap;gap:10px;margin:16px 0 28px;align-items:center}
.actions{align-items:center;gap:10px}.actions>button,.actions>.button{margin:0}
.actions>label{margin:0;min-width:0}
#userform{max-width:1000px}#userform>label{flex:1 1 220px}
#masterform,#traceform{align-items:center;gap:10px}
#masterform .scan-clear-field{flex:1 1 320px;max-width:520px}
#traceform .scan-clear-field{width:auto;flex:1 1 420px}
#masterform input,#traceform input{min-height:46px}
#masterform>button,#traceform>button{min-height:46px;align-self:center}
#scanreceiveform{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:18px 16px;align-items:end}
#scanreceiveform>label{grid-column:span 2;width:100%;margin:0}
#scanreceiveform>label:has(#scanlocation){grid-column:span 3}
#scanreceiveform>#scanconfirm{grid-column:1/-1;justify-self:start;min-height:48px;margin-top:6px}
#contactform,#shipping-register,#breakform,#splitform,.move-form{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px 16px;align-items:end}
#contactform>label,#shipping-register>label,#breakform>label,#splitform>label,.move-form>label{width:100%;margin:0}
#contactform>button,#shipping-register>button,#breakform>button,#splitform>button,.move-form>button{grid-column:1/-1;justify-self:start;margin-top:4px}
.move-form>h3,.move-form>p{grid-column:1/-1;margin:0}
.move-form{padding-top:20px;border-top:1px solid var(--line);margin-top:26px}
#deliverform{padding:14px 0}#deliverform>button{min-height:48px}
#shipping-lookup>label{flex-basis:340px}
#shipping-control-filter>label,#audit-filter>label{flex:1 1 190px}
#shipping-control-filter,#audit-filter{gap:14px}
#shipping-control .actions,#audit-log-panel>.actions{margin-top:18px}
.shipment-pagination{margin-top:18px}.pagination-controls{align-items:center}
#detail>h3{margin-top:28px}#detail>.scroll{margin-top:14px}
#required-attached{flex:none}#detail:has(#required-print)>label{display:block;margin:18px 0;line-height:1.7}
#detail:has(#required-print)>button{margin:6px 8px 6px 0}
#detail:has(#required-print)>input[type=file]{display:block;width:100%;margin:18px 0 8px}
@media(max-width:1000px){
 #scanreceiveform{grid-template-columns:repeat(2,minmax(0,1fr))}
 #scanreceiveform>label,#scanreceiveform>label:has(#scanlocation){grid-column:span 1}
 #splitform,.move-form{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:700px){
 nav{position:static}
 form,.control-row{gap:14px;margin:16px 0 22px}
 form>label,.control-row>label,#userform>label,#shipping-lookup>label{flex:1 1 100%;width:100%}
 form>button,.control-row>button{max-width:100%;min-height:46px}
 #userform>button,#shipping-lookup>button,#shipping-register>button{width:100%}
 #scanreceiveform,#contactform,#shipping-register,#breakform,#splitform,.move-form{grid-template-columns:1fr}
 #scanreceiveform>label,#scanreceiveform>label:has(#scanlocation){grid-column:1/-1}
 #scanconfirm,#contactform>button,#breakform>button,#splitform>button,.move-form>button{width:100%;justify-self:stretch}
 #masterform .scan-clear-field,#traceform .scan-clear-field{flex:1 1 100%;max-width:none}
 #masterform>button{flex:1 1 150px;min-height:58px}#traceform>button{width:100%}
 #shipping-control-filter>label,#audit-filter>label{flex:1 1 100%}
 .control-row>.button,.control-row>button,.control-row>input{flex:1 1 100%;width:100%}
 .form-actions>button,.form-actions>.button{flex:1 1 160px;text-align:center}
 #detail:has(#required-print)>button{display:block;width:100%;margin:10px 0}
}
@media print{form,.control-row,.form-actions{display:none!important}}

/* Warehouse registry: give the name the spare width and keep row actions compact. */
#warehouse-site-panel{--warehouse-code-width:112px;--warehouse-coordinate-width:210px;--warehouse-enabled-width:90px;--warehouse-actions-width:180px;--warehouse-table-min:1100px}
#warehouse-site-panel table{table-layout:fixed;min-width:var(--warehouse-table-min);width:100%}
#warehouse-site-panel th,#warehouse-site-panel td{padding:12px 8px;vertical-align:middle}
#warehouse-site-panel th:nth-child(1){width:var(--warehouse-code-width)}
#warehouse-site-panel th:nth-child(3),#warehouse-site-panel th:nth-child(4){width:var(--warehouse-coordinate-width)}
#warehouse-site-panel th:nth-child(5){width:var(--warehouse-enabled-width)}
#warehouse-site-panel th:nth-child(6){width:var(--warehouse-actions-width)}
#warehouse-create{display:grid;grid-template-columns:var(--warehouse-code-width) minmax(0,1fr) var(--warehouse-coordinate-width) var(--warehouse-coordinate-width) var(--warehouse-enabled-width) var(--warehouse-actions-width);gap:0;min-width:var(--warehouse-table-min);width:100%;margin:16px 0;padding:0;align-items:end}
#warehouse-create>label{width:100%;max-width:100%;padding:0 8px;gap:8px}
#warehouse-create>label>input:not([type=checkbox]){min-width:0;width:100%;min-height:44px}
#warehouse-create>label:has(input[type=checkbox]){flex-direction:column!important;align-items:flex-start;gap:4px}
#warehouse-create input[type=checkbox]{width:24px;min-width:24px;min-height:24px;margin:0}
#warehouse-create>button{justify-self:start;margin:0 8px;min-height:44px}
#warehouse-site-panel>.scroll>h3{margin:24px 8px 12px}
#warehouse-registry input:not([type=checkbox]){width:100%;min-width:0;min-height:44px}
#warehouse-registry form{margin:0;gap:8px;flex-wrap:nowrap;align-items:center}
#warehouse-registry form>button{padding:10px 14px;align-self:center}
#warehouse-registry td>label{margin:0;gap:4px;align-items:center}
#warehouse-registry input[type=checkbox]{margin:0;min-width:24px;min-height:24px}
#warehouse-context{display:flex;align-items:center;flex-wrap:wrap;gap:12px 24px}
#warehouse-context>label{margin:0;flex:1 1 360px;max-width:600px;min-width:0}
#warehouse-context select{width:100%}
@media(max-width:700px){
 #warehouse-create{grid-template-columns:minmax(0,1fr);min-width:0;gap:14px;padding:0 14px}
 #warehouse-create>label{padding:0}
 #warehouse-create>label:has(input[type=checkbox]){flex-direction:row!important;justify-content:flex-start;gap:8px;min-height:44px}
 #warehouse-create>button{margin:0;width:100%;justify-self:stretch}
 #warehouse-site-panel table,#warehouse-site-panel tbody{display:block;min-width:0;width:100%}
 #warehouse-site-panel thead{display:none}
 #warehouse-registry tr{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;margin:0 0 14px;padding:14px;border:1px solid var(--line,#dbe5eb);border-radius:12px}
 #warehouse-registry td{display:block;border:0;padding:0;min-width:0}
 #warehouse-registry td{grid-column:1/-1}
 #warehouse-registry td:nth-child(2)::before{content:'ชื่อคลัง'}
 #warehouse-registry td:nth-child(3)::before{content:'ละติจูด'}
 #warehouse-registry td:nth-child(4)::before{content:'ลองจิจูด'}
 #warehouse-registry td:nth-child(2)::before,#warehouse-registry td:nth-child(3)::before,#warehouse-registry td:nth-child(4)::before{display:block;margin-bottom:6px;color:var(--muted,#68818e);font-size:13px}
 #warehouse-registry td>label{flex-direction:row;gap:8px;justify-content:flex-start;min-height:44px}
 #warehouse-registry form{width:100%;gap:8px}
 #warehouse-registry form>button{flex:1;min-width:0}
 #warehouse-context>label{flex-basis:100%;max-width:none}
}
