/* STEP49 / V63
   1) Increase default desktop chart tab height by about 20% more.
   2) Prevent the market pair dropdown from falling over the Watchlist / top chart tools area.
   We keep all existing controls and runtime logic intact. */

@media (min-width: 1181px) {
  body.terminal-active.gp-dashboard-chart-mode:not(.gp-chart-tab-fullscreen),
  body.gp-terminal-active.gp-dashboard-chart-mode:not(.gp-chart-tab-fullscreen) {
    --gp-step46-chart-height: clamp(840px, 78dvh, 940px) !important;
    --gp-step05-chart-min-height: var(--gp-step46-chart-height) !important;
  }

  body.terminal-active.gp-dashboard-chart-mode:not(.gp-chart-tab-fullscreen) .chart-area,
  body.gp-terminal-active.gp-dashboard-chart-mode:not(.gp-chart-tab-fullscreen) .chart-area {
    min-height: clamp(510px, 54dvh, 660px) !important;
  }
}

@media (min-width: 1181px) and (max-height: 850px) {
  body.terminal-active.gp-dashboard-chart-mode:not(.gp-chart-tab-fullscreen),
  body.gp-terminal-active.gp-dashboard-chart-mode:not(.gp-chart-tab-fullscreen) {
    --gp-step46-chart-height: clamp(760px, 75dvh, 840px) !important;
  }

  body.terminal-active.gp-dashboard-chart-mode:not(.gp-chart-tab-fullscreen) .chart-area,
  body.gp-terminal-active.gp-dashboard-chart-mode:not(.gp-chart-tab-fullscreen) .chart-area {
    min-height: clamp(470px, 50dvh, 590px) !important;
  }
}

@media (min-width: 1181px) and (min-height: 1150px) {
  body.terminal-active.gp-dashboard-chart-mode:not(.gp-chart-tab-fullscreen),
  body.gp-terminal-active.gp-dashboard-chart-mode:not(.gp-chart-tab-fullscreen) {
    --gp-step46-chart-height: clamp(900px, 74dvh, 980px) !important;
  }

  body.terminal-active.gp-dashboard-chart-mode:not(.gp-chart-tab-fullscreen) .chart-area,
  body.gp-terminal-active.gp-dashboard-chart-mode:not(.gp-chart-tab-fullscreen) .chart-area {
    min-height: clamp(560px, 56dvh, 710px) !important;
  }
}

/* Keep the market selector above local content and open the custom pair menu upward.
   This avoids the pair list dropping on top of the Watchlist / chart toolbar row. */
body.terminal-active .gp-overview-market--switch,
body.gp-terminal-active .gp-overview-market--switch,
body.terminal-active .gp-overview-market--switch .gp-market-symbol-row,
body.gp-terminal-active .gp-overview-market--switch .gp-market-symbol-row {
  position: relative !important;
  overflow: visible !important;
  z-index: 10080 !important;
  isolation: isolate;
}

body.terminal-active .gp-market-instrument-shell,
body.gp-terminal-active .gp-market-instrument-shell {
  position: relative !important;
  z-index: 10100 !important;
  isolation: isolate;
}

body.terminal-active .gp-market-instrument-menu,
body.gp-terminal-active .gp-market-instrument-menu {
  top: auto !important;
  bottom: calc(100% + 8px) !important;
  left: auto !important;
  right: 0 !important;
  min-width: max(146px, 100%) !important;
  max-width: 220px !important;
  background: linear-gradient(180deg, rgba(5, 18, 35, 0.995), rgba(2, 8, 18, 0.995)) !important;
  background-color: #061326 !important;
  border-color: rgba(65, 151, 255, 0.34) !important;
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.52), 0 0 0 1px rgba(0, 213, 255, 0.08) inset !important;
  z-index: 10120 !important;
}

body.terminal-active .gp-market-instrument-option,
body.gp-terminal-active .gp-market-instrument-option {
  position: relative;
  z-index: 1;
  white-space: nowrap;
}
