/* Shared static TopNav. Screen only: page content and PDF styles keep their own rules. */
html:has(body.gatekeepr-navigation) { --gatekeepr-header-height: 76px; scroll-padding-top: calc(var(--gatekeepr-header-height) + 8px); }
body.gatekeepr-navigation:not(.pdf-layout-probe) { padding-top: var(--gatekeepr-header-height); }
body.gatekeepr-navigation.tools-page main { padding-top: 0; }
.gatekeepr-navigation .gatekeepr-header {
  position: fixed; inset: 0 0 auto; z-index: 50;
  background: var(--header-bg, rgba(248, 251, 249, .84));
  border-bottom: 1px solid var(--header-line, #dce8e2); backdrop-filter: blur(16px);
  font-family: var(--font-sans, Inter, system-ui, sans-serif);
}
.gatekeepr-navigation .gatekeepr-header .nav-wrap {
  width: min(1280px, calc(100% - 32px)); margin: 0 auto;
  min-height: 76px; display: flex; flex-wrap: nowrap; align-items: center;
  justify-content: space-between; gap: 22px;
}
.gatekeepr-navigation .gatekeepr-header .brand { display: inline-flex; flex-shrink: 0; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.gatekeepr-navigation .gatekeepr-header .brand-mark { display: grid; place-items: center; overflow: hidden; background: transparent; box-shadow: none; border-radius: 14px; }
.gatekeepr-navigation .gatekeepr-header .brand-mark,
.gatekeepr-navigation .gatekeepr-header .brand-logo-svg { width: 44px !important; height: 44px !important; max-width: 44px !important; flex: 0 0 44px; }
.gatekeepr-navigation .gatekeepr-header .brand strong { display: block; font-size: 19px; font-weight: 900; }
.gatekeepr-navigation .gatekeepr-header .brand small { display: block; margin-top: 3px; font-size: 11px; font-weight: 650; letter-spacing: .045em; color: var(--text-muted, #658178); }
.gatekeepr-navigation .gatekeepr-header .top-nav { display: flex; flex: 0 1 auto; align-items: center; gap: 6px; margin: 0; min-width: 0; }
.gatekeepr-navigation .gatekeepr-header .top-nav > a,
.gatekeepr-navigation .gatekeepr-header .nav-dropdown-button {
  display: inline-flex; flex-shrink: 0; min-height: 32px; align-items: center; gap: 6px;
  padding: 0 9px; border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--text-muted, #658178);
  font: 700 12px var(--font-sans, Inter, system-ui, sans-serif); white-space: nowrap; text-decoration: none; cursor: pointer;
}
.gatekeepr-navigation .gatekeepr-header .top-nav > a:hover,
.gatekeepr-navigation .gatekeepr-header .nav-dropdown-button:hover { background: var(--surface-74, var(--surface-soft)); color: var(--text); }
.gatekeepr-navigation .gatekeepr-header .top-nav > a.active,
.gatekeepr-navigation .gatekeepr-header .nav-dropdown-button.active { background: var(--accent-soft, #e7f3ee); color: var(--primary); box-shadow: none; }
.gatekeepr-navigation .gatekeepr-header .nav-dropdown { position: relative; flex-shrink: 0; }
.gatekeepr-navigation .gatekeepr-header .nav-dropdown-menu {
  position: absolute; z-index: 80; top: calc(100% + 8px); right: 0;
  display: none; width: 210px; padding: 7px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface-96, var(--surface)); box-shadow: var(--shadow-card, 0 12px 30px rgba(40, 83, 70, .12));
}
.gatekeepr-navigation .gatekeepr-header .nav-dropdown-menu::before { content: ''; position: absolute; right: 0; bottom: 100%; left: 0; height: 10px; }
.gatekeepr-navigation .gatekeepr-header .nav-dropdown:hover .nav-dropdown-menu,
.gatekeepr-navigation .gatekeepr-header .nav-dropdown:focus-within .nav-dropdown-menu { display: grid; }
.gatekeepr-navigation .gatekeepr-header .nav-dropdown-menu a { padding: 10px 12px; border-radius: 9px; color: var(--text-muted, #658178); font-size: 12px; font-weight: 750; text-decoration: none; }
.gatekeepr-navigation .gatekeepr-header .nav-dropdown-menu a:hover { background: var(--surface-soft); color: var(--text); }
.gatekeepr-navigation .gatekeepr-header .nav-dropdown-menu a.active { background: var(--accent-soft, #e7f3ee); color: var(--primary); }
.gatekeepr-navigation .gatekeepr-header .workspace-view-switch {
  position: relative;
  isolation: isolate;
  display: grid;
  width: 82px;
  height: 38px;
  flex: 0 0 82px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px;
  border-radius: 999px;
}

.gatekeepr-navigation .gatekeepr-header .workspace-view-track {
  position: absolute;
  inset: 0;
  z-index: 0;
  border: 1px solid var(--line);
  border-radius: inherit;
  background: var(--surface-78, var(--surface));
  box-shadow: 0 8px 20px var(--shadow-soft, rgba(40,83,70,.08));
}

.gatekeepr-navigation .gatekeepr-header .workspace-view-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  z-index: 1;
  width: calc(50% - 3px);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 3px 10px var(--shadow-12, rgba(40,83,70,.12)), inset 0 0 0 1px var(--line-soft, #e5eee9);
  transform: translateX(0);
  transition: transform .22s ease, background .22s ease, box-shadow .22s ease;
}

.gatekeepr-navigation .gatekeepr-header .workspace-view-switch[data-view="portfolio"] .workspace-view-thumb {
  background: var(--surface-tint, #eaf4ef);
  box-shadow: 0 3px 10px var(--shadow-12, rgba(40,83,70,.12)), inset 0 0 0 1px var(--line-tint, #dce8e2);
  transform: translateX(100%);
}

.gatekeepr-navigation .gatekeepr-header .workspace-view-button {
  position: relative;
  z-index: 2;
  display: inline-flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted, #658178);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.gatekeepr-navigation .gatekeepr-header .workspace-view-button:hover {
  color: var(--text);
}

.gatekeepr-navigation .gatekeepr-header .workspace-view-button:focus-visible {
  outline: 3px solid var(--accent-focus);
  outline-offset: 2px;
}

.gatekeepr-navigation .gatekeepr-header .workspace-view-switch[data-view="all"] .workspace-view-button-all,
.gatekeepr-navigation .gatekeepr-header .workspace-view-switch[data-view="portfolio"] .workspace-view-button-portfolio {
  color: var(--text);
}

.gatekeepr-navigation .gatekeepr-header .workspace-view-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}


.gatekeepr-navigation .gatekeepr-header .watchlist-control-mobile { display: none; }

/* Keep the watchlist selector visually stable before watchlist.js hydrates it.
   The root state is written in <head>, before first paint, so there is no neutral -> selected animation. */
[data-watchlist-static] .workspace-view-thumb {
  transition: none !important;
}
html[data-watchlist-view="all"] [data-watchlist-static] .workspace-view-thumb {
  transform: translateX(0);
}
html[data-watchlist-view="portfolio"] [data-watchlist-static] .workspace-view-thumb {
  background: var(--surface-tint);
  box-shadow: 0 3px 10px var(--shadow-12), inset 0 0 0 1px var(--line-tint);
  transform: translateX(100%);
}
html[data-watchlist-view="all"] [data-watchlist-static] .workspace-view-button-all,
html[data-watchlist-view="portfolio"] [data-watchlist-static] .workspace-view-button-portfolio {
  color: var(--text);
}

@media (max-width: 1180px) {
  html:has(body.gatekeepr-navigation) { --gatekeepr-header-height: 116px; }
  .gatekeepr-navigation .gatekeepr-header .nav-wrap { min-height: 116px; flex-wrap: wrap; gap: 0; padding-top: 10px; padding-bottom: 6px; }
  .gatekeepr-navigation .gatekeepr-header .brand { order: 0; }
  .gatekeepr-navigation .gatekeepr-header .watchlist-control-mobile { display: grid; order: 1; margin-left: auto; }
  .gatekeepr-navigation .gatekeepr-header .top-nav { display: flex; order: 2; flex: 0 0 100%; width: 100%; overflow-x: auto; padding: 6px 0; }
  .gatekeepr-navigation .gatekeepr-header .top-nav > a { display: inline-flex; }
  .gatekeepr-navigation .gatekeepr-header .top-nav > .watchlist-control { display: none; }
  .gatekeepr-navigation .gatekeepr-header .nav-dropdown-menu { position: fixed; top: 116px; right: 16px; max-height: calc(100dvh - 132px); overflow-y: auto; }
}
@media (max-width: 540px) {
  .gatekeepr-navigation .gatekeepr-header .brand strong { font-size: 17px; }
  .gatekeepr-navigation .gatekeepr-header .brand-mark,
  .gatekeepr-navigation .gatekeepr-header .brand-logo-svg { width: 39px !important; height: 39px !important; max-width: 39px !important; flex-basis: 39px; }
}

/* Grouped navigation: six primary choices, with click/touch disclosures. */
html:has(.top-nav[data-navigation="grouped"]) { --gatekeepr-header-height: 76px; }
.gatekeepr-navigation .gatekeepr-header .nav-wrap:has(> [data-navigation="grouped"]) {
  min-height: 76px; flex-wrap: nowrap; gap: 22px; padding-top: 0; padding-bottom: 0;
}
.gatekeepr-navigation .gatekeepr-header .top-nav[data-navigation="grouped"] {
  display: flex; order: 0; flex: 0 1 auto; width: auto; gap: 6px; padding: 0; overflow: visible;
}
.gatekeepr-navigation .gatekeepr-header .top-nav[data-navigation="grouped"] > a { display: inline-flex; }
.gatekeepr-navigation .gatekeepr-header .top-nav[data-navigation="grouped"] > .watchlist-control { display: grid; }
.gatekeepr-navigation .gatekeepr-header .nav-wrap:has(> [data-navigation="grouped"]) > .watchlist-control-mobile { display: none; }
.gatekeepr-navigation .gatekeepr-header .nav-mobile-toggle {
  display: none; align-items: center; justify-content: center; gap: 6px; min-height: 38px;
  padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--text); font: 700 12px var(--font-sans, Inter, system-ui, sans-serif); cursor: pointer;
}
.gatekeepr-navigation .gatekeepr-header [data-navigation="grouped"] .nav-dropdown-menu {
  position: absolute; display: grid; top: calc(100% + 10px); right: 0; width: 264px;
  max-height: calc(100dvh - 100px); overflow-y: auto; padding: 8px;
  background: var(--surface); gap: 2px;
}
.gatekeepr-navigation .gatekeepr-header [data-navigation="grouped"] .nav-dropdown-menu[hidden] { display: none; }
.gatekeepr-navigation .gatekeepr-header [data-navigation="grouped"] .nav-dropdown-menu::before { display: none; }
.gatekeepr-navigation .gatekeepr-header .nav-dropdown-heading {
  padding: 7px 12px 5px; color: var(--text-muted); font-size: 10px; font-weight: 750; line-height: 1.4; letter-spacing: .08em; text-transform: uppercase;
}
.gatekeepr-navigation .gatekeepr-header [data-navigation="grouped"] .nav-dropdown-menu a {
  display: grid; gap: 3px; padding: 10px 12px; white-space: normal; line-height: 1.35; color: var(--text);
}
.gatekeepr-navigation .gatekeepr-header .nav-item-label { font-size: 12px; font-weight: 750; }
.gatekeepr-navigation .gatekeepr-header [data-navigation="grouped"] .nav-dropdown-menu small {
  display: block; color: var(--text-muted); font-size: 11px; font-weight: 500; line-height: 1.4;
}
.gatekeepr-navigation .gatekeepr-header .nav-dropdown-button[aria-expanded="true"] { background: var(--surface-soft); color: var(--text); }
.gatekeepr-navigation .gatekeepr-header .nav-chevron { transition: transform .15s ease; }
.gatekeepr-navigation .gatekeepr-header [aria-expanded="true"] > .nav-chevron { transform: rotate(180deg); }
.gatekeepr-navigation .gatekeepr-header :is(.nav-mobile-toggle, .nav-dropdown-button, .nav-dropdown-menu a):focus-visible { outline: 3px solid var(--accent-focus, var(--primary)); outline-offset: 2px; }

@media (max-width: 1050px) {
  .gatekeepr-navigation .gatekeepr-header .nav-wrap:has(> [data-navigation="grouped"]) {
    width: calc(100% - 24px); min-height: 76px; flex-wrap: wrap; justify-content: flex-start; gap: 0 8px;
  }
  .gatekeepr-navigation .gatekeepr-header .nav-wrap:has(> [data-navigation="grouped"]) > .brand { order: 0; min-height: 76px; margin-right: auto; }
  .gatekeepr-navigation .gatekeepr-header .nav-wrap:has(> [data-navigation="grouped"]) > .watchlist-control-mobile { display: grid; order: 1; margin-left: 0; }
  .gatekeepr-navigation .gatekeepr-header .nav-mobile-toggle { display: inline-flex; order: 2; }
  .gatekeepr-navigation .gatekeepr-header .top-nav[data-navigation="grouped"] {
    display: none; order: 3; flex: 0 0 100%; width: 100%; flex-direction: column; align-items: stretch; gap: 4px;
    max-height: calc(100dvh - 76px); overflow-y: auto; overscroll-behavior: contain; padding: 0 0 12px;
  }
  .gatekeepr-navigation .gatekeepr-header .top-nav[data-navigation="grouped"][data-open="true"] { display: flex; }
  .gatekeepr-navigation .gatekeepr-header .top-nav[data-navigation="grouped"] > a,
  .gatekeepr-navigation .gatekeepr-header [data-navigation="grouped"] .nav-dropdown-button {
    display: flex; width: 100%; min-height: 44px; justify-content: space-between; padding: 0 12px;
  }
  .gatekeepr-navigation .gatekeepr-header [data-navigation="grouped"] .nav-dropdown-menu {
    position: static; width: 100%; max-height: none; margin: 4px 0 6px; padding: 6px;
    overflow: visible; border-radius: 10px; box-shadow: none;
  }
  .gatekeepr-navigation .gatekeepr-header [data-navigation="grouped"] .nav-dropdown-menu a { min-height: 48px; }
  .gatekeepr-navigation .gatekeepr-header .top-nav[data-navigation="grouped"] > .watchlist-control { display: none; }
}
@media (max-width: 540px) {
  .gatekeepr-navigation .gatekeepr-header .nav-mobile-toggle { width: 36px; padding: 0; }
  .gatekeepr-navigation .gatekeepr-header .nav-mobile-icon { font-size: 20px; line-height: 1; }
  .gatekeepr-navigation .gatekeepr-header .nav-mobile-label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .gatekeepr-navigation .gatekeepr-header .nav-wrap:has(> [data-navigation="grouped"]) > .watchlist-control-mobile { width: 72px; flex-basis: 72px; }
}
@media (prefers-reduced-motion: reduce) {
  .gatekeepr-navigation .gatekeepr-header .nav-chevron { transition: none; }
}

/* One global market control; the same node lives in the mobile disclosure. */
.gatekeepr-navigation .gatekeepr-header .market-control {
  display: inline-flex; flex: 0 0 auto; align-items: center; gap: 5px;
  min-height: 38px; margin: 0 3px; padding: 0 6px 0 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-78, var(--surface)); color: var(--text);
}
.gatekeepr-navigation .gatekeepr-header .market-control svg {
  width: 15px; height: 15px; fill: none; stroke: var(--text-muted, currentColor); stroke-width: 1.5;
}
.gatekeepr-navigation .gatekeepr-header .market-control-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
.gatekeepr-navigation .gatekeepr-header .market-control select {
  width: 133px; min-height: 36px; margin: 0; padding: 0 5px; border: 0; border-radius: 12px;
  background: transparent; color: var(--text); box-shadow: none;
  font: 700 12px var(--font-sans, Inter, system-ui, sans-serif); cursor: pointer;
}
.gatekeepr-navigation .gatekeepr-header .market-control option { background: var(--surface); color: var(--text); }
.gatekeepr-navigation .gatekeepr-header .market-control:hover { background: var(--surface-soft); }
.gatekeepr-navigation .gatekeepr-header .market-control:focus-within {
  outline: 3px solid var(--accent-focus, var(--primary)); outline-offset: 2px;
}
.gatekeepr-navigation .gatekeepr-header .market-control select:focus { outline: none; box-shadow: none; }
.market-empty {
  display: grid; place-items: center; gap: 9px; width: 100%; min-width: 0;
  padding: 24px 18px; color: var(--text); text-align: center;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft, var(--surface));
  grid-column: 1 / -1; box-sizing: border-box;
}
.market-empty-symbol { color: var(--primary); font-size: 25px; line-height: 1; }
.market-empty strong { font-size: 15px; line-height: 1.4; }
.market-empty p { max-width: 58ch; margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-muted); }
@media (min-width: 1051px) and (max-width: 1100px) {
  .gatekeepr-navigation .gatekeepr-header .nav-wrap:has(> [data-navigation="grouped"]) { gap: 8px; }
  .gatekeepr-navigation .gatekeepr-header .top-nav[data-navigation="grouped"] { gap: 1px; }
  .gatekeepr-navigation .gatekeepr-header .top-nav[data-navigation="grouped"] > a,
  .gatekeepr-navigation .gatekeepr-header [data-navigation="grouped"] .nav-dropdown-button { padding-inline: 6px; }
}
@media (max-width: 1050px) {
  .gatekeepr-navigation .gatekeepr-header .market-control { margin: 8px 0 0; border-radius: 10px; padding: 4px 12px; }
  .gatekeepr-navigation .gatekeepr-header .market-control-label {
    position: static; width: auto; height: auto; clip-path: none; margin-right: auto;
    font-size: 12px; font-weight: 700;
  }
  .gatekeepr-navigation .gatekeepr-header .market-control select { min-height: 40px; }
}
