/* Portfolio-scope button (Growth / Indian / US) for the stock page.
   Used in two places: the trade bar (left of Trade) and the Stats grid (where Volume used to be).
   Both open the same menu and change which portfolio "Portfolio diversity" is measured against. */

/* Trade bar: no surface of its own. The bar is the glass; this button sits directly on it (icon + text + chevron), Trade stays green.
   Selectors are as specific as the existing `#phTrade button` glass rules so they win without touching them. */
html body:not(#lgfa):not(#lgfb) #phTrade button.ph-scope {
  flex: 0 1 auto; min-width: 0; height: 52px; padding: 0 12px 0 4px; gap: 8px;
  display: inline-flex; align-items: center; justify-content: flex-start;
  background: none !important; color: var(--text) !important; border-radius: 0;
  -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none !important;
  font-size: calc(18px * var(--pf-ts, 1)); font-weight: 600; line-height: 1; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
#phTrade button.ph-scope svg { flex: none; display: block; width: 24px; height: 24px; color: var(--text); }
#phTrade button.ph-scope .ps-chev { width: 18px; height: 18px; opacity: .9; transition: transform .18s ease; }
#phTrade button.ph-scope .ps-t { display: block; line-height: 1; overflow: hidden; text-overflow: ellipsis; }
#phTrade button.ph-scope[aria-expanded="true"] .ps-chev { transform: rotate(180deg); }
html body:not(#lgfa):not(#lgfb) #phTrade button.ph-scope:active { opacity: .6; }
#phTrade button.ph-t-go { flex: 1 1 0; min-width: 0; padding: 0 24px; }

/* Stats grid cell: sits where Volume was */
.rhp-grid > div.rhp-scope-cell { min-width: 0; }
.rhp-grid > div.rhp-scope-cell > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.rhp-scope {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 34px; padding: 0 10px 0 8px;
  border: 0; border-radius: 999px; background: var(--lgf-pill, var(--pill)); color: var(--text);
  -webkit-backdrop-filter: var(--lgf-fx); backdrop-filter: var(--lgf-fx); box-shadow: var(--lgf-pill-sh);
  font: inherit; font-size: calc(14px * var(--pf-ts, 1)); font-weight: 600; line-height: 1; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
button.rhp-scope svg { flex: none; width: 16px; height: 16px; }
button.rhp-scope .rs-t { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.rhp-scope .rs-chev { transition: transform .18s ease; }
button.rhp-scope[aria-expanded="true"] .rs-chev { transform: rotate(180deg); }

/* Menu (opens above the trade bar; works from either button) */
#phScopeScrim { display: none; }
#phScopeScrim.show { display: block; position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.45); }
#phScopeMenu { display: none; }
#phScopeMenu.show {
  display: flex; flex-direction: column; gap: 4px; position: fixed; z-index: 91; padding: 8px; box-sizing: border-box;
  left: max(14px, calc((100vw - 430px) / 2 + 14px)); width: min(260px, calc(100vw - 28px));
  bottom: calc(max(8px, env(safe-area-inset-bottom, 0px) - 20px) + 76px + 72px + 10px);
  border-radius: 24px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(0,0,0,.35);
}
#phScopeMenu .ps-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 52px; padding: 0 14px; box-sizing: border-box;
  border: 0; border-radius: 16px; background: transparent; color: var(--text); font: inherit; font-size: calc(17px * var(--pf-ts, 1)); font-weight: 600; text-align: left; cursor: pointer;
}
#phScopeMenu .ps-opt span { flex: 1; }
#phScopeMenu .ps-opt small { color: var(--muted); font-size: calc(13px * var(--pf-ts, 1)); font-weight: 400; }
#phScopeMenu .ps-opt i { flex: none; width: 18px; color: var(--text); font-style: normal; font-weight: 700; text-align: right; }
#phScopeMenu .ps-opt.sel { background: var(--pill); }
#phScopeMenu .ps-opt:disabled { opacity: .4; cursor: default; }
#phScopeMenu .ps-opt:focus-visible, button.rhp-scope:focus-visible, #phTrade button.ph-scope:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
