/* The warehouse is the main view. Operational detail opens on demand. */
body.warehouse-focus {
  --warehouse-header-height: 78px;
  --warehouse-edge: 20px;
}

.warehouse-focus .warehouse-experience {
  display: block;
  height: calc(100svh - var(--warehouse-header-height) - 36px);
  min-height: 420px;
  padding: 0;
  overflow: hidden;
}

.warehouse-focus .world-viewport {
  inset: 0;
  width: 100%;
  height: 100%;
}

.warehouse-focus .warehouse-stats {
  top: 16px;
  left: var(--warehouse-edge);
  right: auto;
  width: min(740px, calc(100% - 100px));
  gap: 10px;
  z-index: 10;
}

.warehouse-focus .stat-card {
  min-width: 0;
  min-height: 72px;
  max-width: none;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 24px #03070b35;
  background: linear-gradient(120deg, #111b25ed, #0b151fec);
}

.warehouse-focus .stat-card > div > span {
  font-size: 10px;
}

.warehouse-focus .stat-card strong {
  font-size: 25px;
}

.warehouse-focus .scene-tools {
  top: 100px;
  left: var(--warehouse-edge);
  right: 78px;
  gap: 7px;
  flex-wrap: wrap;
}

.warehouse-focus .scene-tools > button,
.warehouse-focus .map-mode-switch {
  min-height: 35px;
  border-radius: 7px;
  box-shadow: 0 4px 14px #070b1430;
}

.warehouse-focus .scene-tools > button {
  padding: 7px 10px;
  font-size: 10px;
}

.warehouse-focus #warehouse-console-toggle {
  border: 1px solid #8c9bba44;
  background: #101b26ed;
  color: #bfccd8;
}

.warehouse-focus #warehouse-console-toggle[aria-expanded='true'] {
  border-color: #a67ce68f;
  background: #372355f5;
  color: #e1cdff;
}

.warehouse-focus .world-controls,
.warehouse-focus.warehouse-exploring .world-controls {
  top: 16px;
  right: var(--warehouse-edge);
  border-radius: 9px;
  background: #0e1923ed;
}

.warehouse-focus .overview-panel {
  position: absolute;
  top: 150px;
  right: var(--warehouse-edge);
  bottom: 78px;
  left: auto;
  width: min(340px, calc(100% - 40px));
  max-height: none;
  margin: 0;
  overflow-y: auto;
  z-index: 16;
}

.warehouse-focus.warehouse-exploring .overview-panel {
  display: none;
}

.warehouse-focus .area-navigation,
.warehouse-focus.warehouse-exploring .area-navigation,
.warehouse-focus.warehouse-exploring:has(#world-flow-console.has-layer-detail) .area-navigation {
  top: auto !important;
  bottom: 16px !important;
  left: var(--warehouse-edge);
  right: auto !important;
  width: max-content;
  max-width: calc(100% - 370px);
  min-height: 44px;
  align-items: center;
  overflow-x: auto;
  background: #0c1722f2;
  border-radius: 9px;
  scrollbar-width: none;
}

.warehouse-focus .area-navigation button {
  min-height: 34px;
  padding: 9px 12px;
}

.warehouse-focus .map-help,
.warehouse-focus.warehouse-exploring .map-help,
.warehouse-focus.warehouse-exploring:has(#world-flow-console.has-layer-detail) .map-help {
  top: auto;
  bottom: 68px;
  left: var(--warehouse-edge);
  padding: 4px 8px;
  background: #09131cc4;
  border-radius: 5px;
  color: #afc2d3;
  font-size: 9px;
}

.warehouse-focus .safety-notice {
  top: 146px;
  left: var(--warehouse-edge);
  padding: 8px 11px;
  max-width: min(360px, calc(100% - 100px));
}

/* This drawer retains the flow stages, sensor layers, speed, pause and route controls. */
.warehouse-focus .warehouse-experience > .bottom-dashboard {
  display: none;
  position: absolute;
  top: auto;
  bottom: 78px;
  left: var(--warehouse-edge);
  right: var(--warehouse-edge);
  margin: 0;
  max-height: calc(100% - 230px);
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 12px;
  z-index: 18;
  overflow-y: auto;
  scrollbar-width: thin;
}

.warehouse-focus.warehouse-console-open .warehouse-experience > .bottom-dashboard {
  display: grid;
}

.warehouse-focus .bottom-dashboard .flow-tour-bar,
.warehouse-focus .bottom-dashboard .activity-card {
  margin: 0;
  width: 100%;
  padding: 12px 14px;
  background: #0e1825f5;
  border-color: #849bb940;
  border-radius: 10px;
  box-shadow: 0 12px 36px #0005;
}

.warehouse-focus .flow-stages button {
  min-height: 43px;
  padding: 6px;
}

.warehouse-focus .flow-technologies {
  flex-wrap: wrap;
}

.warehouse-focus .flow-technologies button {
  min-height: 30px;
  padding: 6px 10px;
}

.warehouse-focus .has-layer-detail .flow-explanation {
  display: block;
}

.warehouse-focus .activity-body {
  margin: 8px 0;
}

.warehouse-focus .activity-footer {
  padding-top: 8px;
}

/* MM robotai opens this roster; the four original pairs remain individually selectable. */
.warehouse-focus .fleet-console {
  display: none;
  top: auto;
  bottom: 82px;
  right: var(--warehouse-edge);
  left: auto;
  width: 370px;
  max-width: calc(100% - 40px);
  padding: 10px 12px;
  border-radius: 10px;
  z-index: 17;
}

.warehouse-focus.warehouse-fleet-open.warehouse-exploring .fleet-console {
  display: block;
}

.warehouse-focus .fleet-heading span {
  font-size: 9px;
  letter-spacing: 0.08em;
}

.warehouse-focus .fleet-heading b {
  font-size: 16px;
}

.warehouse-focus .fleet-console > p {
  display: none;
}

.warehouse-focus .fleet-pairs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-top: 7px;
}

.warehouse-focus .fleet-pairs button {
  min-height: 43px;
  padding: 7px 6px;
  gap: 5px;
}

.warehouse-focus .fleet-pairs strong {
  font-size: 10px;
}

.warehouse-focus .fleet-pairs small {
  display: block;
  font-size: 8px;
  max-width: none;
}

.warehouse-focus .fleet-pairs em,
.warehouse-focus .pair-glyph {
  display: none;
}

.warehouse-focus .fleet-junctions {
  margin-top: 7px;
  width: calc(100% - 90px);
}

.warehouse-focus .fleet-junctions span {
  padding: 5px;
}

.warehouse-focus .fleet-console > button {
  position: absolute;
  bottom: 17px;
  right: 12px;
  width: auto;
  padding: 0;
  font-size: 9px;
}

.warehouse-focus.warehouse-fleet-open.warehouse-exploring.warehouse-console-open .fleet-console {
  display: none;
}

.warehouse-focus .warehouse-legend {
  position: absolute;
  right: var(--warehouse-edge);
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 19px;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid #a8bdd62b;
  border-radius: 9px;
  background: #0c1722ed;
  backdrop-filter: blur(12px);
  z-index: 12;
}

.warehouse-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: #aebfd1;
  font-size: 9px;
}

.warehouse-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1ba6a6;
}

.warehouse-legend .is-busy i {
  background: #a576e8;
}

.warehouse-legend .is-warning i {
  background: #fbbf24;
}

.warehouse-legend .is-danger i {
  background: #ee626d;
}

.warehouse-focus.warehouse-fleet-open.warehouse-exploring.dashboard-open .fleet-console,
.warehouse-focus.dashboard-open .warehouse-legend {
  display: none;
}

.facility-hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 7;
}

.facility-hotspot {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: max-content;
  max-width: 180px;
  height: 30px;
  padding: 0 12px 0 0;
  border: 1px solid #a67ce796;
  border-radius: 6px;
  background: linear-gradient(110deg, #41206beb, #482574f2);
  box-shadow:
    0 4px 18px #0608105c,
    inset 0 1px 0 #d5c2f816;
  color: #f0e5ff;
  pointer-events: auto;
  transform: translate(-2000px, -2000px);
  white-space: nowrap;
}

.facility-hotspot.is-teal {
  border-color: #45c5c09c;
  background: linear-gradient(110deg, #0d535eea, #104957f2);
  color: #d4f7f6;
}

.facility-hotspot > span {
  display: grid;
  place-items: center;
  align-self: stretch;
  width: 31px;
  flex: none;
  border-right: 1px solid #ffffff21;
  background: #ffffff09;
  font:
    600 10px ui-monospace,
    monospace;
}

.facility-hotspot > strong {
  font-size: 10px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
}

.facility-hotspot:hover,
.facility-hotspot:focus-visible {
  filter: brightness(1.25);
  z-index: 8;
}

@media (max-width: 980px) {
  body.warehouse-focus {
    --warehouse-header-height: 67px;
    --warehouse-edge: 14px;
  }

  .warehouse-focus .warehouse-stats {
    width: calc(100% - 86px);
    top: 14px;
    gap: 7px;
  }

  .warehouse-focus .stat-card {
    min-height: 70px;
    padding: 10px;
    gap: 8px;
  }

  .warehouse-focus .stat-icon {
    width: 30px;
    height: 34px;
  }

  .warehouse-focus .scene-tools {
    top: 96px;
  }

  .warehouse-focus .area-navigation,
  .warehouse-focus.warehouse-exploring .area-navigation {
    max-width: calc(100% - 28px);
  }

  .warehouse-focus .warehouse-legend {
    bottom: 68px;
    min-height: 29px;
    padding: 6px 9px;
    gap: 12px;
  }

  .warehouse-focus .map-help {
    bottom: 105px;
  }

  .warehouse-focus .fleet-console {
    bottom: 108px;
  }

  .warehouse-focus .warehouse-experience > .bottom-dashboard {
    bottom: 108px;
    grid-template-columns: minmax(0, 1fr);
    max-height: calc(100% - 275px);
    gap: 8px;
  }

  .warehouse-focus .activity-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 8px 18px;
  }

  .warehouse-focus .activity-header {
    grid-column: 1;
    grid-row: 1;
  }

  .warehouse-focus .activity-body {
    grid-column: 2;
    grid-row: 1 / 3;
    margin: 0;
  }

  .warehouse-focus .activity-footer {
    grid-column: 1;
    padding-top: 0;
    border-top: 0;
  }

  .warehouse-focus .technology-bar {
    display: flex;
    height: 36px;
    min-height: 36px;
    padding: 0 14px;
  }

  .warehouse-focus .technology-names {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 14px;
  }

  .warehouse-focus .technology-names > * {
    flex: none;
  }
}

@media (max-width: 620px) {
  .facility-hotspot {
    height: 28px;
    max-width: 130px;
    gap: 6px;
    padding-right: 7px;
  }

  .facility-hotspot > span {
    width: 24px;
    font-size: 9px;
  }

  .facility-hotspot > strong {
    font-size: 8px;
  }

  .warehouse-focus .warehouse-stats {
    width: calc(100% - 28px);
    right: 14px;
    gap: 6px;
  }

  .warehouse-focus .warehouse-stats .stat-card {
    min-height: 77px;
    padding: 9px 10px;
  }

  .warehouse-focus .warehouse-stats .stat-card strong {
    font-size: 22px;
    line-height: 1;
    gap: 4px;
  }

  .warehouse-focus .warehouse-stats .stat-card > div > span {
    font-size: 8px;
    min-height: 20px;
  }

  .warehouse-focus .warehouse-stats .stat-card small {
    font-size: 7px;
  }

  .warehouse-focus .scene-tools {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    top: 101px;
    right: 62px;
    gap: 5px;
  }

  .warehouse-focus .scene-tools > button,
  .warehouse-focus .scene-tools #warehouse-explore,
  .warehouse-focus .map-mode-switch {
    min-width: 0;
    min-height: 32px;
    height: 32px;
    font-size: 8px;
  }

  .warehouse-focus .scene-tools > button {
    gap: 4px;
    padding: 6px 5px;
    justify-content: center;
  }

  .warehouse-focus .scene-tools .roof-toggle {
    display: flex;
  }

  .warehouse-focus .map-mode-switch button {
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
  }

  .warehouse-focus .world-controls {
    top: 101px;
    right: 14px;
    padding: 3px;
  }

  .warehouse-focus .icon-button {
    width: 29px;
    height: 30px;
  }

  .warehouse-focus .area-navigation,
  .warehouse-focus.warehouse-exploring .area-navigation,
  .warehouse-focus.warehouse-exploring:has(#world-flow-console.has-layer-detail) .area-navigation {
    max-width: calc(100% - 28px);
    width: calc(100% - 28px);
    min-height: 43px;
    bottom: 12px !important;
    justify-content: space-between;
    gap: 0;
  }

  .warehouse-focus .area-navigation button {
    padding: 8px 9px;
    font-size: 9px;
  }

  .warehouse-focus .map-help {
    display: none;
  }

  .warehouse-focus .warehouse-legend {
    bottom: 64px;
    right: 14px;
    min-height: 26px;
    gap: 12px;
  }

  .warehouse-focus .warehouse-legend span {
    font-size: 8px;
  }

  .warehouse-focus .warehouse-legend i {
    width: 6px;
    height: 6px;
  }

  .warehouse-focus .safety-notice {
    top: 181px;
    max-width: calc(100% - 76px);
    left: 14px;
  }

  .warehouse-focus .safety-notice small {
    display: none;
  }

  .warehouse-focus .overview-panel {
    top: 180px;
    bottom: 102px;
    width: calc(100% - 28px);
    right: 14px;
    padding: 18px;
  }

  .warehouse-focus .overview-panel h1 {
    font-size: 25px;
  }

  .warehouse-focus .overview-panel .zone-link {
    padding: 10px 0;
  }

  .warehouse-focus .fleet-console {
    bottom: 103px;
    width: calc(100% - 28px);
    max-width: 370px;
    right: 14px;
    left: auto;
    padding: 10px;
  }

  .warehouse-focus .warehouse-experience > .bottom-dashboard {
    bottom: 102px;
    max-height: calc(100% - 290px);
  }

  .warehouse-focus .bottom-dashboard .flow-tour-bar,
  .warehouse-focus .bottom-dashboard .activity-card {
    padding: 11px;
  }

  .warehouse-focus .flow-stages {
    gap: 4px;
  }

  .warehouse-focus .flow-stages button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 5px;
  }

  .warehouse-focus .flow-stages small,
  .warehouse-focus .flow-stages em {
    display: none;
  }

  .warehouse-focus .flow-stages span {
    max-width: 100%;
    font-size: 8px;
  }

  .warehouse-focus .flow-stages b {
    font-size: 17px;
  }

  .warehouse-focus .flow-technologies {
    gap: 4px;
  }

  .warehouse-focus .flow-technologies > span {
    width: 100%;
  }

  .warehouse-focus .flow-technologies button {
    font-size: 8px;
    min-height: 30px;
    padding: 5px 7px;
  }

  .warehouse-focus .activity-card {
    gap: 7px;
  }

  .warehouse-focus .activity-icon {
    display: none;
  }

  .warehouse-focus .technology-names {
    justify-content: space-between;
    gap: 8px;
    font-size: 8px;
  }

  .warehouse-focus .technology-names > span:nth-child(4),
  .warehouse-focus .technology-names > span:nth-child(5) {
    display: none;
  }

  .warehouse-focus .technology-names button {
    font-size: 8px;
  }
}

@media (max-width: 620px) {
  .facility-hotspot {
    width: 28px;
    padding: 0;
    gap: 0;
  }

  .facility-hotspot > span {
    width: 100%;
    border: 0;
  }

  .facility-hotspot > strong {
    display: none;
  }
}
