/* STEP44 SAFE TOPBAR + PRIME TOOLS MODAL V1
   Ported visually from Step83 top navigation / PRIME Tools, but intentionally scoped so it does not touch candle history, auth session, API config, chart data, or drawing tools. */

:root {
  --gp-step44-topbar-green: #19f09b;
  --gp-step44-topbar-cyan: #00dfc4;
  --gp-step44-topbar-blue: #0aa7ff;
  --gp-step44-topbar-panel: rgba(7, 7, 9, .98);
  --gp-step44-topbar-line: rgba(255,255,255,.13);
  --gp-step44-topbar-muted: rgba(247,247,248,.66);
}

html body.gp-step44-topbar-ready.terminal-active .header,
html body.gp-step44-topbar-ready.gp-terminal-active .header {
  min-height: 48px !important;
  gap: 8px !important;
  align-items: center !important;
  overflow: visible !important;
}

html body.gp-step44-topbar-ready.terminal-active .header .header__logo,
html body.gp-step44-topbar-ready.gp-terminal-active .header .header__logo {
  order: 1 !important;
  flex: 0 0 auto !important;
}

html body.gp-step44-topbar-ready.terminal-active .header #gp-auth-widget,
html body.gp-step44-topbar-ready.gp-terminal-active .header #gp-auth-widget,
html body.gp-step44-topbar-ready.terminal-active .header #gp-auth-widget.gp-auth-header-inline,
html body.gp-step44-topbar-ready.gp-terminal-active .header #gp-auth-widget.gp-auth-header-inline {
  order: 10 !important;
  flex: 0 0 auto !important;
}

.gp-step44-header-nav {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 6px;
  min-width: 0;
  flex: 0 1 auto;
  order: 20 !important;
  position: relative;
  z-index: 115;
}

body:not(.gp-step44-topbar-ready) .gp-step44-header-nav,
body.gp-home-page-active .gp-step44-header-nav,
body.gp-profile-open .gp-step44-header-nav {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.gp-step44-header-nav__btn {
  appearance: none !important;
  min-height: 34px !important;
  height: 34px !important;
  padding: 0 13px !important;
  border-radius: 11px !important;
  border: 1px solid rgba(255,255,255,.13) !important;
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025)) !important;
  color: rgba(246,247,249,.90) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  font: 900 11px/1 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  letter-spacing: .015em !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  box-shadow: inset 0 1px rgba(255,255,255,.055) !important;
  transition: background .14s ease, color .14s ease, border-color .14s ease, box-shadow .14s ease, transform .14s ease !important;
}

.gp-step44-header-nav__btn:hover {
  color: #ffffff !important;
  border-color: rgba(0,224,255,.28) !important;
  background: rgba(255,255,255,.085) !important;
}

.gp-step44-header-nav__btn:active { transform: translateY(1px) !important; }

.gp-step44-header-nav__btn.is-active,
.gp-step44-header-nav__btn.is-open,
.gp-step44-header-nav__btn[aria-pressed="true"] {
  color: #03111d !important;
  border-color: transparent !important;
  background: linear-gradient(135deg, var(--gp-step44-topbar-blue), var(--gp-step44-topbar-cyan)) !important;
  box-shadow: 0 0 22px rgba(0,224,255,.20), inset 0 1px rgba(255,255,255,.22) !important;
}

.gp-step44-header-nav__btn[data-gp-step44-top-nav="prime-tools"].is-active,
.gp-step44-header-nav__btn[data-gp-step44-top-nav="prime-tools"].is-open,
.gp-step44-header-nav__btn[data-gp-step44-top-nav="prime-tools"][aria-expanded="true"] {
  color: #03110d !important;
  background: linear-gradient(135deg, var(--gp-step44-topbar-green), var(--gp-step44-topbar-cyan)) !important;
  box-shadow: 0 0 22px rgba(25,240,155,.22), inset 0 1px rgba(255,255,255,.22) !important;
}

.gp-step44-header-nav__icon { font-size: 12px; line-height: 1; }

/* Replaced by the safe top navigation / PRIME Tools menu. Kept in DOM for original handlers. */
html body.gp-step44-topbar-ready.terminal-active .header #chart-settings-btn,
html body.gp-step44-topbar-ready.gp-terminal-active .header #chart-settings-btn,
html body.gp-step44-topbar-ready.terminal-active .header #prime-orderflow-btn,
html body.gp-step44-topbar-ready.gp-terminal-active .header #prime-orderflow-btn,
html body.gp-step44-topbar-ready.terminal-active .header #prime-indicator-btn,
html body.gp-step44-topbar-ready.gp-terminal-active .header #prime-indicator-btn,
html body.gp-step44-topbar-ready.terminal-active .header #gp-prime-walls-header-btn,
html body.gp-step44-topbar-ready.gp-terminal-active .header #gp-prime-walls-header-btn,
html body.gp-step44-topbar-ready.terminal-active .header #tools-panel-btn,
html body.gp-step44-topbar-ready.gp-terminal-active .header #tools-panel-btn,
html body.gp-step44-topbar-ready.terminal-active .header #settings-btn,
html body.gp-step44-topbar-ready.gp-terminal-active .header #settings-btn,
html body.gp-step44-topbar-ready.terminal-active .header #header-timeframe-select,
html body.gp-step44-topbar-ready.gp-terminal-active .header #header-timeframe-select {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html body.gp-step44-topbar-ready.terminal-active .header #gp-clean-chart-head-btn,
html body.gp-step44-topbar-ready.gp-terminal-active .header #gp-clean-chart-head-btn,
html body.gp-step44-topbar-ready.terminal-active .header .gp-clean-chart-head-btn,
html body.gp-step44-topbar-ready.gp-terminal-active .header .gp-clean-chart-head-btn {
  order: 30 !important;
  flex: 0 0 auto !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 14px !important;
  border-radius: 11px !important;
  border-color: rgba(0,224,255,.36) !important;
  color: #efffff !important;
  background: linear-gradient(135deg, rgba(0,110,255,.86), rgba(0,219,205,.62)) !important;
  box-shadow: 0 0 18px rgba(0,224,255,.13), inset 0 1px rgba(255,255,255,.18) !important;
  font: 900 11px/1 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  white-space: nowrap !important;
}

html body.gp-step44-topbar-ready.terminal-active .header .gp-terminal-livebar,
html body.gp-step44-topbar-ready.gp-terminal-active .header .gp-terminal-livebar {
  order: 80 !important;
  margin-left: auto !important;
  flex: 0 0 auto !important;
}

html body.gp-step44-topbar-ready.terminal-active .header .header__controls,
html body.gp-step44-topbar-ready.gp-terminal-active .header .header__controls {
  order: 90 !important;
  flex: 0 0 auto !important;
}

html body.gp-step44-topbar-ready.terminal-active .header #fullscreen-btn,
html body.gp-step44-topbar-ready.gp-terminal-active .header #fullscreen-btn {
  display: inline-flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  border-radius: 10px !important;
}

/* PRIME Tools popover */
.gp-step44-prime-tools-popover {
  position: fixed;
  left: 154px;
  top: 58px;
  z-index: 100420;
  width: min(430px, calc(100vw - 22px));
  color: #f7f7f8;
  background:
    radial-gradient(circle at 12% -10%, rgba(255,255,255,.08), transparent 34%),
    linear-gradient(180deg, rgba(15,15,17,.985), rgba(5,5,6,.975));
  border: 1px solid var(--gp-step44-topbar-line);
  border-radius: 18px;
  box-shadow: 0 26px 72px rgba(0,0,0,.70), inset 0 1px rgba(255,255,255,.07);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
  max-height: min(78dvh, 760px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(-10px, -6px, 0) scale(.985);
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.gp-step44-prime-tools-popover.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

body:not(.terminal-active):not(.gp-terminal-active) .gp-step44-prime-tools-popover,
body.gp-home-page-active .gp-step44-prime-tools-popover,
body.gp-profile-open .gp-step44-prime-tools-popover {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.gp-step44-prime-tools-popover__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 13px 11px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  cursor: grab;
  user-select: none;
}

.gp-step44-prime-tools-popover.is-dragging .gp-step44-prime-tools-popover__head { cursor: grabbing; }

.gp-step44-prime-tools-popover__title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.gp-step44-prime-tools-popover__title strong {
  color: #ffffff;
  font-size: 13px;
  line-height: 1.08;
  font-weight: 950;
  letter-spacing: .10em;
  text-transform: uppercase;
}

.gp-step44-prime-tools-popover__title span {
  color: var(--gp-step44-topbar-muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gp-step44-prime-tools-popover__close {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.88);
  background: rgba(255,255,255,.06);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.gp-step44-prime-tools-popover__close:hover {
  color: #fff;
  background: rgba(255,255,255,.11);
}

.gp-step44-prime-tools-popover__body {
  padding: 12px;
  max-height: calc(min(78dvh, 760px) - 58px);
  overflow: auto;
}

.gp-step44-prime-tools-popover__body::-webkit-scrollbar { width: 5px; }
.gp-step44-prime-tools-popover__body::-webkit-scrollbar-track { background: rgba(255,255,255,.035); }
.gp-step44-prime-tools-popover__body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 999px; }

.gp-step44-prime-tools-popover__grid {
  display: grid;
  gap: 9px;
}

.gp-step44-prime-tools-action {
  appearance: none;
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(135deg, rgba(255,255,255,.07), rgba(255,255,255,.035));
  color: #f7f7f8;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px rgba(255,255,255,.045);
}

.gp-step44-prime-tools-action:hover,
.gp-step44-prime-tools-action.is-active {
  border-color: rgba(25,240,155,.44);
  background: linear-gradient(135deg, rgba(25,240,155,.13), rgba(255,255,255,.045));
}

.gp-step44-prime-tools-action > span {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.07);
  font-size: 15px;
  color: rgba(255,255,255,.92);
}

.gp-step44-prime-tools-action.is-active > span {
  color: var(--gp-step44-topbar-green);
  background: rgba(37,229,143,.13);
  border-color: rgba(37,229,143,.35);
  box-shadow: 0 0 14px rgba(37,229,143,.18);
}

.gp-step44-prime-tools-action > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.gp-step44-prime-tools-action strong {
  color: #ffffff;
  font-size: 12px;
  line-height: 1.1;
  font-weight: 950;
}

.gp-step44-prime-tools-action small {
  color: var(--gp-step44-topbar-muted);
  font-size: 10.5px;
  line-height: 1.25;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gp-step44-prime-tools-action em {
  min-width: 50px;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.78);
  background: rgba(255,255,255,.07);
  font-size: 9px;
  line-height: 1;
  font-weight: 950;
  text-align: center;
  text-transform: uppercase;
  font-style: normal;
}

.gp-step44-prime-tools-action.is-active em {
  min-width: 58px;
  color: #04120b;
  background: var(--gp-step44-topbar-green);
  border-color: rgba(145,255,198,.72);
  box-shadow: 0 0 16px rgba(37,229,143,.24);
}

.gp-step44-prime-tools-action.is-active em::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 999px;
  background: #04120b;
  vertical-align: 1px;
}

.gp-step44-prime-tools-popover__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 2px 0;
  color: rgba(247,247,248,.52);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.gp-step44-prime-tools-popover__foot span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gp-step44-prime-tools-popover__foot span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #28d888;
  box-shadow: 0 0 10px rgba(40,216,136,.55);
}

@media (max-width: 1380px) {
  .gp-step44-header-nav__btn { padding: 0 10px !important; font-size: 10px !important; }
}

@media (max-width: 1180px) {
  .gp-step44-header-nav { display: none !important; }
}

@media (max-width: 760px) {
  .gp-step44-prime-tools-popover {
    left: 11px !important;
    right: 11px !important;
    top: auto !important;
    bottom: 86px !important;
    width: auto !important;
    max-height: min(72dvh, 520px);
    overflow: auto;
    transform: translate3d(0, 12px, 0) scale(.985);
  }

  .gp-step44-prime-tools-popover.is-open {
    transform: translate3d(0, 0, 0) scale(1);
  }

  .gp-step44-prime-tools-action {
    min-height: 62px;
  }
}
