/* Standalone Grafo Factory shell. Hospital navigation is intentionally excluded. */
html.factory-standalone body {
  opacity: 0;
  background: #050910;
}

html.factory-standalone body.factory-standalone-ready {
  opacity: 1;
  transition: opacity .18s ease;
}

html.factory-standalone .facility-switch {
  pointer-events: none;
  cursor: default;
  text-align: center;
  background-image: none !important;
  padding-inline: 18px;
}

html.factory-standalone :is(
  #verifiedFloorPlan,
  #accessibilityBtn,
  .qr-dialog,
  .route-panel,
  .route-launcher,
  .layer-panel,
  .left-rail,
  .right-rail,
  .floor-picker,
  .block-tabs,
  .view-modes,
  .telemetry-card,
  .device-card,
  .buhara-panel,
  .buhara-panel-open,
  .buhara-stack,
  .active-floor-hud,
  .scheme-notice,
  .legend,
  .map-scale,
  .map-trust,
  .facility-kpis,
  .device-cluster-layer
) {
  display: none !important;
}

html.factory-standalone .module-nav {
  max-width: min(560px, calc(100vw - 32px));
}

html.factory-standalone .module-nav button {
  min-width: 74px;
}

html.factory-standalone .brand {
  min-width: 286px;
}

html.factory-standalone .brand b {
  letter-spacing: .18em;
}

html.factory-standalone .map-loading {
  color: #9fb2bf;
}

@media (max-width: 1050px) {
  html.factory-standalone .module-nav {
    display: flex;
  }
}

@media (max-width: 760px) {
  html.factory-standalone .brand {
    min-width: 0;
  }

  html.factory-standalone .facility-switch {
    top: 88px;
    width: calc(100vw - 24px);
  }

  html.factory-standalone .module-nav {
    top: 145px;
    right: 12px;
    left: 12px;
    display: flex;
    justify-content: space-between;
    width: auto;
    max-width: none;
    overflow-x: auto;
    padding: 4px;
    border-radius: 16px;
    scrollbar-width: none;
  }

  html.factory-standalone .module-nav::-webkit-scrollbar {
    display: none;
  }

  html.factory-standalone .module-nav button {
    flex: 1 0 auto;
    min-width: 72px;
    height: 34px;
    padding: 0 10px;
    border-radius: 11px;
  }

  html.factory-standalone .ot-notice {
    top: 194px;
  }

  html.factory-standalone .ot-hud {
    top: 236px;
  }

  html.factory-standalone .ops-ticker span:nth-child(n + 4) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.factory-standalone body.factory-standalone-ready {
    transition: none;
  }
}

/* Factory workspace: one module menu, one area list and one detail panel. */
html.factory-standalone body.ot-mode .ot-tabbar {
  display: none;
}

html.factory-standalone .module-nav {
  box-sizing: border-box;
  max-width: none;
  overflow-x: auto;
  justify-content: flex-start;
  scrollbar-width: none;
}

html.factory-standalone .module-nav::-webkit-scrollbar,
html.factory-standalone .ot-view-modes::-webkit-scrollbar {
  display: none;
}

html.factory-standalone .module-nav button {
  flex: 0 0 auto;
  min-width: max-content;
  font-size: 9px;
  white-space: nowrap;
}

@media (min-width: 761px) {
  html.factory-standalone body.ot-mode {
    --factory-gutter: 24px;
    --factory-panel-width: clamp(340px, 27vw, 420px);
    --factory-sidebar-width: 230px;
  }

  html.factory-standalone .module-nav {
    right: calc(var(--factory-panel-width) + 2 * var(--factory-gutter));
    width: auto;
  }

  html.factory-standalone body.ot-mode .ot-panel {
    top: 154px;
    right: var(--factory-gutter);
    bottom: 48px;
    width: var(--factory-panel-width);
    border-radius: 18px;
  }

  html.factory-standalone body.ot-mode .ot-panel.collapsed {
    right: var(--factory-gutter);
    bottom: auto;
    width: 56px;
  }

  html.factory-standalone body.ot-mode .ot-panel-head {
    min-height: 64px;
  }

  html.factory-standalone body.ot-mode .ot-panel-head h2 {
    font-size: 16px;
  }

  html.factory-standalone body.ot-mode .ot-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html.factory-standalone body.ot-mode .ot-kpi span,
  html.factory-standalone body.ot-mode .ot-kpi small {
    font-size: 9px;
  }

  html.factory-standalone body.ot-mode .ot-panel-body {
    padding-top: 3px;
  }

  html.factory-standalone body.ot-mode .ot-hud {
    top: 154px;
    left: var(--factory-gutter);
    box-sizing: border-box;
    width: var(--factory-sidebar-width);
    padding: 13px 14px;
  }

  html.factory-standalone body.ot-mode .ot-hud h2 {
    font-size: 17px;
  }

  html.factory-standalone body.ot-mode .ot-hud p {
    font-size: 9px;
  }

  html.factory-standalone body.ot-mode .ot-notice {
    top: 154px;
    right: calc(var(--factory-panel-width) + 2 * var(--factory-gutter));
    left: calc(var(--factory-sidebar-width) + 2 * var(--factory-gutter));
    box-sizing: border-box;
    max-width: none;
    min-height: 33px;
    justify-content: center;
    font-size: 8px;
    line-height: 1.35;
    transform: none;
    pointer-events: none;
  }

  html.factory-standalone body.ot-mode .ot-view-modes {
    right: calc(var(--factory-panel-width) + 2 * var(--factory-gutter));
    bottom: 48px;
    left: calc(var(--factory-sidebar-width) + 2 * var(--factory-gutter));
    box-sizing: border-box;
    justify-content: center;
    min-width: 0;
    overflow-x: auto;
    transform: none;
    scrollbar-width: none;
  }

  html.factory-standalone body.ot-mode .ot-view-modes button {
    min-width: max-content;
    padding-inline: 9px;
    font-size: 9px;
    white-space: nowrap;
  }

  html.factory-standalone body.ot-mode .map-control-dock {
    top: auto;
    right: calc(var(--factory-panel-width) + 2 * var(--factory-gutter));
    bottom: 104px;
    left: auto;
    display: block;
    width: auto;
    height: auto;
  }

  html.factory-standalone body.ot-mode .map-control-dock .map-controls {
    display: flex;
    width: auto;
    height: auto;
    overflow: hidden;
    border-radius: 999px;
  }

  html.factory-standalone body.ot-mode .map-control-dock .map-controls button {
    width: 40px;
    height: 40px;
    border-radius: 0;
  }

  html.factory-standalone body.ot-mode .map-control-dock .map-controls button:first-child {
    border-radius: 999px 0 0 999px;
  }

  html.factory-standalone body.ot-mode .map-control-dock .map-controls button:last-child {
    border-radius: 0 999px 999px 0;
  }

  html.factory-standalone body.ot-mode .map-control-dock .map-controls span {
    width: 1px;
    height: 40px;
  }

  html.factory-standalone body.ot-mode .ot-device-popover:is(.alarm-mode, .network-mode, .segment-mode, .anomaly-mode) {
    top: 154px;
    right: calc(var(--factory-panel-width) + 2 * var(--factory-gutter));
    bottom: 48px;
    left: auto;
    box-sizing: border-box;
    width: min(510px, calc(100vw - var(--factory-panel-width) - var(--factory-sidebar-width) - 4 * var(--factory-gutter)));
    max-width: none;
    max-height: none;
    transform: none;
  }
}

@media (min-width: 1181px) {
  html.factory-standalone body.ot-mode .ot-zone-nav {
    top: 336px;
    right: auto;
    bottom: 48px;
    left: var(--factory-gutter);
    box-sizing: border-box;
    width: var(--factory-sidebar-width);
    max-width: none;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    padding: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 17px;
    scrollbar-width: thin;
    scrollbar-color: rgba(61, 219, 226, .28) transparent;
  }

  html.factory-standalone body.ot-mode .ot-zone-nav::before {
    content: 'FABRİKA ALANLARI';
    display: block;
    flex: 0 0 auto;
    padding: 3px 8px 8px;
    color: #5f8290;
    font: 800 9px Manrope, sans-serif;
    letter-spacing: .16em;
  }

  html.factory-standalone body.ot-mode .ot-zone-nav button {
    width: 100%;
    height: 36px;
    min-height: 36px;
    padding: 0 10px;
    overflow: hidden;
    font-size: 9px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.factory-standalone body.light-theme.ot-mode .ot-zone-nav::before {
    color: #547483;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  html.factory-standalone body.ot-mode {
    --factory-gutter: 16px;
    --factory-panel-width: clamp(300px, 32vw, 350px);
    --factory-sidebar-width: 0px;
  }

  html.factory-standalone body.ot-mode .ot-hud {
    top: 199px;
    width: min(214px, calc(100vw - var(--factory-panel-width) - 3 * var(--factory-gutter)));
  }

  html.factory-standalone body.ot-mode .ot-notice {
    left: var(--factory-gutter);
    padding-inline: 8px;
    font-size: 7px;
  }

  html.factory-standalone body.ot-mode .ot-zone-nav {
    right: calc(var(--factory-panel-width) + 2 * var(--factory-gutter));
    bottom: 48px;
    left: var(--factory-gutter);
    box-sizing: border-box;
    max-width: none;
    min-width: 0;
    justify-content: flex-start;
  }

  html.factory-standalone body.ot-mode .ot-view-modes {
    right: calc(var(--factory-panel-width) + 2 * var(--factory-gutter));
    bottom: 100px;
    left: var(--factory-gutter);
    justify-content: flex-start;
  }

  html.factory-standalone body.ot-mode .map-control-dock {
    bottom: 154px;
  }
}

@media (max-width: 760px) {
  html.factory-standalone body.ot-mode .module-nav {
    justify-content: flex-start;
  }

  html.factory-standalone body.ot-mode .ot-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html.factory-standalone body.ot-mode .ot-kpi:nth-child(n + 3) {
    display: grid;
  }

  html.factory-standalone body.ot-mode .ot-panel-body {
    padding-top: 3px;
  }

  html.factory-standalone body.ot-mode .ot-zone-nav,
  html.factory-standalone body.ot-mode .ot-view-modes {
    box-sizing: border-box;
    max-width: calc(100vw - 16px);
    overflow-x: auto;
    scrollbar-width: none;
  }

  html.factory-standalone body.ot-mode .ot-view-modes {
    right: 8px;
    left: 8px;
    justify-content: flex-start;
    transform: none;
  }

  html.factory-standalone body.ot-mode .ot-view-modes button,
  html.factory-standalone body.ot-mode .ot-zone-nav button {
    white-space: nowrap;
  }
}
