/* CloudBridge: 全站统一样式（由 Nginx 注入到每个页面） */

/* 1. 全局主色：和首页的深墨绿 / 亮绿保持一致 */
html:not(.dark) {
  --background: #F3F5F0;
  --primary: #0C1F1A;
  --primary-foreground: #FFFFFF;
  --ring: #9BCB2F;
  --sidebar-primary: #0C1F1A;
  --sidebar-primary-foreground: #FFFFFF;
}

/* 2. 顶栏 */
html:not(.dark) header {
  background: #F3F5F0 !important;
  border-bottom: 1px solid #DDE3DA !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
}
html.dark header {
  background: #0C1F1A !important;
  border-bottom: 1px solid #1F3A31 !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
}
header a { font-weight: 600; }
html:not(.dark) header a:hover { color: #0C1F1A; }

/* 当前页高亮：深墨绿胶囊 */
html:not(.dark) header a[aria-current="page"],
html:not(.dark) header a[data-status="active"] {
  background: #0C1F1A !important;
  color: #fff !important;
  border-radius: 999px;
  padding-left: 14px;
  padding-right: 14px;
}
html.dark header a[aria-current="page"],
html.dark header a[data-status="active"] {
  background: #C6F24E !important;
  color: #0C1F1A !important;
  border-radius: 999px;
  padding-left: 14px;
  padding-right: 14px;
}
header a[data-cb-extra] { cursor: pointer; }

/* 3. 左上角：系统头像图片换成和首页一样的 CB 方块 */
header a[href="/"].group img { display: none !important; }
header a[href="/"].group > div {
  background: #0C1F1A;
  border-radius: 8px;
}
header a[href="/"].group > div::before {
  content: "CB";
  color: #C6F24E;
  font: 800 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: .02em;
}
html.dark header a[href="/"].group > div { background: #C6F24E; }
html.dark header a[href="/"].group > div::before { color: #0C1F1A; }

/* 4. 隐藏版本号（"系统更新 v1.0.0-rc.52" 按钮） */
header button[aria-label^="系统更新"] { display: none !important; }

/* 5. 右侧用户头像圆点用主色 */
header [data-slot="avatar-fallback"] {
  background-color: #0C1F1A !important;
  color: #C6F24E !important;
}

/* 6. 通用品牌区：任何页面的顶栏，只要 JS 标记出了 logo+名称，就换成 CB 方块 */
header [data-cb-brand] > :not([data-cb-name]) { display: none !important; }
header [data-cb-brand]::before {
  content: "CB";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  border-radius: 8px;
  background: #0C1F1A;
  color: #C6F24E;
  font: 800 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: .02em;
}
html.dark header [data-cb-brand]::before { background: #C6F24E; color: #0C1F1A; }

/* 7. 公共页面顶栏（首页、/pricing 等）：透明悬浮、纯文字菜单，当前页只加粗变深 */
html:not(.dark) header[class*="inset-x-0"],
html.dark header[class*="inset-x-0"] {
  background: transparent !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}
header[class*="inset-x-0"] a[title] {
  font-size: 13px;
  font-weight: 500;
}
html:not(.dark) header[class*="inset-x-0"] a[title] { color: #4A5A52; }
html.dark header[class*="inset-x-0"] a[title] { color: #9FB2A8; }
html:not(.dark) header[class*="inset-x-0"] a[title]:hover { color: #0C1F1A; }
html.dark header[class*="inset-x-0"] a[title]:hover { color: #fff; }
html:not(.dark) header[class*="inset-x-0"] a[aria-current="page"],
html:not(.dark) header[class*="inset-x-0"] a[data-status="active"] {
  background: transparent !important;
  color: #0C1F1A !important;
  font-weight: 800;
  border-radius: 8px;
  padding-left: .75rem;
  padding-right: .75rem;
}
html.dark header[class*="inset-x-0"] a[aria-current="page"],
html.dark header[class*="inset-x-0"] a[data-status="active"] {
  background: transparent !important;
  color: #fff !important;
  font-weight: 800;
  border-radius: 8px;
  padding-left: .75rem;
  padding-right: .75rem;
}

/* 8. 首页内容的深色模式（兼容 .dark 在 html / body / 外层容器上的各种写法） */
.dark .cg, [data-theme="dark"] .cg, html[class~="dark"] .cg {
  background: #07120E !important; color: #E6EFE9 !important;
  --line: #1D352C; --mut: #9FB2A8;
}
.dark .cg-hero, .dark .cg-wn, .dark .cg-code { border: 1px solid #1D352C; }
.dark .cg-c, .dark .cg-pn, .dark .cg-tw, .dark .cg-cta, .dark .cg-hp, .dark .pf-c, .dark .pf-c label { background: #0F211A !important; }
.dark .cg-c { border-top-color: #C8F23A !important; }
.dark .cg-pr b, .dark .cg-fm b, .dark .cg-lg.h, .dark .cg td:first-child { color: #E6EFE9 !important; }
.dark .cg th, .dark .cg-pt span { background: #14291F !important; color: #CFE0D6 !important; }
.dark .cg-b.d, .dark .cg-n { background: #1B3A30 !important; color: #fff !important; }
.dark .cg-n { color: #C8F23A !important; }
.dark .cg-b.g { border-color: #3A5A4E !important; color: #E6EFE9 !important; }
.dark .cg-ft, .dark .cg-ft a { color: #9FB2A8 !important; }
.dark .cg details { border-color: #1D352C !important; }

/* 9. 首页双语内容：按当前语言只显示一种 */
[data-l="en"] { display: none; }
i[data-l] { font-style: normal; }
html[data-cb-lang="en"] [data-l="zh"] { display: none !important; }
html[data-cb-lang="en"] i[data-l="en"] { display: inline !important; }
html[data-cb-lang="en"] div[data-l="en"] { display: block !important; }

/* 10. 版本号按钮（兜底：按名称匹配，不受语言影响） */
header button[aria-label*="v1."], header button[title*="v1."] { display: none !important; }
