.pilot-shell #catalog-view {
  --stock-line: #e2e8ed;
  --stock-grid: #e9edef;
  --stock-positive: #1f573f;
  --stock-positive-bg: #e5f3df;
  --stock-sum: #eaf0ff;
  max-width: none;
  padding: 0 clamp(12px,1.5vw,26px) 6px;
}
.pilot-shell #catalog-title {
  margin:0;color:var(--ink);font-size:19px;font-weight:680;line-height:1.1;letter-spacing:-.035em;
}
#catalog-switch-slot:empty {display:none}
#catalog-view .catalog-controls {padding:8px 0}
.catalog-switch,.stock-metrics {display:inline-flex;align-items:center;gap:2px}
.catalog-switch {padding:2px;background:#edf0f5;border-radius:6px}
.catalog-switch button,.stock-metrics button {font:inherit;white-space:nowrap;transition:background-color .12s,color .12s}
.catalog-switch button {padding:4px 10px;border-radius:4px;background:transparent;color:#526077;font-size:12px;font-weight:600}
.catalog-switch button[aria-pressed=true] {background:white;color:var(--ink);box-shadow:0 1px 3px #2137521c}
.stock-sheet-bar {display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid #dbe1e8}
.stock-tabs {display:flex;align-items:stretch;gap:clamp(8px,1.6vw,25px);min-width:0;max-width:100%;overflow-x:auto;scrollbar-width:thin}
.stock-tab {
  --group-ink:#425887;--group-tint:#e7edfa;
  position:relative;display:flex;align-items:center;justify-content:center;gap:7px;flex:none;
  padding:5px 3px 6px;background:transparent;color:#47566a;font-size:13px;font-weight:600;white-space:nowrap;
}
.stock-tab[data-group=jeans] {--group-ink:#3b6093;--group-tint:#e2ecfa}
.stock-tab[data-group=shoes] {--group-ink:#98613c;--group-tint:#f6e9da}
.stock-tab[data-group=accessories] {--group-ink:#38695e;--group-tint:#deeee7}
.stock-tab svg {box-sizing:content-box;width:16px;height:16px;padding:3px;border-radius:5px;color:var(--group-ink);background:var(--group-tint)}
.stock-tab[aria-selected=true] {color:#16223a}
.stock-tab[aria-selected=true]::after {content:'';position:absolute;height:3px;bottom:0;inset-inline:2px;background:var(--group-ink);border-radius:2px 2px 0 0}
.stock-tab:hover:not(:disabled) {color:var(--group-ink)}
.stock-tab:focus-visible {outline-offset:-3px}
.stock-location {display:flex;align-items:center;gap:6px;color:#435366;font-size:12px;font-weight:600;white-space:nowrap}
.stock-location svg {height:15px;width:15px}
.stock-stamp {font-size:11px;font-weight:450;color:#657489;padding-left:10px;margin-left:4px;border-left:1px solid #ced6df}
.stock-tools {display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:6px 0}
.stock-tools .stock-query {flex:1 1 200px;max-width:345px;height:32px;min-width:0;background:white;border:1px solid #d9e1e9;border-radius:6px}
.stock-query input {height:100%}
.stock-tools select {height:32px;padding:0 26px 0 9px;min-width:112px;border:1px solid #d9e1e9;border-radius:6px;background-color:white;font-size:12px}
.stock-only {display:inline-flex;align-items:center;gap:6px;font-size:12px;white-space:nowrap;color:#3f5166;cursor:pointer}
.stock-only input {appearance:none;position:relative;width:27px;height:16px;margin:0;padding:0;border:0;border-radius:8px;background:#c7d0da;cursor:pointer}
.stock-only input::after {content:'';position:absolute;top:3px;left:3px;width:10px;height:10px;border-radius:50%;background:white}
.stock-only input:checked {background:#466552}
.stock-only input:checked::after {left:14px}
.stock-metrics {margin-left:auto;background:#e9edf2;padding:3px;border-radius:6px}
.stock-metrics button {padding:5px 10px;border-radius:4px;color:#49576a;background:transparent;font-size:12px;font-weight:550}
.stock-metrics button[aria-pressed=true] {background:#2e3f51;color:#fff}
.stock-scroll {
  max-width:100%;overflow:auto;
  overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#bbc6ce transparent;
  background:white;
}
.stock-scroll:focus-visible {outline:2px solid #526ab8;outline-offset:2px}
.stock-table {min-width:100%;border-spacing:0;border-collapse:separate;font-size:13px;line-height:1.3;font-variant-numeric:tabular-nums;color:#2d3b4d}
.stock-table th,.stock-table td {padding:5px 8px;text-align:center;border:0;border-right:1px solid var(--stock-grid);border-bottom:1px solid var(--stock-line)}
.stock-table thead th {
  position:sticky;top:0;z-index:3;height:36px;min-width:44px;background:#eff3f5;color:#48586a;
  font-size:12px;font-weight:650;white-space:nowrap;border-bottom-color:#cdd8df;
}
.stock-table .stock-product-head,.stock-table .stock-name {
  position:sticky;left:0;z-index:2;width:29%;min-width:210px;max-width:340px;text-align:left;
  border-right-color:#d4dde4;
}
.stock-table .stock-product-head {z-index:5;padding-left:12px}
.stock-table .stock-name {background:#fff;padding:4px 11px}
.stock-identity {display:flex;align-items:center;gap:10px;min-height:42px}
.stock-photo {position:relative;width:38px;height:42px;flex:none;display:grid;place-items:center;overflow:hidden;border-radius:5px;color:#8795a5;background:#f0f2f2}
.stock-photo svg {width:18px;height:18px}
.stock-photo img {position:absolute;inset:0;width:100%;height:100%;object-fit:cover;background:#f1f2ef}
.stock-photo img:not([src]) {visibility:hidden}
.stock-product-text {display:block;min-width:0}
.stock-name strong {display:block;color:#233144;font-size:13px;font-weight:620;line-height:1.26;overflow-wrap:anywhere}
.stock-product-meta {display:flex;flex-wrap:wrap;align-items:center;gap:3px 8px;margin-top:3px;font-size:11px;font-weight:450;color:#627283}
.stock-product-meta .stock-folder {padding-left:7px;border-left:1px solid #ced6dc}
.stock-product-meta .stock-folder:first-child {padding-left:0;border:0}
.stock-size,.stock-subtotal {background:#fff}
.stock-size[data-tone=positive] {background:var(--stock-positive-bg);color:var(--stock-positive);font-weight:650}
.stock-table[data-metric=reserve] .stock-size[data-tone=positive] {background:#fff0d7;color:#795016}
.stock-size[data-tone=zero] {color:#758494}
.stock-table [data-tone=negative] {color:#9b4039;background:#fae8e5}
.stock-table [data-tone=unknown] {color:#647181;font-size:11px}
.stock-table [data-tone=unknown] .stock-amount {display:inline-block;max-width:7ch;line-height:1.15}
.stock-table .stock-sum {position:sticky;right:0;z-index:1;min-width:67px;background:var(--stock-sum);color:#263f79;border-right:0;border-left:1px solid #c8d5ed;font-weight:720}
.stock-table thead .stock-sum {z-index:5;background:#dfe8fc}
.stock-table .stock-total[data-tone=negative] {color:#982e2e;background:#f8e2df}
.stock-table .stock-total[data-tone=unknown] {color:#576982}
.stock-table tbody tr:hover .stock-name,.stock-table tbody tr:hover .stock-absent {background:#f5f8fb}
.stock-table tfoot th,.stock-table tfoot td {position:sticky;bottom:0;z-index:3;height:36px;background:#eaf0f4;color:#304555;border-top:1px solid #cbd7dd;border-bottom:0;font-size:12px;font-weight:700}
.stock-table tfoot .stock-name {z-index:4;background:#eaf0f4}
.stock-table tfoot .stock-grand {z-index:4;color:#fff;background:#283e61}
.stock-table tfoot .stock-grand[data-tone=negative] {background:#873b3b}
.stock-no-results {display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:10px;padding:28px 15px;color:var(--quiet);font-size:13px}
@media (min-width:701px) {
  /* Let the matrix use the space left by the actual toolbar, including when filters wrap. */
  #main:has(#catalog-view:not([hidden]) .stock-panel) {
    height:100dvh;display:flex;flex-direction:column;
  }
  #page-content:has(#catalog-view:not([hidden]) .stock-panel),
  #catalog-view:not([hidden]):has(.stock-panel),
  #catalog:has(.stock-panel),#catalog > div:has(> .stock-panel),.stock-panel {
    display:flex;flex-direction:column;flex:1;min-height:0;
  }
  .stock-sheet-bar,.stock-tools {flex:none}
  .stock-scroll {min-height:0}
}
@media (max-width:1080px) {
  .stock-stamp {display:block;border:0;margin:0;padding:0}
  .stock-location {display:grid;grid-template-columns:auto auto;gap:1px 6px}
  .stock-location svg {grid-row:span 2}
  .stock-table .stock-name,.stock-table .stock-product-head {min-width:175px}
}
@media (max-width:700px) {
  .pilot-shell #catalog-view {padding-inline:12px}
  .catalog-switch button {font-size:12px;padding:6px 8px}
  .stock-sheet-bar {display:flex;flex-direction:column-reverse;align-items:stretch;gap:3px}
  .stock-location {display:flex;flex-wrap:wrap;align-items:center;gap:5px;font-size:11px}
  .stock-location svg {width:13px;height:13px}
  .stock-stamp {margin-left:auto;font-size:10px}
  .stock-tabs {gap:13px}
  .stock-tab {font-size:12px;gap:4px;padding:6px 0}
  .stock-tab svg {width:14px;height:14px;padding:3px}
  .stock-tools {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px;padding:7px 0}
  .stock-tools .stock-query {max-width:none;width:100%}
  .stock-tools select {width:100%;min-width:0}
  .stock-tools select[hidden] {display:none}
  .stock-tools:has(select[hidden]) .stock-query {grid-column:1/-1}
  .stock-metrics {grid-row:2;grid-column:1;justify-self:start;margin:0}
  .stock-metrics button {padding:4px 7px;font-size:11px}
  .stock-only {grid-row:2;grid-column:2;justify-self:end}
  .stock-scroll {overflow:visible;max-height:none;background:transparent}
  .stock-table,.stock-table tbody,.stock-table tfoot {display:block}
  .stock-table thead {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  .stock-table tbody tr {display:flex;align-items:center;flex-wrap:wrap;gap:5px;padding:7px 9px;background:white;border-bottom:1px solid var(--stock-line)}
  .stock-table tbody td,.stock-table tbody th {position:static;min-width:0;padding:0;border:0}
  .stock-table tbody .stock-name {order:0;max-width:none;min-width:0;flex:1 1 calc(100% - 59px);width:auto;padding:0;background:transparent}
  .stock-identity {min-height:34px;gap:7px}
  .stock-photo {width:31px;height:34px}
  .stock-name strong {font-size:12px}
  .stock-product-meta {font-size:10px}
  .stock-table tbody .stock-total {order:1;flex:0 0 54px;min-width:54px;max-width:54px;padding:4px;border:0;border-radius:4px;font-size:13px;line-height:1.1}
  .stock-total::before {content:'Итого';display:block;font-size:9px;font-weight:500;margin-bottom:2px}
  .stock-table tbody .stock-size {order:2;display:flex;align-items:center;gap:6px;min-width:30px;padding:3px 6px;border:1px solid #e1e7eb;border-radius:3px;font-size:12px;line-height:1.15}
  .stock-size::before {content:attr(data-label);font-size:10px;font-weight:500}
  .stock-size .stock-amount {padding-left:5px;border-left:1px solid #becdc3;font-weight:650}
  .stock-size:not([data-tone=unknown]) .stock-amount::after {content:' шт.';font-size:9px;font-weight:450}
  .stock-table tbody .stock-absent {display:none}
  .stock-table tfoot tr {display:flex;align-items:center;background:#eaf0f4}
  .stock-table tfoot .stock-name {position:static;flex:1;min-width:0;height:auto;border:0;padding:10px}
  .stock-table tfoot .stock-subtotal {display:none}
  .stock-table tfoot .stock-grand {position:static;display:grid;place-items:center;min-width:68px;border:0}
}
@media (max-width:540px) {
  .pilot-shell .topbar:has(#catalog-switch-slot:not(:empty):not([hidden])) {
    flex-wrap:wrap;height:auto;row-gap:0;padding-bottom:4px;
  }
  #catalog-switch-slot {order:1;flex:0 0 100%}
}
@media (max-width:375px) {
  .stock-tabs {gap:10px}
  .stock-tab svg {display:none}
}
