@media screen {
  /* The location list owns its scroll; toolbar and totals remain visible. */
  #warehouseCards {
    container: warehouse-cards / inline-size;
    display: block !important;
    height: var(--fh-warehouse-list-height, calc(100vh - 330px));
    max-height: var(--fh-warehouse-list-height, calc(100vh - 330px));
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 0 3px 2px 0;
  }
  #warehouseCards > .wh-category { margin: 0 0 7px !important; }
  #warehouseCards .wh-category-cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 5px !important;
    padding: 5px !important;
  }
  #warehouseCards .wh-category-cards > div > .grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 5px !important;
    margin: 5px 0 0 12px !important;
    padding-left: 8px !important;
  }
  #warehouseCards summary.wh-category-heading {
    min-height: 27px;
    padding: 3px 8px;
  }
  #warehouseCards .wh-category-heading h3 { min-width: 0; overflow-wrap: anywhere; font-size: 12px; line-height: 18px; }
  #warehouseCards .wh-category-heading span { flex: 0 1 auto; min-width: 0; text-align: right; overflow-wrap: anywhere; font-size: 11px; line-height: 16px; }
  #warehouseNetworkSummary .wh-overview > div { padding: 5px 8px; }
  #warehouseNetworkSummary .wh-overview strong { font-size: 14px; line-height: 20px; }
  #warehouseLocationsPanel > div:nth-child(2) { padding: 7px !important; }
  #warehouseLocationsPanel > div:nth-child(2) > div:nth-child(2) { margin-top: 5px !important; padding-top: 5px !important; }
  #warehouseLocationsPanel > div:nth-child(2) > div:nth-child(2) :is(input:not([type=checkbox]), select) { height: 28px; }
  #warehouseLocationsPanel > :is(#warehouseNetworkSummary, #warehouseCards) { margin-top: 6px !important; }

  :is([data-wh-category=main], [data-wh-category-nav=CENTRAL], [data-wh-brand=MAIN]) {
    --wh-solid: #0f766e; --wh-tone: #0f766e; --wh-soft: #f0fdfa; --wh-line: #99f6e4; --wh-secondary: #5eead4;
  }
  :is([data-wh-category=market-FLIPKART], [data-wh-category-nav=FLIPKART], [data-wh-brand=FLIPKART]) {
    --wh-solid: #2874f0; --wh-tone: #1d4ed8; --wh-soft: #eff6ff; --wh-line: #bfdbfe; --wh-secondary: #ffe500;
  }
  :is([data-wh-category=market-AMAZON], [data-wh-category-nav=AMAZON], [data-wh-brand=AMAZON]) {
    --wh-solid: #ff9900; --wh-tone: #232f3e; --wh-soft: #fff9ed; --wh-line: #fed7aa; --wh-secondary: #232f3e;
  }
  :is([data-wh-category=market-MEESHO], [data-wh-category-nav=MEESHO], [data-wh-brand=MEESHO]) {
    --wh-solid: #d81b83; --wh-tone: #a21caf; --wh-soft: #fdf2f8; --wh-line: #fbcfe8; --wh-secondary: #f9a8d4;
  }
  :is([data-wh-category=market-FLYINGHANDS], [data-wh-category=own], [data-wh-brand=FLYINGHANDS]) {
    --wh-solid: #ef4044; --wh-tone: #9f1239; --wh-soft: #fff1f2; --wh-line: #fecdd3; --wh-secondary: #fb7185;
  }
  [data-wh-brand=OTHER] { --wh-solid: #64748b; --wh-tone: #475569; --wh-soft: #f8fafc; --wh-line: #cbd5e1; --wh-secondary: #94a3b8; }

  #warehouseCards .wh-category-cards .wh-location-card {
    padding: 7px 9px !important;
    border: 1px solid var(--wh-line, #cbd5e1) !important;
    border-left: 3px solid var(--wh-solid, #0e7490) !important;
    border-radius: 6px;
    box-shadow: none !important;
    background: var(--fh-theme-surface, #fff);
    color: var(--fh-theme-copy, #111827);
  }
  #warehouseCards .wh-location-header {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto auto;
    align-items: center;
    gap: 8px;
    min-height: 25px;
  }
  #warehouseCards .wh-location-header > * { min-width: 0; max-width: 100%; }
  #warehouseCards .wh-location-header h4 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin: 0;
    color: var(--fh-theme-copy, #111827) !important;
    font: 700 13px/19px Inter, sans-serif;
    overflow-wrap: anywhere;
  }
  #warehouseCards .wh-location-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border-radius: 3px;
    padding: 0 4px;
    background: var(--fh-theme-surface-2, #f1f5f9);
    color: var(--fh-theme-muted, #475569);
    font: 600 10px/16px Inter, sans-serif;
    white-space: nowrap;
  }
  #warehouseCards .wh-location-main { background: #0f766e; color: #fff; }
  #warehouseCards .wh-location-restock { background: #fef3c7; color: #92400e; }
  #warehouseCards .wh-location-code {
    padding: 1px 5px;
    border: 1px solid var(--wh-line, #cbd5e1);
    border-bottom: 2px solid var(--wh-secondary, var(--wh-solid, #0e7490));
    border-radius: 3px;
    background: var(--wh-soft, #ecfeff);
    color: var(--wh-tone, #0e7490);
    font: 500 11px/16px monospace;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  #warehouseCards .wh-location-stock {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 5px;
    color: var(--fh-theme-copy, #111827);
  }
  #warehouseCards .wh-location-stock strong { font: 700 15px/20px Inter, sans-serif; white-space: nowrap; }
  #warehouseCards .wh-location-stock span { color: var(--fh-theme-muted, #475569); font: 500 11px/16px Inter, sans-serif; }
  #warehouseCards .wh-location-actions { display: flex; flex-wrap: nowrap; align-items: center; justify-self: end; gap: 5px; }
  #warehouseCards .wh-location-actions button:is(.hidden, [hidden], .fh-role-hidden, .fh-permission-hidden) { display: none !important; }
  #warehouseCards :is(.wh-location-actions button, .wh-location-toggle) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex: 0 0 auto;
    width: auto;
    min-width: 25px;
    min-height: 25px;
    padding: 0 7px;
    border: 1px solid var(--fh-theme-border, #e2e8f0);
    border-radius: 4px;
    background: var(--fh-theme-surface, #fff);
    color: var(--fh-theme-muted, #475569);
    font-size: 11px !important;
    line-height: 19px !important;
    white-space: nowrap;
    cursor: pointer;
  }
  #warehouseCards .wh-location-actions button[aria-label] { width: 25px; padding: 0; }
  #warehouseCards .wh-location-toggle { width: 21px; min-width: 21px; min-height: 21px; padding: 0; border: 0; }
  #warehouseCards .wh-location-actions button:hover { border-color: var(--wh-solid, #0e7490); color: var(--wh-tone, #0e7490); }
  #warehouseCards :is(.wh-location-actions button, .wh-location-toggle, .wh-location-details summary):focus-visible { outline: 2px solid #0891b2; outline-offset: 2px; }
  #warehouseCards .wh-location-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 3px 12px;
    margin: 2px 0 0;
    color: var(--fh-theme-muted, #475569);
    font: 400 11px/17px Inter, sans-serif;
  }
  #warehouseCards .wh-location-model { color: var(--wh-tone, #0e7490); font-weight: 500; }
  #warehouseCards .wh-location-details { min-width: 0; max-width: 100%; }
  #warehouseCards .wh-location-details summary { cursor: pointer; color: var(--fh-theme-muted, #475569); }
  #warehouseCards .wh-location-details > div { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 3px 0; overflow-wrap: anywhere; }
  #warehouseCards .wh-location-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 20px;
    margin: 4px 0 0;
    padding-top: 4px;
    border-top: 1px solid var(--fh-theme-border, #e2e8f0);
    font: 500 11px/17px Inter, sans-serif;
    color: var(--fh-theme-muted, #475569);
  }
  #warehouseCards .wh-location-stats > span { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 4px; }
  #warehouseCards .wh-location-stats strong { color: var(--fh-theme-copy, #111827); font-size: 12px; font-weight: 700; }
  #warehouseCards .wh-location-stats small { font-size: 10px; }
  #warehouseCards .wh-location-own-totals { margin: 3px 0 0; color: var(--fh-theme-muted, #475569); font: 400 10px/16px Inter, sans-serif; }
  #warehouseCards .wh-location-channels { display: flex; flex-wrap: wrap; gap: 3px 6px; margin-top: 3px; }
  #warehouseCards .wh-location-channels span { padding: 0 4px; border: 1px solid var(--wh-line, #cbd5e1); border-radius: 3px; color: var(--wh-tone, #0e7490); background: var(--wh-soft, #ecfeff); font: 500 10px/16px Inter, sans-serif; }

  #warehouseCards .fh-warehouse-titles, #warehouseCards .fh-warehouse-title-list { min-width: 0; max-width: 100%; }
  #warehouseCards .fh-warehouse-titles > div:first-child { flex-wrap: wrap; }
  #warehouseCards .fh-warehouse-titles > div:first-child strong { min-width: 0; overflow-wrap: anywhere; }
  #warehouseCards .fh-warehouse-titles input { flex: 1 1 180px; min-width: 0; max-width: 100%; }
  #warehouseCards .fh-warehouse-titles select { min-width: 0; max-width: 100%; }
  @container warehouse-cards (max-width: 920px) {
    #warehouseCards .wh-location-header { grid-template-columns: minmax(0, 1fr) auto auto; }
    #warehouseCards .wh-location-header h4 { grid-column: 1; grid-row: 1; }
    #warehouseCards .wh-location-code { grid-column: 2; grid-row: 1; }
    #warehouseCards .wh-location-stock { grid-column: 1 / span 2; grid-row: 2; }
    #warehouseCards .wh-location-actions { grid-column: 3; grid-row: 1 / span 2; }
  }
  @container warehouse-cards (max-width: 520px) {
    #warehouseCards .wh-location-header { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; }
    #warehouseCards .wh-location-header h4 { grid-column: 1 / -1; grid-row: 1; }
    #warehouseCards .wh-location-code { grid-column: 1; grid-row: 2; justify-self: start; }
    #warehouseCards .wh-location-stock { grid-column: 1 / -1; grid-row: 3; }
    #warehouseCards .wh-location-actions { grid-column: 2; grid-row: 2; }
    #warehouseCards .wh-category-heading { flex-wrap: wrap; gap: 2px 8px; }
    #warehouseCards .wh-location-meta { gap: 2px 8px; }
    #warehouseCards .wh-location-stats { gap: 3px 12px; }
  }
  @media (prefers-color-scheme: dark) {
    :is([data-wh-category=main], [data-wh-category-nav=CENTRAL], [data-wh-brand=MAIN]) { --wh-tone: #5eead4; --wh-soft: #042f2e; --wh-line: #115e59; }
    :is([data-wh-category=market-FLIPKART], [data-wh-category-nav=FLIPKART], [data-wh-brand=FLIPKART]) { --wh-tone: #93c5fd; --wh-soft: #172554; --wh-line: #1e40af; }
    :is([data-wh-category=market-AMAZON], [data-wh-category-nav=AMAZON], [data-wh-brand=AMAZON]) { --wh-tone: #ffb347; --wh-soft: #292015; --wh-line: #9a5f12; }
    :is([data-wh-category=market-MEESHO], [data-wh-category-nav=MEESHO], [data-wh-brand=MEESHO]) { --wh-tone: #f9a8d4; --wh-soft: #500724; --wh-line: #9d174d; }
    :is([data-wh-category=market-FLYINGHANDS], [data-wh-category=own], [data-wh-brand=FLYINGHANDS]) { --wh-tone: #fda4af; --wh-soft: #4c0519; --wh-line: #9f1239; }
    [data-wh-brand=OTHER] { --wh-tone: #cbd5e1; --wh-soft: #1e293b; --wh-line: #475569; }
  }
}

/* Location controls occupy three compact rows; the existing list owns scrolling. */
@media screen {
  #appShell #sview-warehouses{position:relative;container:warehouse-page / inline-size;margin-top:0!important}
  #appShell #sview-warehouses>#warehouseSectionTools{gap:4px;padding:3px 4px;margin:0;min-width:0}
  #appShell #sview-warehouses>#warehouseSectionTools button{height:23px;min-height:23px;padding:2px 6px!important;font-size:11px!important;line-height:17px!important;border-radius:5px;white-space:nowrap}
  #appShell #sview-warehouses>.pt-1{padding-top:0!important;margin-top:3px!important}
  #appShell #warehouseLocationsPanel{margin:0!important}
  #appShell #warehouseLocationsPanel>div:nth-child(2){display:grid;grid-template-columns:112px minmax(0,1fr);column-gap:5px;align-items:center;padding:3px 6px!important;margin:0!important}
  #appShell #warehouseLocationsPanel>div:nth-child(2)>div:first-child{display:contents}
  #appShell #warehouseLocationsPanel>div:nth-child(2)>div:first-child>div:first-child{grid-column:1;grid-row:1}
  #appShell #warehouseLocationsPanel>div:nth-child(2)>div:first-child h3{font-size:12px!important;line-height:18px!important;margin:0}
  #appShell #warehouseLocationsPanel>div:nth-child(2)>div:first-child>div:last-child{position:absolute;top:3px;right:4px;gap:4px;flex-wrap:nowrap}
  #appShell #warehouseLocationsPanel>div:nth-child(2)>div:first-child button{height:23px;min-height:23px;padding:2px 6px!important;font-size:11px!important;line-height:17px!important;border-radius:5px;white-space:nowrap}
  #appShell #sview-warehouses:has(#warehouseLocationsPanel:not(.hidden))>#warehouseSectionTools{padding-right:414px}
  #appShell #warehouseLocationsPanel>div:nth-child(2)>div:nth-child(2){grid-column:2;grid-row:1;display:grid;grid-template-columns:minmax(130px,1.4fr) minmax(100px,1fr) minmax(90px,.9fr) minmax(115px,1.15fr) minmax(85px,.8fr) minmax(110px,1fr) auto auto;gap:4px;align-items:center;margin:0!important;padding:0!important;border:0;min-width:0}
  #appShell #warehouseLocationsPanel>div:nth-child(2)>div:nth-child(2) :is(input:not([type=checkbox]),select){box-sizing:border-box;width:100%;min-width:0;max-width:none;height:23px;min-height:23px;margin:0;padding:2px 5px!important;font-size:11px!important;line-height:17px!important;border-radius:5px}
  #appShell #warehouseLocationsPanel>div:nth-child(2)>div:nth-child(2)>label{box-sizing:border-box;display:flex;align-items:center;gap:4px;min-height:23px;height:23px;padding:2px 5px;margin:0;font-size:11px!important;line-height:17px!important;white-space:nowrap;border-radius:5px}
  #appShell #whNeedsRestock{width:13px;height:13px;min-height:0;padding:0;margin:0;flex:none}
  #appShell #whResultCount{margin:0;font-size:10px!important;line-height:15px!important;white-space:nowrap;text-align:right}
  #appShell #warehouseLocationsPanel>#warehouseNetworkSummary{margin-top:3px!important}
  #appShell #warehouseNetworkSummary .wh-overview{gap:4px}
  #appShell #warehouseNetworkSummary .wh-overview>div{display:flex;align-items:center;justify-content:space-between;gap:5px;min-height:22px;padding:1px 7px}
  #appShell #warehouseNetworkSummary .wh-overview :is(span,small){font-size:11px!important;line-height:17px!important}
  #appShell #warehouseNetworkSummary .wh-overview strong{font-size:13px!important;line-height:18px!important}
  #appShell #warehouseLocationsPanel>#warehouseCards{margin-top:3px!important}
  @container warehouse-page (max-width:1120px){
    #appShell #sview-warehouses:has(#warehouseLocationsPanel:not(.hidden))>#warehouseSectionTools{padding-right:4px}
    #appShell #warehouseLocationsPanel>div:nth-child(2){display:block}
    #appShell #warehouseLocationsPanel>div:nth-child(2)>div:first-child{display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:6px;margin:0 0 4px}
    #appShell #warehouseLocationsPanel>div:nth-child(2)>div:first-child>div:last-child{position:static;flex-wrap:wrap}
    #appShell #warehouseLocationsPanel>div:nth-child(2)>div:nth-child(2){grid-template-columns:repeat(4,minmax(0,1fr))}
  }
  @container warehouse-page (max-width:650px){
    #appShell #warehouseLocationsPanel>div:nth-child(2)>div:first-child{flex-wrap:wrap}
    #appShell #warehouseLocationsPanel>div:nth-child(2)>div:nth-child(2){grid-template-columns:repeat(2,minmax(0,1fr))}
    #appShell #warehouseNetworkSummary .wh-overview{grid-template-columns:repeat(2,minmax(0,1fr))}
  }
}
