/* Fast inventory review: the same actions in cards or a compact list. */
.inventory-search { position: relative; width: 100%; min-width: 0; }
@media (min-width: 1200px) { .inventory-search { grid-area: search; } }
body:not([data-view="stock"]) .inventory-search { display: none; }
body[data-view="stock"] .topbar .inventory-search #search.search-main { width: 100% !important; min-width: 0 !important; max-width: none !important; margin: 0 !important; padding-right: 44px !important; }
.inventory-search input::-webkit-search-cancel-button { display: none; }
.inventory-search__clear { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 8px; padding: 0; background: transparent; color: var(--ds-muted); cursor: pointer; }
.inventory-search__clear svg { width: 19px; height: 19px; }
.inventory-search__clear:hover { color: var(--ds-text); background: #ffffff08; }
.inventory-search__clear:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: -4px; }
.inventory-active-filters { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 26px 0; padding: 6px 8px 6px 12px; border: 1px solid var(--ds-border); border-radius: 10px; background: var(--ds-inset); }
.inventory-active-filters > span { min-width: 0; overflow-wrap: anywhere; color: var(--ds-muted); font-size: 12px; line-height: 1.45; }
#inventoryClearFilters { flex-shrink: 0; min-height: 36px; padding: 6px 10px; font-size: 12px; color: var(--ds-accent); }
.inventory-search-sku { display: block; color: var(--ds-muted); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
#stockView .hl { border-radius: 2px; padding: 0; background: #294551; color: #e5f7ff; }
.inventory-viewbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 26px 0; }
.inventory-results { font-size: 12px; color: var(--ds-muted); }
.inventory-viewbar #bulkToggleBtn { margin-right: auto; min-height: 38px !important; }
.inventory-layout { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--ds-border); border-radius: 11px; background: var(--ds-inset); }
.inventory-layout button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ds-muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.inventory-layout button svg { width: 16px; height: 16px; }
.inventory-layout button[aria-pressed="true"] { background: var(--ds-elevated); color: var(--ds-text); border-color: #405768; }
.inventory-layout button:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }
.inventory-viewbar #densityToggle { margin: 0; }
body[data-inventory-layout="list"] #densityToggle { display: none; }
body[data-inventory-layout="list"] #stockView .grid { grid-template-columns: minmax(0, 1fr) !important; gap: 7px !important; }
body[data-inventory-layout="list"] #stockView .inventory-row { display: grid !important; grid-template-columns: 52px minmax(0, 1fr) 80px 170px auto; align-items: center; gap: 16px; min-height: 86px; padding: 12px !important; border-radius: 12px !important; }
body[data-inventory-layout="list"] #stockView .inventory-row .card__img { padding: 0 !important; width: 52px; height: 52px; min-height: 0 !important; aspect-ratio: 1 !important; border-radius: 8px; overflow: visible; }
body[data-inventory-layout="list"] #stockView .inventory-row .card__img img,
body[data-inventory-layout="list"] #stockView .inventory-row .card__image-placeholder { width: 52px; height: 52px !important; aspect-ratio: 1 !important; object-fit: cover; font-size: 9px; text-align: center; line-height: 1.2; }
body[data-inventory-layout="list"] #stockView .inventory-row .card__title { display: block !important; -webkit-line-clamp: unset; overflow: visible; min-height: 0 !important; margin: 0 !important; font-size: 13px !important; }
.inventory-row__identity { display: grid; gap: 6px; min-width: 0; }
.inventory-row__quantity { display: grid; justify-items: end; gap: 2px; color: var(--ds-muted); font-size: 11px; white-space: nowrap; }
.inventory-row__quantity strong { color: var(--ds-text); font-size: 23px; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; }
.inventory-row__quantity small { color: var(--ds-muted); font-size: 10px; font-weight: 400; letter-spacing: 0; }
.inventory-row__available { font-size: 9px; }
.inventory-row__movement { display: grid; gap: 4px; color: var(--ds-muted); font-size: 11px; line-height: 1.4; min-width: 0; overflow-wrap: anywhere; }
.inventory-row__movement time { font-size: 10px; }
.inventory-row__actions { display: flex; gap: 6px; }
#stockView .inventory-row__actions .btn { min-height: 40px; padding: 8px 11px !important; min-width: 0; font-size: 12px !important; border-radius: 8px !important; }
#stockView .inventory-row__actions .btn--primary { background: var(--ds-soft) !important; color: #85c3df !important; border: 1px solid #31515f !important; }
#stockView .inventory-row__actions .inventory-row__edit { flex: 0 0 40px; width: 40px; padding: 0 !important; }
.inventory-row__edit svg { width: 16px; height: 16px; }
body[data-inventory-layout="list"] #stockView .inventory-row .card__bulk-check { inset: 0; display: grid; place-items: center; padding: 0; width: 52px; height: 52px; background: #101820e8; }
.inventory-row .card__bulk-check span { display: none; }
.inventory-row .card__bulk-check input { width: 22px; height: 22px; margin: 0; }
@media (max-width: 1199px) {
  body[data-view="stock"] .topbar__actions.topbar__actions--search-first { grid-template-columns: minmax(0, 1fr) !important; }
  body[data-view="stock"] .topbar__actions > .inventory-search,
  body[data-view="stock"] .topbar__actions > .sort-refresh-row { grid-column: 1 / -1 !important; grid-row: auto !important; width: 100%; min-width: 0; }
  .inventory-active-filters { margin-inline: 18px; }
  .inventory-viewbar { margin-inline: 18px; }
  body[data-inventory-layout="list"] #stockView .inventory-row { grid-template-columns: 52px minmax(0, 1fr) 76px auto; gap: 12px; }
  .inventory-row__movement { display: none; }
}
@media (max-width: 767px) {
  .inventory-active-filters { margin-inline: 12px; gap: 6px; padding: 6px 8px; }
  .inventory-active-filters > span { font-size: 11px; }
  #inventoryClearFilters { min-height: 44px; max-width: 114px; padding-inline: 8px; font-size: 11px; line-height: 1.4; }
  .inventory-viewbar { margin: 12px 12px 0; gap: 6px; }
  .inventory-results { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .inventory-viewbar #bulkToggleBtn { min-height: 44px !important; }
  .inventory-layout button { min-height: 38px; padding-inline: 9px; }
  body[data-inventory-layout="list"] #stockView .inventory-row { grid-template-columns: 44px minmax(0, 1fr) 67px; gap: 8px 10px; padding: 12px !important; }
  body[data-inventory-layout="list"] #stockView .inventory-row .card__img,
  body[data-inventory-layout="list"] #stockView .inventory-row .card__img img,
  body[data-inventory-layout="list"] #stockView .inventory-row .card__image-placeholder,
  body[data-inventory-layout="list"] #stockView .inventory-row .card__bulk-check { width: 44px; height: 44px !important; }
  .inventory-row__actions { grid-column: 2 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; }
  #stockView .inventory-row__actions .btn { min-height: 44px; padding: 7px 6px !important; font-size: 11px !important; }
  #stockView .inventory-row__actions .inventory-row__edit { width: 44px; }
  .inventory-row__available { display: none; }
  .inventory-row__quantity strong { font-size: 22px; }
  .inventory-row__quantity { font-size: 10px; }
}
@media (pointer: coarse) { .inventory-layout button, #stockView .inventory-row__actions .btn { min-height: 44px; } }

/* A rotated phone needs working space, not the taller tablet overview. */
@media (min-width: 768px) and (max-width: 1199px) and (max-height: 520px) {
  body[data-view="stock"] .topbar { padding: 8px 14px !important; gap: 6px !important; }
  body[data-view="stock"] .topbar__row--main { min-height: 44px; }
  body[data-view="stock"] #viewSubtitle { display: none !important; }
  body[data-view="stock"] #viewTitle { font-size: 21px !important; }
  body[data-view="stock"] .topbar__actions.topbar__actions--search-first { grid-template-columns: minmax(0, 1fr) minmax(230px, .8fr) !important; gap: 8px !important; }
  body[data-view="stock"] .topbar__actions > .inventory-search { grid-column: 1 !important; }
  body[data-view="stock"] .topbar__actions > .sort-refresh-row { grid-column: 2 !important; margin: 0 !important; }
  body[data-view="stock"] .topbar .inventory-search #search.search-main,
  body[data-view="stock"] .sort-refresh-row #sortBy { min-height: 44px !important; height: 44px !important; padding-block: 8px !important; font-size: 14px !important; }
  body[data-view="stock"] #refresh { min-height: 44px !important; height: 44px !important; min-width: 44px !important; width: 44px !important; }
  #stockView { display: grid; grid-template-columns: minmax(260px, .9fr) minmax(310px, 1fr); }
  #stockView > * { min-width: 0; grid-column: 1 / -1; }
  #stockView .kpis { padding: 8px 14px 0 !important; gap: 8px !important; }
  #stockView .kpi { min-height: 44px !important; padding: 6px 10px !important; }
  #stockView .kpi__body { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; }
  #stockView .kpi__label { font-size: 10px !important; line-height: 1.25; }
  #stockView .kpi__value { font-size: 22px !important; line-height: 1; }
  #stockView #statusFilters { grid-column: 1; grid-row: 2; align-items: center; flex-wrap: nowrap; padding: 6px 0 0 14px !important; gap: 2px !important; }
  #stockView #statusFilters .chip { min-height: 44px !important; padding: 8px !important; font-size: 11px !important; }
  #stockView .inventory-viewbar { grid-column: 2; grid-row: 2; justify-content: flex-end; flex-wrap: nowrap; margin: 6px 14px 0 8px; gap: 6px; }
  #stockView .inventory-results, #stockView #densityToggle { display: none; }
  #stockView .inventory-viewbar #bulkToggleBtn { min-height: 44px !important; padding-inline: 8px; font-size: 11px; margin-right: 0; }
  #stockView .inventory-layout button { min-height: 44px; padding-inline: 8px; }
  #stockView .inventory-active-filters { grid-row: 3; margin: 6px 14px 0; }
  #stockView #inventoryClearFilters { min-height: 44px; }
  #stockView #grid { grid-template-columns: minmax(0, 1fr) !important; padding: 8px 14px 14px !important; margin-top: 0 !important; gap: 8px !important; }
  body:not([data-inventory-layout="list"]) #stockView .card { display: grid !important; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 10px !important; min-height: 0 !important; }
  body:not([data-inventory-layout="list"]) #stockView .card__img { width: 76px; height: 76px; margin: 0 !important; padding: 0 !important; }
  body:not([data-inventory-layout="list"]) #stockView .card__img img,
  body:not([data-inventory-layout="list"]) #stockView .card__image-placeholder { width: 76px; height: 76px !important; aspect-ratio: 1 !important; }
  body:not([data-inventory-layout="list"]) #stockView .card__body { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(125px, .45fr); gap: 5px 12px !important; padding: 0 !important; }
  body:not([data-inventory-layout="list"]) #stockView .card__title { min-height: 0 !important; margin: 0 !important; font-size: 13px !important; }
  body:not([data-inventory-layout="list"]) #stockView .card__availability,
  body:not([data-inventory-layout="list"]) #stockView .inventory-search-sku { grid-column: 1; }
  body:not([data-inventory-layout="list"]) #stockView .card__split { grid-column: 2; grid-row: 1 / span 3; padding: 6px 10px !important; margin: 0 !important; align-self: start; }
  body:not([data-inventory-layout="list"]) #stockView .card__meta,
  body:not([data-inventory-layout="list"]) #stockView .card__obs { display: none; }
  body:not([data-inventory-layout="list"]) #stockView .card__footer { grid-column: 1 / -1; margin: 0 !important; padding-top: 2px !important; }
  #stockView .card__actions-inline .btn,
  #stockView .card__img-top-right .btn { min-height: 44px !important; height: 44px !important; }
  #stockView .card__img-top-right .btn { min-width: 44px !important; width: 44px !important; }
}


