/*
 * Innellis canonical desktop product toolbar.
 *
 * One visual contract for:
 *   Overview
 *   Research
 *   Portfolio & Risk
 *   Intelligence
 *   Track Record
 *   Alpha
 *
 * Desktop only. Existing mobile product/SEO navigation remains
 * authoritative below 768px.
 */

.innellis-product-toolbar {
  position: sticky;
  top: 0;
  z-index: 500;
  min-height: 50px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 20px;
  background: rgba(255,255,255,.985);
  border-bottom: 1px solid #E1E5EA;
  box-shadow: 0 1px 2px rgba(16,24,40,.035);
  color: #172033;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.innellis-product-toolbar,
.innellis-product-toolbar * {
  box-sizing: border-box;
}

.innellis-toolbar-brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
  text-decoration: none;
  font-family:
    "JetBrains Mono",
    ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: .05em;
  color: #A86F15;
}

.innellis-toolbar-brand-page {
  margin-left: 5px;
  color: #687386;
  font-weight: 500;
  letter-spacing: .02em;
}

.innellis-toolbar-right {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.innellis-toolbar-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-family:
    "JetBrains Mono",
    ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  font-size: 10px;
  line-height: 1;
  color: #687386;
}

.innellis-toolbar-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #168554;
  animation: innellisToolbarPulse 2s infinite;
}

@keyframes innellisToolbarPulse {
  0%,100% { opacity: 1; }
  50% { opacity: .42; }
}

#clock.innellis-toolbar-clock {
  min-width: 58px;
  flex: 0 0 auto;
  white-space: nowrap;
  font-family:
    "JetBrains Mono",
    ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  font-size: 10px;
  line-height: 1;
  color: #687386;
  text-align: left;
}

.innellis-toolbar-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.innellis-toolbar-nav a,
.innellis-toolbar-nav span {
  flex: 0 0 auto;
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border: 1px solid #E1E5EA;
  border-radius: 4px;
  background: #FFFFFF;
  color: #26364A;
  text-decoration: none;
  font-family:
    "JetBrains Mono",
    ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  font-size: 10px;
  line-height: 1;
  font-weight: 600;
  transition:
    border-color .15s ease,
    background-color .15s ease,
    color .15s ease;
}

.innellis-toolbar-nav a:hover {
  border-color: #D6B879;
  background: #FBF6EC;
}

.innellis-toolbar-nav .active {
  border-color: #D6B879;
  background: #FBF6EC;
  color: #8B5A0A;
  cursor: default;
}

.innellis-toolbar-utility {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.innellis-toolbar-auth {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 27px;
}

/*
 * Existing account controls are page-owned for now because their
 * authentication/error contracts intentionally differ.
 * Normalize their outer geometry only.
 */
.innellis-toolbar-auth > * {
  margin: 0 !important;
}

/*
 * Research notification behavior remains page-owned.
 * This normalizes only its placement.
 */
.innellis-toolbar-notifications {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 27px;
}

/*
 * Intermediate desktop widths:
 * navigation may scroll horizontally instead of wrapping and making
 * toolbar height differ from page to page.
 */
@media (min-width:769px) and (max-width:1180px) {
  .innellis-product-toolbar {
    gap: 10px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .innellis-toolbar-right {
    gap: 8px;
    overflow: hidden;
  }

  .innellis-toolbar-nav {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .innellis-toolbar-nav::-webkit-scrollbar {
    display: none;
  }

  .innellis-toolbar-status {
    display: none;
  }

  #clock.innellis-toolbar-clock {
    display: none;
  }
}

/*
 * Do not replace the established mobile terminal / mobile SEO systems.
 */
@media (max-width:768px) {
  .innellis-product-toolbar {
    display: none !important;
  }
}

/* =========================================================
   HARD ISOLATION FROM LEGACY PAGE-LEVEL NAV RULES
   =========================================================

   Intelligence and Track Record historically define broad selectors
   such as:

       nav { ... }

   The shared product toolbar contains its own semantic <nav>.
   Reset every structural property here so those legacy selectors
   cannot alter toolbar geometry or appearance.
 */

.innellis-product-toolbar .innellis-toolbar-nav {
  position: static !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;

  z-index: auto !important;

  width: auto !important;
  max-width: none !important;
  min-height: 0 !important;
  height: auto !important;

  margin: 0 !important;
  padding: 0 !important;

  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;

  background: transparent !important;
  background-color: transparent !important;

  border: 0 !important;
  border-top: 0 !important;
  border-right: 0 !important;
  border-bottom: 0 !important;
  border-left: 0 !important;

  border-radius: 0 !important;
  box-shadow: none !important;

  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;

  overflow-y: visible !important;
  white-space: nowrap !important;
}

.innellis-product-toolbar .innellis-toolbar-nav a,
.innellis-product-toolbar .innellis-toolbar-nav span {
  margin: 0 !important;
}

@media (min-width:769px) and (max-width:1180px) {
  .innellis-product-toolbar .innellis-toolbar-nav {
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }
}

/* =========================================================
   ALPHA MOBILE EXCEPTION
   =========================================================

   /alpha has no dedicated view in dashboard-mobile.html and is served
   directly on phones. Keep the canonical product toolbar available on
   that surface rather than leaving Alpha without navigation.
 */

@media (max-width:768px) {
  .innellis-product-toolbar[data-section="alpha"] {
    display: flex !important;
    position: sticky !important;
    min-height: 48px;
    gap: 8px;
    padding: 7px 10px;
  }

  .innellis-product-toolbar[data-section="alpha"]
  .innellis-toolbar-brand-page {
    display: none;
  }

  .innellis-product-toolbar[data-section="alpha"]
  .innellis-toolbar-right {
    flex: 1 1 auto;
    min-width: 0;
    gap: 0;
    overflow: hidden;
  }

  .innellis-product-toolbar[data-section="alpha"]
  .innellis-toolbar-status,
  .innellis-product-toolbar[data-section="alpha"]
  .innellis-toolbar-clock,
  .innellis-product-toolbar[data-section="alpha"]
  .innellis-toolbar-utility {
    display: none !important;
  }

  .innellis-product-toolbar[data-section="alpha"]
  .innellis-toolbar-nav {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    justify-content: flex-start !important;
    scrollbar-width: none;
  }

  .innellis-product-toolbar[data-section="alpha"]
  .innellis-toolbar-nav::-webkit-scrollbar {
    display: none;
  }

  .innellis-product-toolbar[data-section="alpha"]
  .innellis-toolbar-nav a,
  .innellis-product-toolbar[data-section="alpha"]
  .innellis-toolbar-nav span {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 9px;
  }
}

/* =========================================================
   PRODUCT TOOLBAR FIRST-PAINT STABILITY
   =========================================================
   Every product route performs a full document navigation.
   Keep the shared product chrome geometrically identical before,
   during and after JS mounting so route changes do not look like
   different header animations.
 */

#product-toolbar {
  box-sizing: border-box !important;
  width: 100% !important;
  height: 52px !important;
  min-height: 52px !important;
  max-height: 52px !important;

  margin: 0 !important;

  opacity: 1 !important;
  transform: none !important;

  animation: none !important;
  transition: none !important;
}

/*
 * Until JS has finished mounting, reserve exactly the same physical
 * toolbar space but do not show partially-created controls.
 */
#product-toolbar:not([data-toolbar-ready="true"]) {
  background: #fff !important;
  border-top: 2px solid #19b7b3 !important;
  border-bottom: 1px solid #e7eaee !important;
  overflow: hidden !important;
}

/*
 * Page-level rules must never animate product chrome.
 */
#product-toolbar,
#product-toolbar *,
#product-toolbar *::before,
#product-toolbar *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/*
 * Explicitly freeze the elements whose dimensions could otherwise
 * shift as page-specific CSS or fonts finish loading.
 */
#product-toolbar .innellis-toolbar-brand,
#product-toolbar .innellis-toolbar-brand-name,
#product-toolbar .innellis-toolbar-brand-page,
#product-toolbar .innellis-toolbar-status,
#product-toolbar .innellis-toolbar-clock,
#product-toolbar .innellis-toolbar-nav,
#product-toolbar .innellis-toolbar-nav a,
#product-toolbar .innellis-toolbar-nav span,
#product-toolbar .innellis-toolbar-utility {
  animation: none !important;
  transition: none !important;
  transform: none !important;
}

/*
 * Desktop toolbar geometry is deliberately fixed across all product
 * surfaces. Individual pages may not alter this height.
 */
@media (min-width:769px) {
  #product-toolbar {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
  }
}

/*
 * Alpha deliberately retains shared product navigation on mobile.
 * Its mobile exception needs natural height rather than desktop 52px.
 */
@media (max-width:768px) {
  #product-toolbar[data-section="alpha"] {
    height: auto !important;
    max-height: none !important;
  }
}

/* =========================================================
   CANONICAL ACCOUNT / UTILITY GEOMETRY
   =========================================================
   Keep the right edge identical across every desktop product surface.
   Notification presence and username length must not move navigation
   or account positioning from page to page.
 */

@media (min-width:769px) {
  #product-toolbar .innellis-toolbar-right {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  #product-toolbar .innellis-toolbar-nav {
    margin-left: auto !important;
  }

  #product-toolbar .innellis-toolbar-utility {
    display: grid !important;
    grid-template-columns: 34px 154px !important;
    align-items: center !important;
    justify-content: end !important;

    width: 194px !important;
    min-width: 194px !important;
    max-width: 194px !important;

    margin-left: 8px !important;
    gap: 6px !important;
  }

  /*
   * Always reserve the first utility column for notifications.
   * Pages without notifications simply leave it visually empty.
   */
  #product-toolbar .innellis-toolbar-notifications {
    grid-column: 1 !important;

    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #product-toolbar .innellis-toolbar-auth {
    grid-column: 2 !important;

    width: 154px !important;
    min-width: 154px !important;
    max-width: 154px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;

    overflow: hidden !important;
    white-space: nowrap !important;
  }

  #product-toolbar .innellis-toolbar-account-name {
    display: block !important;
    width: 100% !important;

    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;

    text-align: right !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    font-weight: 600 !important;
  }

  #product-toolbar .innellis-toolbar-login-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    min-height: 28px !important;
    padding: 3px 10px !important;

    border: 1px solid var(--amber, #d49a28) !important;
    border-radius: 4px !important;

    background: rgba(245,166,35,.08) !important;
    color: var(--amber, #b07810) !important;

    font-family: 'JetBrains Mono', monospace !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    text-decoration: none !important;

    white-space: nowrap !important;
  }

  /*
   * Existing page-owned account controls are allowed to replace the
   * fallback contents, but may not change the canonical outer geometry.
   */
  #product-toolbar .innellis-toolbar-auth > * {
    max-width: 154px !important;
  }
}


/* =========================================================
   CANONICAL_ACCOUNT_CONTROL_DIMENSIONS_V1
   =========================================================
   The account slot is shared, but Overview/Research/Risk still own
   richer account behavior and replace its inner HTML. Normalize every
   possible account trigger to exactly the same dimensions without
   changing page-owned authentication behavior.
 */

@media (min-width:769px) {

  #product-toolbar .innellis-toolbar-auth > div {
    box-sizing: border-box !important;

    width: 154px !important;
    min-width: 154px !important;
    max-width: 154px !important;

    position: relative !important;
  }

  #product-toolbar .innellis-toolbar-auth > button,
  #product-toolbar .innellis-toolbar-auth > div > button,
  #product-toolbar .innellis-toolbar-login-link,
  #product-toolbar .innellis-toolbar-account-name {
    box-sizing: border-box !important;

    width: 154px !important;
    min-width: 154px !important;
    max-width: 154px !important;

    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;

    margin: 0 !important;
    padding: 0 10px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    font-family: 'JetBrains Mono', monospace !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1 !important;

    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;

    border-radius: 4px !important;

    transform: none !important;
    animation: none !important;
    transition: none !important;
  }

  /*
   * Username/profile controls keep the same physical position and
   * dimensions regardless of username length.
   */
  #product-toolbar .innellis-toolbar-account-name,
  #product-toolbar .innellis-toolbar-auth > div > button {
    text-align: center !important;
  }
}

/* =========================================================
   CANONICAL_ACCOUNT_VISUAL_V1
   =========================================================
   Overview, Research and Portfolio & Risk provide richer
   page-owned account buttons. Alpha, Intelligence and Track
   Record retain the shared fallback account name.

   Give the shared authenticated fallback the same green
   account-control treatment without pretending it owns the
   page-specific dropdown behavior.
 */

@media (min-width:769px) {

  #product-toolbar .innellis-toolbar-account-name {
    background: rgba(63,185,80,.08) !important;
    border: 1px solid var(--green, #3fb950) !important;
    color: var(--green, #238b57) !important;

    text-decoration: none !important;
  }

  #product-toolbar .innellis-toolbar-account-name::before {
    content: '●';
    display: inline-block;
    margin-right: 8px;
    font-size: 8px;
    line-height: 1;
    color: currentColor;
    flex: 0 0 auto;
  }
}

/* =========================================================
   TOOLBAR_INTERACTIVE_OVERFLOW_V1
   =========================================================
   Page-owned authenticated account controls and notification
   controls may render dropdowns below the canonical toolbar.

   The nav itself owns horizontal clipping/scrolling. Do not
   clip interactive overlays at the toolbar-right or auth-slot
   ancestor level.
 */

@media (min-width:769px) {
  #product-toolbar .innellis-toolbar-right {
    overflow: visible !important;
  }

  #product-toolbar .innellis-toolbar-auth {
    overflow: visible !important;
  }
}

/* =========================================================
   TOOLBAR_CANONICAL_ACCOUNT_MENU_V2
   =========================================================
   Intelligence, Track Record and Alpha use the shared account
   fallback. Unlike the historical decorative username, this is
   an actual account trigger with the same desktop geometry as the
   richer page-owned controls.
 */

@media (min-width:769px) {

  #product-toolbar .innellis-toolbar-account-name {
    cursor: pointer !important;
  }

  #product-toolbar .innellis-toolbar-account-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #product-toolbar .innellis-toolbar-account-caret {
    margin-left: 6px;
    flex: 0 0 auto;
    font-size: 9px;
    line-height: 1;
  }

  #product-toolbar .innellis-toolbar-account-menu {
    box-sizing: border-box;

    position: absolute;
    z-index: 9000;

    top: calc(100% + 6px);
    right: 0;

    width: 210px;
    min-width: 210px;
    max-width: 210px;

    background: var(--surface, #fff);
    border: 1px solid var(--border, #d9dee7);
    border-radius: 6px;

    box-shadow: 0 8px 24px rgba(0,0,0,.18);

    overflow: hidden;
    white-space: normal;
  }

  #product-toolbar .innellis-toolbar-account-menu[hidden] {
    display: none !important;
  }

  #product-toolbar .innellis-toolbar-account-summary {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border, #d9dee7);
    background: var(--surface2, #f7f8fa);
  }

  #product-toolbar .innellis-toolbar-account-menu-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;

    color: var(--amber, #b07810);
  }

  #product-toolbar .innellis-toolbar-account-menu-type {
    margin-top: 3px;

    font-size: 10px;
    line-height: 1.35;

    color: var(--muted, #6f7785);
  }

  #product-toolbar .innellis-toolbar-account-actions {
    padding: 6px 0;
  }

  #product-toolbar .innellis-toolbar-account-logout {
    box-sizing: border-box;

    width: 100%;

    padding: 9px 14px;

    background: transparent;
    border: 0;

    color: var(--red, #cf4444);

    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;

    text-align: left;

    cursor: pointer;
  }

  #product-toolbar .innellis-toolbar-account-logout:hover {
    background: rgba(207,68,68,.06);
  }
}
