/* ===== 青鸿API 控制台主题 v3 —— 皮肤层（暗色品牌 / 亮色双模式） =====
 * 内核 100% new-api 未动；本文件只是皮肤。
 * 暗色 = 青鸿官网 token；亮色 = 同品牌浅色版。
 * 明暗由 html.dark / html.light 驱动（console-theme.js 的太阳/月亮按钮：浅色/深色/系统）。
 * 已隐藏 new-api 的 Theme Settings 抽屉入口（含 Color preset 预设选择器）。
 * 注意：shadcn 的 token 是「裸 HSL 分量」，使用处必须写成 hsl(var(--xxx))。 */

/* ---------- 公共 token（两态通用） ---------- */
html:root{
  --radius: .5rem;
  --font-sans: "JetBrains Mono", "Cascadia Code", "Fira Code", "SF Mono", Menlo, Consolas, monospace;
  --default-font-family: var(--font-sans);
  --font-mono: "JetBrains Mono", "Cascadia Code", "Fira Code", "SF Mono", Menlo, Consolas, monospace;
  --tracking-tight: 0;
  --chart-1: 43 94% 58%;
  --chart-2: 174 72% 40%;
  --chart-3: 197 71% 52%;
  --chart-4: 142 70% 45%;
  --chart-5: 27 87% 55%;
}

/* ---------- 暗色（默认，青鸿品牌） ---------- */
html:root.dark{
  color-scheme: dark;
  --background: 0 0% 6.7%;
  --foreground: 60 5% 92%;
  --card: 30 6% 9%;
  --card-foreground: 60 5% 92%;
  --popover: 30 6% 9%;
  --popover-foreground: 60 5% 92%;
  --primary: 43 94% 58%;
  --primary-foreground: 40 60% 4%;
  --secondary: 30 5% 14%;
  --secondary-foreground: 60 5% 92%;
  --muted: 30 5% 14%;
  --muted-foreground: 40 5% 62%;
  --accent: 43 40% 20%;
  --accent-foreground: 43 94% 70%;
  --destructive: 4 74% 50%;
  --destructive-foreground: 0 0% 98%;
  --border: 40 4% 19%;
  --input: 40 4% 19%;
  --ring: 43 94% 58%;
  --sidebar: 30 6% 8%;
  --sidebar-foreground: 60 5% 92%;
  --sidebar-primary: 43 94% 58%;
  --sidebar-primary-foreground: 40 60% 4%;
  --sidebar-accent: 43 35% 16%;
  --sidebar-accent-foreground: 43 94% 70%;
  --sidebar-border: 40 4% 16%;
  --sidebar-ring: 43 94% 58%;
}

/* ---------- 亮色（青鸿浅色版） ---------- */
html:root:not(.dark){
  color-scheme: light;
  --background: 45 22% 96%;
  --foreground: 0 0% 7%;
  --card: 0 0% 100%;
  --card-foreground: 0 0% 7%;
  --popover: 0 0% 100%;
  --popover-foreground: 0 0% 7%;
  --primary: 43 94% 52%;
  --primary-foreground: 40 60% 4%;
  --secondary: 45 15% 91%;
  --secondary-foreground: 0 0% 7%;
  --muted: 45 12% 91%;
  --muted-foreground: 45 5% 40%;
  --accent: 43 80% 88%;
  --accent-foreground: 40 60% 10%;
  --destructive: 4 74% 46%;
  --destructive-foreground: 0 0% 98%;
  --border: 45 10% 85%;
  --input: 45 10% 85%;
  --ring: 43 94% 52%;
  --sidebar: 0 0% 100%;
  --sidebar-foreground: 0 0% 7%;
  --sidebar-primary: 43 94% 52%;
  --sidebar-primary-foreground: 40 60% 4%;
  --sidebar-accent: 43 75% 90%;
  --sidebar-accent-foreground: 40 60% 10%;
  --sidebar-border: 45 10% 87%;
  --sidebar-ring: 43 94% 52%;
}

/* ---------- 字体 + 根/主体背景（覆盖应用硬写 Public Sans 与运行时注入） ---------- */
html:root, html:root body{
  font-family: var(--font-sans) !important;
  -webkit-font-smoothing: antialiased;
}
html:root button, html:root input, html:root select, html:root textarea{ font-family: inherit; }
html:root{ background-color: hsl(var(--background)) !important; }
html:root body{ background-color: hsl(var(--background)) !important; color: hsl(var(--foreground)) !important; }

/* ---------- 暗色背景辉光（与官网一致；亮色不加） ---------- */
html.dark body::before{
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 40% at 85% -5%, rgba(250,189,47,.10), transparent 60%),
    radial-gradient(50% 40% at 0% 100%, rgba(40,40,40,.55), transparent 65%);
}

/* ---------- 隐藏 new-api Theme Settings 抽屉入口（含 Color preset） ---------- */
html:root button[data-slot="sheet-trigger"][aria-label="Open theme settings"]{
  display: none !important;
}

/* ---------- 隐藏顶栏「未知版本」系统更新按钮（预编译二进制无版本信息，常显 Unknown version）
 * 注意：aria-label 会随界面语言翻译（英文 "System updates..." / 中文 "系统更新..."），
 * 不能按 aria 前缀匹配；header 内 dialog-trigger 只有这一个按钮，直接按 data-slot 匹配。 ---------- */
html:root header button[data-slot="dialog-trigger"]{
  display: none !important;
}

/* ---------- 主按钮：官网同款渐变黄 + 内高光 ---------- */
html:root button.bg-primary,
html:root .bg-primary:not(.bg-sidebar-primary){
  background-image: linear-gradient(135deg, #FABD2F 0%, #F08A24 100%);
  color: #171300;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 0 0 1px rgba(250,189,47,.25), 0 6px 18px -6px rgba(250,189,47,.45);
}
html:root button.bg-primary:hover{ filter: brightness(1.05); }

/* ---------- 卡片：16px 圆角 + 微渐变 + 悬停浮起 ---------- */
html:root [data-slot="card"], html:root .bg-card{
  border-radius: 16px;
  background-color: hsl(var(--card)) !important;
  background-image: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0));
  border-color: hsl(var(--border));
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
html:root [data-slot="card"]:hover{
  transform: translateY(-2px);
  border-color: rgba(250,189,47,.35);
  box-shadow: 0 14px 30px -18px rgba(0,0,0,.8), 0 0 0 1px rgba(250,189,47,.12);
}
html:root:not(.dark) [data-slot="card"], html:root:not(.dark) .bg-card{
  background-image: none;
  box-shadow: 0 1px 3px rgba(23,19,0,.06);
}
html:root:not(.dark) [data-slot="card"]:hover{
  box-shadow: 0 14px 28px -18px rgba(23,19,0,.35), 0 0 0 1px rgba(250,189,47,.35);
}

/* ---------- 输入聚焦：香蕉黄 3px 环 ---------- */
html:root :is(input, textarea, select, [contenteditable="true"]):focus-visible,
html:root [data-slot="input"]:focus-visible{
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px rgba(250,189,47,.28);
}

/* ---------- 开关（switch）显形 ----------
 * new-api rc.47 的 Base UI Switch 轨道/滑块颜色类失效（computed 全透明），
 * 在卡片背景上完全隐形。这里强制涂色：关=灰轨道白滑块，开=香蕉黄轨道白滑块。 */
html:root [role="switch"]{
  background-color: hsl(var(--input)) !important;
  border-radius: 9999px !important;
  transition: background-color .18s ease;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.35);
}
html:root [role="switch"][aria-checked="true"],
html:root [role="switch"][data-checked]{
  background-color: #FABD2F !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.18), 0 0 10px -2px rgba(250,189,47,.55);
}
html:root [role="switch"] > span{
  background-color: #ffffff !important;
  border-radius: 9999px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.45);
}
html:root:not(.dark) [role="switch"]{
  background-color: hsl(var(--input)) !important;
}
html:root:not(.dark) [role="switch"] > span{
  background-color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(23,19,0,.3);
}

/* ---------- 表格 ---------- */
html:root thead, html:root [data-slot="table-header"]{ color: hsl(var(--muted-foreground)); }
html:root tbody tr:hover, html:root [data-slot="table-row"]:hover{ background-color: rgba(250,189,47,.06); }

/* ---------- 徽标：胶囊 + 黄描边 ---------- */
html:root [data-slot="badge"]{
  border-radius: 999px;
  border-color: rgba(250,189,47,.35);
}
html:root [data-slot="badge"].bg-primary{ box-shadow: none; }

/* ---------- 侧栏：玻璃感 + 选中项渐变黄 ---------- */
html:root .bg-sidebar, html:root [data-slot="sidebar"]{
  background-color: hsl(var(--sidebar)) !important;
  background-image: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
}
html:root:not(.dark) .bg-sidebar, html:root:not(.dark) [data-slot="sidebar"]{ background-image: none; }
html:root [data-active="true"], html:root a[aria-current="page"]{
  background-image: linear-gradient(135deg, rgba(250,189,47,.22), rgba(240,138,36,.12));
  color: hsl(var(--sidebar-accent-foreground));
}

/* ---------- 浮层：14px 圆角 + 重阴影 ---------- */
html:root [data-slot="dialog-content"],
html:root [data-slot="popover-content"],
html:root [data-slot="select-content"],
html:root [data-slot="dropdown-menu-content"],
html:root [data-slot="sheet-content"],
html:root [role="menu"]{
  border-radius: 14px;
  border-color: hsl(var(--border));
  background-color: hsl(var(--popover)) !important;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.75);
}
html:root:not(.dark) [data-slot="dialog-content"],
html:root:not(.dark) [data-slot="popover-content"],
html:root:not(.dark) [data-slot="select-content"],
html:root:not(.dark) [data-slot="dropdown-menu-content"],
html:root:not(.dark) [role="menu"]{
  box-shadow: 0 24px 60px -24px rgba(23,19,0,.35);
}

/* ---------- 滚动条 ---------- */
html:root ::-webkit-scrollbar{ width: 10px; height: 10px; }
html:root ::-webkit-scrollbar-thumb{ background: hsl(var(--border)); border-radius: 8px; }
html:root ::-webkit-scrollbar-thumb:hover{ background: hsl(var(--ring)); }
html:root ::-webkit-scrollbar-track{ background: transparent; }

/* ---------- 顶栏玻璃化 ---------- */
html:root body > div > div > header:first-of-type,
html:root body > div > header:first-of-type{
  background-color: hsl(var(--background) / .72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid hsl(var(--border));
}

/* ---------- logo 悬停旋转（官网同款彩蛋） ---------- */
html:root img[src*="logo"]{ transition: transform .5s ease; }
html:root a:hover img[src*="logo"]{ transform: rotate(-8deg) scale(1.06); }

/* ================= 青鸿太阳/月亮切换按钮 + 菜单（JS 注入） ================= */
.qh-theme-btn{
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  color: hsl(var(--foreground)); background: transparent; border: 1px solid transparent;
  cursor: pointer; transition: background-color .15s ease, color .15s ease;
}
.qh-theme-btn:hover{ background-color: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.qh-theme-btn svg{ width: 18px; height: 18px; }
.qh-theme-menu{
  position: fixed; z-index: 70; min-width: 132px; padding: 4px;
  background: hsl(var(--popover)); color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border)); border-radius: 12px;
  box-shadow: 0 18px 44px -16px rgba(0,0,0,.7);
  font-family: var(--font-sans); font-size: 13px;
}
html:root:not(.dark) .qh-theme-menu{ box-shadow: 0 18px 44px -18px rgba(23,19,0,.35); }
.qh-theme-item{
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; border: 0; border-radius: 8px; background: transparent;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.qh-theme-item:hover{ background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.qh-theme-item .qh-check{ width: 14px; visibility: hidden; flex-shrink: 0; }
.qh-theme-item[data-active="true"] .qh-check{ visibility: visible; color: hsl(var(--primary)); }
.qh-theme-item[data-active="true"]{ color: hsl(var(--primary)); }
html:root:not(.dark) .qh-theme-item[data-active="true"]{ color: #8a6a00; }

/* ================= 钱包页内嵌在线充值面板（青鸿控制台风格，复用虎皮椒链路） ================= */
.qh-recharge{ display:flex; flex-direction:column; gap:12px; width:100%; margin-top:4px; font-size:13px; }
.qh-recharge .qh-rc-row{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.qh-recharge .qh-rc-amt{
  min-width:76px; min-height:44px; padding:11px 18px; border-radius:10px; cursor:pointer;
  border:1px solid hsl(var(--border)); background:transparent; color:hsl(var(--foreground));
  font:inherit; font-size:15px; line-height:1; font-weight:600; transition: all .15s ease;
}
.qh-recharge .qh-rc-amt:hover{ border-color: hsl(var(--ring)); background: hsl(var(--foreground) / .05); }
.qh-recharge .qh-rc-amt.is-active{ background: hsl(var(--primary)); border-color: hsl(var(--primary)); color: hsl(var(--primary-foreground)); box-shadow: 0 2px 10px hsl(var(--primary) / .35); }
.qh-recharge .qh-rc-input{
  flex:1; min-width:110px; padding:8px 10px; border-radius:9px;
  border:1px solid hsl(var(--border)); background:hsl(var(--card)); color:hsl(var(--foreground));
  font:inherit;
}
.qh-recharge .qh-rc-ch{ display:flex; gap:8px; }
.qh-recharge .qh-rc-ch button{
  flex:1; padding:8px 10px; border-radius:9px; cursor:pointer;
  border:1px solid hsl(var(--border)); background:transparent; color:hsl(var(--foreground));
  font:inherit; font-weight:600; transition: all .15s ease;
}
.qh-recharge .qh-rc-ch button.is-active{ border-color: hsl(var(--primary)); background: hsl(var(--primary) / .12); color: hsl(var(--primary)); }
.qh-recharge .qh-rc-submit{
  width:100%; padding:10px; border-radius:9px; cursor:pointer; border:0;
  background-image: linear-gradient(135deg, #FABD2F 0%, #F08A24 100%);
  color:#171300; font:inherit; font-weight:700; transition: filter .15s ease;
}
.qh-recharge .qh-rc-submit:hover{ filter: brightness(1.05); }
.qh-recharge .qh-rc-submit:disabled{ opacity:.55; cursor:not-allowed; }
.qh-recharge .qh-rc-qr{ display:none; flex-direction:column; align-items:center; gap:10px; padding-top:6px; }
.qh-recharge .qh-rc-qr.show{ display:flex; }
.qh-recharge .qh-rc-qr img{ width:196px; height:196px; border-radius:10px; border:1px solid hsl(var(--border)); background:#fff; padding:8px; }
.qh-recharge .qh-rc-status{ color:hsl(var(--muted-foreground)); text-align:center; }
.qh-recharge .qh-rc-status.ok{ color: hsl(var(--primary)); }
.qh-recharge .qh-rc-err{ color:hsl(var(--destructive)); font-size:12px; min-height:16px; }
.qh-recharge .qh-rc-open{ font-size:12px; color: hsl(var(--primary)); }
