html[data-global-font-scale] {
  --global-font-scale: 1;
  text-size-adjust: 100%;
}

html[data-global-font-scale] .header {
  grid-template-columns: max-content minmax(0, 1fr) max-content;
}

.global-font-scale-control {
  box-sizing: border-box;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 36px;
  padding: 0 9px;
  border: 1px solid rgba(219, 228, 239, .9);
  border-radius: 18px;
  background: rgba(255, 255, 255, .82);
  color: #526177;
  box-shadow: 0 2px 8px rgba(20, 35, 58, .06);
}

.global-font-scale-label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.global-font-scale-select {
  box-sizing: border-box;
  width: 94px;
  min-width: 0;
  height: 28px;
  padding: 0 20px 0 6px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #243a57;
  font-family: inherit;
  font-size: 12px;
  line-height: normal;
  letter-spacing: 0;
  cursor: pointer;
}

.global-font-scale-select:focus-visible {
  border-radius: 7px;
  outline: 2px solid #75aef0;
  outline-offset: 1px;
}

.header .system-title,
.header .toolbox-btn,
.header .user-info,
.header .username {
  white-space: nowrap;
}

[data-global-font-fixed-icon='true'] {
  width: var(--global-fixed-icon-width) !important;
  height: var(--global-fixed-icon-height) !important;
  font-size: var(--global-fixed-icon-font) !important;
}

.global-font-scale-live {
  position: fixed;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

html[data-global-font-scale='110'] :is(button, input, select, textarea),
html[data-global-font-scale='120'] :is(button, input, select, textarea),
html[data-global-font-scale='150'] :is(button, input, select, textarea),
html[data-global-font-scale='200'] :is(button, input, select, textarea),
html[data-global-font-scale='250'] :is(button, input, select, textarea) {
  max-width: 100%;
}

html[data-global-font-scale='110'] :is(.el-dialog, .el-message-box, .el-dropdown-menu),
html[data-global-font-scale='120'] :is(.el-dialog, .el-message-box, .el-dropdown-menu),
html[data-global-font-scale='150'] :is(.el-dialog, .el-message-box, .el-dropdown-menu),
html[data-global-font-scale='200'] :is(.el-dialog, .el-message-box, .el-dropdown-menu),
html[data-global-font-scale='250'] :is(.el-dialog, .el-message-box, .el-dropdown-menu) {
  overflow-wrap: anywhere;
}

html[data-global-font-scale='150'] .header,
html[data-global-font-scale='200'] .header,
html[data-global-font-scale='250'] .header {
  grid-template-columns: max-content minmax(0, 1fr);
  grid-template-areas: 'logo actions' 'tabs tabs';
  row-gap: 8px;
}

html[data-global-font-scale='150'] .logo-section,
html[data-global-font-scale='200'] .logo-section,
html[data-global-font-scale='250'] .logo-section {
  grid-area: logo;
}

html[data-global-font-scale='150'] .main-tabs,
html[data-global-font-scale='200'] .main-tabs,
html[data-global-font-scale='250'] .main-tabs {
  grid-area: tabs;
  width: 100%;
  justify-content: flex-start;
}

html[data-global-font-scale='150'] .header-actions,
html[data-global-font-scale='200'] .header-actions,
html[data-global-font-scale='250'] .header-actions {
  grid-area: actions;
}

html[data-global-font-scale='150'] .global-font-scale-control,
html[data-global-font-scale='200'] .global-font-scale-control,
html[data-global-font-scale='250'] .global-font-scale-control {
  height: auto;
  min-height: 36px;
  padding-top: 4px;
  padding-bottom: 4px;
}

html[data-global-font-scale='150'] .global-font-scale-select {
  width: 116px;
  height: auto;
  min-height: 28px;
}

html[data-global-font-scale='150'] .stock-detail-page-header,
html[data-global-font-scale='200'] .stock-detail-page-header,
html[data-global-font-scale='250'] .stock-detail-page-header {
  align-items: stretch;
  flex-direction: column;
}

html[data-global-font-scale='150'] .stock-detail-heading-group,
html[data-global-font-scale='200'] .stock-detail-heading-group,
html[data-global-font-scale='250'] .stock-detail-heading-group {
  display: block;
}

html[data-global-font-scale='150'] .stock-detail-page-subtitle,
html[data-global-font-scale='200'] .stock-detail-page-subtitle,
html[data-global-font-scale='250'] .stock-detail-page-subtitle {
  margin-top: 8px;
  white-space: normal;
}

html[data-global-font-scale='150'] .stock-detail-header-actions,
html[data-global-font-scale='200'] .stock-detail-header-actions,
html[data-global-font-scale='250'] .stock-detail-header-actions {
  width: 100%;
  flex-wrap: wrap;
  justify-content: flex-start;
}

html[data-global-font-scale='150'] .stock-detail-analysis-mode-switch,
html[data-global-font-scale='200'] .stock-detail-analysis-mode-switch,
html[data-global-font-scale='250'] .stock-detail-analysis-mode-switch,
html[data-global-font-scale='150'] .stock-detail-analysis-mode-button,
html[data-global-font-scale='200'] .stock-detail-analysis-mode-button,
html[data-global-font-scale='250'] .stock-detail-analysis-mode-button,
html[data-global-font-scale='150'] .stock-detail-search-input,
html[data-global-font-scale='200'] .stock-detail-search-input,
html[data-global-font-scale='250'] .stock-detail-search-input {
  height: auto;
  min-height: 34px;
}

html[data-global-font-scale='150'] .stock-detail-search,
html[data-global-font-scale='200'] .stock-detail-search,
html[data-global-font-scale='250'] .stock-detail-search {
  flex: 1 1 420px;
  min-width: 0;
}

html[data-global-font-scale='150'] .stock-detail-metric-grid,
html[data-global-font-scale='200'] .stock-detail-metric-grid,
html[data-global-font-scale='250'] .stock-detail-metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html[data-global-font-scale='200'] .global-font-scale-select {
  width: 142px;
  height: auto;
  min-height: 28px;
}

html[data-global-font-scale='250'] .global-font-scale-select {
  width: 170px;
  height: auto;
  min-height: 28px;
}

@media (max-width: 1100px) {
  .global-font-scale-control {
    padding: 0 7px;
  }

  .global-font-scale-select {
    width: 88px;
  }
}

@media (max-width: 900px) {
  html[data-global-font-scale] .header {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 640px) {
  html[data-global-font-scale] .header {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'logo' 'actions' 'tabs' !important;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start !important;
  }

  html[data-global-font-scale='150'] .header-actions,
  html[data-global-font-scale='200'] .header-actions,
  html[data-global-font-scale='250'] .header-actions {
    flex-wrap: wrap;
  }

  .header .user-section {
    min-width: 0;
    max-width: 140px !important;
  }

  .header .user-info {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 140px !important;
    overflow: hidden;
  }

  .header .username {
    min-width: 0;
    max-width: 88px !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .global-font-scale-control {
    height: 34px;
    padding: 0 5px;
  }

  .global-font-scale-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .global-font-scale-select {
    width: 64px;
    height: 26px;
    padding-left: 4px;
  }

  html[data-global-font-scale='150'] .global-font-scale-select,
  html[data-global-font-scale='200'] .global-font-scale-select,
  html[data-global-font-scale='250'] .global-font-scale-select {
    width: 96px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .global-font-scale-control,
  .global-font-scale-select {
    transition: none;
  }
}
