/* 全站统一顶栏：高度、间距、导航与账户区 */
@import url("/assets/design-tokens.css");
@import url("/components/site/site-chrome.css");
@import url("/components/shared/user-menu.css");
/* Toket Site Header desktop layout (file: marketing-header-desktop.css) */
@import url("/assets/marketing-header-desktop.css");
@import url("/assets/site-brand-logo.css");

html.site-unified-chrome body > header,
html.site-unified-chrome header.pay-top {
  position: sticky;
  top: 0;
  z-index: 999;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--card-bg, #fff) 92%, transparent);
  border-bottom: 1px solid var(--line, rgba(15, 23, 42, 0.08));
  box-shadow: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

html.site-unified-chrome body > header.scrolled {
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

:root[data-theme="dark"].site-unified-chrome body > header,
:root[data-theme="dark"].site-unified-chrome header.pay-top {
  background: color-mix(in srgb, var(--dark-bg, #0f172a) 90%, transparent);
  border-bottom-color: var(--line);
}

html.site-unified-chrome .nav-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--site-header-pad-x, 24px);
  min-height: var(--site-header-h, 64px);
  display: flex;
  align-items: center;
  gap: 12px 20px;
}

html.site-unified-chrome .logo {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-main);
  text-decoration: none;
  flex-shrink: 0;
}

html.site-unified-chrome .nav-end,
html.site-unified-chrome .v2-nav-cluster,
html.site-unified-chrome .site-header__cluster {
  display: flex;
  align-items: center;
  gap: 12px 16px;
  margin-left: auto;
  min-width: 0;
}

html.site-unified-chrome .site-header__actions,
html.site-unified-chrome .bar-user {
  display: flex;
  align-items: center;
  gap: 10px 12px;
  flex-shrink: 0;
}

/* v1↔v2 跳转：顶栏账户区占位稳定，避免「登录/获取点数」切换时宽度跳动 */
html.site-unified-chrome .site-header__actions {
  min-width: 7.5rem;
  justify-content: flex-end;
}
html.site-unified-chrome #siteHeaderRechargeCta,
html.site-unified-chrome .home-open-workspace {
  min-width: 136px;
  box-sizing: border-box;
  text-align: center;
  flex: 0 0 auto;
  flex-shrink: 0;
}

html.site-unified-chrome .v2-user-menu__trigger,
html.site-unified-chrome .site-header__account-trigger {
  min-width: 2.25rem;
}

html.site-unified-chrome .site-header__guest {
  display: flex;
  align-items: center;
  gap: 10px 12px;
}

html.site-unified-chrome .nav-links {
  display: flex;
  align-items: center;
  gap: 0 var(--site-nav-gap, 28px);
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

html.site-unified-chrome .nav-links a {
  display: inline-flex;
  align-items: center;
  padding: 6px 2px;
  border-radius: 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-sub, rgba(15, 23, 42, 0.72));
  text-decoration: none;
  transition: color 0.15s ease, box-shadow 0.15s ease;
}

html.site-unified-chrome .nav-links a:hover {
  color: var(--text-main, #0f172a);
}

html.site-unified-chrome .nav-links a[aria-current="page"],
html.site-unified-chrome .nav-links a.is-active {
  color: var(--text-main, #0f172a);
  font-weight: 600;
  background: transparent;
  box-shadow: inset 0 -2px 0 var(--primary, var(--toket-brand, #635bff));
}

html.toket-app-shell.site-unified-chrome .nav-links a[aria-current="page"],
html.toket-app-shell.site-unified-chrome .nav-links a.is-active {
  box-shadow: inset 0 -2px 0 var(--toket-brand);
}

html.site-unified-chrome .site-header__login {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  border: 1px solid var(--line);
  background: transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}

html.site-unified-chrome .site-header__login:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--line));
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

html.site-unified-chrome .site-header__cta-primary,
html.site-unified-chrome #siteHeaderRechargeCta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  color: #fff !important;
  background: var(--primary, #4f6ef7);
  border: none;
  box-shadow: none;
  transition: filter 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

html.toket-app-shell.site-unified-chrome .site-header__cta-primary,
html.toket-app-shell.site-unified-chrome #siteHeaderRechargeCta {
  background: var(--toket-gradient-primary);
  box-shadow: var(--toket-btn-primary-shadow, none);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

html.site-unified-chrome .site-header__cta-primary:hover {
  filter: brightness(1.06);
}

html.toket-app-shell.site-unified-chrome .site-header__cta-primary:hover,
html.toket-app-shell.site-unified-chrome #siteHeaderRechargeCta:hover {
  filter: none;
  background: var(--toket-gradient-primary-hover);
  transform: translateY(var(--toket-translate-hover-btn, -2px));
  box-shadow: var(--toket-btn-primary-shadow-hover, none);
}

html.site-unified-chrome .nav-recharge-btn:not(.site-header__cta-primary) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  color: var(--primary, #4f6ef7) !important;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--primary) 45%, var(--line));
  transition: background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

html.site-unified-chrome .v2-nav-product {
  display: none !important;
}

html.site-unified-chrome .v2-bar-balance {
  cursor: pointer;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card-bg) 80%, transparent);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease;
}

html.site-unified-chrome .v2-user-menu {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  max-width: min(200px, 30vw);
}

/* Get Credits 仅在下拉菜单 #v2UmBilling，禁止出现在顶栏 */
html.site-unified-chrome #v2UserMenuUpgrade,
html.site-unified-chrome .v2-user-menu__upgrade-pill,
html.site-unified-chrome .home-header-actions .site-header__credits-cta {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

html.site-unified-chrome .v2-user-menu__email,
html.site-unified-chrome #v2BarUserEmail {
  display: inline-block !important;
  max-width: min(168px, 32vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

html.site-unified-chrome .v2-user-menu__caret {
  display: inline-flex !important;
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-sub, var(--v2-muted));
  margin-left: 2px;
}

html.site-unified-chrome .v2-user-menu__trigger,
html.site-unified-chrome .site-header__account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

html.site-unified-chrome .v2-user-menu__trigger:hover,
html.site-unified-chrome .site-header__account-trigger:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-color: color-mix(in srgb, var(--primary) 20%, transparent);
}

/* 双语 span：默认仅中文，避免 Header/Footer 中英拼接 */
html.site-unified-chrome:not([lang="en"]) .v2-i18n-en,
html.has-v2-user-chrome:not([lang="en"]) .v2-i18n-en {
  display: none !important;
}
html.site-unified-chrome:not([lang="en"]) .v2-i18n-zh,
html.has-v2-user-chrome:not([lang="en"]) .v2-i18n-zh {
  display: inline;
}
html.site-unified-chrome header .site-header__login,
html.site-unified-chrome header .site-header__cta-primary,
html.site-unified-chrome header .site-header__guest a,
html.site-unified-chrome footer.site-standard-footer .terms-trigger,
html.site-unified-chrome footer.site-standard-footer .legal-links > a {
  white-space: nowrap;
}

/* v2 顶栏右侧：收敛账户区占位，避免圆点/菜单右侧大块空白 */
html.site-unified-chrome .bar-user,
html.has-v2-user-chrome .bar-user,
html.site-unified-chrome .v2-bar-user {
  flex: 0 1 auto;
  max-width: 220px;
  width: auto;
  min-width: 0;
}

html.site-unified-chrome .home-header-actions {
  flex: 0 0 auto;
  flex-shrink: 0;
  min-width: 0;
}

@media (max-width: 960px) {
  html.site-unified-chrome .home-header-actions {
    min-width: max-content;
  }
}

html.site-unified-chrome .home-header-actions > .home-lang-switch,
html.site-unified-chrome .home-header-actions > .home-theme-switch {
  flex: 0 0 auto;
  flex-shrink: 0;
}

html.site-unified-chrome .home-header-actions > .home-header-cta,
html.site-unified-chrome .home-header-actions > #siteHeaderRechargeCta,
html.site-unified-chrome .home-header-actions > .home-open-workspace {
  flex: 0 0 auto;
  flex-shrink: 0;
}
html.site-unified-chrome .bar-user[hidden],
html.has-v2-user-chrome .bar-user[hidden] {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
}
html.site-unified-chrome .v2-user-menu__trigger,
html.has-v2-user-chrome .v2-user-menu__trigger,
html.site-unified-chrome .home-account__trigger {
  max-width: 100%;
  width: auto;
  min-width: 0;
  overflow: hidden;
}

html.site-unified-chrome #homeAccountEmail,
html.site-unified-chrome #v2BarUserEmail {
  display: block;
  max-width: min(140px, 22vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 顶栏：nav 可收缩，actions 区不被挤压 */
html.site-unified-chrome header .nav-wrap.home-header-inner,
html.site-unified-chrome header .nav-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

html.site-unified-chrome header #navLinks,
html.site-unified-chrome header .nav-links.home-nav,
html.site-unified-chrome header .nav-links {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

html.site-unified-chrome header .nav-end {
  flex: 0 0 auto;
  flex-shrink: 0;
  margin-left: auto;
}

html.site-unified-chrome .home-header-actions .home-account,
html.site-unified-chrome .home-header-actions .home-account-slot,
html.site-unified-chrome .home-header-actions #homeAccount {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(200px, 30vw);
}

html.site-unified-chrome .site-um-who,
html.site-unified-chrome .v2-um-who {
  min-width: 0;
  overflow: hidden;
}

html.site-unified-chrome .site-um-email,
html.site-unified-chrome #v2UmPanelEmail,
html.page-home .site-um-email,
html.page-home #v2UmPanelEmail {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.site-unified-chrome .site-um-name,
html.site-unified-chrome #v2UmPanelName {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.site-unified-chrome .home-account,
html.site-unified-chrome .home-account-slot {
  flex: 0 1 auto;
  max-width: 220px;
  min-width: 0;
}

html.site-unified-chrome .v2-nav-cluster,
html.has-v2-user-chrome .v2-nav-cluster {
  flex: 0 1 auto;
  max-width: 220px;
  min-width: 0;
}

/* Toket Site Header：nav 可收缩，右侧 actions 固定宽度不挤压 */
html.page-home .nav-wrap.home-header-inner,
html.page-home.site-unified-chrome .nav-wrap {
  align-items: center;
  min-width: 0;
}

html.page-home #navLinks.home-nav,
html.page-home.site-unified-chrome ul.nav-links#navLinks {
  flex: 1 1 auto;
  min-width: 0;
}

html.page-home .nav-end {
  flex: 0 0 auto;
  flex-shrink: 0;
  min-width: 0;
  margin-left: auto;
}

@media (max-width: 960px) {
  html.page-home .nav-end {
    min-width: max-content;
  }
}

html.page-home .home-header-actions > .home-account,
html.page-home .home-header-actions > .home-account-slot,
html.page-home .home-header-actions > .bar-user,
html.page-home .home-header-actions > .v2-bar-user {
  flex: 0 1 auto;
  max-width: 220px;
  min-width: 0;
}

html.page-home .home-account__trigger,
html.page-home .home-account-trigger,
html.page-home .v2-user-menu__trigger {
  max-width: 220px;
}

/* EN：双 span 导航/账户菜单切换（全站） */
html[lang="en"].site-unified-chrome .v2-i18n-zh,
html[lang="en"] .v2-i18n-zh {
  display: none !important;
}
html[lang="en"].site-unified-chrome .v2-i18n-en,
html[lang="en"] .v2-i18n-en {
  display: inline !important;
}
html[lang="en"] [data-locale-only="zh"] {
  display: none !important;
}

@media (max-width: 768px) {
  html.site-unified-chrome .nav-wrap {
    padding: 0 16px;
    min-height: 56px;
  }
  html.site-unified-chrome .nav-links {
    display: none;
  }
  html.site-unified-chrome .site-header__guest .nav-recharge-btn,
  html.site-unified-chrome .site-header__cta-primary {
    display: none;
  }
  html.site-unified-chrome .v2-user-menu__upgrade-pill {
    display: none !important;
  }
}

/* Toket Site Header (lite chrome): mobile drawer owns header actions */
@media (max-width: 960px) {
  html.site-unified-chrome .nav-end .home-header-actions {
    display: none !important;
  }

  html.site-unified-chrome .home-mobile-menu {
    display: inline-flex !important;
  }

  html.site-unified-chrome body.home-mobile-open .nav-end .home-header-actions {
    display: none !important;
  }
}

/* Site User Menu SSOT — dropdown panel on Home / V1 (matches V2 v2-auth-chrome) */
html.site-unified-chrome .v2-user-menu,
html.page-home .v2-user-menu {
  position: relative;
}

html.site-unified-chrome .v2-workspace-panel,
html.page-home .v2-workspace-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(280px, calc(100vw - 24px));
  padding: 0;
  border-radius: 16px;
  border: none;
  background: color-mix(in srgb, var(--card-bg, var(--v2-card, #fff)) 92%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 12px 40px rgba(15, 23, 42, 0.12),
    0 0 0 1px color-mix(in srgb, var(--line, var(--v2-border, #e5e7eb)) 55%, transparent);
  z-index: 10060;
  text-align: left;
  overflow: visible;
  pointer-events: auto;
}

html.site-unified-chrome .home-account,
html.site-unified-chrome .home-account-slot,
html.page-home .home-account,
html.page-home .home-account-slot {
  position: relative;
  z-index: 10055;
  pointer-events: auto;
}

html.site-unified-chrome .v2-user-menu__trigger,
html.site-unified-chrome .site-header__account-trigger,
html.page-home .v2-user-menu__trigger,
html.page-home .site-header__account-trigger {
  pointer-events: auto;
}

html.site-unified-chrome .v2-workspace-panel[hidden],
html.page-home .v2-workspace-panel[hidden] {
  display: none !important;
}

html.site-unified-chrome .v2-um-accounts,
html.page-home .v2-um-accounts {
  padding: 12px 12px 10px;
}

html.site-unified-chrome .v2-um-current,
html.page-home .v2-um-current {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 6px 4px;
  pointer-events: none;
}

html.site-unified-chrome .v2-um-av,
html.page-home .v2-um-av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  background-size: cover;
  background-position: center;
  color: color-mix(in srgb, var(--primary, #635bff) 88%, var(--text, #111) 12%);
  background-color: color-mix(in srgb, var(--primary, #635bff) 16%, var(--card-bg, #fff) 84%);
}

html.site-unified-chrome .v2-um-email,
html.page-home .v2-um-email {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text, var(--v2-text, #111));
}

html.site-unified-chrome .v2-um-name,
html.page-home .v2-um-name {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-sub, var(--v2-muted, #6b7280));
}

html.site-unified-chrome .v2-um-credits-line,
html.page-home .v2-um-credits-line {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-sub, var(--v2-muted, #6b7280));
}

html.site-unified-chrome .v2-um-check,
html.page-home .v2-um-check {
  flex-shrink: 0;
  width: 22px;
  font-size: 14px;
  font-weight: 700;
  color: color-mix(in srgb, var(--primary, #635bff) 78%, var(--text-sub, #6b7280) 22%);
}

html.site-unified-chrome .v2-um-divider,
html.page-home .v2-um-divider {
  height: 1px;
  margin: 4px 12px;
  background: color-mix(in srgb, var(--line, #e5e7eb) 70%, transparent);
}

html.site-unified-chrome .v2-um-nav,
html.page-home .v2-um-nav {
  padding: 4px 6px 8px;
  display: flex;
  flex-direction: column;
}

html.site-unified-chrome .v2-um-item,
html.page-home .v2-um-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text, var(--v2-text, #111));
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  box-sizing: border-box;
  transition: background 0.12s ease;
}

html.site-unified-chrome a.v2-um-item,
html.page-home a.v2-um-item {
  color: var(--text, var(--v2-text, #111));
}

html.site-unified-chrome .v2-um-item:hover,
html.page-home .v2-um-item:hover {
  background: color-mix(in srgb, var(--text, #111) 8%, transparent);
}

html.site-unified-chrome .v2-um-item__ic,
html.page-home .v2-um-item__ic {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html.site-unified-chrome .v2-um-item__ic svg,
html.page-home .v2-um-item__ic svg {
  width: 18px;
  height: 18px;
  display: block;
}

html.site-unified-chrome .v2-um-item--danger,
html.page-home .v2-um-item--danger {
  color: #dc2626;
}
