/* DIDO + HAZI | v3: the language selector has a physical, stable position.
   The document's Arabic/English/Chinese text direction still changes normally. */
html body .masthead .masthead-inner {
  direction: ltr !important;
  grid-template-columns: minmax(0, 1fr) max-content 166px !important;
}
html body .masthead .masthead-inner > .brand {
  grid-column: 1 !important;
  grid-row: 1 !important;
  justify-self: start !important;
}
html body .masthead .masthead-inner > .nav-wrap {
  grid-column: 2 !important;
  grid-row: 1 !important;
  justify-self: center !important;
}
html body .masthead .masthead-inner > .language,
html body .masthead .masthead-inner > .language.lang-menu-host {
  grid-column: 3 !important;
  grid-row: 1 !important;
  justify-self: end !important;
  direction: ltr !important;
  position: relative !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  bottom: auto !important;
  inset-inline-start: auto !important;
  inset-inline-end: auto !important;
  width: 166px !important;
  min-width: 166px !important;
  max-width: 166px !important;
  box-sizing: border-box;
}
html[lang="ar"] .masthead .brand,
html[lang="ar"] .masthead .nav-wrap {
  direction: rtl;
}
html body .masthead .language.lang-menu-host .lang-menu-trigger {
  flex: 1;
  width: auto;
  min-width: 0;
  justify-content: space-between;
}
html body .masthead .lang-menu-list,
html body .site-head .lang-menu-list {
  direction: ltr !important;
  top: calc(100% + 8px) !important;
  bottom: auto !important;
  right: 0 !important;
  left: auto !important;
  inset-inline-end: auto !important;
  inset-inline-start: auto !important;
  transform-origin: top right !important;
}
/* Hide the separate ID label only in Chinese: the full label includes 1010. */
html[lang="zh-CN"] .support > bdi { display: none !important; }

/* Admin header: do not mirror the action bar in RTL. */
html body .site-head .head-inner,
html body .site-head .head-actions {
  direction: ltr !important;
}
html body .site-head .head-actions { margin-left: auto !important; }
html body .site-head .head-actions > .lang-menu-host {
  direction: ltr !important;
  width: 150px !important;
  min-width: 150px !important;
  max-width: 150px !important;
  position: relative !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  inset-inline-start: auto !important;
  inset-inline-end: auto !important;
  box-sizing: border-box;
}
html body .site-head .head-actions > .lang-menu-host .lang-menu-trigger {
  width: 100%; justify-content: space-between;
}
@media (max-width: 640px) {
  html body .masthead .masthead-inner {
    grid-template-columns: minmax(0,1fr) auto !important;
    direction: ltr !important;
  }
  html body .masthead .masthead-inner > .brand {
    grid-column: 1 !important;
    grid-row: 1 !important;
    min-width: 0;
  }
  html body .masthead .masthead-inner > .language,
  html body .masthead .masthead-inner > .language.lang-menu-host {
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: end !important;
  }
  html body .masthead .masthead-inner > .nav-wrap {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    justify-self: stretch !important;
  }
}
@media (max-width: 400px) {
  html body .masthead .masthead-inner > .brand .brand-divider,
  html body .masthead .masthead-inner > .brand .brand-name { display:none !important; }
}
