/*
 * CX.API 全站检查修复样式（2026-11-26）
 * 独立文件，加在 platform-theme.css 之后加载。只补颜色和排版，不改结构。
 * 每段前面的 #数字 对应《CX.API 修复清单》里的行内容。
 */

/* 后台侧边栏：二级菜单选中项在日间模式是白字、无底色（内容审计、提示词审计、支付概览） */
html.platform-theme.theme-console[data-theme="light"] aside.sidebar .sidebar-section > div.border-l > a.sidebar-link.sidebar-link-active,
html.platform-theme.theme-console[data-theme="light"] aside.sidebar .sidebar-section > div.border-l > a.sidebar-link.router-link-active,
html.platform-theme.theme-console[data-theme="light"] aside.sidebar .sidebar-section > div.border-l > a.sidebar-link[aria-current="page"] {
  color: #4338ca !important;
  -webkit-text-fill-color: #4338ca !important;
  background-color: rgba(99, 102, 241, .14) !important;
  background-image: none !important;
  font-weight: 600 !important;
}
html.platform-theme.theme-console[data-theme="light"] aside.sidebar .sidebar-section > div.border-l > a.sidebar-link.sidebar-link-active *,
html.platform-theme.theme-console[data-theme="light"] aside.sidebar .sidebar-section > div.border-l > a.sidebar-link.router-link-active * {
  color: #4338ca !important;
  -webkit-text-fill-color: #4338ca !important;
}

/* 后台侧边栏：分组标题（渠道管理、安全审计、订单管理）和箭头排在同一行 */
html.platform-theme.theme-console aside.sidebar button.sidebar-link > .sidebar-label.sidebar-label-flex {
  display: flex !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
}

/* 选中状态的分段按钮（支付概览“30天”、管理控制台“Token”）：日间模式文字被改成灰色，恢复白字 */
html.platform-theme.theme-console[data-theme="light"] button.text-white:is([class*="bg-primary-"], [class*="bg-blue-"], [class*="bg-indigo-"], [class*="bg-violet-"], [class*="bg-purple-"]),
html.platform-theme.theme-console[data-theme="light"] button.text-white:is([class*="bg-primary-"], [class*="bg-blue-"], [class*="bg-indigo-"], [class*="bg-violet-"], [class*="bg-purple-"]) > span {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* 顶栏：页面副标题很长时（操作日志、提示词审计），“模型广场”被挤成竖排 */
html.platform-theme.theme-console header.glass a[href="/models"],
html.platform-theme.theme-console header.glass a[href="/models"] > span {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}
html.platform-theme.theme-console header.glass > div > .flex.items-center.gap-4 {
  min-width: 0 !important;
  flex: 1 1 auto !important;
}
html.platform-theme.theme-console header.glass > div > .flex.items-center.gap-4 > div {
  min-width: 0 !important;
}
html.platform-theme.theme-console header.glass h1 + p.text-xs {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  overflow: hidden !important;
}
@media (min-width: 1280px) {
  html.platform-theme.theme-console header.glass > div > .flex.items-center.gap-3 {
    flex-shrink: 0 !important;
  }
}

/* 后台生图任务：夜间模式“失败”徽标是浅粉底配浅灰字 */
html.platform-theme.theme-console[data-theme="dark"] .bg-red-100:is(.text-red-600, .text-red-700, .text-red-800) {
  background-color: rgba(239, 68, 68, .2) !important;
  background-image: none !important;
  color: #fecaca !important;
  -webkit-text-fill-color: #fecaca !important;
}

/* 使用说明 /guide：夜间模式补配色（左侧目录、正文列表、说明框、行内代码、标签） */
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-index > a,
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-doc-list > li,
html.platform-theme.theme-guide[data-theme="dark"] body #app .guide-doc-block ol > li,
html.platform-theme.theme-guide[data-theme="dark"] body #app .guide-doc-block ul > li,
html.platform-theme.theme-guide[data-theme="dark"] body #app .guide-doc-block p {
  color: #cbd5e1 !important;
  -webkit-text-fill-color: #cbd5e1 !important;
}
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-index > a.cx-active {
  color: #bfdbfe !important;
  -webkit-text-fill-color: #bfdbfe !important;
}
html.platform-theme.theme-guide[data-theme="dark"] body #app .guide-doc-block li > code,
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-doc-list li > code,
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-section ol > li > code,
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-section ul > li > code {
  color: #e2e8f0 !important;
  -webkit-text-fill-color: #e2e8f0 !important;
  background-color: rgba(148, 163, 184, .18) !important;
}
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-note {
  background: rgba(148, 163, 184, .12) !important;
  border-color: rgba(148, 163, 184, .28) !important;
}
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-note,
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-note > p,
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-note li {
  color: #cbd5e1 !important;
  -webkit-text-fill-color: #cbd5e1 !important;
}
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-note code {
  color: #e2e8f0 !important;
  -webkit-text-fill-color: #e2e8f0 !important;
  background-color: rgba(15, 23, 42, .55) !important;
}
html.platform-theme.theme-guide[data-theme="dark"] body #app .guide-gif-examples .code-card > .code-title {
  color: #e2e8f0 !important;
  -webkit-text-fill-color: #e2e8f0 !important;
}
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-eyebrow {
  color: #bfdbfe !important;
  -webkit-text-fill-color: #bfdbfe !important;
  background: rgba(59, 130, 246, .18) !important;
  border-color: rgba(96, 165, 250, .35) !important;
}
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-api-label,
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-side > span,
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-section > span {
  color: #93c5fd !important;
  -webkit-text-fill-color: #93c5fd !important;
}
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-inline-code {
  color: #bfdbfe !important;
  -webkit-text-fill-color: #bfdbfe !important;
  background: rgba(59, 130, 246, .18) !important;
  border-color: rgba(96, 165, 250, .32) !important;
}
html.platform-theme.theme-guide[data-theme="dark"] body #app .cx-guide-badge {
  color: #c7d2fe !important;
  -webkit-text-fill-color: #c7d2fe !important;
  background: rgba(99, 102, 241, .24) !important;
  border-color: rgba(129, 140, 248, .36) !important;
}

/* 使用说明 /guide：日间模式顶部按钮的渐变右端太浅（白字对比度约 2），整体加深一档 */
html.platform-theme.theme-guide[data-theme="light"] body #app .cx-guide-actions > a.cx-guide-action {
  background-color: #3b6fe6 !important;
  background-image: linear-gradient(135deg, #6d4df5 0%, #3b6fe6 55%, #0e8fb8 100%) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* 手机：客服悬浮按钮已在 platform-support.css 里缩成小圆标；这里给页面底部留出滚动空间，
   让“确认支付”等底部按钮能滚到圆标上方 */
@media (max-width: 700px) {
  html.platform-theme.theme-console main {
    padding-bottom: 76px !important;
  }
}

/* 手机：模型广场阶梯计费表的表头和档位（上下文、≤512K）不折行 */
@media (max-width: 640px) {
  html.platform-theme table.cxmp2-actual-prices.cxmp2-compact-tiers thead th:first-child {
    width: 58px !important;
  }
  html.platform-theme table.cxmp2-actual-prices.cxmp2-compact-tiers thead th,
  html.platform-theme table.cxmp2-actual-prices.cxmp2-compact-tiers th.cxmp2-tier-label {
    white-space: nowrap !important;
    word-break: keep-all !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
  }
}

/* 登录页：日间模式“忘记密码？”太淡（未能在浏览器里验证，上线后需看一眼登录页） */
html.platform-theme[data-theme="light"] body #app a[href="/forgot-password"],
html.platform-theme[data-theme="light"] a[href="/forgot-password"] {
  color: #4338ca !important;
  -webkit-text-fill-color: #4338ca !important;
}

/* 页脚指向上游开源项目的 GitHub 链接：主前端发版删除之前先隐藏 */
html.platform-theme a[href*="github.com/Wei-Shaw/sub2api"] {
  display: none !important;
}
