.inventory-request-status {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border: 1px solid var(--line, #39434e);
  border-radius: 12px;
  color: var(--text, #f4f5f7);
  background: var(--surface-strong, #17212b);
  box-shadow: 0 6px 24px #0004;
  pointer-events: none;
  font-size: 14px;
}
.inventory-request-status[hidden] { display: none; }
.toast { z-index: 10001; }

.toast:not(.hidden) ~ .inventory-request-status { visibility: hidden; }
.inventory-request-status.is-loading::before,
button.inventory-action-pending::after,
.inventory-inline-loading::before,
.inventory-beta-shell .inventory-beta-loading-target:empty::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: inventory-request-spin .8s linear infinite;
}
.inventory-inline-loading { display: inline-flex; align-items: center; gap: 10px; }
.inventory-beta-shell .inventory-beta-loading-target:empty { gap: 10px; align-content: center; }
.inventory-beta-shell .inventory-beta-loading-target:empty::before { padding-left: 0; background: none; }
button.inventory-action-pending::after { margin-left: 8px; vertical-align: middle; }
button.inventory-action-pending { cursor: progress; }
@keyframes inventory-request-spin { to { transform: rotate(360deg); } }
@keyframes inventory-request-pulse { 50% { opacity: .35; } }

:root.performance-lite .inventory-request-status.is-loading::before,
:root.performance-lite button.inventory-action-pending::after,
:root.performance-lite .inventory-inline-loading::before,
:root.performance-lite .inventory-beta-shell .inventory-beta-loading-target:empty::after {
  animation: var(--inventory-loading-animation, inventory-request-spin .8s linear infinite) !important;
}
@media (prefers-reduced-motion: reduce) {
  :root { --inventory-loading-animation: inventory-request-pulse 1.6s steps(2, end) infinite; }
  .inventory-request-status.is-loading::before,
  button.inventory-action-pending::after,
  .inventory-inline-loading::before,
  .inventory-beta-shell .inventory-beta-loading-target:empty::after {
    animation: inventory-request-pulse 1.6s steps(2, end) infinite;
  }
}
.inventory-stock-search { grid-column: 1 / -1; display: grid; gap: 8px; width: 100%; }
.inventory-stock-search label { display: grid; gap: 6px; font-weight: 600; }
.inventory-stock-search input { width: 100%; min-width: 0; }
.inventory-stock-search [role="status"] { color: var(--muted); font-size: 13px; }
.inventory-stock-empty { grid-column: 1 / -1; color: var(--muted); }
.inventory-stock-search [hidden],
.inventory-special-category-grid [hidden],
.inventory-stock-empty[hidden] { display: none !important; }
.device-trace-body .log-detail-lines { display: grid; gap: 12px; }
.device-trace-body .log-detail-line {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line, #39434e);
  border-radius: 10px;
  background: var(--surface, #17212b);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.device-trace-body .log-detail-line time { font-weight: 600; }
.device-trace-body .log-detail-line small { color: var(--muted); }
.device-trace-body .supply-history-distribution { min-width: 0; }
.device-trace-body .supply-history-distribution-table { overflow-x: auto; max-width: 100%; }

body #device-trace-drawer.drawer { z-index: 6301; }
.warehouse-unit-action-modal { width: min(1100px, 100%); overflow-x: hidden; }
.warehouse-unit-action-body, .warehouse-unit-action-history {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
}
.warehouse-unit-action-summary { grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); }
body #supply-history-drawer.drawer .drawer-sheet,
body #device-trace-drawer.drawer .drawer-sheet {
  inset: 24px 0;
  width: min(1180px, calc(100% - 48px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  margin: 0 auto;
  padding: 20px 22px calc(24px + var(--safe-bottom));
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  border: 1px solid var(--ib-border-strong, var(--line));
  border-radius: 20px;
}
body #supply-history-drawer.drawer .drawer-head,
body #device-trace-drawer.drawer .drawer-head {
  position: sticky;
  top: -20px;
  margin: -20px -22px 0;
  padding: 16px 22px;
  z-index: 20;
  align-items: center;
  border-bottom: 1px solid var(--ib-border, var(--line));
  background: var(--ib-surface, var(--surface-strong));
}
:is(.supply-history-sheet, #supply-page-list, .warehouse-unit-action-modal) :is(.log-details, .log-item, .supply-history-distribution, .supply-history-items, .log-detail-row),
.supply-history-sheet > :not(.drawer-head) {
  min-width: 0;
  max-width: 100%;
  align-content: start;
}
:is(.supply-history-sheet, #supply-page-list) .panel-head { flex-wrap: wrap; }
:is(.supply-history-sheet, #supply-page-list) :is(.panel-head, .log-meta) > * {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
:is(.supply-history-sheet, #supply-page-list, .warehouse-unit-action-modal) .log-detail-row > * { min-width: 0; overflow-wrap: anywhere; }
:is(.supply-history-sheet, #supply-page-list, .warehouse-unit-action-modal) .supply-history-distribution-table {
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-x: contain;
}
:is(.supply-history-sheet, #supply-page-list, .warehouse-unit-action-modal) .supply-history-distribution-table table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
}
:is(.supply-history-sheet, #supply-page-list, .warehouse-unit-action-modal) .supply-history-distribution-table :is(th, td) {
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}
@media (max-width: 760px) {
  body #supply-history-drawer.drawer .drawer-sheet,
  body #device-trace-drawer.drawer .drawer-sheet {
    inset: 0;
    width: 100%;
    max-height: 100dvh;
    padding: max(16px, var(--safe-top)) 12px max(20px, var(--safe-bottom));
    border: 0;
    border-radius: 0;
  }
  body #supply-history-drawer.drawer .drawer-head,
  body #device-trace-drawer.drawer .drawer-head {
    top: calc(-1 * max(16px, var(--safe-top)));
    margin: calc(-1 * max(16px, var(--safe-top))) -12px 0;
    padding: max(12px, var(--safe-top)) 12px 12px;
  }
}
