.nav-scroll-shell{position:relative;display:flex;flex:1 1 auto;align-items:center;min-width:0;height:100%;overflow:hidden}
.nav-scroll-shell .app-switch-menu,.nav-scroll-shell #appMenu[hidden]{display:flex!important;flex:1 1 auto!important;align-items:center!important;min-width:0!important;width:100%!important;height:100%;padding-inline:30px!important;overflow-x:auto!important;overflow-y:hidden!important;white-space:nowrap!important;scrollbar-width:none!important;-ms-overflow-style:none;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;touch-action:pan-x}
.nav-scroll-shell .app-switch-menu::-webkit-scrollbar{display:none!important;width:0;height:0}
.nav-scroll-shell .app-switch-menu button{flex:0 0 auto!important;white-space:nowrap!important}
.nav-scroll-arrow{position:absolute;z-index:12;top:50%;display:grid;place-items:center;width:28px;height:38px;margin:0;padding:0;border:0;border-radius:8px;background:linear-gradient(90deg,#17233df5,#17233dcc);color:#fff;font:900 25px/1 Arial,sans-serif;transform:translateY(-50%);box-shadow:0 0 12px #0b1428a8;cursor:pointer;touch-action:manipulation}
.nav-scroll-arrow[data-nav-scroll-left]{left:1px}
.nav-scroll-arrow[data-nav-scroll-right]{right:1px;background:linear-gradient(270deg,#17233df5,#17233dcc)}
.nav-scroll-arrow[hidden]{display:none!important}
.nav-scroll-arrow:focus-visible{outline:2px solid #9dc7ff;outline-offset:1px}
@media(max-width:700px){.nav-scroll-shell .app-switch-menu,.nav-scroll-shell #appMenu[hidden]{justify-content:flex-start!important;padding-inline:28px!important}.nav-scroll-arrow{width:27px;height:42px;font-size:26px}.brand-area{gap:3px!important}}

/*
 * v111: the menu itself is the only horizontal scrollport.
 * Every ancestor stays unclipped and every tab keeps its intrinsic width.
 */
.topbar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) max-content !important;
  align-items: center !important;
  overflow: visible !important;
}

.topbar > .brand-area,
.brand-area,
.brand-menu-wrap {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: visible !important;
}

.topbar > .brand-area {
  display: flex !important;
  width: 100% !important;
}

.nav-scroll-shell {
  position: relative;
  display: flex !important;
  flex: 1 1 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow: visible !important;
}

.nav-scroll-shell > .app-switch-menu,
.nav-scroll-shell > #appMenu,
.nav-scroll-shell > #appMenu[hidden],
.nav-container {
  display: flex !important;
  flex: 1 1 0 !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  white-space: nowrap !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x !important;
}

.nav-scroll-shell > .app-switch-menu::-webkit-scrollbar,
.nav-scroll-shell > #appMenu::-webkit-scrollbar,
.nav-container::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.nav-scroll-shell > .app-switch-menu > button,
.nav-scroll-shell > #appMenu > button,
.nav-container > .nav-item,
.nav-container .nav-link,
.nav-container > li {
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  width: auto !important;
  min-width: max-content !important;
  white-space: nowrap !important;
  touch-action: pan-x !important;
}

.topbar > .user-box {
  flex: 0 0 auto !important;
  min-width: max-content !important;
}

@media (max-width: 700px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) max-content !important;
    column-gap: 4px !important;
  }

  .nav-scroll-shell > .app-switch-menu,
  .nav-scroll-shell > #appMenu,
  .nav-scroll-shell > #appMenu[hidden] {
    padding-inline: 30px !important;
  }
}

/* v124：把主要頁籤固定放回深色頂欄內，覆蓋舊版 absolute/top:42px 下拉定位。 */
.sticky-header-container.top-header {
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
}

.sticky-header-container.top-header > .brand-area {
  display: flex !important;
  flex: 1 1 auto !important;
  align-items: center !important;
  align-self: stretch !important;
  width: auto !important;
  min-width: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
}

.sticky-header-container .brand-menu-wrap {
  position: static !important;
  display: flex !important;
  flex: 1 1 auto !important;
  align-items: center !important;
  align-self: stretch !important;
  min-width: 0 !important;
  height: 100% !important;
}

.sticky-header-container .tab-navbar {
  position: relative !important;
  inset: auto !important;
  display: flex !important;
  flex: 1 1 auto !important;
  align-items: center !important;
  align-self: stretch !important;
  min-width: 0 !important;
  height: 100% !important;
  margin: 0 !important;
}

.sticky-header-container #appMenu,
.sticky-header-container #appMenu[hidden] {
  position: relative !important;
  inset: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  display: flex !important;
  flex: 1 1 auto !important;
  align-items: center !important;
  align-self: stretch !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #17233d !important;
}

.sticky-header-container .environment,
.sticky-header-container > .user-box {
  flex: 0 0 auto !important;
}

/*
 * Keep the complete header visible while the page scrolls. Older global
 * styles collapsed it with translateY(), which also intercepted the first
 * mobile tap. This final override intentionally disables that behaviour.
 */
.topbar,
.topbar:hover,
.topbar:focus-within,
.topbar.touch-open {
  position: sticky !important;
  top: 0 !important;
  transform: none !important;
  transition: box-shadow .2s ease !important;
}

/* Sticky, horizontally scrollable navigation with an animated active line. */
.sticky-navbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 1000 !important;
  background: #17233d;
  box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
}

.nav-scroll-wrapper {
  position: relative !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  white-space: nowrap !important;
  -webkit-overflow-scrolling: touch;
}

.nav-scroll-wrapper::-webkit-scrollbar {
  display: none !important;
}

.nav-menu {
  display: flex !important;
  flex-wrap: nowrap !important;
  margin: 0;
  list-style: none;
}

.nav-menu > .nav-item {
  position: relative;
  z-index: 1;
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  transition: color .2s ease, background-color .2s ease;
}

.nav-menu > .nav-item.active {
  color: #fff !important;
  font-weight: 700 !important;
}

.nav-indicator {
  position: absolute;
  z-index: 3;
  bottom: 0;
  left: 0;
  width: 1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: #38bdf8;
  box-shadow: 0 -1px 5px rgb(56 189 248 / 45%);
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  transform-origin: 0 50%;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform .24s cubic-bezier(.2,.8,.2,1);
}

@media (max-width: 700px) {
  html {
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body {
    overflow: visible !important;
  }

  .sticky-navbar {
    min-height: 52px;
  }

  .nav-menu > .nav-item {
    min-height: 48px;
    padding: 14px 16px !important;
  }

  .nav-menu > .nav-item.active {
    background: transparent !important;
  }
}

/*
 * v123：Zero-Flicker composite header。
 * 頂欄保留獨立 GPU 合成圖層；固定高度避免字型、資料與頁籤切換造成 reflow。
 */
.sticky-header-container,
.top-header,
.top-header:hover,
.top-header:focus-within,
.top-header.touch-open {
  position: sticky !important;
  top: 0 !important;
  z-index: 9999 !important;
  height: 58px !important;
  min-height: 58px !important;
  max-height: 58px !important;
  background-color: #17233d !important;
  will-change: transform;
  transform: translate3d(0, 0, 0) !important;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  isolation: isolate;
  contain: layout style;
}

.top-header .tab-navbar,
.top-header .nav-scroll-wrapper,
.top-header .nav-menu {
  height: 58px !important;
  min-height: 58px !important;
  max-height: 58px !important;
  background-color: #17233d !important;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}

.top-header .tab-navbar {
  position: relative !important;
  top: auto !important;
  z-index: 1 !important;
  contain: layout style;
}

.top-header .nav-indicator {
  left: 0 !important;
  width: 1px !important;
  min-width: 1px !important;
  max-width: 1px !important;
  transform-origin: 0 50% !important;
  contain: strict;
}

@media (max-width: 700px) {
  .sticky-header-container,
  .top-header,
  .top-header:hover,
  .top-header:focus-within,
  .top-header.touch-open,
  .top-header .tab-navbar,
  .top-header .nav-scroll-wrapper,
  .top-header .nav-menu {
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
  }
}

/*
 * v121: Zero-layout-shift navigation.
 * Header、scroll shell、menu 與 tab 都維持固定盒模型；互動只允許改變顏色，
 * 不可改動 height / padding / margin / border-width / transform。
 */
.topbar,
.topbar:hover,
.topbar:focus-within,
.topbar.touch-open {
  position: sticky !important;
  top: 0 !important;
  width: 100% !important;
  height: 58px !important;
  min-height: 58px !important;
  max-height: 58px !important;
  margin: 0 !important;
  padding-block: 0 !important;
  transform: none !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}

.topbar::after {
  display: none !important;
  content: none !important;
}

.topbar > .brand-area,
.brand-menu-wrap,
.nav-scroll-shell,
.nav-scroll-wrapper,
.nav-menu {
  height: 100% !important;
  min-height: 0 !important;
  max-height: 58px !important;
  margin-block: 0 !important;
  box-sizing: border-box !important;
}

.nav-menu > .nav-item,
.nav-menu > .nav-item:hover,
.nav-menu > .nav-item:focus,
.nav-menu > .nav-item:focus-visible,
.nav-menu > .nav-item:active {
  align-self: center !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  margin: 0 !important;
  padding: 8px 12px !important;
  border: 0 !important;
  line-height: 22px !important;
  transform: none !important;
  box-sizing: border-box !important;
}

/* 桌機滑鼠才有 hover；只改色彩，盒模型尺寸完全不變。 */
@media (hover: hover) and (pointer: fine) {
  .nav-menu > .nav-item:hover {
    background: rgb(255 255 255 / 12%) !important;
    color: #fff !important;
  }
}

/* 觸控裝置不保留瀏覽器模擬的 :hover 狀態。 */
@media (hover: none), (pointer: coarse) {
  .nav-menu > .nav-item:hover:not(.active) {
    background: transparent !important;
    color: #dce7f6 !important;
  }

  .topbar,
  .topbar:hover,
  .topbar:focus-within,
  .topbar.touch-open {
    transform: none !important;
  }
}

@media (max-width: 700px) {
  .topbar,
  .topbar:hover,
  .topbar:focus-within,
  .topbar.touch-open {
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
  }

  .topbar > .brand-area,
  .brand-menu-wrap,
  .nav-scroll-shell,
  .nav-scroll-wrapper,
  .nav-menu {
    max-height: 52px !important;
  }

  .nav-menu > .nav-item,
  .nav-menu > .nav-item:hover,
  .nav-menu > .nav-item:focus,
  .nav-menu > .nav-item:focus-visible,
  .nav-menu > .nav-item:active {
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 11px 14px !important;
    line-height: 22px !important;
  }
}

/* v123 final cascade guard：必須置於所有舊版規則之後。 */
.sticky-header-container.top-header,
.sticky-header-container.top-header:hover,
.sticky-header-container.top-header:focus-within,
.sticky-header-container.top-header.touch-open {
  position: sticky !important;
  top: 0 !important;
  z-index: 9999 !important;
  height: 58px !important;
  min-height: 58px !important;
  max-height: 58px !important;
  background-color: #17233d !important;
  will-change: transform !important;
  transform: translate3d(0, 0, 0) !important;
  backface-visibility: hidden !important;
  -webkit-backface-visibility: hidden !important;
  isolation: isolate;
  contain: layout style;
}

.sticky-header-container .tab-navbar,
.sticky-header-container .nav-scroll-wrapper,
.sticky-header-container .nav-menu {
  height: 58px !important;
  min-height: 58px !important;
  max-height: 58px !important;
  background-color: #17233d !important;
  backface-visibility: hidden !important;
  -webkit-backface-visibility: hidden !important;
  transform: translateZ(0) !important;
}

.sticky-header-container .tab-navbar {
  position: relative !important;
  top: auto !important;
  z-index: 1 !important;
  contain: layout style;
}

@media (max-width: 700px) {
  .sticky-header-container.top-header,
  .sticky-header-container.top-header:hover,
  .sticky-header-container.top-header:focus-within,
  .sticky-header-container.top-header.touch-open,
  .sticky-header-container .tab-navbar,
  .sticky-header-container .nav-scroll-wrapper,
  .sticky-header-container .nav-menu {
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
  }
}
