.tabs button{min-width:0}.batch-box,.rule-settings{border-top:1px solid #dde6ee;margin-top:12px;padding-top:10px;font-size:14px;line-height:1.5}.batch-box summary,.rule-settings summary{cursor:pointer;color:#005daa;font-weight:600;min-height:36px}.batch-box label,.rule-settings>label{display:block;margin:8px 0}.batch-box textarea,.rule-settings textarea{font-size:16px;min-height:76px;padding:8px}.feature-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:10px 0;font-size:14px}.feature-actions button,.feature-actions select{min-height:40px;font-size:14px}.feature-note,[data-request-status],[data-batch-status]{font-size:13px;line-height:1.5;margin:8px 0;white-space:pre-line}.data-warning{color:#a13c24;font-size:13px}.department-checks{display:flex;flex-wrap:wrap;gap:8px}.department-checks label{display:flex;align-items:center;gap:4px;min-height:36px;font-size:14px}.department-checks input{width:18px;height:18px}.rule-settings fieldset{border:1px solid #dde6ee;border-radius:8px;padding:8px}.rule-settings input[type=number]{display:block;font-size:16px;width:120px;margin-top:4px}.batch-result{border:1px solid #dde6ee;border-radius:9px;padding:10px;margin:8px 0;font-size:14px;line-height:1.45;overflow-wrap:anywhere}.batch-result strong{display:block;font-size:14px}.batch-result p{margin:6px 0}.batch-result small{font-size:12px}.compact-values{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px 12px;margin-top:8px;font-size:13px}.order-lines{white-space:pre-line}.replenish-quantity{color:#005daa;font-weight:700}button:disabled{opacity:.55;cursor:default}@media(max-width:700px){.compact-values{grid-template-columns:repeat(2,minmax(0,1fr))}.tabs{gap:4px}.tabs button{font-size:13px}.tabs button small{font-size:10px}.batch-box{flex:0 0 auto}.rule-settings{margin-top:6px}.feature-note{font-size:12px}.feature-actions{margin:8px 0}.batch-result{margin:6px 0}} 

.request-search-label{display:block;font-size:14px;line-height:1.5;margin:4px 0 8px}.request-search-label input{display:block;width:100%;min-height:40px;font-size:16px;margin-top:4px;padding:8px 10px}[data-request-match]{font-size:12px;color:#627789;overflow-wrap:anywhere}

.status-upload{flex:0 0 auto!important;padding:10px;border:1px solid #dde6ee;margin-bottom:8px}.status-upload>label{display:flex;align-items:center;justify-content:space-between;gap:8px}.status-upload .file-picker{margin:0}.status-upload .upload-state{font-size:12px;line-height:1.4}.status-upload .error{color:#a13c24}

.shortage-choice{display:block;width:100%;text-align:left;min-height:44px;padding:9px 10px;margin:6px 0;white-space:normal;overflow-wrap:anywhere}.shortage-choice strong{display:block;font-size:13px;line-height:1.4}.shortage-choice span{display:block;font-size:12px;line-height:1.4;margin-top:3px}

.shortage-department{margin-top:14px;border:1px solid #dce6ed;border-radius:10px;overflow:hidden}.shortage-department-heading{display:flex;justify-content:space-between;align-items:center;margin:0;padding:9px 10px;background:#f1f6fb;border-bottom:1px solid #dce6ed;color:#005daa;font-size:14px;line-height:1.4}.shortage-department-heading span:last-child{color:#627789;font-size:12px;font-weight:400}.shortage-department .shortage-compact{padding:0 10px}.shortage-department .shortage-entry:first-child{border-top:0}

.request-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.request-filters label{display:flex;align-items:center;gap:6px;min-width:0}.request-filters select{flex:1;min-width:0;width:100%;font-size:16px;padding:6px}
/* Phase two: compact working surfaces with readable controls. */
.batch-box,.rule-settings{font-size:14px;margin-top:12px;padding-top:10px;border-color:var(--line)}.batch-box summary,.rule-settings summary,.import-settings>summary,.source-summary>summary{min-height:40px;align-content:center;cursor:pointer;color:var(--costco-blue);font-size:13px}.feature-actions button,.feature-actions select{min-height:44px}.feature-actions{gap:8px}.feature-note{font-size:13px;line-height:1.6}.status-upload{border:0;padding:8px 0;margin:0}.status-upload .upload-state{font-size:12px}.import-settings{border-bottom:1px solid var(--line);padding-bottom:5px;margin-bottom:8px}.import-settings>summary{font-weight:600}.department-checks label{min-height:44px}.rule-settings fieldset{border-color:var(--line)}.request-filters{margin-top:12px}.request-filters label{display:block;font-size:13px;color:var(--muted)}.request-filters select{display:block;margin-top:4px;width:100%;min-height:44px;padding:8px}.request-search-label input{min-height:44px}.compact-values{font-size:13px;line-height:1.5;gap:6px 10px}.batch-result{border-color:var(--line);padding:11px;min-width:0}.batch-result strong{font-size:14px;line-height:1.5}.request-card-top{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:12px}.request-quantity{white-space:nowrap;font-size:15px;font-weight:700;color:var(--costco-red);background:#fff2f4;border-radius:6px;padding:5px 8px}.request-kind-review .request-quantity{color:#7b571d;background:#faf5e9;font-size:13px}.request-kind-excluded .request-quantity{color:var(--muted);background:var(--soft);font-size:13px}.request-essential{display:flex;flex-wrap:wrap;gap:5px 14px;font-size:13px;line-height:1.5;margin-top:8px}.request-essential b{font-variant-numeric:tabular-nums}.request-reason{font-size:13px;color:var(--muted)}.request-kind-candidate{border-left:3px solid var(--costco-red)}.request-kind-review{border-left:3px solid #c7a264}.request-details .compact-values{margin:4px 0 8px}.shortage-department-heading{background:var(--soft);color:#334b62;border-color:var(--line);padding:10px;font-size:14px}.shortage-department{border-color:var(--line)}.shortage-product{border-bottom:1px solid var(--line);padding:2px 0 10px;margin-bottom:5px}.shortage-product:last-child{border-bottom:0;margin-bottom:0}.shortage-choice{min-height:48px}.shortage-choice strong{font-size:14px}.source-summary>div{margin-top:5px}
@media(max-width:700px){.batch-result{margin:7px 0;padding:10px}.request-card-top{gap:8px}.request-essential{gap:5px 10px}.feature-note{font-size:13px}.request-quantity{font-size:14px}.shortage-department-heading span:last-child{font-size:12px}.feature-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.feature-actions button{width:100%}.request-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.shortage-product-status{font-size:12px}.department-checks{gap:4px 10px}}
@media(max-width:700px){.batch-box,.rule-settings{margin-top:6px;padding-top:5px}.batch-box summary,.rule-settings summary,.import-settings>summary{min-height:30px;font-size:12px}.import-settings{padding-bottom:2px;margin-bottom:4px}.feature-actions{gap:6px;margin:6px 0}.feature-actions button{min-height:42px;padding:8px}.request-filters{margin-top:6px}.request-filters label{font-size:12px}.request-filters select{min-height:42px;margin-top:2px;padding:7px}.request-search-label{font-size:12px;line-height:1.3;margin:3px 0 5px}.request-search-label input{min-height:42px;margin-top:3px}.feature-note,[data-request-status],[data-batch-status]{font-size:12px;line-height:1.35;margin:5px 0}.batch-result{padding:8px;margin:5px 0;font-size:13px;line-height:1.35}.batch-result strong{font-size:13px;line-height:1.35}.batch-result p{margin:4px 0}.request-essential{font-size:12px;gap:3px 9px;margin-top:5px;line-height:1.35}.request-quantity{font-size:13px;padding:4px 6px}.request-reason{font-size:12px}.compact-values{font-size:12px;gap:4px 8px;line-height:1.35;margin-top:5px}.request-details{margin-top:5px;padding-top:1px}.shortage-department{margin-top:7px}.shortage-department-heading{padding:7px 9px;font-size:13px}.shortage-department .shortage-compact{padding:0 8px}.shortage-product{padding-bottom:6px;margin-bottom:3px}}

/* Smaller controls and fewer stacked rows; product text keeps its reading space. */
@media(max-width:700px){
header{padding-top:calc(env(safe-area-inset-top,0px) + 6px);padding-bottom:6px}.brand-logo{width:142px;height:43px}.brand-logo img{width:199px;height:199px;left:-28px;top:-75px}
main{margin-top:8px;padding-left:max(8px,env(safe-area-inset-left));padding-right:max(8px,env(safe-area-inset-right))}.tabs{margin-bottom:8px}.tabs button{min-height:40px;padding:4px 2px;gap:2px}.panel{padding:10px}
input:not([type=checkbox]):not([type=file]),select,[data-file-search],.request-search-label input{min-height:36px;padding:5px 8px;border-radius:6px;font-size:16px}
.primary,.secondary,.file-picker,.feature-actions button,.row input,.row select,.shortage-actions select,.shortage-actions button,.shortage-toolbar select{min-height:36px;padding:5px 9px;border-radius:6px}
.row{margin:5px 0;gap:6px}.row select{flex-basis:100px}.row input[name=sku]{flex:1 1 0}
#shortagesForm .shortage-save-row{display:grid;grid-template-columns:minmax(0,1fr) 82px;gap:6px;align-items:center}
#shortagesForm .shortage-save-row input,#shortagesForm .shortage-save-row button{width:100%;min-width:0;max-width:100%;margin:0}
#shortagesForm .shortage-save-row input[name=day]{grid-column:1;grid-row:1;height:36px;min-height:36px;overflow:hidden;line-height:24px;-webkit-appearance:none;appearance:none;text-align:left}
#shortagesForm .shortage-save-row input[name=day]::-webkit-date-and-time-value{text-align:left;min-width:0;margin:0}
#shortagesForm .shortage-save-row input[name=note]{grid-column:1/-1;grid-row:2;height:36px}
#shortagesForm .shortage-save-row .primary{grid-column:2;grid-row:1;height:36px;font-size:12px;padding:5px 3px}
.shortage-match.is-hint{border:0;background:transparent;padding:2px 0;margin:4px 0;color:var(--muted);font-size:12px;line-height:1.4}
.shortage-toolbar{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:6px;margin:8px 0 6px;align-items:center}
.shortage-toolbar label{min-width:0;gap:4px;font-size:12px}.shortage-toolbar select{min-width:0;width:100%;font-size:14px;padding:5px 4px}
.shortage-toolbar button{white-space:nowrap;font-size:12px;padding:5px 7px}
.request-search-label{margin:5px 0;font-size:12px}.request-search-label input{margin-top:3px}
.shortage-actions select{max-width:130px}.shortage-delete{min-width:48px;font-size:13px}.shortage-actions{margin-top:7px}
.file-picker{font-size:13px}.request-filters select{min-height:36px;padding:5px 8px}.upload-tools>summary{min-height:32px}
}
@media(max-width:350px){#shortagesForm .shortage-save-row{grid-template-columns:minmax(0,1fr) 76px}.shortage-toolbar{grid-template-columns:repeat(2,minmax(0,1fr))}.shortage-toolbar button{justify-self:start}}

.shortage-department>summary{list-style:none;cursor:pointer;min-height:38px;border-bottom:0;gap:6px}.shortage-department>summary::-webkit-details-marker{display:none}.shortage-department>summary::before{content:'▶';color:var(--costco-blue);font-size:11px;flex:0 0 auto}.shortage-department[open]>summary::before{content:'▼'}.shortage-department>summary span:first-of-type{margin-right:auto}.shortage-department[open]>summary{border-bottom:1px solid var(--line)}

/* Place each record's controls in its metadata row. */
.shortage-top{gap:4px 8px}.shortage-top .shortage-actions{display:flex;margin:0 0 0 auto;gap:5px;flex:0 0 auto}.shortage-top .shortage-actions select{width:90px;max-width:90px;flex:none;min-height:30px;height:30px;font-size:14px;padding:3px 5px;border-radius:5px}.shortage-top .shortage-delete{min-width:36px;min-height:30px;height:30px;padding:3px 6px;font-size:12px;border-radius:5px}
@media(max-width:700px){.shortage-entry{padding:8px 0;line-height:1.45}.shortage-name{margin:5px 0;font-size:13px;line-height:1.45}.shortage-top{font-size:11px;gap:4px 6px}.shortage-top strong{font-size:13px}.shortage-metrics{gap:4px 10px;font-size:12px;line-height:1.45}.shortage-product-status,.shortage-note{margin-top:4px;line-height:1.45}.shortage-product{padding-bottom:3px;margin-bottom:2px}}

.status-upload.upload-tools-row{padding:0;margin:0 0 8px;border:0}

/* Consistent reading rhythm and touch controls for the mobile workbench. */
.lookup-card>strong,.batch-result strong{letter-spacing:.01em}
.lookup-grid>span,.compact-values>span{min-width:0;overflow-wrap:anywhere}
.sales-preview b,.request-quantity,.request-essential b{font-variant-numeric:tabular-nums}
.replenishment-preview{border-top:1px solid var(--line);padding-top:9px;margin-top:12px}
.replenishment-preview>div{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;align-items:baseline}
.replenishment-preview b{min-width:0;overflow-wrap:anywhere}
@media(min-width:900px){
  .batch-result{margin:0}
  [data-batch-results]>.search-more{grid-column:1/-1}
}
@media(max-width:700px){
  .tabs button{min-height:44px}
  .upload-tools-row{margin-bottom:8px}
  .upload-tools-row>.upload-tools>summary{font-weight:600}
  input:not([type=checkbox]):not([type=file]),select,[data-file-search],.request-search-label input{min-height:44px;padding:8px 10px;border-radius:8px}
  .primary,.secondary,.feature-actions button,.row input,.row select,.shortage-actions select,.shortage-actions button,.shortage-toolbar select{min-height:44px;padding:8px 10px;border-radius:8px}
  .upload-box>label,.request-search-label{font-size:13px;line-height:1.5}
  .lookup-card,.batch-result{padding:12px;margin:8px 0;border-radius:10px}
  .lookup-card>strong,.batch-result strong{font-size:14px;line-height:1.5}
  .lookup-grid{gap:8px 12px;margin-top:10px}
  .sales-preview{padding:9px;gap:8px;border-radius:8px}
  .sales-preview b{font-size:16px}
  .compact-values{font-size:13px;line-height:1.5;gap:6px 10px}
  .request-essential{font-size:13px;line-height:1.5;gap:5px 12px;margin-top:8px}
  .request-reason,.feature-note{font-size:13px;line-height:1.5}
  .batch-box>summary,.rule-settings>summary,.sales-detail>summary,.request-details>summary{min-height:44px;align-content:center;font-size:13px}
  .coverage-basis>summary,.shortage-department>summary{min-height:44px;align-content:center}
  #shortagesForm .shortage-save-row input[name=day],#shortagesForm .shortage-save-row input[name=note],#shortagesForm .shortage-save-row .primary{height:44px;min-height:44px}
  #shortagesForm .shortage-save-row input[name=day]{line-height:24px}
  .shortage-top .shortage-actions select,.shortage-top .shortage-delete{height:44px;min-height:44px}
  .shortage-top .shortage-delete{min-width:44px}
  .shortage-toolbar select{font-size:14px;padding:8px 4px}
  .shortage-toolbar button{font-size:12px;padding:8px 7px}
  .request-filters select{min-height:44px;padding:8px 10px}
  .department-checks label:focus-within{outline:2px solid var(--costco-blue);outline-offset:2px;border-radius:4px}
}

@media(max-width:700px){.upload-tools-row{margin-bottom:3px}.lookup-card .sales-detail{margin-top:4px;padding-top:0}.lookup-card .sales-detail>summary{min-height:32px}.lookup-card .coverage-basis>summary{min-height:26px}}

/* Compact expandable explanation in inventory lookup cards. */
.replenishment-explanation{margin-top:5px;color:var(--muted);font-size:12px}
.replenishment-explanation>summary{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:32px;cursor:pointer;list-style:none;color:var(--costco-blue);font-weight:600}
.replenishment-explanation>summary::-webkit-details-marker{display:none}
.replenishment-explanation>summary::marker{content:''}
.replenishment-explanation>summary:focus-visible{outline:2px solid var(--costco-blue);outline-offset:2px;border-radius:4px}
.explanation-arrow{flex:0 0 16px}
.replenishment-explanation[open]>summary .explanation-arrow{transform:rotate(180deg)}

.product-status-red{color:#c8102e}

.product-status-green{color:#15803d}

.arrival-status{font-size:12px;line-height:1.5;margin-top:8px}.arrival-warning{color:#b42318}.arrival-safe{color:#15803d}.calculation-basis,.arrival-details{margin-top:6px;border-top:1px solid var(--line);padding-top:3px;font-size:12px;line-height:1.5}.calculation-basis summary,.arrival-details summary{cursor:pointer;color:var(--costco-blue);min-height:34px;align-content:center}.calculation-basis p,.arrival-details p{margin:6px 0;overflow-wrap:anywhere}.replenishment-preview>.arrival-status,.replenishment-preview>.calculation-basis,.replenishment-preview>.arrival-details{grid-column:1/-1}

.replenishment-preview>.arrival-status{display:block}

/* Keep the shortage action beside the sales disclosure, above replenishment. */
.lookup-card .sales-action-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;column-gap:8px;border-top:1px solid var(--line);margin-top:8px;padding-top:4px}
.lookup-card .sales-action-row>.sales-detail{grid-area:1/1/2/3;margin:0;padding:0;border:0;min-width:0}
.lookup-card .sales-action-row>.sales-detail>summary{padding-right:150px;min-height:36px;align-content:center}
.sales-action-row>.quick-shortage{display:contents}
.sales-action-row .quick-shortage-button{grid-area:1/2/2/3;align-self:start;z-index:1;margin:0;min-height:36px;padding:6px 9px;font-size:12px;white-space:nowrap}
.sales-action-row .quick-shortage-feedback{grid-column:1/-1;margin-top:4px}
.sales-action-row .quick-shortage-feedback:empty{display:none}

.data-date-bar{margin:5px 0 9px;font-size:11px;color:#475569}.data-date-bar summary{display:flex;align-items:center;gap:3px;flex-wrap:wrap;cursor:pointer;font-weight:500}.data-date-bar summary span{white-space:nowrap}.data-date-bar summary i{font-style:normal;color:#cbd5e1}.data-date-bar summary::after{content:'⌄';margin-left:auto}.data-date-bar[open] summary::after{content:'⌃'}.date-stale{color:#b45309}.delivery-countdown{display:block;font-size:11px;margin-top:2px;color:#b91c1c}.past-orders{margin-top:10px}.past-orders>summary{font-weight:600;color:#b45309;cursor:pointer;padding:7px 0}

.followup-age{font-size:11px;color:#b45309;margin:3px 0;font-weight:600}@supports(content-visibility:auto){.shortage-product{content-visibility:auto;contain-intrinsic-size:auto 170px}}

.upload-tools-row>.file-picker{min-height:36px;height:36px;font-size:14px}.upload-tools-row>.file-picker>span{min-height:32px;padding:4px 8px}.upload-tools-row>.upload-tools>summary{padding-right:104px}

/* Keep every mobile panel within the usable screen, including safe areas. */
@media(max-width:700px){
  html,body{width:100%;min-width:0}
  header,main,.panel{width:100%;min-width:0;max-width:100%}
  .panel :where(div,article,details,summary,form,fieldset,label,p,strong,span){min-width:0}
  .panel :where(article,details,form,fieldset),.scroll{max-width:100%}
  .panel :where(p,strong,summary,label),.request-essential,.shortage-metrics,.feature-note{overflow-wrap:anywhere}
  .tabs button,.tabs button small,.panel button{white-space:normal;overflow-wrap:anywhere;max-width:100%}
  .lookup-grid>span,.compact-values>span,.sales-preview>span{min-width:0;overflow-wrap:anywhere}
  .data-date-bar summary span{white-space:normal;overflow-wrap:anywhere;max-width:100%}
  .data-date-bar summary::after{flex:0 0 auto}
  .future-order,.order-lines{max-width:100%;overflow-wrap:anywhere}
  .request-card-top{grid-template-columns:minmax(0,1fr) minmax(0,auto)}
  .request-quantity{max-width:100%;white-space:normal;overflow-wrap:anywhere;text-align:right}
  .feature-actions>*{min-width:0;max-width:100%}
  .rule-settings fieldset{min-inline-size:0;margin-inline:0}
  .row label{flex-wrap:wrap;max-width:100%}
  .row input[name=sku]{width:100%;flex:1 1 140px}
  .row select{max-width:100%;flex:0 1 112px}
  .shortage-toolbar{grid-template-columns:repeat(2,minmax(0,1fr))}
  .shortage-toolbar button{grid-column:1/-1;justify-self:start;white-space:normal}
  .shortage-actions{flex-wrap:wrap;max-width:100%}
  .shortage-top .shortage-actions{flex:0 1 auto;max-width:100%;flex-wrap:wrap}
  .lookup-card .sales-action-row{grid-template-columns:minmax(0,1fr) minmax(0,104px)}
  .lookup-card .sales-action-row>.sales-detail>summary{padding-right:112px}
  .sales-action-row .quick-shortage-button{width:100%;white-space:normal;overflow-wrap:anywhere}
  .upload-tools-row>.upload-tools>summary{padding-right:100px;overflow-wrap:anywhere}
  .upload-tools-row>.file-picker{max-width:96px}
  .scroll table{min-width:0;table-layout:fixed;font-size:12px}
  .scroll th,.scroll td{padding:6px 3px;overflow-wrap:anywhere}
}
@media(max-width:360px){
  .lookup-grid,.compact-values{column-gap:8px}
  .request-card-top{grid-template-columns:minmax(0,1fr)}
  .request-quantity{justify-self:start;text-align:left}
  .lookup-card,.batch-result{padding:10px}
}

.stock-export-preview{width:min(720px,calc(100% - 20px));max-width:calc(100% - 20px);max-height:calc(100dvh - 24px);padding:14px;border:1px solid var(--line);border-radius:12px;color:#172b40;background:#fff;overflow:auto;overscroll-behavior:contain}
.stock-export-preview::backdrop{background:#172b4070}.export-preview-head{display:flex;align-items:center;justify-content:space-between;gap:10px}.export-preview-head h2{margin:0}.export-preview-scope,.export-preview-warning{font-size:12px;line-height:1.5;overflow-wrap:anywhere}.export-preview-warning:empty{display:none}.export-preview-warning{color:#b45309}.export-preview-item{min-width:0;border-top:1px solid var(--line);padding:10px 0;overflow-wrap:anywhere;font-size:13px;line-height:1.5}.export-preview-item>strong{display:block}.export-preview-item p{margin:6px 0}.export-preview-item summary{min-height:32px;align-content:center;color:var(--costco-blue);cursor:pointer}.export-preview-footer{position:sticky;bottom:-14px;background:#fff;border-top:1px solid var(--line);display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;padding:10px 0}.export-preview-footer button{white-space:normal}.export-preview-footer [hidden]{display:none}

/* Scale the complete mobile workbench consistently, including controls. */
@media(max-width:700px){

 header{padding-top:calc(env(safe-area-inset-top,0px) + 5px);padding-bottom:5px}
 main{margin-top:7px}
 .tabs{margin-bottom:7px}
 .tabs button{min-height:40px;padding:4px 3px}
 .panel,.panel:has(>.upload-box){padding:9px}
 .data-date-bar{margin:0 0 5px}
 .data-date-bar summary{min-height:28px}
 input:not([type=checkbox]):not([type=file]),select,[data-file-search],.request-search-label input{font-size:16px;min-height:36px;padding:5px 8px;line-height:24px}
 [data-file-search],.request-search-label input{height:36px}
 .lookup-meta{margin:6px 0 4px}
 .lookup-card,.batch-result{padding:10px;margin:6px 0}
 .lookup-grid{gap:6px 10px;margin-top:8px}
 .lookup-card p{margin-top:7px}
 .lookup-card .future-order{margin:7px 0}
 .sales-preview{padding:7px;margin-top:7px}
 .lookup-card .sales-action-row{margin-top:6px}
 .lookup-card .sales-action-row>.sales-detail>summary{min-height:36px}
 .sales-action-row .quick-shortage-button{min-height:36px;padding:5px 8px}
 .replenishment-preview{margin-top:8px;padding-top:6px}
 .coverage-basis>summary,.calculation-basis>summary,.arrival-details>summary,.batch-box>summary,.rule-settings>summary{min-height:32px}
 .batch-box,.rule-settings{margin-top:7px;padding-top:5px}
}

/* Remove inherited source-footer spacing from the date header. */
.source-summary.data-date-bar{border-top:0;padding-top:0;margin:0 0 2px;line-height:1.35}
.source-summary.data-date-bar>summary{min-height:24px;padding:0;line-height:1.35}
.source-summary.data-date-bar[open]>div{margin:3px 0 6px}
.source-summary.data-date-bar+.upload-box>.upload-tools-row{margin-top:0}
@media(max-width:700px){
 .source-summary.data-date-bar{padding-top:0;margin:0 0 2px}
 .source-summary.data-date-bar>summary{min-height:24px}
}

/* Tighter date-to-upload header spacing. */
.source-summary.data-date-bar{margin-bottom:0}
.source-summary.data-date-bar>summary{min-height:20px;line-height:1.2}
.source-summary.data-date-bar+.upload-box>.upload-tools-row{margin-top:0;margin-bottom:2px}
.source-summary.data-date-bar+.upload-box>.upload-tools-row>.upload-tools>summary{min-height:30px;line-height:1.25;padding-top:0;padding-bottom:0}
.source-summary.data-date-bar+.upload-box>.upload-tools-row>.file-picker{min-height:30px;height:30px}
.source-summary.data-date-bar+.upload-box>.upload-tools-row>.file-picker>span{min-height:26px;padding:2px 7px}
@media(max-width:700px){
 .source-summary.data-date-bar{margin-bottom:0}
 .source-summary.data-date-bar>summary{min-height:20px}
}

/* Short lookup field and closely grouped sales actions. */
@media(max-width:700px){
 .upload-box>label>[data-file-search]{width:72%;max-width:280px;min-height:32px;height:32px;padding:3px 7px;line-height:24px;margin-top:2px}
 .lookup-meta{margin:4px 0 3px;line-height:1.3}
 .lookup-card .sales-action-row{grid-template-columns:88px minmax(0,1fr);column-gap:7px;margin-top:4px;padding-top:2px;align-items:start}
 .lookup-card .sales-action-row>.sales-detail>summary{width:88px;max-width:88px;min-height:30px;padding:0;font-size:12px;line-height:1.3}
 .sales-action-row .quick-shortage-button{width:auto;max-width:100%;justify-self:start;min-height:30px;padding:3px 8px;font-size:12px;border-radius:6px;line-height:1.3}
 .replenishment-preview{margin-top:5px;padding-top:5px}
}

/* Matched, shallow sales controls and a smaller lookup field. */
@media(max-width:700px){
 .upload-box>label>[data-file-search]{width:60%;max-width:220px;height:28px;min-height:28px;line-height:20px;padding:3px 6px;border-radius:6px;margin-top:2px}
 .lookup-card .sales-action-row{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:6px;align-items:start;margin-top:4px;padding-top:3px}
 .lookup-card .sales-action-row>.sales-detail>summary{display:flex;align-items:center;justify-content:center;gap:4px;width:calc((100% - 6px) / 2);max-width:none;height:28px;min-height:28px;padding:3px 6px;border:1px solid var(--line);border-radius:6px;background:var(--soft);font-size:12px;font-weight:700;line-height:1.25;list-style:none}
 .lookup-card .sales-action-row>.sales-detail>summary::-webkit-details-marker{display:none}
 .lookup-card .sales-action-row>.sales-detail>summary::marker{content:''}
 .lookup-card .sales-action-row>.sales-detail>summary::before{content:'▶';font-size:9px}
 .lookup-card .sales-action-row>.sales-detail[open]>summary::before{content:'▼'}
 .sales-action-row .quick-shortage-button{width:100%;max-width:100%;height:28px;min-height:28px;padding:3px 6px;justify-self:stretch;border-radius:6px;font-size:12px;line-height:1.25}
 .lookup-card .sales-action-row>.sales-detail[open] .sales-metrics{margin-top:5px}
 .replenishment-preview{margin-top:4px;padding-top:4px}
}

/* Phone-native sizing: no zoomed or oversized page canvas. */
@media(max-width:700px){
 html{width:100%;min-width:0;overflow-x:clip}
 body{width:100%;max-width:100%;min-width:0;margin:0;zoom:1;overflow-x:clip}
 :root{font-size:13px}
 header,main{width:100%;max-width:100%;min-width:0}
 header{padding:calc(env(safe-area-inset-top,0px) + 4px) max(8px,env(safe-area-inset-right)) 4px max(8px,env(safe-area-inset-left));gap:6px}
 .brand-logo{width:120px;height:36px}
 .brand-logo img{width:168px;height:168px;left:-24px;top:-63px}
 #offline-status{font-size:10px;max-width:100px}
 main{margin-top:5px;padding-left:max(6px,env(safe-area-inset-left));padding-right:max(6px,env(safe-area-inset-right));padding-bottom:max(8px,env(safe-area-inset-bottom))}
 .tabs{width:100%;grid-template-columns:repeat(4,minmax(0,1fr));gap:3px;margin-bottom:5px}
 .tabs button{width:100%;min-width:0;min-height:36px;padding:3px 1px;font-size:11px;gap:1px}
 .tabs button small{font-size:9px;line-height:1.2}
 .panel,.panel:has(>.upload-box){padding:7px;min-width:0;width:100%;max-width:100%}
 .panel>h2{display:none}
 .upload-tools-row>.upload-tools>summary{font-size:12px}
 .upload-box>label,.request-search-label{font-size:11px;line-height:1.3}
 input:not([type=checkbox]):not([type=file]),textarea,select{font-size:16px}
 .upload-box>label>[data-file-search]{font-size:16px}
 .lookup-meta{font-size:10px;margin:4px 0 3px}
 .lookup-card,.batch-result{padding:8px;margin:5px 0}
 .lookup-card>strong,.batch-result strong{font-size:12px;line-height:1.35}
 .lookup-grid,.compact-values{font-size:11px;line-height:1.35;gap:4px 7px;margin-top:6px}
 .lookup-card p,.batch-result p{font-size:11px;line-height:1.35;margin-top:5px}
 .lookup-card .future-order{margin:5px 0}
 .sales-preview{padding:5px 6px;margin-top:5px;gap:4px}
 .sales-preview span{font-size:10px;line-height:1.3}
 .sales-preview b{font-size:13px;margin-top:1px}
 .replenishment-preview{font-size:11px;line-height:1.35}
 .replenishment-preview>div{gap:5px;margin-top:2px}
 .lookup-card .replenishment-preview p,.coverage-basis,.arrival-status,.calculation-basis,.arrival-details{font-size:10px;line-height:1.35}
 .coverage-basis>summary,.calculation-basis>summary,.arrival-details>summary,.replenishment-explanation>summary,.batch-box>summary{min-height:26px;font-size:11px}
 .replenishment-explanation{font-size:11px;margin-top:3px}
 .batch-box{margin-top:5px;padding-top:3px;font-size:12px}
 .feature-note,.request-essential,.request-reason{font-size:11px;line-height:1.35}
 .query-metrics{font-size:11px}
 .query-metrics th,.query-metrics td{padding:4px 3px}
 .row,.feature-actions,.shortage-actions{max-width:100%;min-width:0}
 .scroll{width:100%;max-width:100%;overflow-x:clip}
 .scroll table{width:100%;min-width:0;table-layout:fixed}
}

/* Match the shortage note field to its search field. */
@media(max-width:700px){
 #shortagesForm .shortage-save-row input[name=note],.request-search-label input[data-shortage-search]{width:100%;max-width:100%;height:36px;min-height:36px;padding:5px 8px;font-size:16px;line-height:24px;border-radius:6px}
}

/* Match date and save controls to the compact shortage search. */
@media(max-width:700px){
 #shortagesForm .shortage-save-row{gap:5px;margin:5px 0;grid-template-columns:minmax(0,1fr) 78px}
 #shortagesForm .shortage-save-row input[name=day]{height:36px;min-height:36px;padding:5px 8px;font-size:16px;line-height:24px;border-radius:6px}
 #shortagesForm .shortage-save-row .primary{height:36px;min-height:36px;padding:5px 4px;font-size:12px;line-height:24px;border-radius:6px;white-space:nowrap}
}

/* Compact matched replenishment actions. */
@media(max-width:700px){
 .feature-actions:has(>[data-request-run]){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;margin:5px 0}
 .feature-actions>[data-request-run],.feature-actions>[data-request-export]{width:100%;height:36px;min-height:36px;padding:5px 7px;font-size:12px;line-height:24px;border-radius:6px;white-space:nowrap}
}

/* One mobile control size across all four workbench pages. */
@media(max-width:700px){
 :root{--mobile-control-height:36px}
 .panel input:not([type=checkbox]):not([type=radio]):not([type=file]),.panel select,.panel button,.stock-export-preview button{
  height:var(--mobile-control-height)!important;min-height:var(--mobile-control-height)!important;
  padding:5px 8px!important;border-radius:6px!important;line-height:24px!important;
 }
 .panel input:not([type=checkbox]):not([type=radio]):not([type=file]),.panel select{font-size:16px!important}
 .panel button,.stock-export-preview button{font-size:12px!important}
 .upload-box>label>[data-file-search]{width:100%;max-width:100%}
 .upload-tools-row>.file-picker{height:var(--mobile-control-height)!important;min-height:var(--mobile-control-height)!important;padding:0!important;font-size:12px}
 .upload-tools-row>.file-picker>span{height:var(--mobile-control-height);min-height:var(--mobile-control-height);padding:5px 8px;border-radius:6px;line-height:24px}
 .upload-tools-row>.upload-tools>summary{min-height:var(--mobile-control-height)!important;line-height:1.35}
 .lookup-card .sales-action-row>.sales-detail>summary{height:var(--mobile-control-height)!important;min-height:var(--mobile-control-height)!important;padding:5px 8px!important;line-height:24px!important}
 .shortage-top .shortage-delete{min-width:48px}
}

/* Larger phone navigation, always four equal columns. */
@media(max-width:700px){
 .tabs{width:100%;max-width:100%;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
 .tabs button{width:100%;max-width:100%;min-width:0;height:44px;min-height:44px;padding:5px 2px;gap:2px;font-size:13px;line-height:1.2;border-radius:9px}
 .tabs button small{font-size:10px;line-height:1.2;max-width:100%}
}

/* Slightly larger product text with a more relaxed reading rhythm. */
@media(max-width:700px){
 .lookup-card{padding:10px;margin:7px 0}
 .lookup-card>strong{font-size:14px;line-height:1.45}
 .lookup-card .lookup-grid{font-size:13px;line-height:1.45;gap:7px 10px;margin-top:9px}
 .lookup-card p{font-size:13px;line-height:1.45;margin-top:7px}
 .lookup-card .future-order{margin:8px 0}
 .lookup-card .sales-preview{padding:8px;margin-top:8px;gap:6px}
 .lookup-card .sales-preview span{font-size:12px;line-height:1.4}
 .lookup-card .sales-preview b{font-size:15px;margin-top:2px}
 .lookup-card .sales-action-row{margin-top:8px;padding-top:4px}
 .lookup-card .sales-action-row>.sales-detail>summary{font-size:13px}
 .lookup-card .sales-action-row .quick-shortage-button{font-size:13px!important}
 .lookup-card .replenishment-preview{font-size:13px;line-height:1.45;margin-top:8px;padding-top:7px}
 .lookup-card .replenishment-preview>div{gap:8px;margin-top:4px}
 .lookup-card .replenishment-preview p,.lookup-card .arrival-status,.lookup-card .coverage-basis,.lookup-card .calculation-basis,.lookup-card .arrival-details{font-size:12px;line-height:1.45}
 .lookup-card .coverage-basis>summary,.lookup-card .calculation-basis>summary,.lookup-card .arrival-details>summary,.lookup-card .replenishment-explanation>summary{min-height:30px;font-size:13px}
 .lookup-card .replenishment-explanation{margin-top:6px;font-size:12px}
 .lookup-card .query-metrics{font-size:12px}
 .lookup-card .query-metrics th,.lookup-card .query-metrics td{padding:6px 4px;line-height:1.4}
 .batch-box{margin-top:8px;padding-top:5px}
 .batch-box>summary{font-size:13px;min-height:30px}
}

/* Consistent hierarchy and spacing across the mobile workbench. */
@media(max-width:700px){
 :root{--line:#e0e5eb;--soft:#f7f9fb}
 .panel{border-radius:10px;padding:9px}
 .panel:has(>.upload-box){padding:9px}
 .lookup-card,.batch-result,.shortage-department{border-color:var(--line);border-radius:8px;background:#fff}
 .upload-box>label,.request-search-label,.request-filters label{font-size:12px;line-height:1.4}
 .lookup-meta,.shortage-count,[data-request-match]{font-size:11px;line-height:1.4;color:var(--muted)}
 .batch-result{padding:10px;margin:7px 0;font-size:12px;line-height:1.45}
 .batch-result strong,.shortage-name{font-size:13px;line-height:1.45}
 .batch-result .compact-values,.request-essential,.request-reason,.feature-note{font-size:12px;line-height:1.45}
 .batch-result .compact-values{gap:6px 10px;margin-top:7px}
 .shortage-entry{padding:9px 0;line-height:1.45}
 .shortage-metrics{font-size:12px;line-height:1.45;gap:6px 10px}
 .shortage-name{margin:6px 0}
 .shortage-department>summary{font-size:12px;padding:7px 9px}
 .shortage-note,.shortage-product-status{font-size:12px;line-height:1.45}
 .feature-actions,.shortage-toolbar{gap:6px;margin-top:7px;margin-bottom:7px}
 .rule-settings,.batch-box{border-top-color:var(--line)}
 .lookup-card .sales-action-row{column-gap:6px}
 .stock-export-preview{border-radius:10px}
 .stock-export-preview .export-preview-item{font-size:12px;line-height:1.45;padding:9px 0}
}

/* Department images stay readable and fit the phone preview. */
.shortage-toolbar{grid-template-columns:repeat(2,minmax(0,1fr))}
.shortage-toolbar [data-shortage-export],.shortage-toolbar [data-shortage-image-export]{grid-column:auto;justify-self:stretch}
.shortage-image-preview{width:min(430px,calc(100% - 20px));box-sizing:border-box}
.image-department{display:flex;align-items:center;gap:8px;font-size:13px}
.image-department select{flex:1;min-width:0;min-height:36px;font-size:16px}
.department-export-image{display:block;width:100%;height:auto;border:1px solid #ddd;box-sizing:border-box}
.department-export-image[hidden]{display:none}
.shortage-image-preview [data-image-status]{font-size:12px;line-height:1.5}
.shortage-image-preview .export-preview-footer{justify-content:stretch}
.shortage-image-preview .export-preview-footer button{flex:1}
.department-image-scroll{max-width:100%;overflow:auto;-webkit-overflow-scrolling:touch;margin-top:8px}
.department-image-scroll.is-zoomed .department-export-image{width:2400px;max-width:none}
.shortage-image-preview [data-image-zoom]{font-size:12px;min-height:32px}
.manual-pallet-field{display:flex;align-items:center;gap:6px;margin:8px 0;font-size:13px}
.manual-pallet-field input{width:100px;min-width:0;font-size:16px!important;min-height:36px;box-sizing:border-box}
.manual-pallet-field input[aria-invalid=true]{border-color:#e31837}
.manual-pallet-editor{margin:10px 0;border-top:1px solid var(--line);padding-top:8px}
.manual-pallet-editor>summary{font-size:13px;cursor:pointer}
.manual-pallet-editor>p{font-size:12px;color:var(--muted)}
.manual-pallet-row{padding:6px 0;border-bottom:1px solid var(--line)}
.manual-pallet-row>strong{font-size:12px;line-height:1.5;overflow-wrap:anywhere;display:block}
.manual-remark-field{display:block;font-size:12px;margin:6px 0 8px}
.manual-remark-field>span{display:block;margin-bottom:4px}
.manual-remark-field textarea{display:block;box-sizing:border-box;width:100%;min-width:0;resize:vertical;font-size:16px!important;line-height:1.4;padding:6px 8px;border:1px solid var(--line);border-radius:6px}
.manual-order-info{font-size:12px;line-height:1.5;margin:5px 0 7px}
.manual-order-info>span{font-weight:600}
.manual-order-info>p{white-space:pre-line;overflow-wrap:anywhere;margin:2px 0;color:var(--text,#172b40)}
@media(prefers-color-scheme:dark){.manual-order-info>p{color:#e5e7eb}}
