/* Supply workspace: compact operational layout. */
#supplyOrderNoticesTitle:focus { outline: none; }

body {
  min-width: 320px;
}

body:not(.supply-selection-mode) main {
  padding: 8px 10px 10px;
}

.workspace-supply-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 30px;
  padding: 3px 14px 5px;
  color: #17233a;
  font-size: 16px;
  line-height: 22px;
}

.workspace-supply-summary strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supply-overview-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

body:not(.supply-selection-mode) .supply-overview-row .stats {
  flex: 1 1 608px;
  grid-template-columns: repeat(3, minmax(152px, 1fr));
  max-width: 720px;
  min-width: 496px;
  margin: 0;
}

body:not(.supply-selection-mode) .supply-overview-row .stats article {
  min-height: 46px;
  padding: 6px 12px;
}

.supply-overview-row .workspace-assembly-toggle {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 12px;
  white-space: nowrap;
}

.supply-overview-row .workspace-supply-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.supply-overview-row .workspace-supply-actions button {
  min-height: 34px;
  padding: 7px 12px;
  white-space: nowrap;
}

body:not(.supply-selection-mode) .scanner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  min-height: 62px;
  padding: 9px 10px;
}

body:not(.supply-selection-mode) .scanner input {
  grid-column: 1;
  grid-row: 1;
  height: 44px;
  font-size: 20px;
}

body:not(.supply-selection-mode) .scanner-actions {
  grid-column: 2;
  grid-row: 1;
  flex-wrap: nowrap;
}

#supplyWorkspaceView .scanner {
  grid-template-columns: minmax(0, 1fr) auto;
}

#supplyWorkspaceView .scanner-printer-status {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: start;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

#supplyWorkspaceView .printer-ready,
#supplyWorkspaceView .assembly-status {
  color: #146c43;
  background: #e5f7ed;
}

#supplyWorkspaceView #scanMessage {
  grid-column: 1 / -1;
  grid-row: 3;
  margin: 0;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

#ordersTable .last-scanned-order {
  outline: 3px solid #2762e8;
  outline-offset: -3px;
  scroll-margin-block: 100px;
}

@media (max-width: 600px) {
  #supplyWorkspaceView .scanner { grid-template-columns: minmax(0, 1fr); }
  #supplyWorkspaceView .scanner-actions { grid-column: 1; grid-row: 2; }
  #supplyWorkspaceView .scanner-printer-status { grid-row: 3; }
  #supplyWorkspaceView #scanMessage { grid-row: 4; }
}

body:not(.supply-selection-mode) .orders-card {
  height: auto;
  min-height: 0;
  padding: 10px;
}

body:not(.supply-selection-mode) .orders-card .section-title {
  align-items: center;
  min-height: 38px;
}

body:not(.supply-selection-mode) .orders-card .section-title h2 {
  margin: 0;
  font-size: 23px;
}

body:not(.supply-selection-mode) .orders-card #supplyMeta,
body:not(.supply-selection-mode) .orders-card #completionHint {
  display: none;
}

body:not(.supply-selection-mode) .orders-card .section-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
}

body:not(.supply-selection-mode) .orders-card .section-actions > * {
  flex: 0 0 auto;
}

body:not(.supply-selection-mode) .orders-card .table-wrap {
  flex: 0 0 auto;
  min-height: auto;
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  margin-top: 8px;
}

.floating-horizontal-scroll {
  position: fixed;
  z-index: 45;
  bottom: 0;
  height: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #eef3f9;
  border: 1px solid #cbd6e5;
  border-bottom: 0;
  box-shadow: 0 -2px 7px rgba(22, 39, 68, .14);
}

.floating-horizontal-scroll[hidden] { display: none; }
.floating-horizontal-scroll-content { height: 1px; }

/* Shared WB directory layout; wide tables scroll inside their cards. */
body.supply-selection-mode main,
body:has(#dbwNewView:not([hidden])) main { padding: 10px 16px 36px; }
.supply-selection-view,
#dbwNewView,
#dbwLoadingView { width: min(1800px,100%); margin: 12px auto 0; }
body.supply-selection-mode #wbFulfillmentNavigation,
body:has(#dbwNewView:not([hidden])) #wbFulfillmentNavigation {
  width: min(1800px,100%); margin: 20px auto 12px;
}
body:has(#dbwNewView:not([hidden])) #dbwNavigation {
  width: 100%; margin: 16px 0 0; padding: 0 0 16px;
  border: 0; border-bottom: 1px solid #dfe4eb; border-radius: 0; box-shadow: none;
}
#dbwNewView > .card { padding: 20px; }
#dbwNewView .supply-selection-title h2 { margin: 0 0 4px; font-size: 24px; }
#dbwNewView .supply-selection-title p { margin: 0; color: #687487; font-size: 14px; }
#dbwNewView #dbwNewSearch { min-width: 0; }
#dbwDirectoryTabs .dbw-navigation-actions { display: none; }
#dbwNavigation .dbw-tabs button { box-shadow: none; }
#dbwNewView .table-wrap { overflow-x: auto; margin-top: 18px; }
#dbwNewView .dbw-orders-table,
.supply-list-wrap > table,
.fbs-new-orders-table-wrap > table { min-width: 1200px !important; }

body:not(.supply-selection-mode) .orders-card .moved-orders-section {
  flex: 0 0 auto;
  max-height: none;
}

body:not(.supply-selection-mode) .orders-card .moved-orders-table-wrap {
  flex: 0 0 auto;
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

body:not(.supply-selection-mode) #ordersTable thead,
body:not(.supply-selection-mode) #movedOrdersTable thead {
  position: static;
  top: auto;
  z-index: auto;
}

/* Final compact sizing override for controls declared later in this stylesheet. */
.button-link[hidden] {
  display: none !important;
}

.button-link {
  min-height: 30px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.15;
}

/* One compact application header on every screen. The supply workspace is the reference layout. */
body.supply-selection-mode header,
body:not(.supply-selection-mode) header {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand session"
    "tabs tabs";
  align-items: center;
  box-sizing: border-box;
  height: auto;
  min-height: 104px;
  padding: 9px 16px;
  column-gap: 14px;
  row-gap: 8px;
}

body .brand-block {
  grid-area: brand;
  min-width: 0;
}

body header h1 {
  margin: 0;
  font-size: 25px;
}

body.supply-selection-mode .program-tabs,
body:not(.supply-selection-mode) .program-tabs {
  grid-area: tabs;
  width: 100%;
  min-width: 0;
  justify-content: flex-start;
  gap: 6px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

body .program-tab {
  min-height: 36px;
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 13px;
}

body .header-session {
  grid-area: session;
  position: static;
  max-width: none;
  justify-self: end;
  gap: 7px;
  white-space: nowrap;
  transform: none;
  opacity: 1;
}

body .workspace-dialog[open] {
  inset-block-start: 68px;
  height: calc(100vh - 68px);
}

@media (max-width: 1200px) {
  body .workspace-dialog[open] {
    inset-block-start: 68px;
    height: calc(100vh - 68px);
  }
}

/* Put all main sections behind the menu button beside the application title. */
body.supply-selection-mode header,
body:not(.supply-selection-mode) header {
  z-index: 1000;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-areas: "menu brand session";
  min-height: 68px;
  row-gap: 0;
}

body .program-menu-toggle {
  grid-area: menu;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid #ffffff38;
  background: transparent !important;
  color: #fff !important;
  font-size: 23px;
  line-height: 1;
}

body .program-menu-toggle:hover {
  background: #ffffff12 !important;
}

body header .program-tabs[hidden] {
  display: none !important;
}

body header .program-tabs:not([hidden]) {
  position: absolute;
  z-index: 1001;
  top: calc(100% + 5px);
  left: 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: min(340px, calc(100vw - 32px));
  max-height: min(75vh, 620px);
  overflow-y: auto;
  padding: 9px;
  border: 1px solid #dfe4eb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px #1720331a;
}

body header .program-tab {
  flex: 0 0 auto;
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border-radius: 7px;
  background: transparent !important;
  color: #263244 !important;
  text-align: left;
  white-space: normal;
}

body header .program-tab:hover {
  background: #f3f5f8 !important;
}

body header .program-tab.active {
  background: #e9eef7 !important;
  color: #253550 !important;
}

body header .program-menu-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 5px;
  padding: 12px 4px 3px;
  border-top: 1px solid #e3e7ed;
}

body header .program-menu-session[hidden] {
  display: none !important;
}

body header .program-menu-user {
  min-width: 0;
  overflow: hidden;
  color: #5a687c;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body header .program-menu-session #logoutButton {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 11px;
  font-size: 13px;
}

body header h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
