/* Stage 397 — Post-auth professional terminal activation */
:root {
  --stage397-panel: rgba(8, 18, 34, .96);
  --stage397-panel-2: rgba(12, 30, 55, .98);
  --stage397-border: rgba(96, 165, 250, .30);
  --stage397-border-strong: rgba(250, 204, 21, .32);
  --stage397-text: #edf5ff;
  --stage397-muted: #a9bad3;
  --stage397-blue: #60a5fa;
  --stage397-green: #34d399;
  --stage397-gold: #facc15;
}

html, body { overflow-x: hidden; }

body.stage397-terminal-active select,
body.stage397-terminal-active .sidebar-select,
body.stage397-terminal-active select.sidebar-select,
body.stage397-terminal-active #derivAccountSelect {
  appearance: auto;
  -webkit-appearance: auto;
  width: 100%;
  min-height: 46px;
  border-radius: 16px;
  background-color: #071223 !important;
  color: var(--stage397-text) !important;
  border: 1px solid var(--stage397-border) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 10px 28px rgba(2,8,23,.22);
  padding: 0 14px;
  font-weight: 800;
  letter-spacing: .01em;
  text-overflow: ellipsis;
}

body.stage397-terminal-active select option,
body.stage397-terminal-active #derivAccountSelect option,
body.stage397-terminal-active #languageSelect option {
  background-color: #071223 !important;
  color: #f8fbff !important;
  font-weight: 700;
  padding: 10px 12px;
}

body.stage397-terminal-active select option:checked,
body.stage397-terminal-active #derivAccountSelect option:checked {
  background-color: #1d4ed8 !important;
  color: #ffffff !important;
}

body.stage397-authenticated #accountSelectorPanel,
body.stage397-terminal-active #accountSelectorPanel:not([hidden]) {
  display: block !important;
  border-color: rgba(52, 211, 153, .28) !important;
  box-shadow: 0 18px 46px rgba(2,8,23,.28), inset 0 1px 0 rgba(255,255,255,.05);
}

body.stage397-authenticated #heroLoginBtn {
  border-color: rgba(52, 211, 153, .42) !important;
  background: linear-gradient(135deg, rgba(7, 54, 43, .96), rgba(16, 46, 83, .95)) !important;
}

body.stage397-authenticated #heroLoginBtn .hero-media-cta__icon {
  border-color: rgba(52, 211, 153, .38) !important;
  background: radial-gradient(circle at 35% 25%, rgba(52,211,153,.33), rgba(15,23,42,.72)) !important;
}

body.stage397-authenticated #oauthLoginBtn,
body.stage397-authenticated #oauthSignupBtn {
  opacity: .82;
}

.stage397-auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  margin-top: 10px;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, .30);
  background: rgba(6, 78, 59, .22);
  color: #d1fae5;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.stage397-auth-pill::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--stage397-green);
  box-shadow: 0 0 18px rgba(52,211,153,.9);
}

body.stage397-terminal-active .hero-dropdown-shell.open .hero-dropdown-menu,
body.stage397-terminal-active .hero-dropdown-menu.stage397-open,
body.stage397-terminal-active .hero-dropdown-menu.stage383-open {
  display: grid !important;
  gap: 8px !important;
  min-width: min(340px, calc(100vw - 32px));
  max-height: min(430px, calc(100vh - 160px));
  overflow: auto;
  padding: 10px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(10,23,42,.98), rgba(4,10,22,.98)) !important;
  border: 1px solid rgba(96,165,250,.30) !important;
  box-shadow: 0 28px 72px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.05);
  z-index: 999999 !important;
}

body.stage397-terminal-active .hero-dropdown-option {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 9px 10px;
  border-radius: 15px;
  border: 1px solid rgba(96,165,250,.18);
  background: rgba(15, 32, 57, .82);
  color: #eef6ff;
  cursor: pointer;
  text-align: left;
}
body.stage397-terminal-active .hero-dropdown-option:hover,
body.stage397-terminal-active .hero-dropdown-option[aria-selected="true"] {
  border-color: rgba(250,204,21,.42);
  background: linear-gradient(135deg, rgba(30,64,120,.78), rgba(36,30,12,.50));
}
body.stage397-terminal-active .hero-dropdown-option strong { font-size: 13px; }
body.stage397-terminal-active .hero-dropdown-option small { color: var(--stage397-muted); font-weight: 700; }
body.stage397-terminal-active .hero-dropdown-check { color: var(--stage397-gold); font-weight: 900; }

.stage397-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000000;
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 15px;
  border-radius: 16px;
  color: #eef6ff;
  background: rgba(10,23,42,.97);
  border: 1px solid rgba(96,165,250,.28);
  box-shadow: 0 22px 58px rgba(0,0,0,.45);
  font: 800 13px/1.45 Inter, system-ui, -apple-system, Segoe UI, sans-serif;
}
.stage397-toast[data-tone="success"] { background: rgba(6,78,59,.97); border-color: rgba(52,211,153,.34); }
.stage397-toast[data-tone="error"] { background: rgba(127,29,29,.97); border-color: rgba(248,113,113,.38); }

body.stage397-terminal-active .hero-media-cta strong,
body.stage397-terminal-active .hero-media-cta small,
body.stage397-terminal-active .hero-media-cta__tail {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
body.stage397-terminal-active .hero-media-cta {
  min-width: 0;
  overflow: hidden;
}
body.stage397-terminal-active .hero-media-cta__body {
  min-width: 0;
}

body.stage397-authenticated .stage397-login-only-label { display: none !important; }

@media (max-width: 860px) {
  body.stage397-terminal-active .hero-dropdown-menu.stage397-open { right: 8px; left: auto; }
  .stage397-auth-pill { font-size: 10px; padding: 0 10px; }
}
