/* 熵基 AI 网关 · 主题覆盖 v1（参考 LimAPI/shadcn 中性风格）
 * 通过 nginx sub_filter 注入到 new-api 内嵌前端之后，升级 new-api 不需要改二进制。
 * 只覆盖设计 token + 少量组件外观；不改布局 DOM。
 */

/* ---------- 亮色：默认主题 ---------- */
html:not(.dark) body,
html:not(.dark) body[data-theme-preset="default"] {
  --radius: 0.75rem;

  --background: #ffffff;
  --foreground: #111111;
  --card: #ffffff;
  --card-foreground: #111111;
  --popover: #ffffff;
  --popover-foreground: #111111;

  --primary: #111111;               /* LimAPI 单色黑 */
  --primary-foreground: #ffffff;
  --secondary: #f3f4f6;
  --secondary-foreground: #111111;
  --muted: #f8fafc;
  --muted-foreground: #6b7280;
  --accent: #f3f4f6;
  --accent-foreground: #111111;
  --destructive: #dc2626;
  --destructive-foreground: #ffffff;

  --border: #e5e7eb;
  --input: #e5e7eb;
  --ring: #111111;

  --sidebar-background: #f8f9fa;
  --sidebar-foreground: #374151;
  --sidebar-primary: #111111;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #111111;
  --sidebar-accent-foreground: #fafafa;
  --sidebar-border: #e5e7eb;
  --sidebar-ring: #111111;

  --font-ui-sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-body: var(--font-ui-sans);
}

/* ---------- 暗色：只做轻调（圆角/字体/边框柔化） ---------- */
html.dark body {
  --radius: 0.75rem;
  --border: #262d3a;
  --input: #2a3242;
  --font-ui-sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* ---------- 全局质感 ---------- */
body {
  font-family: var(--font-ui-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

/* 卡片：轻阴影 + 柔和边框（LimAPI 的 white-on-white 质感） */
[data-slot="card"] {
  border-color: var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

/* 按钮：更克制的圆角与字重 */
[data-slot="button"] {
  border-radius: calc(var(--radius) * 0.72);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* 输入框 */
[data-slot="input"],
[data-slot="textarea"],
[data-slot="select-trigger"] {
  border-radius: calc(var(--radius) * 0.72);
}

/* 表格：表头浅灰、行悬停、分隔线更轻 */
[data-slot="table-header"] tr,
thead tr {
  background: var(--muted);
}
[data-slot="table-head"],
thead th {
  color: var(--muted-foreground);
  font-weight: 500;
  letter-spacing: 0.02em;
}
tbody tr {
  border-color: var(--border) !important;
}
tbody tr:hover {
  background: var(--muted);
}

/* 侧边栏：浅灰底 + 右侧细线（LimAPI 的侧栏观感） */
[data-slot="sidebar"] [data-sidebar="sidebar"],
[data-sidebar="sidebar"] {
  background: var(--sidebar-background);
  border-right: 1px solid var(--sidebar-border);
}
[data-sidebar="menu-button"],
[data-sidebar="menu-sub-button"] {
  border-radius: calc(var(--radius) * 0.55);
}
[data-sidebar="menu-button"][data-active="true"] {
  font-weight: 600;
}

/* 顶栏：细分割线 */
header[data-slot="app-header"],
[data-slot="app-header"] {
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(6px);
}

/* 徽标/标签：小圆角 */
[data-slot="badge"] {
  border-radius: calc(var(--radius) * 0.45);
}

/* 登录页：让卡片更干净（选择器尽量宽容，避免影响控制台） */
.auth-shell [data-slot="card"],
.auth-page [data-slot="card"],
[data-auth-page] [data-slot="card"] {
  box-shadow: 0 12px 40px rgba(16, 24, 40, 0.08);
}

/* 品牌 logo 尺寸收敛（避免过大） */
[data-slot="sidebar"] img,
[data-slot="app-header"] img {
  max-height: 28px;
  width: auto;
}

/* 滚动条（WebKit）低调化 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; background-clip: content-box; }

/* ---------- LimAPI 式排版纪律 ---------- */
h1, h2, h3, [data-slot="card-title"] { letter-spacing: -0.02em; }
[data-slot="table"], [data-slot="table"] * { font-size: 13px; }
[data-slot="table"] td, [data-slot="table"] th { font-variant-numeric: tabular-nums; }
[data-slot="table"] td { padding-top: .55rem; padding-bottom: .55rem; }
[data-slot="table"] th { padding-top: .5rem; padding-bottom: .5rem; }
/* 数字类一律等宽 */
.tabular-nums, [class*="tabular"] { font-variant-numeric: tabular-nums; }
