/* ==========================================================================
 * 晶星屿链 AI 运营工作台 - 全局样式表
 * 描述：主工作台前端的全部视觉样式，涵盖：
 *   1. CSS 自定义属性（暗色/亮色双主题设计令牌）
 *   2. 全局重置与基础排版
 *   3. AI 帮写按钮与提示词优化提示
 *   4. 登录视图（品牌展示、角色切换、登录表单）
 *   5. 应用主壳与侧边栏（导航、能力状态、模型配置、快捷入口）
 *   6. 顶栏与按钮系统（主按钮/次按钮/幽灵按钮）
 *   7. 工作台视图（公告横幅、指标卡片、客户输入、AI 回复）
 *   8. 内容工坊视图（模式卡片、表单、输出区）
 *   9. 行业情报视图
 *  10. 内容解析视图
 *  11. 素材库视图
 *  12. 运营配置视图（看板、公告、积分、代理、备份、网盘）
 *  13. 知识库管理视图（双库卡片、录入、上传）
 *  14. 通用组件（标签、进度条、模态框、Toast）
 *  15. 响应式适配
 * 主题：暗色模式以深绿黑为底、teal（青绿）为主色；亮色模式以浅灰白为底
 * ========================================================================== */

/* === CSS 自定义属性 - 暗色主题（默认） === */
:root,
:root[data-theme="dark"] {
  --bg: #050706;
  --surface: #101312;
  --surface-soft: #0b1010;
  --ink: #f4faf7;
  --ink-soft: #d7e2de;
  --muted: #83918c;
  --line: #222b29;
  --line-strong: #34413d;
  --teal: #31d5c8;
  --teal-dark: #8eece4;
  --violet: #8b7cff;
  --amber: #b37a2b;
  --ruby: #a94357;
  --green: #24744b;
  --nav: #050706;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 28px 68px rgba(0, 0, 0, 0.42);
  --shadow-btn: 0 4px 18px rgba(49, 213, 200, 0.18);
  --shadow-btn-hover: 0 8px 28px rgba(49, 213, 200, 0.28);
  --shadow-violet: 0 4px 12px rgba(101, 84, 168, 0.18);
  --shadow-violet-hover: 0 8px 24px rgba(101, 84, 168, 0.28);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --sidebar-width: 248px;
  --transition-fast: 120ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-mid: 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --body-gradient:
    radial-gradient(circle at 72% -10%, rgba(139, 124, 255, 0.18), transparent 34%),
    radial-gradient(circle at 15% 12%, rgba(49, 213, 200, 0.12), transparent 28%),
    linear-gradient(180deg, #050706 0%, #080a0a 100%);
  --login-gradient:
    radial-gradient(circle at 15% 20%, rgba(139, 124, 255, 0.32), transparent 42%),
    radial-gradient(circle at 85% 30%, rgba(49, 213, 200, 0.26), transparent 46%),
    linear-gradient(180deg, #050706 0%, #0a1110 100%);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === CSS 自定义属性 - 亮色主题 === */
:root[data-theme="light"] {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-soft: #eef1f0;
  --ink: #14201e;
  --ink-soft: #35413f;
  --muted: #6b7775;
  --line: #d8dedc;
  --line-strong: #b6c0bd;
  --teal: #0e9a91;
  --teal-dark: #086661;
  --violet: #6c5dd3;
  --amber: #b4722a;
  --ruby: #b13e58;
  --green: #1e7a4d;
  --nav: #ffffff;
  --shadow: 0 18px 42px rgba(20, 32, 30, 0.08);
  --shadow-lg: 0 28px 68px rgba(20, 32, 30, 0.12);
  --shadow-btn: 0 4px 18px rgba(14, 154, 145, 0.22);
  --shadow-btn-hover: 0 8px 28px rgba(14, 154, 145, 0.32);
  --shadow-violet: 0 4px 12px rgba(108, 93, 211, 0.18);
  --shadow-violet-hover: 0 8px 24px rgba(108, 93, 211, 0.28);
  --body-gradient:
    radial-gradient(circle at 72% -10%, rgba(108, 93, 211, 0.12), transparent 40%),
    radial-gradient(circle at 15% 12%, rgba(14, 154, 145, 0.10), transparent 36%),
    linear-gradient(180deg, #f7f9f8 0%, #eef1f0 100%);
  --login-gradient:
    radial-gradient(circle at 15% 20%, rgba(108, 93, 211, 0.18), transparent 48%),
    radial-gradient(circle at 85% 30%, rgba(14, 154, 145, 0.18), transparent 52%),
    linear-gradient(180deg, #f7f9f8 0%, #eef1f0 100%);
}

/* === 全局重置与基础排版 === */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  background: var(--body-gradient);
  transition: background 300ms ease, color 200ms ease;
}

button,
input,
textarea,
select {
  font: inherit;
}

.file-input {
  margin-top: 8px;
  padding: 8px;
}

/* === 提示词输入行（表单字段与 AI 帮写按钮并排布局） === */
.prompt-field-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.prompt-field-row .textarea {
  flex: 1;
  min-width: 0; /* min-width:0 确保 flex 子项可被压缩，防止文本域撑破容器 */
}

/* === AI 帮写按钮 === */
.ai-help-btn {
  flex-shrink: 0;
  min-height: 39px;
  min-width: 88px;
  border: none;
  border-radius: var(--radius);
  padding: 0 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--violet) 0%, #8b6fc0 50%, #9b7fd4 100%);
  background-size: 200% 200%;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-violet);
  transition: box-shadow var(--transition-mid), transform var(--transition-fast), background-position var(--transition-mid);
}

.ai-help-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 60%);
  pointer-events: none;
}

.ai-help-btn:hover {
  box-shadow: var(--shadow-violet-hover);
  transform: translateY(-2px);
  background-position: 100% 100%;
}

.ai-help-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(101, 84, 168, 0.2);
}

.ai-help-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* === 提示词优化结果提示框 === */
.prompt-optimize-hint {
  margin-top: 8px;
  border: 1px solid rgba(101, 84, 168, 0.18);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: linear-gradient(135deg, #faf8ff 0%, #f5f0ff 100%);
  font-size: 13px;
  line-height: 1.6;
  box-shadow: 0 2px 8px rgba(101, 84, 168, 0.06);
}

.prompt-optimize-hint .hint-title {
  font-weight: 900;
  color: var(--violet);
  margin-bottom: 4px;
}

.prompt-optimize-hint .hint-body {
  color: var(--ink-soft);
}

.prompt-optimize-hint .hint-ref {
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #f0ecf8, #e8e0f6);
  color: var(--violet);
  font-weight: 900;
  font-size: 12px;
}

button {
  cursor: pointer;
}

/* === 基础排版（标题与段落） === */
h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.16;
  font-weight: 900;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 900;
}

p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.62;
}

/* === 通用隐藏工具类 === */
.hidden,
.hidden-field {
  display: none !important;
}

/* === 登录视图（品牌展示区 + 登录卡片） === */
.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 440px);
  gap: 24px;
  padding: 28px;
  align-items: stretch;
}

.login-product,
.login-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* === 登录品牌展示区（左侧大图区） === */
.login-product {
  min-height: 620px;
  padding: 42px;
  display: grid;
  align-content: end;
  color: #f2f6f5;
  background: var(--login-gradient);
  position: relative;
  overflow: hidden;
}
.login-product::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 70% 20%, rgba(49, 213, 200, 0.22), transparent 44%),
    radial-gradient(circle at 20% 70%, rgba(139, 124, 255, 0.22), transparent 50%);
  pointer-events: none;
}
.login-product > * { position: relative; z-index: 1; }

.login-product h1 {
  max-width: 820px;
  margin-top: 96px;
  font-size: clamp(38px, 5.2vw, 58px);
  line-height: 1.08;
  color: #ffffff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.25);
}

.login-product p {
  max-width: 620px;
  margin-top: 18px;
  font-size: 15px;
  color: rgba(242, 246, 245, 0.82);
}

/* === 品牌标识组合（图标 + 名称） === */
.brand-lockup {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-lockup strong {
  display: block;
  font-size: 17px;
  font-weight: 900;
}

.brand-lockup small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.brand-lockup.compact strong,
.brand-lockup.compact small {
  color: var(--ink);
}

.brand-lockup.compact small {
  color: var(--muted);
}

/* === 品牌图标徽标 === */
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--teal), var(--violet));
}

/* === 登录卡片（右侧表单区） === */
.login-card {
  align-self: center;
  padding: 24px;
}

.login-card h2 {
  margin-bottom: 18px;
}

/* === 角色选择标签与快捷按钮行 === */
.role-row,
.button-row,
.top-actions,
.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.role-row {
  margin: 8px 0 16px;
}

.role-chip,
.quick-row button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 900;
}

.role-chip.active,
.quick-row button:hover {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.login-error {
  min-height: 22px;
  margin-top: 12px;
  color: var(--ruby);
}

.login-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

/* === 应用主壳（侧边栏 + 主内容区双栏布局） === */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

/* === 侧边栏（固定吸顶、可滚动导航容器） === */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--nav), var(--surface-soft));
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  overscroll-behavior: contain; /* 阻止滚动传播到页面主体 */
  scrollbar-width: thin; /* Firefox 细滚动条 */
  scrollbar-color: var(--line-strong) transparent;
}

/* --- 侧边栏滚动条样式（WebKit 内核浏览器） --- */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* === 侧边栏导航列表 === */
.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  min-height: 44px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink-soft);
  background: transparent;
  text-align: left;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-item::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
}

.nav-item:hover,
.nav-item.active {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface-soft);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--teal), var(--violet));
  color: #fff;
  border-color: transparent;
}

.nav-item.active::after {
  background: #d8eee9;
}

/* === 侧边栏信息卡片（API Key / 模型配置 / 能力状态） === */
.sidebar-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: var(--surface-soft);
}

/* === API 密钥配置卡片 === */
.api-key-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.api-key-card .input {
  margin-bottom: 2px;
}

/* === 模型 ID 网格（双列模型配置） === */
.model-id-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
}

.model-id-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.model-id-item span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.input-sm {
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 6px;
}

.mini-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

/* === 能力状态行（连接状态指示） === */
.status-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(238, 247, 243, 0.84);
  font-size: 13px;
}

/* === 生产工坊快捷入口（侧边栏底部模式切换） === */
.production-quick {
  display: grid;
  gap: 8px;
}

.production-quick button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  text-align: left;
  font-size: 12px;
  font-weight: 900;
  position: relative;
  overflow: hidden;
}

.production-quick button:hover,
.production-quick button.active {
  color: #fff;
  border-color: rgba(189, 236, 229, 0.38);
  background: rgba(11, 118, 109, 0.38);
}

/* === 状态圆点指示器 === */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.ok {
  background: #52c889;
}

.dot.warn {
  background: #e2ad43;
}

/* === 主内容区 === */
.main {
  min-width: 0;
  padding: 24px 28px 48px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 220px);
}

/* === 顶栏（标题 + 操作按钮） === */
.topbar {
  min-height: 70px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

/* === 眉标（小标题/标签文字） === */
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* === 按钮系统（主按钮 / 次按钮 / 幽灵按钮） === */
.primary-btn,
.secondary-btn,
.ghost-btn {
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 18px;
  font-weight: 900;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition-mid), transform var(--transition-fast), border-color var(--transition-mid), background var(--transition-mid);
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, #6f62ff 0%, #2452ff 42%, #31d5c8 100%);
  background-size: 200% 200%; /* 放大背景以实现渐变位移动画 */
  box-shadow: var(--shadow-btn), inset 0 1px 0 rgba(255,255,255,0.22);
}

/* === 按钮光泽扫过动画伪元素（sheen 高光效果） === */
.primary-btn::before,
.ai-help-btn::before,
.scan-button::before,
.production-quick button::before,
.mode-card::after {
  content: "";
  position: absolute;
  top: -40%;
  left: -80%;
  width: 46%;
  height: 180%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.34), transparent);
  transform: rotate(18deg);
  pointer-events: none;
}

.primary-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.14) 0%, transparent 50%);
  pointer-events: none;
}

.primary-btn:hover::before,
.ai-help-btn:hover::before,
.scan-button:hover::before,
.production-quick button:hover::before,
.mode-card:hover::after,
.mode-card.active::after {
  animation: sheen 980ms ease;
}

.primary-btn:hover {
  box-shadow: var(--shadow-btn-hover);
  transform: translateY(-1px);
  background-position: 100% 100%;
}

.primary-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(11, 118, 109, 0.18);
}

.secondary-btn {
  color: var(--teal-dark);
  background: linear-gradient(180deg, #0f1c1a 0%, #0a1312 100%);
  border-color: rgba(11, 118, 109, 0.32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.secondary-btn:hover {
  border-color: var(--teal);
  background: linear-gradient(180deg, #122624 0%, #0d1b1a 100%);
  box-shadow: 0 2px 10px rgba(11, 118, 109, 0.14), inset 0 1px 0 rgba(255,255,255,0.06);
  transform: translateY(-1px);
}

.secondary-btn:active {
  transform: translateY(0);
}

.ghost-btn {
  color: var(--ink-soft);
  background: linear-gradient(180deg, #141a19 0%, #0e1312 100%);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.ghost-btn:hover {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, #1a2120 0%, #121817 100%);
  transform: translateY(-1px);
}

.sidebar .ghost-btn {
  color: rgba(238, 247, 243, 0.9);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar .ghost-btn:first-of-type {
  margin-top: auto;
}

.full {
  width: 100%;
}

/* === 表单控件（输入框 / 下拉框 / 文本域） === */
.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070b0c;
  color: var(--ink);
  outline: none;
  min-height: 39px;
  padding: 0 12px;
}

.textarea {
  padding: 12px;
  resize: vertical;
  line-height: 1.6;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(11, 118, 109, 0.58);
  box-shadow: 0 0 0 3px rgba(11, 118, 109, 0.1), 0 2px 8px rgba(11, 118, 109, 0.06);
}

/* === 表单字段容器（标签 + 控件） === */
.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 900;
}

/* === 视图容器（仅显示当前激活视图） === */
.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

/* === 指标卡片网格与卡片 === */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

button.metric-card {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.metric-card:hover,
button.metric-card:focus-visible {
  border-color: rgba(49, 213, 200, 0.52);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 0 0 2px rgba(49, 213, 200, 0.12);
  outline: none;
}

.metric-card .metric-detail-cue {
  margin-top: 8px;
  color: #31d5c8;
  font-size: 11px;
  font-weight: 900;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.metric-value {
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
}

.metric-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

/* === 工作台四象限布局：客户输入+AI输出 占左两列跨两行，平台文案+智能配单 占右列上下 === */
.work-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(360px, 1.35fr) minmax(300px, 1fr);
  grid-template-rows: auto auto;
  grid-template-areas:
    "task-panel result-panel side-panel-platform"
    "task-panel result-panel side-panel-match";
  gap: 18px;
  align-items: start;
}

.work-layout > .task-panel { grid-area: task-panel; }
.work-layout > .result-panel { grid-area: result-panel; }
.work-layout > .side-panel.platform-copy-panel { grid-area: side-panel-platform; }
.work-layout > .side-panel.product-match-panel { grid-area: side-panel-match; }

/* 小屏退化为单列堆叠，避免挤压 */
@media (max-width: 1080px) {
  .work-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "task-panel"
      "result-panel"
      "side-panel-platform"
      "side-panel-match";
  }
}

/* === 生产工坊模式卡片网格 === */
.production-mode-grid {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.mode-card {
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 8px;
  color: var(--ink-soft);
  background: linear-gradient(135deg, #101312, #090d0e);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.mode-card::before {
  content: "";
  width: 34px;
  height: 3px;
  border-radius: 999px;
  background: var(--line-strong);
}

.mode-card span {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.mode-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mode-card:hover,
.mode-card.active {
  border-color: rgba(11, 118, 109, 0.42);
  background: linear-gradient(135deg, rgba(139, 124, 255, 0.18), rgba(49, 213, 200, 0.08));
  box-shadow: 0 8px 20px rgba(22, 32, 28, 0.06);
}

.mode-card.active {
  box-shadow: inset 0 0 0 2px rgba(11, 118, 109, 0.1), 0 8px 20px rgba(22, 32, 28, 0.06);
}

.mode-card.active::before {
  background: var(--teal);
}

/* === 通用面板与面板头部 === */
.panel {
  padding: 18px;
}

.panel-head {
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

/* === 结果输出框 === */
.result-box {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
  line-height: 1.72;
  overflow: auto;
}

.result-box.empty {
  color: var(--muted);
  display: grid;
  place-items: center;
  text-align: center;
}

.result-box.compact {
  min-height: 70px;
  margin-top: 14px;
}

/* === 智能配单结果卡片 === */
.match-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px 0;
  background: var(--surface);
}
.match-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}
.match-meta {
  font-size: 13px;
  color: var(--muted);
  margin: 2px 0;
}
.match-reason {
  font-size: 13px;
  line-height: 1.6;
  margin-top: 8px;
  color: var(--text);
}
.match-sales {
  font-size: 13px;
  line-height: 1.65;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(79, 140, 255, 0.08);
  border-left: 3px solid var(--accent, #4f8cff);
  color: var(--text);
}
.match-sales strong {
  color: var(--accent, #4f8cff);
}
.match-summary {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text);
}
.match-notes {
  font-size: 13px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text);
}

/* === 图片解析：4类水晶行业范文块 === */
.analyze-crystal-parse {
  border-left: 3px solid var(--teal) !important;
  background: linear-gradient(135deg, rgba(49, 213, 200, 0.06), rgba(139, 124, 255, 0.04)) !important;
}
.analyze-crystal-parse header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.crystal-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  align-items: start;
  font-size: 13px;
  line-height: 1.6;
}
.crystal-row:last-child {
  border-bottom: none;
}
.crystal-label {
  color: var(--muted);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.crystal-value {
  color: var(--ink);
  word-break: break-word;
}
.crystal-seg {
  display: inline-block;
  margin-right: 10px;
}
.crystal-seg em {
  color: var(--muted);
  font-style: normal;
  font-weight: 600;
  margin-right: 4px;
}
.crystal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.crystal-tags .tag {
  background: rgba(49, 213, 200, 0.12);
  color: var(--teal-dark, var(--teal));
  border: 1px solid rgba(49, 213, 200, 0.24);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.crystal-five-dim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.crystal-five-dim-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.crystal-five-dim-grid > div > span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.crystal-five-dim-grid > div > strong {
  font-size: 13px;
  color: var(--ink);
  font-weight: 700;
  word-break: break-word;
}
.crystal-trivia-row {
  background: rgba(139, 124, 255, 0.05);
  border-radius: 8px;
  padding: 10px;
  margin-top: 6px;
  border-bottom: none !important;
}
.crystal-trivia {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.7;
  font-style: normal;
}
@media (max-width: 768px) {
  .crystal-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .crystal-five-dim-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.reply-text {
  white-space: pre-wrap;
  font-size: 15px;
}

/* === 标签行与风险标签 === */
.tag-row,
.source-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag,
.risk,
.source-row span {
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 900;
}

.tag,
.source-row span {
  color: var(--teal-dark);
  background: rgba(49, 213, 200, 0.12);
}

.risk.low {
  color: var(--green);
  background: #e7f4ec;
}

.risk.mid,
.risk.high {
  color: #8a5911;
  background: #fff1cf;
}

/* === 列表容器（配额 / 平台 / 素材 / 治理 / 开关） === */
.quota-list,
.platform-list,
.material-library,
.governance-list,
.switch-list {
  display: grid;
  gap: 10px;
}

/* 平台文案列表限高+滚动，避免 6 条全展开挤掉智能配单 */
.platform-list {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.quota-list {
  margin-top: 18px;
}

/* 配额面板折叠容器：默认收起为一行 "今日用量 5/2700"，展开显示各类型进度条 */
.quota-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1211;
  overflow: hidden;
}
.quota-panel > summary.quota-summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
  user-select: none;
}
.quota-panel > summary.quota-summary::-webkit-details-marker { display: none; }
.quota-panel > summary.quota-summary::before {
  content: "▼";
  font-size: 10px;
  color: var(--ink-soft);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
  margin-right: 6px;
}
.quota-panel:not([open]) > summary.quota-summary::before { transform: rotate(-90deg); }
.quota-panel[open] > summary.quota-summary::before { transform: rotate(0deg); }
.quota-panel .quota-summary-tail {
  font-weight: 600;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}
.quota-panel .quota-list {
  margin-top: 0;
  padding: 0 12px 12px;
  border-top: 1px dashed var(--line);
  display: grid;
  gap: 8px;
}
.quota-panel .quota-item {
  background: #0d1211;
  border-color: var(--line);
  padding: 10px 12px;
}
.quota-panel .quota-top {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.quota-panel .quota-top span:last-child {
  color: var(--ink-soft);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* === 列表项卡片（配额 / 平台 / 素材 / 治理 / 开关 / 知识） === */
.quota-item,
.platform-item,
.material-item,
.governance-item,
.switch-item,
.knowledge-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #0d1211;
}

/* details 折叠样式：summary 行展示平台名+标题+风险，点击展开正文 */
details.platform-item {
  padding: 0;
}
details.platform-item > summary.platform-top {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
}
details.platform-item > summary.platform-top::-webkit-details-marker {
  display: none;
}
details.platform-item > summary.platform-top::before {
  content: "▶";
  font-size: 10px;
  color: var(--ink-soft);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}
details.platform-item[open] > summary.platform-top::before {
  transform: rotate(90deg);
}
details.platform-item > summary.platform-top .platform-name {
  flex-shrink: 0;
  color: var(--teal);
}
details.platform-item > summary.platform-top .platform-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--ink-soft);
}
details.platform-item .platform-body {
  padding: 0 12px 12px 12px;
  border-top: 1px dashed var(--line);
  margin-top: 0;
  padding-top: 10px;
}

/* === 平台文案3套备选样式 === */
.platform-variant {
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}
.platform-variant:last-child {
  border-bottom: none;
}
.variant-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.variant-style {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
}
.variant-style.style-A {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}
.variant-style.style-B {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}
.variant-style.style-C {
  background: rgba(231, 126, 34, 0.15);
  color: #e67e22;
}
.variant-title {
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 4px !important;
  margin-top: 4px !important;
}
.platform-count {
  font-size: 12px;
  color: var(--ink-faint);
  font-weight: 400;
}

.quota-top,
.material-top,
.switch-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.quota-top,
.material-top {
  font-size: 13px;
  font-weight: 900;
}

/* === 进度条 === */
.progress {
  height: 8px;
  margin-top: 10px;
  border-radius: 999px;
  background: #1b2422;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.platform-item p,
.material-item p,
.knowledge-item p {
  margin-top: 8px;
}

/* === 平台操作按钮组 === */
.platform-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.platform-actions button {
  flex: 1;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #111817 0%, #0c1110 100%);
  color: var(--ink-soft);
  font-weight: 900;
  letter-spacing: 0.01em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  transition: border-color var(--transition-mid), background var(--transition-mid), color var(--transition-mid), transform var(--transition-fast);
}

.platform-actions button:hover {
  border-color: rgba(49, 213, 200, 0.4);
  background: linear-gradient(180deg, #14201e 0%, #0e1614 100%);
  color: var(--ink);
  transform: translateY(-1px);
}

/* === 素材网格与管理网格（双栏布局） === */
.material-grid,
.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
}

#production .material-grid {
  grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1.28fr);
  align-items: start;
}

/* === 生产工坊面板与表单/输出区 === */
.production-panel {
  padding: 20px;
}

.production-form,
.production-output {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #0d1211;
}

.production-output {
  min-height: 100%;
  display: grid;
  align-content: start;
  gap: 12px;
}

.output-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.production-output .mini-title {
  color: var(--muted);
}

.production-output .result-box {
  min-height: 420px;
}

.prompt-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 188px;
  gap: 12px;
  align-items: stretch;
}

.ai-write-stack {
  display: grid;
  gap: 10px;
  align-content: start;
}

.mini-field {
  display: grid;
  gap: 5px;
}

.mini-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.mini-field .select,
.credit-generate-btn {
  width: 100%;
  min-height: 38px;
}

.generation-options {
  margin: 4px 0 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

#imageGenerationOptions {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 768px) {
  .generation-options {
    grid-template-columns: 1fr;
  }
}

.credit-generate-btn {
  white-space: normal;
  line-height: 1.25;
}

.ai-writer-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 8, 9, 0.72);
  backdrop-filter: blur(10px);
}

.ai-writer-modal.active {
  display: flex;
}

.ai-writer-dialog {
  width: min(920px, 100%);
  max-height: min(86vh, 820px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1211;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.ai-writer-head,
.ai-writer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.ai-writer-actions {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ai-writer-head strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
}

.ai-writer-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ai-writer-body {
  overflow: auto;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.ai-writer-section,
.ai-writer-card,
.ai-writer-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 13, 14, 0.5);
  padding: 12px;
}

.ai-writer-section.primary {
  border-left: 3px solid var(--teal);
}

.ai-writer-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.ai-writer-textarea {
  min-height: 170px;
}

.ai-writer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ai-writer-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  margin-bottom: 6px;
}

.ai-writer-card p,
.ai-writer-note p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.ai-writer-note strong {
  display: block;
  color: var(--ink);
  margin-bottom: 8px;
}

/* === 素材库网格（三列卡片） === */
.material-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.material-filter-tabs button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: border-color var(--transition-mid), background var(--transition-mid), color var(--transition-mid);
}

.material-filter-tabs button.active,
.material-filter-tabs button:hover {
  border-color: rgba(49, 213, 200, 0.48);
  color: var(--ink);
  background: rgba(49, 213, 200, 0.12);
}

.material-library {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.material-item {
  min-height: 150px;
  display: grid;
  align-content: start;
  transition: border-color var(--transition-mid), background var(--transition-mid), transform var(--transition-fast), box-shadow var(--transition-mid);
}

.material-item:hover {
  border-color: rgba(49, 213, 200, 0.32);
  background: #0f1614;
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

/* === 素材缩略图容器 === */
.material-thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 10; /* CSS 宽高比，保持缩略图比例一致 */
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #eef4f0;
  transition: border-color var(--transition-mid);
}

.material-item:hover .material-thumb-wrap {
  border-color: rgba(49, 213, 200, 0.4);
}

/* === 素材缩略图 === */
.material-thumb {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover; /* object-fit:cover 使图片填满容器并裁剪溢出部分 */
}

.video-material .material-thumb-wrap {
  aspect-ratio: 16 / 9;
  background: #12201d;
}

.material-thumb-wrap video.material-thumb {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.material-thumb-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  background: repeating-linear-gradient(135deg, rgba(49, 213, 200, 0.08), rgba(49, 213, 200, 0.08) 10px, rgba(255, 255, 255, 0.03) 10px, rgba(255, 255, 255, 0.03) 20px);
  font-size: 12px;
  font-weight: 900;
}

.media-load-failed {
  display: grid;
  place-items: center;
}

.media-fallback {
  width: 100%;
  height: 100%;
  min-height: 120px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 14px;
  text-align: center;
  color: var(--muted);
  background: repeating-linear-gradient(135deg, rgba(49, 213, 200, 0.08), rgba(49, 213, 200, 0.08) 10px, rgba(255, 255, 255, 0.04) 10px, rgba(255, 255, 255, 0.04) 20px);
}

.media-fallback strong {
  color: var(--ink);
  font-size: 13px;
}

.media-fallback span {
  font-size: 12px;
}

.thumb-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  color: #f3faf6;
  background: rgba(17, 27, 24, 0.82);
  font-size: 11px;
  font-weight: 900;
}

/* === 素材检索结果区 === */
.asset-result {
  display: grid;
  gap: 14px;
}

.asset-result h3 {
  margin: 4px 0 2px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.asset-result .knowledge-item {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(49, 213, 200, 0.22);
  border-radius: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(49, 213, 200, 0.06), rgba(139, 124, 255, 0.04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 200ms ease, transform 200ms ease;
}

.asset-result .knowledge-item:hover {
  border-color: rgba(49, 213, 200, 0.4);
}

.asset-result .knowledge-item .platform-top span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.asset-result .knowledge-item p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
  word-break: break-word;
}

.asset-preview {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #eef4f0;
}

.asset-preview.video-preview {
  aspect-ratio: 16 / 9;
  background: #12201d;
}

.asset-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.asset-preview video {
  width: 100%;
  height: 100%;
  display: block;
  background: #07110f;
  object-fit: cover;
}

.asset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.material-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* === 素材资产链接按钮 === */
.asset-link {
  min-height: 30px;
  border: 1px solid rgba(49, 213, 200, 0.28);
  border-radius: 999px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--teal-dark);
  background: linear-gradient(180deg, rgba(49, 213, 200, 0.1) 0%, rgba(49, 213, 200, 0.04) 100%);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.01em;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  transition: border-color var(--transition-mid), background var(--transition-mid), transform var(--transition-fast), box-shadow var(--transition-mid);
}

.asset-link::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 6px rgba(49, 213, 200, 0.6);
  flex-shrink: 0;
}

.asset-link:hover {
  border-color: var(--teal);
  background: linear-gradient(180deg, rgba(49, 213, 200, 0.18) 0%, rgba(49, 213, 200, 0.08) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(49, 213, 200, 0.16), inset 0 1px 0 rgba(255,255,255,0.08);
}

.asset-link.danger-link {
  border-color: rgba(239, 68, 68, 0.38);
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.asset-link.danger-link::before {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.45);
}

.asset-link.danger-link:hover {
  border-color: rgba(239, 68, 68, 0.7);
  background: rgba(239, 68, 68, 0.14);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.12);
}

/* === 开关切换器（自定义 toggle 开关） === */
.switch-toggle {
  width: 48px;
  height: 27px;
  border: 0;
  border-radius: 999px;
  padding: 3px;
  background: #d7e0da;
}

.switch-toggle::before {
  content: "";
  width: 21px;
  height: 21px;
  display: block;
  border-radius: 50%;
  background: #fff;
  transition: transform 150ms ease;
}

.switch-toggle.on {
  background: var(--teal);
}

.switch-toggle.on::before {
  transform: translateX(21px); /* 开启时滑块向右平移 */
}

/* === 素材预览模态框 === */
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px); /* 背景模糊毛玻璃效果 */
}

.preview-modal.active {
  display: flex;
}

.preview-modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 1;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.preview-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.preview-modal-body {
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.preview-modal-title {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.preview-modal-body img {
  max-width: 90vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
}

.preview-modal-body video {
  max-width: 90vw;
  max-height: 75vh;
  border-radius: 8px;
}

.metric-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 8, 9, 0.72);
  backdrop-filter: blur(10px);
}

.metric-detail-modal.active {
  display: flex;
}

.metric-detail-dialog {
  width: min(960px, 100%);
  max-height: min(84vh, 760px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1211;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  color: #f8fffc;
  overflow: hidden;
}

.metric-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.metric-detail-head strong {
  display: block;
  font-size: 16px;
}

.metric-detail-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.metric-detail-body {
  overflow: auto;
  padding: 14px 16px 18px;
}

.metric-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.metric-detail-table th,
.metric-detail-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  color: #f8fffc;
  text-align: left;
  vertical-align: top;
}

.metric-detail-table th {
  color: #cfe8e5;
  font-size: 12px;
  font-weight: 900;
}

.metric-detail-table .muted,
.metric-detail-head span {
  color: #d7efea;
}

.metric-detail-empty {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: #f8fffc;
  text-align: center;
}

@media (max-width: 768px) {
  .preview-modal-close {
    top: 10px;
    right: 12px;
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
  .preview-modal-body img,
  .preview-modal-body video {
    max-width: 95vw;
    max-height: 70vh;
  }
  .metric-detail-modal {
    padding: 12px;
  }
  .metric-detail-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .metric-detail-table {
    min-width: 680px;
  }
}

/* === Toast 轻提示（全局浮动通知） === */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 9999;
  min-height: 44px;
  max-width: min(540px, calc(100vw - 28px));
  border: 1px solid rgba(49, 213, 200, 0.42);
  border-radius: 999px;
  padding: 0 22px 0 18px;
  color: #f4faf7;
  background: linear-gradient(135deg, rgba(11, 118, 109, 0.96) 0%, rgba(8, 24, 22, 0.96) 100%);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(49, 213, 200, 0.18) inset, 0 0 24px rgba(49, 213, 200, 0.18);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast::before {
  content: "✓";
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(49, 213, 200, 0.22);
  color: #31d5c8;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.toast.toast-error {
  border-color: rgba(255, 100, 130, 0.5);
  background: linear-gradient(135deg, rgba(169, 67, 87, 0.96) 0%, rgba(34, 12, 18, 0.96) 100%);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 100, 130, 0.2) inset, 0 0 24px rgba(169, 67, 87, 0.22);
}

.toast.toast-error::before {
  content: "!";
  background: rgba(255, 100, 130, 0.22);
  color: #ff8aa0;
}

/* === 知识双库网格（双列统计卡片） === */
.knowledge-dual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.knowledge-dual-card {
  border: 1px solid rgba(49, 213, 200, 0.22);
  border-radius: 8px;
  padding: 15px;
  background: linear-gradient(135deg, rgba(49, 213, 200, 0.08), rgba(139, 124, 255, 0.07));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.knowledge-dual-card div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.knowledge-dual-card strong {
  font-size: 28px;
  line-height: 1;
}

.knowledge-dual-card p {
  margin-top: 8px;
}

/* === 行业情报面板 === */
.intelligence-panel {
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(139, 124, 255, 0.1), transparent 30%),
    linear-gradient(180deg, #0d1010, #070909);
}

.intelligence-head {
  align-items: center;
}

/* === 发光标签栏（三等分切换标签） === */
.glow-tabs {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  background: var(--surface-soft);
}

.glow-tabs span {
  min-width: 106px;
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--ink-soft);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.glow-tabs span:first-child {
  color: #fff;
  border: 1px solid rgba(139, 124, 255, 0.48);
  background: linear-gradient(110deg, rgba(139, 124, 255, 0.22), rgba(49, 213, 200, 0.12));
  box-shadow: inset 0 0 24px rgba(139, 124, 255, 0.18);
}

/* === 行业情报双栏布局 === */
.industry-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.46fr) minmax(0, 1fr);
  gap: 18px;
}

/* === 扫描卡片（带扫描线动画的情报表单卡） === */
.scan-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(49, 213, 200, 0.22);
  border-radius: 8px;
  background: rgba(7, 13, 14, 0.88);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 18px 46px rgba(0,0,0,0.28);
}

.scan-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(49, 213, 200, 0.09), transparent);
  transform: translateX(-100%);
  animation: panelScan 4.6s ease-in-out infinite;
  pointer-events: none;
}

.industry-form {
  padding: 16px;
}

.industry-result {
  min-height: 560px;
  padding: 16px;
}

/* === 空状态提示 === */
.empty-state {
  min-height: 220px;
  display: grid;
  place-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

/* === 行业情报加载骨架屏 === */
.industry-loading {
  display: grid;
  gap: 12px;
}

.industry-loading span {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8b7cff, #31d5c8);
  animation: pulseWidth 1.2s ease-in-out infinite alternate;
}

/* === 行业情报报告 === */
.industry-report {
  display: grid;
  gap: 16px;
}

.industry-summary {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.industry-summary h3 {
  margin-top: 10px;
  font-size: 24px;
}

.industry-section {
  display: grid;
  gap: 10px;
}

.industry-section h4 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* === 情报条目与来源卡片 === */
.intel-item,
.source-card {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255,255,255,0.035);
}

.intel-item span {
  margin-top: 8px;
  display: block;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.bullet-line {
  border-left: 2px solid rgba(49, 213, 200, 0.5);
  padding-left: 10px;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.source-card span {
  color: var(--violet);
  font-size: 11px;
  font-weight: 900;
}

.source-card strong {
  margin-top: 6px;
  display: block;
}

/* === 关键帧动画定义（光泽/扫描/脉冲） === */
@keyframes sheen {
  from { left: -80%; }
  to { left: 130%; }
}

@keyframes panelScan {
  0%, 42% { transform: translateX(-110%); opacity: 0; }
  52% { opacity: 1; }
  76%, 100% { transform: translateX(110%); opacity: 0; }
}

@keyframes pulseWidth {
  from { transform: scaleX(0.68); transform-origin: left; }
  to { transform: scaleX(1); transform-origin: left; }
}

/* === Toast 显示状态 === */
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* === 加载与进度反馈（按钮旋转/工作流进度/登录加载） === */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: -2px;
  animation: btnSpin 0.7s linear infinite;
}

@keyframes btnSpin {
  to { transform: rotate(360deg); }
}

/* === 按钮禁用状态 === */
.primary-btn:disabled,
.secondary-btn:disabled,
.ghost-btn:disabled,
.ai-help-btn:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  transform: none !important;
  box-shadow: none;
}

.primary-btn:disabled::before,
.secondary-btn:disabled::before,
.ghost-btn:disabled::before,
.ai-help-btn:disabled::before {
  display: none;
}

.btn-busy {
  position: relative;
  pointer-events: none;
}

.btn-busy > :not(.btn-spinner):not(.btn-busy-label) {
  visibility: hidden;
}

.btn-busy-label {
  display: inline-flex;
  align-items: center;
}

/* === 工作流进度面板（步骤列表 + 进度条） === */
.workflow-progress {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid rgba(49, 213, 200, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(49, 213, 200, 0.06), rgba(139, 124, 255, 0.05));
}

.workflow-progress .wf-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.workflow-progress .wf-title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(49, 213, 200, 0.18);
  animation: wfPulse 1.2s ease-in-out infinite;
}

@keyframes wfPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(49, 213, 200, 0.18); }
  50% { box-shadow: 0 0 0 8px rgba(49, 213, 200, 0.04); }
}

.workflow-progress .wf-sub {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.workflow-progress ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.workflow-progress li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(7, 13, 14, 0.5);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 900;
  transition: border-color 200ms ease, background 200ms ease, color 200ms ease;
}

.workflow-progress li .wf-step-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 2px solid var(--line-strong);
  background: var(--surface-soft);
  font-size: 10px;
  color: var(--muted);
  font-weight: 900;
}

.workflow-progress li.active {
  border-color: rgba(49, 213, 200, 0.5);
  background: linear-gradient(90deg, rgba(49, 213, 200, 0.1), transparent);
  color: var(--ink);
}

.workflow-progress li.active .wf-step-dot {
  border-color: var(--teal);
  color: transparent;
  background: var(--teal);
  position: relative;
  box-shadow: 0 0 0 0 rgba(49, 213, 200, 0.45);
  animation: wfBreathe 1.6s ease-out infinite;
}

@keyframes wfBreathe {
  0% { box-shadow: 0 0 0 0 rgba(49, 213, 200, 0.42); }
  70% { box-shadow: 0 0 0 7px rgba(49, 213, 200, 0); }
  100% { box-shadow: 0 0 0 0 rgba(49, 213, 200, 0); }
}

.workflow-progress li.active .wf-step-dot::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #fff;
  animation: none;
  border: none;
}

.workflow-progress li.done {
  color: var(--ink);
  border-color: rgba(49, 213, 200, 0.34);
}

.workflow-progress li.done .wf-step-dot {
  background: var(--teal);
  border-color: var(--teal);
  color: #08211e;
}

.workflow-progress li.done .wf-step-dot::after {
  content: "✓";
  color: #08211e;
  position: static;
  animation: none;
  border: none;
  display: block;
  inset: auto;
  font-size: 11px;
  line-height: 1;
}

.workflow-progress li.pending {
  opacity: 0.55;
}

.workflow-progress .wf-bar {
  height: 6px;
  border-radius: 999px;
  background: #14201e;
  overflow: hidden;
}

.workflow-progress .wf-bar span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), var(--teal));
  transition: width 380ms ease;
}

.workflow-progress.failed .wf-title::before {
  background: var(--ruby);
  box-shadow: 0 0 0 4px rgba(169, 67, 87, 0.18);
  animation: none;
}

.workflow-progress.failed li.active .wf-step-dot {
  background: var(--ruby);
  border-color: var(--ruby);
}

.workflow-progress.failed li.active .wf-step-dot::after {
  content: "!";
  color: #fff;
  animation: none;
  border: none;
  inset: auto;
  position: static;
  display: block;
  font-size: 11px;
  line-height: 1;
}

.task-card {
  background: #fff;
  border: 1px solid #e7e1d8;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: all .25s ease;
}
.task-card.running {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(180,140,80,.12);
}
.task-card.done {
  border-color: #d4cfc5;
  opacity: .92;
}
.task-card.failed {
  border-color: var(--ruby);
  box-shadow: 0 0 0 2px rgba(220,80,70,.1);
}
.task-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #faf7f1 0%, #f5efe4 100%);
  border-bottom: 1px solid #ece6da;
  font-size: 13px;
}
.task-card.done .task-card-header {
  background: linear-gradient(135deg, #f3f7ed 0%, #edf3e5 100%);
  border-bottom-color: #dde6d0;
}
.task-card.failed .task-card-header {
  background: linear-gradient(135deg, #fdf2f1 0%, #fbe8e6 100%);
  border-bottom-color: #f0d5d2;
}
.task-card-title {
  font-weight: 600;
  color: #4a3f35;
  font-size: 13px;
  flex-shrink: 0;
}
.task-card-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #fff;
  color: var(--gold-dark);
  font-weight: 500;
}
.task-card.done .task-card-status {
  color: #4a8a2c;
  background: #eef7e4;
}
.task-card.failed .task-card-status {
  color: var(--ruby);
  background: #fde8e6;
}
.task-card-time {
  margin-left: auto;
  font-size: 11px;
  color: #a09080;
  font-variant-numeric: tabular-nums;
  font-family: monospace;
}
.task-card-body {
  padding: 0;
}
.task-card-body .workflow-progress {
  margin: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  padding: 14px 16px;
}
.task-card-body .result-box,
.task-card-body .asset-result,
.task-card-body .material-result {
  margin: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

/* === 登录加载指示器 === */
.login-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  min-height: 22px;
  margin-top: 12px;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 900;
}

.login-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(49, 213, 200, 0.25);
  border-top-color: var(--teal);
  animation: btnSpin 0.7s linear infinite;
}

/* === 按钮成功闪烁动画 === */
.btn-success-flash {
  animation: btnFlash 520ms ease;
}

@keyframes btnFlash {
  0% { background-position: 0 0; }
  40% { box-shadow: 0 0 0 6px rgba(49, 213, 200, 0.18); }
  100% { box-shadow: var(--shadow-btn); }
}

/* === 响应式适配 - 平板断点（≤1180px） === */
@media (max-width: 1180px) {
  .work-layout,
  .material-grid,
  .admin-grid,
  .industry-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .material-library,
  .source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* === 响应式适配 - 移动端断点（≤860px） === */
@media (max-width: 860px) {
  .login-view {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .login-product {
    min-height: 360px;
    padding: 22px;
  }

  .login-product h1 {
    margin-top: 60px;
    font-size: 38px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .main {
    padding: 16px 14px 40px;
  }

  .topbar {
    display: grid;
  }

  .metric-grid,
  .material-library,
  .knowledge-dual-grid,
  .source-grid,
  .two-col {
    grid-template-columns: 1fr;
  }

  .intelligence-head {
    display: grid;
  }

  .glow-tabs {
    overflow-x: auto;
  }
}

/* === 响应式适配 - 小屏手机断点（≤560px） === */
@media (max-width: 560px) {
  h1 {
    font-size: 23px;
  }

  .panel,
  .login-card {
    padding: 14px;
  }

  .button-row,
  .top-actions {
    display: grid;
  }

  .primary-btn,
  .secondary-btn,
  .ghost-btn {
    width: 100%;
  }
}

/* === 知识库管理视图（双库统计、录入、上传、列表） === */
.knowledge-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.knowledge-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.knowledge-head .eyebrow {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--teal);
  font-weight: 900;
  margin-bottom: 6px;
}

.knowledge-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.knowledge-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 540px;
  line-height: 1.55;
}

.knowledge-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* === 知识库统计卡片 === */
.kb-stat {
  min-width: 96px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(49, 213, 200, 0.08), rgba(139, 124, 255, 0.05));
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}

.kb-stat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.kb-stat strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
}

.kb-stat small {
  color: var(--muted);
  font-size: 11px;
}

/* === 知识库分类标签栏 === */
.kb-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.kb-tab {
  border: 1px solid var(--line);
  background: rgba(7, 13, 14, 0.6);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: all 200ms ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kb-tab:hover {
  border-color: rgba(49, 213, 200, 0.4);
  color: var(--ink);
}

.kb-tab.active {
  background: linear-gradient(135deg, var(--teal), var(--violet));
  color: #06120f;
  border-color: transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.kb-tab-badge {
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
  font-size: 11px;
  font-weight: 900;
  border-radius: 999px;
  padding: 2px 8px;
  min-width: 18px;
  text-align: center;
}

.kb-tab-badge.is-zero {
  display: none;
}

.kb-bucket-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* === 知识库录入/列表分栏布局 === */
.kb-split {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
}

.kb-form-pane,
.kb-list-pane {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 13, 14, 0.45);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.kb-form-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.kb-form-tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.kb-form-tab.active {
  border-color: var(--teal);
  color: var(--teal);
  background: rgba(49, 213, 200, 0.08);
}

.kb-form-mode {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kb-form-mode.hidden {
  display: none;
}

/* === 知识库上传拖放区 === */
.kb-upload-zone {
  border: 1.5px dashed rgba(49, 213, 200, 0.32);
  border-radius: 12px;
  padding: 28px 18px;
  background: rgba(49, 213, 200, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color 200ms ease, background 200ms ease;
}

.kb-upload-zone:hover,
.kb-upload-zone.is-dragover {
  border-color: var(--teal);
  background: rgba(49, 213, 200, 0.08);
}

.kb-upload-zone strong {
  color: var(--ink);
  font-size: 14px;
}

.kb-upload-zone span {
  color: var(--muted);
  font-size: 12px;
}

.kb-upload-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--violet));
  color: #06120f;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 900;
}

.kb-upload-result.hidden,
.kb-parse-preview.hidden,
.hidden-field {
  display: none !important;
}

.kb-upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kb-upload-head .mini-title {
  color: var(--teal);
  font-size: 12px;
  letter-spacing: 0.05em;
  font-weight: 900;
}

.kb-upload-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kb-parse-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.kb-parse-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kb-parse-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.02);
}

.kb-parse-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.kb-parse-grid strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  word-break: break-word;
}

.kb-parse-warn {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kb-parse-summary {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0;
}

/* === 知识库解析结果预览 === */
.kb-parse-preview {
  border: 1px solid rgba(49, 213, 200, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(49, 213, 200, 0.04), rgba(139, 124, 255, 0.04));
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* === 知识库列表工具栏与搜索 === */
.kb-list-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kb-search {
  font-size: 13px;
}

.kb-subtype-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* === 知识库子类型筛选标签 === */
.kb-chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: all 200ms ease;
}

.kb-chip:hover {
  border-color: rgba(49, 213, 200, 0.4);
  color: var(--ink);
}

.kb-chip.active {
  background: rgba(49, 213, 200, 0.16);
  color: var(--teal);
  border-color: var(--teal);
}

/* === 知识库卡片列表 === */
.kb-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

/* === 知识库条目卡片 === */
.kb-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(7, 13, 14, 0.4));
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: border-color 200ms ease;
}

.kb-card:hover {
  border-color: rgba(49, 213, 200, 0.4);
}

.kb-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.kb-card-head > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.kb-card-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  word-break: break-word;
}

.kb-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 900;
}

.kb-tag-type {
  background: rgba(139, 124, 255, 0.16);
  color: var(--violet);
  border-color: rgba(139, 124, 255, 0.4);
  align-self: flex-start;
}

.kb-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.kb-card-actions .ghost-btn {
  font-size: 11px;
  padding: 4px 10px;
  min-height: 26px;
}

.kb-card-body {
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.6;
  margin: 0;
  word-break: break-word;
}

.kb-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.kb-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.kb-card-time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.kb-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 40px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(7, 13, 14, 0.4);
}

.kb-danger {
  color: var(--ruby);
  border-color: rgba(255, 100, 130, 0.3);
}

.kb-danger:hover {
  background: rgba(255, 100, 130, 0.1);
  color: var(--ruby);
}

.kb-bucket-pending {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kb-bucket-pending.hidden {
  display: none;
}

/* 知识库查询表单：标题 + 知识类型 + 关键词 + 查询/重置按钮 */
.kb-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.kb-search-row .kb-search,
.kb-search-row .kb-search-type {
  width: 100%;
  min-width: 0;
}
.kb-search-row .kb-search-btn,
.kb-search-row .kb-reset-btn {
  padding: 0 14px;
  white-space: nowrap;
}
.kb-list-empty {
  padding: 28px 18px;
  border: 1px dashed var(--line, #e2e8f0);
  border-radius: 10px;
  color: var(--muted, #64748b);
  text-align: center;
  font-size: 13px;
  background: var(--surface-soft, rgba(148, 163, 184, 0.06));
}

@media (max-width: 1180px) {
  .kb-split {
    grid-template-columns: 1fr;
  }
  .kb-search-row {
    grid-template-columns: 1fr 1fr;
  }
  .kb-search-row .kb-search-btn,
  .kb-search-row .kb-reset-btn {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  .kb-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 4px;
  }
  .kb-tabs .kb-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 6px 12px;
    font-size: 13px;
  }
  .knowledge-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
    margin-top: 12px;
  }
  .knowledge-head {
    flex-direction: column;
    align-items: stretch;
  }
  .kb-search-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .kb-search-row .kb-search-btn,
  .kb-search-row .kb-reset-btn {
    grid-column: span 1;
    width: 100%;
    padding: 8px 14px;
  }
  .kb-list {
    max-height: none;
    grid-template-columns: 1fr;
  }
  .kb-card {
    padding: 12px;
  }
  .kb-card-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .kb-card-actions {
    width: 100%;
    display: flex;
    gap: 6px;
  }
  .kb-card-actions .ghost-btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 12px;
  }
  .kb-subtype-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .kb-subtype-chips .kb-chip {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .kb-form-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .button-row {
    flex-wrap: wrap;
  }
  .button-row > button {
    flex: 1 1 auto;
    min-width: 100px;
  }
}

@media (max-width: 560px) {
  .knowledge-stats {
    grid-template-columns: 1fr;
  }
  .kb-stat {
    padding: 8px 12px;
  }
  .kb-stat strong {
    font-size: 18px;
  }
}

/* === 内容解析/复刻视图（图片/视频智能分析） === */
.analyze-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.analyze-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.analyze-head .eyebrow {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--teal);
  font-weight: 900;
  margin-bottom: 6px;
}

.analyze-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.analyze-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 540px;
  line-height: 1.55;
}

.analyze-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(49, 213, 200, 0.06);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
}

.analyze-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.analyze-tab {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(7, 13, 14, 0.5));
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 200ms ease;
}

.analyze-tab:hover {
  border-color: rgba(49, 213, 200, 0.4);
  color: var(--ink);
}

.analyze-tab.active {
  border-color: var(--teal);
  background: linear-gradient(135deg, rgba(49, 213, 200, 0.12), rgba(139, 124, 255, 0.06));
  color: var(--ink);
  box-shadow: var(--shadow-btn);
}

.analyze-tab-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
}

.analyze-tab-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.analyze-supplement .field span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.analyze-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.analyze-input,
.analyze-output {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(7, 13, 14, 0.4), rgba(7, 13, 14, 0.2));
}

.analyze-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  padding: 28px 18px;
  text-align: center;
  background: rgba(7, 13, 14, 0.4);
  cursor: pointer;
  transition: all 200ms ease;
  color: var(--ink-soft);
}

.analyze-dropzone:hover,
.analyze-dropzone.is-dragover {
  border-color: var(--teal);
  background: rgba(49, 213, 200, 0.08);
  color: var(--ink);
}

.analyze-dropzone-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: linear-gradient(135deg, rgba(49, 213, 200, 0.18), rgba(139, 124, 255, 0.18));
  color: var(--teal);
  margin-bottom: 6px;
}

.analyze-dropzone strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.analyze-dropzone span {
  font-size: 12px;
  color: var(--muted);
}

.analyze-dropzone .secondary-btn {
  margin-top: 8px;
}

.analyze-preview {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(7, 13, 14, 0.55);
  display: grid;
  place-items: center;
  max-height: 240px;
  overflow: hidden;
}

.analyze-preview img,
.analyze-preview video {
  max-width: 100%;
  max-height: 220px;
  border-radius: 8px;
  object-fit: contain;
}

.analyze-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.analyze-output-head .mini-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.analyze-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 220px;
  flex: 1;
}

.analyze-progress-text {
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
}

.analyze-result {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 220px;
  max-height: 540px;
  overflow-y: auto;
  padding-right: 4px;
}

.analyze-result.empty {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 24px;
  background: rgba(7, 13, 14, 0.3);
}

.analyze-summary {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(49, 213, 200, 0.08), rgba(139, 124, 255, 0.04));
}

.analyze-summary header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.analyze-summary h3 {
  margin: 0;
  font-size: 16px;
  color: var(--ink);
}

.analyze-summary .tag {
  background: rgba(49, 213, 200, 0.16);
  border-color: rgba(49, 213, 200, 0.4);
  color: var(--teal);
}

.analyze-summary-text {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.analyze-fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.analyze-fact {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(7, 13, 14, 0.5);
}

.analyze-fact span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.analyze-fact strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
}

.analyze-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.analyze-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(7, 13, 14, 0.5);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.analyze-section strong {
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.analyze-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.55;
}

.analyze-section li::before {
  content: "·";
  color: var(--teal);
  font-weight: 900;
  margin-right: 6px;
}

.analyze-visual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.analyze-visual {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(7, 13, 14, 0.5);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.analyze-visual strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.analyze-visual span {
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.5;
}

.analyze-prompt {
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  border-radius: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(49, 213, 200, 0.08), rgba(7, 13, 14, 0.4));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analyze-prompt.negative {
  border-left-color: var(--ruby);
  background: linear-gradient(135deg, rgba(169, 67, 87, 0.08), rgba(7, 13, 14, 0.4));
}

.analyze-prompt header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.analyze-prompt p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.analyze-json {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 13, 14, 0.55);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
}

.analyze-json-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.analyze-json-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.analyze-json pre {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.6;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "JetBrains Mono", "Fira Code", Consolas, "Courier New", monospace;
}

.analyze-action {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.analyze-action .ghost-btn,
.analyze-action .primary-btn,
.analyze-action .secondary-btn {
  flex: 1;
  min-width: 160px;
}

/* === URL 解析下载地址列表 + 文案二创结果区 === */
.analyze-download-list {
  margin: 6px 0 0;
  padding-left: 18px;
  list-style: disc;
  word-break: break-all;
}

.analyze-download-list li {
  margin: 4px 0;
  font-size: 12px;
}

.analyze-download-list a {
  color: var(--accent, #4f8cff);
  text-decoration: none;
}

.analyze-download-list a:hover {
  text-decoration: underline;
}

.analyze-rewrite {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt, rgba(255, 255, 255, 0.04));
}

.analyze-rewrite-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.analyze-rewrite-actions {
  display: flex;
  gap: 8px;
}

.analyze-rewrite-output {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  min-height: 60px;
}

@media (max-width: 1180px) {
  .analyze-grid {
    grid-template-columns: 1fr;
  }
  .analyze-tabs {
    grid-template-columns: 1fr;
  }
}

/* === Customer Service Conversation Statistics (admin) === */
.cs-stats-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cs-stats-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.cs-stats-head .eyebrow {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--teal);
  font-weight: 900;
  margin-bottom: 6px;
}

.cs-stats-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.cs-stats-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 540px;
  line-height: 1.55;
}

.cs-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.cs-stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(49, 213, 200, 0.08), rgba(139, 124, 255, 0.04));
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cs-stat-card .cs-stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.cs-stat-card strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
  font-weight: 900;
}

.cs-stat-card .cs-stat-sub {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
}

.cs-stat-card .cs-stat-trend {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.cs-stat-card .cs-stat-trend.down {
  color: var(--ruby);
}

.cs-table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(7, 13, 14, 0.4);
}

/* === Overview Dashboard === */
.overview-panel {
  grid-column: 1 / -1;
}

.overview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.overview-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.overview-stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(49, 213, 200, 0.08), rgba(139, 124, 255, 0.04));
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.overview-stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--violet));
  opacity: 0.6;
}

.overview-stat-icon {
  font-size: 20px;
  line-height: 1;
}

.overview-stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.overview-stat-card strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.1;
  font-weight: 900;
}

.overview-stat-sub {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
}

.overview-daily-chart {
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 13, 14, 0.4);
}

.overview-chart-title {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 900;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.overview-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding-top: 8px;
}

.overview-chart-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.overview-chart-bar {
  width: 100%;
  max-width: 40px;
  background: rgba(49, 213, 200, 0.1);
  border-radius: 4px 4px 0 0;
  position: relative;
  min-height: 4px;
}

.overview-chart-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, var(--teal), var(--violet));
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
}

.overview-chart-day {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.overview-chart-value {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
}

.overview-agent-table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(7, 13, 14, 0.4);
}

.overview-usage-bar {
  position: relative;
  width: 100%;
  height: 24px;
  background: rgba(49, 213, 200, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.overview-usage-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: linear-gradient(90deg, var(--teal), var(--violet));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.overview-usage-bar span {
  position: relative;
  z-index: 1;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 24px;
  padding: 0 8px;
}

:root[data-theme="light"] .overview-stat-card {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

:root[data-theme="light"] .overview-stat-card::before {
  opacity: 0.8;
}

:root[data-theme="light"] .overview-daily-chart {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

:root[data-theme="light"] .overview-chart-bar {
  background: rgba(49, 213, 200, 0.15);
}

:root[data-theme="light"] .overview-agent-table-wrap {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

:root[data-theme="light"] .overview-usage-bar {
  background: rgba(49, 213, 200, 0.15);
}

/* === 积分制度 === */
.credit-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  align-items: center;
}

.credit-bar-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.credit-bar-item + .credit-bar-item {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.credit-bar-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.credit-bar-item strong {
  font-size: 24px;
  color: var(--teal);
  font-weight: 700;
}

.credit-bar-item small {
  font-size: 14px;
  color: var(--ink-soft);
}

.credit-txn-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.credit-txn-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.credit-txn {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.credit-txn-in {
  border-left: 3px solid var(--green);
}

.credit-txn-out {
  border-left: 3px solid var(--amber);
}

.credit-txn-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.credit-amount-in {
  color: var(--green);
  font-size: 16px;
}

.credit-amount-out {
  color: var(--amber);
  font-size: 16px;
}

.credit-txn-reason {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 4px;
}

.credit-txn-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.credit-txn-meta small {
  font-size: 11px;
  color: var(--muted);
}

.credit-empty {
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* === 积分看板：顶部可点击积分栏 + 展开式详情面板 === */
.credit-bar-clickable {
  cursor: pointer;
  transition: border-color 0.2s, transform 0.1s;
  user-select: none;
}

.credit-bar-clickable:hover {
  border-color: var(--accent, #4f8cff);
}

.credit-bar-clickable:active {
  transform: scale(0.998);
}

.credit-bar-more {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.credit-bar-arrow {
  font-size: 11px;
  transition: transform 0.2s;
}

/* 积分看板详情面板 */
.credit-dashboard {
  margin-top: -8px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 12px 12px;
  background: var(--surface);
  box-shadow: 0 8px 24px -16px rgba(0, 0, 0, 0.4);
}

.credit-dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.credit-dashboard-header h3 {
  margin: 0;
  font-size: 15px;
  color: var(--text);
}

.credit-dashboard-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.credit-dashboard-close:hover {
  background: var(--surface-alt, rgba(255, 255, 255, 0.06));
  color: var(--text);
}

.credit-dashboard-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.credit-dash-stat {
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt, rgba(255, 255, 255, 0.04));
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.credit-dash-label {
  font-size: 12px;
  color: var(--muted);
}

.credit-dash-value {
  font-size: 20px;
  color: var(--text);
  font-weight: 600;
}

.credit-dashboard-history h4 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.credit-dash-txn {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--surface);
}

.credit-dash-txn-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

@media (max-width: 720px) {
  .credit-dashboard-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

.credit-account-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.credit-account-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.credit-account-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.credit-account-balance {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.credit-balance-label {
  font-size: 12px;
  color: var(--muted);
}

.credit-balance-num {
  font-size: 28px;
  color: var(--teal);
  font-weight: 700;
}

.credit-account-stats {
  display: flex;
  gap: 12px;
}

.credit-account-stats small {
  font-size: 11px;
  color: var(--muted);
}

:root[data-theme="light"] .credit-bar {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

:root[data-theme="light"] .credit-txn {
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--line);
}

:root[data-theme="light"] .credit-account-card {
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--line);
}

/* === 新品公告 === */
.announcement-banner {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(255, 159, 67, 0.05));
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.announcement-banner-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

.announcement-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff6b6b;
  flex-shrink: 0;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.announcement-banner-inner strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.announcement-banner-price {
  color: #ff6b6b;
  font-size: 13px;
  font-weight: 900;
  background: rgba(255, 107, 107, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
}

.announcement-banner-desc {
  color: var(--ink-soft);
  font-size: 13px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.announcement-panel {
  grid-column: 1 / -1;
}

.announcement-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.announcement-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.announcement-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface-soft);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.announcement-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.announcement-card-body strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.announcement-card-body p {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}

.announcement-price {
  color: #ff6b6b;
  font-size: 14px;
  font-weight: 900;
  background: rgba(255, 107, 107, 0.12);
  padding: 3px 10px;
  border-radius: 6px;
  display: inline-block;
  width: fit-content;
}

.announcement-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.announcement-time {
  color: var(--muted);
  font-size: 12px;
}

.announcement-delete {
  flex-shrink: 0;
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.3);
}

.announcement-delete:hover {
  background: rgba(255, 107, 107, 0.1);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

:root[data-theme="light"] .announcement-banner {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.08), rgba(255, 159, 67, 0.04));
  border-color: var(--line);
}

:root[data-theme="light"] .announcement-card {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

:root[data-theme="light"] .announcement-empty {
  border-color: var(--line);
}

.cs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cs-table thead th {
  text-align: left;
  background: rgba(7, 13, 14, 0.7);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.cs-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  vertical-align: middle;
}

.cs-table tbody tr:last-child td {
  border-bottom: 0;
}

.cs-table tbody tr:hover td {
  background: rgba(49, 213, 200, 0.05);
}

.cs-table tbody td.cs-num {
  font-weight: 900;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cs-table tbody td.cs-name strong {
  color: var(--ink);
  display: block;
}

.cs-table tbody td.cs-name small {
  color: var(--muted);
  font-size: 11px;
}

.cs-stats-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.cs-stats-toolbar .cs-range-chip {
  border: 1px solid var(--line);
  background: rgba(7, 13, 14, 0.5);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: all 200ms ease;
}

.cs-stats-toolbar .cs-range-chip:hover {
  border-color: var(--teal);
  color: var(--ink);
}

.cs-stats-toolbar .cs-range-chip.active {
  border-color: var(--teal);
  background: rgba(49, 213, 200, 0.16);
  color: var(--teal);
}

/* === Light theme button refinements === */
:root[data-theme="light"] .primary-btn {
  box-shadow: 0 6px 18px rgba(14, 154, 145, 0.22);
}

:root[data-theme="light"] .primary-btn:hover:not(:disabled) {
  box-shadow: 0 10px 24px rgba(14, 154, 145, 0.32);
}

:root[data-theme="light"] .ghost-btn {
  background: rgba(238, 241, 240, 0.8);
  color: var(--ink);
  border-color: var(--line);
}

:root[data-theme="light"] .ghost-btn:hover:not(:disabled) {
  background: rgba(14, 154, 145, 0.12);
  color: var(--ink);
  border-color: rgba(14, 154, 145, 0.5);
}

:root[data-theme="light"] .secondary-btn {
  background: rgba(238, 241, 240, 0.9);
  color: var(--violet);
  border-color: rgba(108, 93, 211, 0.35);
}

:root[data-theme="light"] .secondary-btn:hover {
  background: rgba(108, 93, 211, 0.12);
  color: #4a3fb1;
  border-color: rgba(108, 93, 211, 0.6);
}

:root[data-theme="light"] .sidebar .ghost-btn {
  background: rgba(238, 241, 240, 0.7);
  color: var(--ink);
  border-color: var(--line);
}

:root[data-theme="light"] .sidebar .ghost-btn:hover {
  background: rgba(14, 154, 145, 0.12);
  color: var(--ink);
  border-color: rgba(14, 154, 145, 0.5);
}

:root[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
}

:root[data-theme="light"] .login-product {
  color: var(--ink);
}
:root[data-theme="light"] .login-product h1 {
  color: var(--ink);
  text-shadow: none;
}
:root[data-theme="light"] .login-product p {
  color: var(--ink-soft);
}
:root[data-theme="light"] .login-product::before {
  background:
    radial-gradient(circle at 70% 20%, rgba(14, 154, 145, 0.10), transparent 44%),
    radial-gradient(circle at 20% 70%, rgba(108, 93, 211, 0.12), transparent 50%);
}
:root[data-theme="light"] .brand-lockup:not(.compact) strong {
  color: var(--ink);
}
:root[data-theme="light"] .brand-lockup:not(.compact) small {
  color: var(--muted);
}

:root[data-theme="light"] .input,
:root[data-theme="light"] .textarea,
:root[data-theme="light"] .select {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--line);
  color: var(--ink);
}

:root[data-theme="light"] .input:focus,
:root[data-theme="light"] .textarea:focus,
:root[data-theme="light"] .select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 154, 145, 0.18);
}

:root[data-theme="light"] .analyze-input,
:root[data-theme="light"] .analyze-output,
:root[data-theme="light"] .cs-table-wrap {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

:root[data-theme="light"] .analyze-dropzone,
:root[data-theme="light"] .analyze-fact,
:root[data-theme="light"] .analyze-section,
:root[data-theme="light"] .analyze-visual,
:root[data-theme="light"] .analyze-json,
:root[data-theme="light"] .analyze-preview {
  background: rgba(238, 241, 240, 0.6);
  border-color: var(--line);
}

:root[data-theme="light"] .analyze-result.empty {
  background: rgba(238, 241, 240, 0.5);
}

:root[data-theme="light"] .analyze-json pre {
  color: var(--ink-soft);
}

:root[data-theme="light"] .analyze-tab {
  background: linear-gradient(135deg, rgba(238, 241, 240, 0.9), rgba(216, 222, 220, 0.8));
  border-color: var(--line);
}

:root[data-theme="light"] .analyze-tab:hover {
  border-color: rgba(14, 154, 145, 0.5);
  background: linear-gradient(135deg, rgba(238, 241, 240, 0.95), rgba(216, 222, 220, 0.9));
}

:root[data-theme="light"] .analyze-tab.active {
  border-color: var(--teal);
  background: linear-gradient(135deg, rgba(14, 154, 145, 0.12), rgba(108, 93, 211, 0.08));
  box-shadow: var(--shadow-btn);
}

:root[data-theme="light"] .cs-table thead th {
  background: rgba(14, 154, 145, 0.06);
  color: var(--ink-soft);
}

:root[data-theme="light"] .cs-table tbody td {
  color: var(--ink-soft);
  border-bottom-color: var(--line);
}

:root[data-theme="light"] .cs-table tbody tr:hover td {
  background: rgba(14, 154, 145, 0.06);
}

:root[data-theme="light"] .cs-stat-card {
  background: linear-gradient(135deg, rgba(14, 154, 145, 0.08), rgba(108, 93, 211, 0.05));
  border-color: var(--line);
}

:root[data-theme="light"] .cs-stats-toolbar .cs-range-chip {
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-soft);
  border-color: var(--line);
}

:root[data-theme="light"] .cs-stats-toolbar .cs-range-chip:hover {
  border-color: var(--teal);
  color: var(--ink);
}

:root[data-theme="light"] .cs-stats-toolbar .cs-range-chip.active {
  border-color: var(--teal);
  background: rgba(14, 154, 145, 0.1);
  color: var(--teal);
}

:root[data-theme="light"] .kb-tab {
  background: rgba(238, 241, 240, 0.9);
  border-color: var(--line);
  color: var(--ink);
}

:root[data-theme="light"] .kb-tab:hover {
  border-color: rgba(14, 154, 145, 0.5);
  color: var(--ink);
}

:root[data-theme="light"] .kb-tab.active {
  background: linear-gradient(135deg, var(--teal), var(--violet));
  color: #fff;
  border-color: transparent;
}

:root[data-theme="light"] .kb-form-pane,
:root[data-theme="light"] .kb-list-pane {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--line);
}

:root[data-theme="light"] .kb-form-tab {
  color: var(--ink);
  background: rgba(238, 241, 240, 0.6);
}

:root[data-theme="light"] .kb-form-tab.active {
  border-color: var(--teal);
  color: var(--teal);
  background: rgba(14, 154, 145, 0.1);
}

:root[data-theme="light"] .kb-upload-zone {
  border-color: rgba(14, 154, 145, 0.4);
  background: rgba(238, 241, 240, 0.5);
}

:root[data-theme="light"] .kb-card {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--line);
}

:root[data-theme="light"] .kb-card:hover {
  border-color: rgba(14, 154, 145, 0.5);
  background: rgba(255, 255, 255, 0.98);
}

:root[data-theme="light"] .production-quick button {
  background: rgba(238, 241, 240, 0.8);
  border-color: var(--line);
  color: var(--ink);
}

:root[data-theme="light"] .production-quick button:hover {
  background: rgba(14, 154, 145, 0.12);
  border-color: rgba(14, 154, 145, 0.5);
  color: var(--ink);
}

:root[data-theme="light"] .production-form,
:root[data-theme="light"] .production-output {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

:root[data-theme="light"] .production-output .mini-title {
  color: var(--muted);
}

:root[data-theme="light"] .production-output .result-box {
  background: rgba(255, 255, 255, 0.6);
}

:root[data-theme="light"] .asset-result .knowledge-item {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(14, 154, 145, 0.32);
  box-shadow: 0 2px 6px rgba(20, 32, 30, 0.04);
}

:root[data-theme="light"] .asset-result .knowledge-item:hover {
  border-color: rgba(14, 154, 145, 0.6);
  background: rgba(255, 255, 255, 0.95);
}

:root[data-theme="light"] .asset-result .knowledge-item p {
  color: var(--ink);
}

:root[data-theme="light"] .toast {
  color: #06231f;
  background: linear-gradient(135deg, rgba(49, 213, 200, 0.98) 0%, rgba(14, 154, 145, 0.98) 100%);
  box-shadow: 0 16px 40px rgba(20, 32, 30, 0.18), 0 0 0 1px rgba(14, 154, 145, 0.32) inset;
}

:root[data-theme="light"] .toast::before {
  background: rgba(255, 255, 255, 0.3);
  color: #06231f;
}

:root[data-theme="light"] .toast.toast-error {
  background: linear-gradient(135deg, rgba(255, 138, 160, 0.98) 0%, rgba(169, 67, 87, 0.98) 100%);
  color: #fff;
}

:root[data-theme="light"] .mode-card {
  background: rgba(238, 241, 240, 0.8);
  border-color: var(--line);
}

:root[data-theme="light"] .mode-card:hover {
  border-color: rgba(14, 154, 145, 0.5);
  background: rgba(238, 241, 240, 0.95);
}

:root[data-theme="light"] .mode-card.active {
  border-color: var(--teal);
  background: linear-gradient(135deg, rgba(14, 154, 145, 0.12), rgba(108, 93, 211, 0.08));
}

:root[data-theme="light"] .sidebar-card {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

:root[data-theme="light"] .status-row {
  color: var(--ink);
}

:root[data-theme="light"] .panel {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--line);
}

:root[data-theme="light"] .cs-range-chip {
  background: rgba(238, 241, 240, 0.8);
  color: var(--ink);
  border-color: var(--line);
}

:root[data-theme="light"] .cs-range-chip:hover {
  border-color: rgba(14, 154, 145, 0.5);
  color: var(--ink);
}

:root[data-theme="light"] .cs-range-chip.active {
  border-color: var(--teal);
  background: rgba(14, 154, 145, 0.15);
  color: var(--teal);
}

:root[data-theme="light"] .analyze-dropzone {
  background: rgba(238, 241, 240, 0.6);
  border-color: rgba(14, 154, 145, 0.4);
}

:root[data-theme="light"] .analyze-dropzone:hover {
  background: rgba(238, 241, 240, 0.8);
  border-color: rgba(14, 154, 145, 0.6);
}

:root[data-theme="light"] .analyze-fact,
:root[data-theme="light"] .analyze-section,
:root[data-theme="light"] .analyze-visual {
  background: rgba(238, 241, 240, 0.6);
  border-color: var(--line);
}

:root[data-theme="light"] .analyze-json {
  background: rgba(238, 241, 240, 0.5);
  border-color: var(--line);
}

:root[data-theme="light"] .analyze-preview {
  background: rgba(238, 241, 240, 0.6);
  border-color: var(--line);
}

:root[data-theme="light"] .analyze-result.empty {
  background: rgba(238, 241, 240, 0.5);
  color: var(--muted);
}

:root[data-theme="light"] .industry-form,
:root[data-theme="light"] .industry-result {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

:root[data-theme="light"] .industry-result .empty-state {
  color: var(--muted);
}

:root[data-theme="light"] .industry-result .empty-state strong {
  color: var(--ink);
}

:root[data-theme="light"] .reply-text {
  color: var(--ink);
}

:root[data-theme="light"] .tag-row .tag,
:root[data-theme="light"] .source-row .tag {
  background: rgba(238, 241, 240, 0.8);
  color: var(--ink-soft);
  border-color: var(--line);
}

/* Knowledge List */
.knowledge-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

:root[data-theme="light"] .knowledge-list {
  background: rgba(255, 255, 255, 0.6);
}

:root[data-theme="light"] .knowledge-dual-card {
  background: rgba(238, 241, 240, 0.6);
  border-color: var(--line);
}

:root[data-theme="light"] .platform-item {
  background: rgba(238, 241, 240, 0.6);
  border-color: var(--line);
}

:root[data-theme="light"] .material-item {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

:root[data-theme="light"] .material-item:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(14, 154, 145, 0.3);
  box-shadow: 0 10px 28px rgba(20, 32, 30, 0.1);
}

:root[data-theme="light"] .governance-list .kb-card {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

:root[data-theme="light"] .platform-actions button {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
  color: var(--ink-soft);
}

:root[data-theme="light"] .platform-actions button:hover {
  background: rgba(14, 154, 145, 0.1);
  border-color: rgba(14, 154, 145, 0.4);
  color: var(--ink);
}

:root[data-theme="light"] .asset-link {
  background: linear-gradient(180deg, rgba(14, 154, 145, 0.1) 0%, rgba(14, 154, 145, 0.04) 100%);
  border-color: rgba(14, 154, 145, 0.3);
  color: var(--teal-dark);
}

:root[data-theme="light"] .asset-link:hover {
  background: linear-gradient(180deg, rgba(14, 154, 145, 0.18) 0%, rgba(14, 154, 145, 0.08) 100%);
  border-color: var(--teal);
}

:root[data-theme="light"] .quota-item {
  background: #ffffff;
  border-color: var(--line);
}

:root[data-theme="light"] .quota-panel {
  background: #ffffff;
  border-color: var(--line);
}
:root[data-theme="light"] .quota-panel > summary.quota-summary {
  color: var(--ink);
}
:root[data-theme="light"] .quota-panel .quota-summary-tail {
  color: var(--teal);
}
:root[data-theme="light"] .quota-panel .quota-top {
  color: var(--ink);
}
:root[data-theme="light"] .quota-panel .quota-top span:last-child {
  color: var(--ink-soft);
}

:root[data-theme="light"] .switch-item {
  background: rgba(238, 241, 240, 0.6);
  border-color: var(--line);
}

:root[data-theme="light"] .switch-list .switch-row {
  background: rgba(238, 241, 240, 0.6);
  border-color: var(--line);
}

/* Quota Bar */
.quota-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-soft);
  overflow: hidden;
}

:root[data-theme="light"] .quota-bar {
  background: rgba(238, 241, 240, 0.8);
}

:root[data-theme="light"] .metric-card {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

:root[data-theme="light"] .sidebar-card {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

/* Sidebar Status */
.sidebar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.sidebar-status .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.sidebar-status .status-dot.ok {
  background: var(--green);
}

.sidebar-status .status-dot.warn {
  background: var(--amber);
}

:root[data-theme="light"] .sidebar-status {
  color: var(--ink-soft);
}

:root[data-theme="light"] .sidebar-status .status-dot {
  background: var(--muted);
}

:root[data-theme="light"] .sidebar-status .status-dot.ok {
  background: var(--green);
}

:root[data-theme="light"] .sidebar-status .status-dot.warn {
  background: var(--amber);
}

/* === Language Selector === */
.lang-selector-wrap {
  margin: 14px 0 4px;
}

.lang-selector-wrap .field {
  margin-bottom: 0;
}

.lang-selector-sm {
  width: auto;
  min-width: 56px;
  min-height: 32px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 900;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink-soft);
  cursor: pointer;
}

.lang-selector-sm:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(49, 213, 200, 0.12);
}

/* === Agent Management === */
.agent-mgmt-panel {
  grid-column: 1 / -1;
}

.agent-mgmt-form {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.agent-table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(7, 13, 14, 0.4);
}

.agent-table .agent-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 900;
}

.agent-table .agent-status.active {
  color: var(--green);
}

.agent-table .agent-status.inactive {
  color: var(--muted);
}

.agent-table .agent-quota {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}

.agent-table .agent-quota-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-soft);
  overflow: hidden;
}

.agent-table .agent-quota-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--violet));
}

.agent-table .agent-quota-text {
  font-size: 11px;
  color: var(--muted);
  font-weight: 900;
}

.agent-table .agent-actions {
  display: flex;
  gap: 6px;
}

.agent-table .agent-actions .ghost-btn {
  font-size: 11px;
  padding: 4px 10px;
  min-height: 26px;
}

/* === Backup Panel === */
.backup-panel {
  grid-column: 1 / -1;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.backup-upload-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  min-width: 280px;
}

.backup-upload-row .input {
  flex: 1;
  min-width: 180px;
}

.backup-status {
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}

.backup-time-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.backup-time-value {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 900;
}

/* === Light theme overrides for new panels === */
:root[data-theme="light"] .lang-selector-sm {
  background: rgba(238, 241, 240, 0.9);
  border-color: var(--line);
  color: var(--ink);
}

:root[data-theme="light"] .agent-mgmt-form {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

:root[data-theme="light"] .agent-table-wrap {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

:root[data-theme="light"] .backup-status {
  background: rgba(238, 241, 240, 0.7);
  border-color: var(--line);
}

/* === Baidu Netdisk Panel === */
.netdisk-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.netdisk-status-badge {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-soft);
  white-space: nowrap;
}

.netdisk-status-badge.active {
  color: var(--teal-dark);
  border-color: rgba(49, 213, 200, 0.4);
  background: linear-gradient(180deg, rgba(49, 213, 200, 0.14) 0%, rgba(49, 213, 200, 0.06) 100%);
}

.netdisk-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
}

.netdisk-section-title {
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
  margin: 0;
  letter-spacing: 0.02em;
}

.netdisk-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.netdisk-fields .field {
  grid-column: span 1;
}

.netdisk-fields .field:nth-child(4) {
  grid-column: span 2;
}

.netdisk-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(49, 213, 200, 0.06);
  border: 1px solid rgba(49, 213, 200, 0.12);
}

.netdisk-schedule-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.netdisk-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

.netdisk-toggle-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
  cursor: pointer;
}

.netdisk-mode-group {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.netdisk-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 6px;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.netdisk-radio input { display: none; }

.netdisk-radio:has(input:checked) {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.netdisk-time-field,
.netdisk-interval-field {
  min-width: 120px;
}

.netdisk-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.netdisk-danger-btn {
  margin-left: auto;
  color: #ff7a7a;
  border-color: rgba(255, 100, 100, 0.25);
}

.netdisk-danger-btn:hover {
  border-color: rgba(255, 100, 100, 0.5);
  color: #ff5252;
  background: linear-gradient(180deg, rgba(255, 80, 80, 0.1) 0%, rgba(255, 80, 80, 0.04) 100%);
}

.netdisk-info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.netdisk-info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.netdisk-info-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.netdisk-info-value {
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.4;
}

.netdisk-result {
  font-size: 12px;
  line-height: 1.6;
  padding: 10px 14px;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-all;
  display: none;
}

.netdisk-result.ok {
  display: block;
  color: var(--teal-dark);
  background: rgba(49, 213, 200, 0.08);
  border: 1px solid rgba(49, 213, 200, 0.2);
}

.netdisk-result.error {
  display: block;
  color: #ff7a7a;
  background: rgba(255, 80, 80, 0.06);
  border: 1px solid rgba(255, 80, 80, 0.2);
}

:root[data-theme="light"] .netdisk-section {
  background: rgba(255, 255, 255, 0.6);
}

:root[data-theme="light"] .netdisk-info-item {
  background: rgba(238, 241, 240, 0.6);
}

:root[data-theme="light"] .netdisk-danger-btn:hover {
  background: rgba(255, 80, 80, 0.06);
}

@media (max-width: 768px) {
  .netdisk-fields { grid-template-columns: 1fr; }
  .netdisk-fields .field:nth-child(4) { grid-column: span 1; }
  .netdisk-info-grid { grid-template-columns: 1fr 1fr; }
  .netdisk-danger-btn { margin-left: 0; }
}

/* === Locale Switcher === */
.locale-select {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  padding: 6px 28px 6px 10px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%23999' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.2s;
}
.locale-select:hover { border-color: var(--accent); }
.locale-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* === Sub-Agent Management === */
.sub-agent-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.sub-agent-form .field:last-child {
  grid-column: 1 / -1;
}
.sub-agent-form .button-row {
  grid-column: 1 / -1;
}
.sub-agent-list {
  margin-top: 8px;
}
.sub-agent-list .cs-table {
  width: 100%;
}

/* === Backup & Restore === */
.backup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.backup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.backup-card strong {
  font-size: 15px;
  color: var(--text);
}
.backup-card p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  flex: 1;
}
.backup-card .primary-btn,
.backup-card .secondary-btn {
  align-self: flex-start;
}

@media (max-width: 768px) {
  .sub-agent-form {
    grid-template-columns: 1fr;
  }
  .backup-actions {
    grid-template-columns: 1fr;
  }
}

:root[data-theme="light"] .ai-writer-dialog,
:root[data-theme="light"] .ai-writer-section,
:root[data-theme="light"] .ai-writer-card,
:root[data-theme="light"] .ai-writer-note {
  background: #ffffff;
}

:root[data-theme="light"] .ai-writer-modal {
  background: rgba(238, 241, 240, 0.78);
}

.credit-account-card.locked {
  border-color: rgba(169, 67, 87, 0.7);
}

.credit-account-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .prompt-field-row {
    grid-template-columns: 1fr;
  }

  .ai-write-stack {
    grid-template-columns: 1fr;
  }

  .ai-writer-modal {
    padding: 12px;
  }

  .ai-writer-grid {
    grid-template-columns: 1fr;
  }

  .ai-writer-actions {
    justify-content: stretch;
  }

  .ai-writer-actions button {
    flex: 1;
    min-width: 120px;
  }
}
