/* STEP 48 / V62: fixed-position portal for the TradingView-style timeframe dropdown.
   This removes toolbar overflow clipping while preserving the STEP47 visual style/classes. */

html body.gp-tv-timeframe-selector-ready #timeframes.timeframes,
html body.terminal-active.gp-tv-timeframe-selector-ready #timeframes.timeframes,
html body.gp-terminal-active.gp-tv-timeframe-selector-ready #timeframes.timeframes,
html body.terminal-active.gp-dashboard-chart-mode.gp-tv-timeframe-selector-ready #timeframes.timeframes,
html body.gp-terminal-active.gp-dashboard-chart-mode.gp-tv-timeframe-selector-ready #timeframes.timeframes {
  position: relative !important;
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: none !important;
  z-index: 80 !important;
  isolation: isolate !important;
  contain: none !important;
  clip-path: none !important;
}

html body.gp-tv-timeframe-selector-ready #timeframes .timeframes__scroll,
html body.terminal-active.gp-tv-timeframe-selector-ready #timeframes .timeframes__scroll,
html body.gp-terminal-active.gp-tv-timeframe-selector-ready #timeframes .timeframes__scroll,
html body.terminal-active.gp-dashboard-chart-mode.gp-tv-timeframe-selector-ready #timeframes .timeframes__scroll,
html body.gp-terminal-active.gp-dashboard-chart-mode.gp-tv-timeframe-selector-ready #timeframes .timeframes__scroll {
  position: relative !important;
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  z-index: 81 !important;
  contain: none !important;
  clip-path: none !important;
}

html body.gp-tv-timeframe-selector-ready #timeframes .timeframes__tools,
html body.terminal-active.gp-tv-timeframe-selector-ready #timeframes .timeframes__tools,
html body.gp-terminal-active.gp-tv-timeframe-selector-ready #timeframes .timeframes__tools,
html body.terminal-active.gp-dashboard-chart-mode.gp-tv-timeframe-selector-ready #timeframes .timeframes__tools,
html body.gp-terminal-active.gp-dashboard-chart-mode.gp-tv-timeframe-selector-ready #timeframes .timeframes__tools {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: none !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

html body.gp-tv-timeframe-selector-ready #gp-tv-timeframe-selector.gp-tv-tf-selector {
  position: relative !important;
  z-index: 82 !important;
  overflow: visible !important;
  contain: none !important;
}

html body.gp-tv-timeframe-selector-ready #gp-tv-timeframe-selector.gp-tv-tf-selector.is-open {
  z-index: 83 !important;
}

#gp-tv-timeframe-menu.gp-tv-tf-menu.gp-tv-tf-menu--portal {
  position: fixed !important;
  top: var(--gp-tv-tf-menu-top, 120px) !important;
  left: var(--gp-tv-tf-menu-left, 130px) !important;
  right: auto !important;
  bottom: auto !important;
  width: 252px !important;
  max-width: min(276px, calc(100vw - 20px)) !important;
  max-height: min(520px, calc(100dvh - 24px)) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(-7px) scale(.985) !important;
  transform-origin: top left !important;
  z-index: 2147483000 !important;
  contain: none !important;
  clip-path: none !important;
}

#gp-tv-timeframe-menu.gp-tv-tf-menu.gp-tv-tf-menu--portal.is-open {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1) !important;
}

#gp-tv-timeframe-menu.gp-tv-tf-menu.gp-tv-tf-menu--portal.opens-up {
  transform-origin: bottom left !important;
}

body.gp-tv-timeframe-menu-open .chart-area,
body.gp-tv-timeframe-menu-open .chart-container,
body.gp-tv-timeframe-menu-open .main {
  overflow: visible !important;
}

html body.gp-chart-tab-fullscreen.gp-tv-timeframe-selector-ready #timeframes.timeframes,
html body.gp-chart-tab-fullscreen.gp-tv-timeframe-selector-ready #timeframes .timeframes__scroll,
html body.gp-chart-tab-fullscreen.gp-tv-timeframe-selector-ready #gp-tv-timeframe-selector.gp-tv-tf-selector {
  overflow: visible !important;
  z-index: 120050 !important;
}

html body.gp-chart-tab-fullscreen.gp-tv-timeframe-selector-ready #gp-tv-timeframe-menu.gp-tv-tf-menu.gp-tv-tf-menu--portal {
  z-index: 2147483000 !important;
}

@media (max-width: 768px) {
  html body.gp-tv-timeframe-selector-ready #timeframes.timeframes,
  html body.terminal-active.gp-tv-timeframe-selector-ready #timeframes.timeframes,
  html body.gp-terminal-active.gp-tv-timeframe-selector-ready #timeframes.timeframes,
  html body.terminal-active.gp-dashboard-chart-mode.gp-tv-timeframe-selector-ready #timeframes.timeframes,
  html body.gp-terminal-active.gp-dashboard-chart-mode.gp-tv-timeframe-selector-ready #timeframes.timeframes {
    height: 40px !important;
    min-height: 40px !important;
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
  }

  #gp-tv-timeframe-menu.gp-tv-tf-menu.gp-tv-tf-menu--portal {
    width: min(276px, calc(100vw - 20px)) !important;
    max-height: min(500px, calc(100dvh - 24px)) !important;
  }
}
