/* GestMan365 - refinamento da navbar superior */

/* Iconografia do cabeçalho: SVGs locais, sem placas decorativas ou relevo.
   Não altera o display dos ícones: os breakpoints continuam controlando espaço. */
body.gm-top-navigation:not(.auth-required):not(.auth-loading) :is(#mainNavigation, .reference-topbar-actions) {
  --gm-header-icon-color: #a8c9dc;
  --gm-header-icon-active: #74d4f2;
  --gm-header-focus: #74d4f2;
  --gm-module-button-bg: #132b3e;
  --gm-module-button-border: #557d97;
  --gm-module-button-text: #f0f7fc;
  --gm-module-button-hover: #203e54;
  --gm-module-button-open: #164864;
}

body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) :is(#mainNavigation, .reference-topbar-actions) {
  --gm-header-icon-color: #365b74;
  --gm-header-icon-active: #075f93;
  --gm-header-focus: #075f93;
  --gm-module-button-bg: #ffffff;
  --gm-module-button-border: #708b9e;
  --gm-module-button-text: #203f55;
  --gm-module-button-hover: #e4f1f8;
  --gm-module-button-open: #d9edf8;
}

body.gm-top-navigation:is(.theme-light, :not(.theme-light)):not(.auth-required):not(.auth-loading) #mainNavigation span:is(.tab-icon, .nav-group-icon) {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  padding: 0 !important;
  color: var(--gm-header-icon-color) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation :is(.tab-icon, .nav-group-icon)::before,
body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation :is(.tab-icon, .nav-group-icon)::after {
  content: none !important;
  display: none !important;
}

body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation :is(.tab-icon, .nav-group-icon) > .gm-icon,
body.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-topbar-actions :is(.reference-icon-button, .theme-icon) .gm-icon {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  color: inherit !important;
  filter: none !important;
  box-shadow: none !important;
}

body.gm-top-navigation:is(.theme-light, :not(.theme-light)):not(.auth-required):not(.auth-loading) #mainNavigation :is(.tab.active, .tab:hover, .tab:focus-visible, .nav-group[open] > summary, .nav-group > summary:hover, .nav-group > summary:focus-visible) span:is(.tab-icon, .nav-group-icon) {
  color: var(--gm-header-icon-active) !important;
}

body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .nav-group > summary > i > .gm-icon,
body.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-topbar-actions .reference-user-chevron > .gm-icon {
  width: 12px !important;
  height: 12px !important;
  min-width: 12px !important;
  color: inherit !important;
  filter: none !important;
}

body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation :is(button, summary):focus-visible,
body.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-topbar-actions button:focus-visible {
  outline: 2px solid var(--gm-header-focus) !important;
  outline-offset: -3px !important;
}

@media (min-width: 901px) {
  body.gm-top-navigation:not(.auth-required):not(.auth-loading):not(.panel-mode) {
    --gm-header-height: 0px;
    --gm-module-nav-height: 64px;
    --gm-brand-width: 154px;
    --gm-utility-reserve: 322px;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-topbar {
    inset: 0 !important;
    width: 100% !important;
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    pointer-events: none !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) :is(
    .reference-topbar-left,
    .reference-topbar-search,
    .header-dashboard-filters,
    .header-context-trigger,
    .header-mobile-search
  ) {
    display: none !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-topbar-actions {
    position: fixed !important;
    z-index: 110 !important;
    top: 7px !important;
    right: 12px !important;
    width: auto !important;
    height: 50px !important;
    padding: 0 0 0 14px !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    background: linear-gradient(90deg, rgba(8, 26, 43, .22), rgba(8, 26, 43, .86)) !important;
    border: 0 !important;
    border-left: 1px solid #2a5069 !important;
    pointer-events: auto !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-topbar-actions .reference-header-separator {
    display: none !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-topbar-actions :is(.reference-icon-button, .system-theme-toggle) {
    height: 42px !important;
    min-height: 42px !important;
    border-radius: 9px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-topbar-actions .reference-icon-button {
    width: 42px !important;
    min-width: 42px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) .system-theme-toggle {
    width: auto !important;
    min-width: 82px !important;
    padding: 0 10px !important;
    grid-template-columns: 20px max-content !important;
    gap: 7px !important;
  }

  body:not(.auth-required):not(.auth-loading) .reference-header-user,
  body.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-header-user {
    box-sizing: border-box !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 126px !important;
    max-width: 170px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 3px 8px 3px 4px !important;
    display: grid !important;
    grid-template-columns: 34px minmax(0, 1fr) 12px !important;
    place-items: center stretch !important;
    gap: 7px !important;
    overflow: visible !important;
  }

  body:not(.auth-required):not(.auth-loading) .reference-header-user .reference-user-copy {
    min-width: 0 !important;
    display: block !important;
    text-align: left !important;
  }

  body:not(.auth-required):not(.auth-loading) .reference-header-user .reference-user-copy strong {
    display: block !important;
    max-width: 92px !important;
    overflow: hidden !important;
    color: #eaf5fc !important;
    font-size: 11px !important;
    font-weight: 720 !important;
    line-height: 1.15 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body:not(.auth-required):not(.auth-loading) .reference-header-user .reference-user-chevron {
    width: 12px !important;
    height: 12px !important;
    display: grid !important;
    place-items: center !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation {
    height: var(--gm-module-nav-height) !important;
    min-height: var(--gm-module-nav-height) !important;
    max-height: var(--gm-module-nav-height) !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .industrial-sidebar-brand {
    flex: 0 0 var(--gm-brand-width) !important;
    width: var(--gm-brand-width) !important;
    height: var(--gm-module-nav-height) !important;
    min-height: var(--gm-module-nav-height) !important;
    padding: 6px 12px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .industrial-sidebar-scroll {
    box-sizing: border-box !important;
    width: 0 !important;
    height: var(--gm-module-nav-height) !important;
    padding: 7px var(--gm-utility-reserve) 7px 10px !important;
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: center !important;
    align-content: center !important;
    gap: 10px !important;
    overflow: visible !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .nav-pinned {
    box-sizing: border-box !important;
    display: flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    gap: 2px !important;
    padding: 3px !important;
    background: rgba(18, 48, 68, .72) !important;
    border: 1px solid #294b62 !important;
    border-radius: 10px !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, .035) !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .nav-pinned .tab {
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 9px !important;
    border-radius: 7px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group {
    min-width: 0 !important;
    display: flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    gap: 2px !important;
    padding-left: 12px !important;
    border-left: 1px solid #2a5069 !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group > .nav-group {
    flex: 0 0 auto !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group .nav-group > summary {
    height: 42px !important;
    min-height: 42px !important;
    border-radius: 7px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .nav-group[open] > summary {
    border-bottom-right-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .nav-group-items {
    top: var(--gm-nav-dropdown-top, var(--gm-module-nav-height)) !important;
    border-radius: 0 10px 10px 10px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading):not(.panel-mode) .workspace {
    top: var(--gm-module-nav-height) !important;
    height: calc(100dvh - var(--gm-module-nav-height)) !important;
  }
}

@media (min-width: 901px) and (max-width: 1840px) {
  body.gm-top-navigation:not(.auth-required):not(.auth-loading):not(.panel-mode) {
    --gm-brand-width: 122px;
    --gm-utility-reserve: 292px;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .sidebar-logo-frame,
  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .sidebar-logo-frame .brand-logo-img {
    width: 104px !important;
    min-width: 104px !important;
    max-width: 104px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group .nav-group-icon {
    display: none !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group .nav-group > summary {
    grid-template-columns: max-content 10px !important;
    padding-inline: 6px !important;
    gap: 4px !important;
    font-size: 10.5px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group .nav-group > summary > span:nth-child(2) {
    grid-column: 1 !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group .nav-group > summary > i {
    grid-column: 2 !important;
  }
}

/* Em notebooks, duas faixas evitam disputar espaço com perfil e tema. */
@media (min-width: 901px) and (max-width: 1500px) {
  body.gm-top-navigation:not(.auth-required):not(.auth-loading):not(.panel-mode) {
    --gm-brand-width: 92px;
    --gm-module-nav-height: 112px;
    --gm-utility-reserve: 244px;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation {
    display: grid !important;
    grid-template-columns: var(--gm-brand-width) minmax(0, 1fr) !important;
    grid-template-rows: 56px 56px !important;
    align-items: stretch !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .industrial-sidebar-brand {
    grid-column: 1 !important;
    grid-row: 1 !important;
    height: 56px !important;
    min-height: 56px !important;
    padding-block: 5px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .sidebar-logo-frame,
  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .sidebar-logo-frame .brand-logo-img {
    width: 76px !important;
    min-width: 76px !important;
    max-width: 76px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .industrial-sidebar-scroll {
    grid-column: 2 !important;
    grid-row: 1 / 3 !important;
    width: auto !important;
    height: 112px !important;
    padding: 0 8px 0 6px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 56px 56px !important;
    gap: 0 !important;
    overflow: visible !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .nav-pinned {
    grid-column: 1 !important;
    grid-row: 1 !important;
    align-self: center !important;
    justify-self: start !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .nav-pinned .tab {
    padding-inline: 6px !important;
    font-size: 10px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group {
    grid-column: 1 !important;
    grid-row: 2 !important;
    width: 100% !important;
    align-self: center !important;
    gap: 4px !important;
    padding: 0 !important;
    border-top: 1px solid #24465d !important;
    border-left: 0 !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group .nav-group > summary {
    padding-inline: 6px !important;
    gap: 4px !important;
    font-size: 12px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-topbar-actions {
    right: 8px !important;
    padding-left: 8px !important;
    gap: 4px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-topbar-actions .reference-icon-button {
    width: 36px !important;
    min-width: 36px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) .system-theme-toggle {
    flex: 0 0 38px !important;
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    padding: 0 !important;
    grid-template-columns: 1fr !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) .system-theme-toggle .theme-label {
    display: none !important;
  }

  body:not(.auth-required):not(.auth-loading) .reference-header-user,
  body.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-header-user {
    flex: 0 0 112px !important;
    min-width: 112px !important;
    max-width: 112px !important;
    grid-template-columns: 34px minmax(0, 1fr) 10px !important;
    gap: 5px !important;
    padding-right: 5px !important;
  }

  body:not(.auth-required):not(.auth-loading) .reference-header-user .reference-user-copy strong {
    max-width: 58px !important;
    font-size: 10px !important;
  }
}

@media (min-width: 901px) and (max-width: 1020px) {
  body.gm-top-navigation:not(.auth-required):not(.auth-loading):not(.panel-mode) {
    --gm-brand-width: 76px;
    --gm-utility-reserve: 232px;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .sidebar-logo-frame,
  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .sidebar-logo-frame .brand-logo-img {
    width: 62px !important;
    min-width: 62px !important;
    max-width: 62px !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .nav-pinned .tab-icon {
    display: none !important;
  }

  body.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .nav-pinned .tab {
    grid-template-columns: max-content !important;
    padding-inline: 5px !important;
  }
}

/* Tema claro: superfícies, contraste e marca coerentes com a barra superior. */
@media (min-width: 901px) {
  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation {
    color: #24445d !important;
    background: #f8fbfd !important;
    background-image: none !important;
    border-top: 0 !important;
    border-bottom: 1px solid #d5e1e9 !important;
    box-shadow: 0 2px 8px rgba(30, 55, 73, .09) !important;
  }

  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .industrial-sidebar-brand {
    color: #24445d !important;
    background: #fff !important;
    background-image: none !important;
    border: 0 !important;
    border-right: 1px solid #d5e1e9 !important;
    box-shadow: none !important;
  }

  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation :is(
    .industrial-sidebar-brand,
    .sidebar-logo-frame
  )::before,
  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation :is(
    .industrial-sidebar-brand,
    .sidebar-logo-frame
  )::after {
    content: none !important;
    display: none !important;
  }

  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .sidebar-logo-frame,
  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .sidebar-logo-frame .brand-logo-img {
    background: transparent !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    clip-path: none !important;
  }

  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .industrial-sidebar-scroll {
    color: #24445d !important;
    background: transparent !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .nav-pinned {
    background: #edf5fa !important;
    background-image: none !important;
    border-color: #bdd0dc !important;
    box-shadow: none !important;
  }

  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .nav-pinned .tab,
  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group .nav-group > summary {
    color: #294b63 !important;
    background: transparent !important;
    background-image: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
  }

  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation :is(
    .nav-pinned .tab,
    .gm-module-nav-group .nav-group > summary
  ):hover {
    color: #075f93 !important;
    background: #e4f1f8 !important;
    border-color: #b1ccdc !important;
  }

  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .nav-pinned .tab.active,
  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group .nav-group[open] > summary {
    color: #075f93 !important;
    background: #d9edf8 !important;
    background-image: none !important;
    border-color: #76b9d8 !important;
    box-shadow: inset 0 -2px #1999c1 !important;
  }

  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .nav-pinned .tab.active :is(span, .gm-icon),
  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group .nav-group[open] > summary :is(span, .gm-icon) {
    color: #075f93 !important;
  }

  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group {
    border-color: #bfd0dc !important;
  }

  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-topbar-actions {
    color: #24445d !important;
    background: #f8fbfd !important;
    background-image: none !important;
    border-left-color: #bfd0dc !important;
    box-shadow: none !important;
  }

  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-topbar-actions :is(
    .reference-icon-button,
    .system-theme-toggle,
    .reference-header-user
  ) {
    color: #24445d !important;
    background: #fff !important;
    background-image: none !important;
    border-color: #c5d6e1 !important;
    box-shadow: none !important;
  }

  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-topbar-actions :is(
    .reference-icon-button,
    .system-theme-toggle,
    .reference-header-user
  ):hover,
  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-topbar-actions :is(
    .reference-icon-button,
    .system-theme-toggle,
    .reference-header-user
  ):focus-visible {
    color: #075f93 !important;
    background: #eaf4f9 !important;
    border-color: #8ebbd1 !important;
  }

  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-header-user .reference-user-copy strong,
  body.theme-light.gm-top-navigation:not(.auth-required):not(.auth-loading) .reference-header-user .reference-user-copy span {
    color: #203f55 !important;
  }
}

/* Botões de módulos identificáveis mesmo sem hover, nos dois temas. */
body.gm-top-navigation:is(.theme-light, :not(.theme-light)):not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group .nav-group > summary {
  color: var(--gm-module-button-text) !important;
  background: var(--gm-module-button-bg) !important;
  border: 1px solid var(--gm-module-button-border) !important;
  box-shadow: none !important;
}

body.gm-top-navigation:is(.theme-light, :not(.theme-light)):not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group .nav-group > summary:hover {
  background: var(--gm-module-button-hover) !important;
  border-color: var(--gm-header-focus) !important;
}

body.gm-top-navigation:is(.theme-light, :not(.theme-light)):not(.auth-required):not(.auth-loading) #mainNavigation .gm-module-nav-group .nav-group[open] > summary {
  background: var(--gm-module-button-open) !important;
  border-color: var(--gm-header-focus) !important;
  box-shadow: inset 0 -2px var(--gm-header-focus) !important;
}
