/* ==========================================================================
   方向 05 清爽白 · 主题基座（R1 批，2026-09-24）
   依据《UI设计规范-方向05清爽白.md》：§2 token 原样落 :root，§5 组件类。
   加载顺序在 style.css 之后，只做层叠覆盖，不改既有规则文件。

   渠道主色机制（保持）：assets/brand.js 的渠道皮肤仍会向 documentElement
   内联写入 --brand / --el-color-primary。本基座的主色一律经 var(--brand)
   派生（软底/描边用 color-mix 跟随渠道色），默认值 #2f6bff；
   渠道配置 themeColor 时全站主色随之覆写，逻辑零改动。
   ========================================================================== */

/* ---------- §2 设计 Token（新名，全主题通用） ---------- */
:root {
  /* 颜色 */
  --bg: #f7f8fa;
  --card: #ffffff;
  --ink: #111318;
  --sub: #6b7280;
  --faint: #9aa3af;
  --line: #eceef2;
  --primary: #2f6bff;
  --primary-hover: #1f56e0;
  --soft: #eaf1ff;

  /* 语义色（软底 + 同色文字成对） */
  --green: #16a34a;   --green-soft: #e8f7ee;
  --orange: #d97706;  --orange-soft: #fdf1e3;
  --purple: #7c3aed;  --purple-soft: #f1ebfe;
  --cyan: #0891b2;    --cyan-soft: #e3f6fa;
  --red: #dc2626;     --red-soft: #fdecec;

  /* 阴影（只有这两档） */
  --shadow: 0 14px 30px -14px rgba(17, 19, 24, .14);
  --shadow-sm: 0 4px 14px -6px rgba(17, 19, 24, .10);

  /* 圆角 */
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
}

/* ---------- 既有变量映射（仅亮色；暗色主题变量块在 style.css，不动） ----------
   :not([data-theme="dark"]) 防止本文件（后加载）压掉暗色块的等优先级覆写 */
:root:not([data-theme="dark"]) {
  /* --brand 是渠道主色注入点（brand.js 内联覆写），默认对齐规范主色 */
  --brand: #2f6bff;
  --brand-hover: #1f56e0;
  --brand-light: #eaf1ff;
  --brand-border: rgba(47, 107, 255, .35);

  --text-1: #111318;
  --text-2: #6b7280;
  --text-3: #9aa3af;
  --bg-page: #f7f8fa;
  --bg-sidebar: #ffffff;
  --bg-hover: #f2f4f8;
  --bg-card: #ffffff;
  --bg-chip: #f1f3f7;
  --bg-table-head: #fafbfd;
  --border: #eceef2;
  --border-light: #f0f2f6;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 4px 14px -6px rgba(17, 19, 24, .10);
  --shadow-lift: 0 14px 30px -14px rgba(17, 19, 24, .14);
  --shadow-input: 0 4px 14px -6px rgba(17, 19, 24, .10);
  --scrollbar: rgba(17, 19, 24, .14);
  --scrollbar-hover: rgba(17, 19, 24, .24);

  /* Element Plus 主色阶（蓝系） */
  --el-color-primary: #2f6bff;
  --el-color-primary-light-3: #5c8aff;
  --el-color-primary-light-5: #8fb0ff;
  --el-color-primary-light-7: #c2d4ff;
  --el-color-primary-light-8: #d7e4ff;
  --el-color-primary-light-9: #eaf1ff;
  --el-color-primary-dark-2: #1f56e0;
  --el-border-radius-base: 10px;
  --el-border-radius-round: 999px;
  --el-dialog-border-radius: 14px;
  --el-messagebox-border-radius: 14px;
  --el-text-color-primary: #111318;
  --el-text-color-regular: #4b5563;
  --el-border-color: #e2e6ec;
  --el-border-color-light: #eceef2;
  --el-border-color-lighter: #f0f2f6;
  --el-fill-color-light: #f2f4f8;
}

/* 渠道主色派生：支持 color-mix 的浏览器下，软底/描边/EP 色阶全部跟随
   --brand（渠道 themeColor 内联覆写 --brand 后自动联动，无需改 JS） */
@supports (color: color-mix(in srgb, red, blue)) {
  :root:not([data-theme="dark"]) {
    --brand-light: color-mix(in srgb, var(--brand) 10%, #ffffff);
    --brand-border: color-mix(in srgb, var(--brand) 38%, transparent);
    --soft: var(--brand-light);
    --el-color-primary: var(--brand);
    --el-color-primary-light-3: color-mix(in srgb, var(--brand) 72%, #ffffff);
    --el-color-primary-light-5: color-mix(in srgb, var(--brand) 52%, #ffffff);
    --el-color-primary-light-7: color-mix(in srgb, var(--brand) 32%, #ffffff);
    --el-color-primary-light-8: color-mix(in srgb, var(--brand) 22%, #ffffff);
    --el-color-primary-light-9: color-mix(in srgb, var(--brand) 12%, #ffffff);
    --el-color-primary-dark-2: color-mix(in srgb, var(--brand) 86%, #000000);
  }
}

/* ---------- §3 字体与排版 ---------- */
html, body, #app {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* 数字等宽（积分/数量/编号等） */
.mono,
.points-text b,
.unread-badge {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

/* ---------- SVG 图标基础设施（emoji 替代，§5.4） ---------- */
.xdh-ic {
  width: 14px;
  height: 14px;
  flex: none;
  vertical-align: -2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.el-button .xdh-ic { margin-right: 2px; }
/* 彩色软底图标块（§5.4a：侧栏 26×26 r8 / 大 40×40 r12） */
.mi {
  width: 26px; height: 26px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.mi .xdh-ic { width: 14px; height: 14px; stroke-width: 2; vertical-align: 0; }
.mi-lg { width: 40px; height: 40px; border-radius: 12px; }
.mi-lg .xdh-ic { width: 19px; height: 19px; stroke-width: 1.8; }
.mi-blue   { background: var(--soft); color: var(--primary); }
.mi-green  { background: var(--green-soft); color: var(--green); }
.mi-orange { background: var(--orange-soft); color: var(--orange); }
.mi-purple { background: var(--purple-soft); color: var(--purple); }
.mi-cyan   { background: var(--cyan-soft); color: var(--cyan); }
.mi-gray   { background: #f1f3f7; color: var(--sub); }

/* ---------- §5.1 按钮（主：蓝底白字+蓝影；次：白底细描边；统一胶囊） ---------- */
.el-button {
  border-radius: 999px;
  font-weight: 600;
  transition: all .15s;
}
.el-button:not(.is-text):not(.is-link):not(.el-button--primary):not(.el-button--success):not(.el-button--warning):not(.el-button--danger):not(.el-button--info) {
  background: var(--bg-card);
  color: var(--text-2);
  border: 1px solid var(--line);
}
.el-button:not(.is-text):not(.is-link):not(.el-button--primary):not(.el-button--success):not(.el-button--warning):not(.el-button--danger):not(.el-button--info):hover {
  color: var(--text-1);
  border-color: #d8dce4;
  background: var(--bg-card);
}
.el-button--primary:not(.is-text):not(.is-link):not(.is-plain) {
  box-shadow: 0 8px 18px -8px rgba(47, 107, 255, .55);
}
/* 输入区主按钮保持胶囊；方形小工具按钮（36×36 r10）见输入区覆写 */

/* ---------- §5.2 卡片 ---------- */
.gen-input-card,
.cw-result-card,
.doc-card,
.input-card,
.hw-task-card,
.work-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.work-card:hover { box-shadow: var(--shadow); }

/* ---------- §5.5 侧栏导航 ---------- */
.sidebar {
  width: 236px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--line);
}
.logo { padding: 18px 16px 12px; gap: 10px; }
.logo .logo-mark { width: 34px; height: 34px; border-radius: 10px; }
.logo-text { font-size: 15px; font-weight: 700; letter-spacing: 0; }
/* 特例：侧栏"新建对话"= 蓝色胶囊，撑满侧栏内容区 */
.new-chat {
  margin: 2px 14px 12px;
  padding: 9px 0;
  background: var(--brand);
  border: none;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 18px -8px rgba(47, 107, 255, .55);
}
.new-chat:hover {
  background: var(--brand-hover);
  color: #fff;
  border: none;
  box-shadow: 0 8px 18px -8px rgba(47, 107, 255, .55);
}
.func-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 2px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-2);
}
.func-item:hover { background: var(--bg-hover); color: var(--text-1); }
.func-item.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }
/* 动态 AI 功能项（无 emoji）：主色软底对话图标块 */
.func-item .mi { transition: none; }
.nav-group {
  padding: 16px 20px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-3);
}
/* 会话子项：缩进对齐图标块后文字；选中态左侧 3px 主色竖条 */
.conv-list { margin: 0 8px 6px; }
.conv-item {
  position: relative;
  padding: 7px 10px 7px 36px;
  border-radius: 8px;
  font-size: 13px;
}
.conv-item.active { background: var(--brand-light); color: var(--text-1); font-weight: 500; }
.conv-item.active::before {
  content: '';
  position: absolute;
  left: 18px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 15px;
  border-radius: 3px;
  background: var(--brand);
}
.conv-op { display: inline-flex; align-items: center; opacity: .55; }
.conv-op:hover { opacity: 1; }
.conv-op .xdh-ic { width: 13px; height: 13px; vertical-align: 0; }
/* 侧栏底部：积分/用户卡 */
.sidebar-bottom {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}
.points-text b { font-size: 16px; letter-spacing: -.5px; }
.avatar-mini { background: var(--brand-light); color: var(--brand); }
.avatar-placeholder .xdh-ic { width: 15px; height: 15px; vertical-align: 0; }

/* ---------- §5.6 顶栏（全部功能页共用 .chat-header） ---------- */
.chat-header {
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  position: relative;
  z-index: 5;
}
.works-header { min-height: 60px; }
.func-name { font-size: 16px; font-weight: 700; }

/* ---------- 对话区（§6.2 消息流） ---------- */
.msg-avatar {
  background: var(--brand-light);
  color: var(--brand);
  border-radius: 50%;
}
/* 用户气泡：主色软底 + 主文字（蓝色只作点睛，不刷墙） */
.msg-row.user .msg-content {
  background: var(--brand-light);
  color: var(--text-1);
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
}
.msg-row.user .msg-attach-item {
  background: rgba(255, 255, 255, .75);
  color: var(--text-2);
  border: 1px solid var(--line);
}
.msg-time-divider > span { background: var(--bg-chip); }

/* 空状态引导（§5.12 轻量版：软底图标块 + 文案，不引入新交互） */
.empty-hint { color: var(--text-3); font-size: 14px; }
.empty-hint::before {
  content: '';
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--brand-light) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232f6bff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5h16v11H9l-5 4z'/%3E%3C/svg%3E") center / 26px 26px no-repeat;
  display: block;
  font-size: 0;
  opacity: 1;
}
.empty-hint-sm::before {
  content: '';
  width: 44px; height: 44px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: var(--bg-chip) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa3af' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7h7l2 2h9v10H3z'/%3E%3C/svg%3E") center / 22px 22px no-repeat;
  display: block;
  font-size: 0;
  opacity: 1;
}

/* ---------- §5.10 输入区 ---------- */
.input-card,
.gen-input-card {
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.input-card:focus-within,
.gen-input-card:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .12);
}
.input-actions .upload-btn.el-button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-card);
}
.input-actions .upload-btn.el-button:hover { background: var(--bg-hover); border-color: #d8dce4; }
.attach-chip { border-radius: 10px; }

/* ---------- 登录页（去顶部色条/径向渐变，白卡清爽化） ---------- */
.login-page { background: var(--bg-page); }
.login-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding-top: 34px;
}
.login-brand-bar { display: none; }
.logo-mark { box-shadow: 0 6px 14px -6px rgba(47, 107, 255, .45); }

/* ---------- §5.7 Tabs（下划线式，Element Plus 覆写） ---------- */
.el-tabs__item { font-weight: 600; color: var(--text-2); }
.el-tabs__item.is-active { color: var(--el-color-primary); }
.el-tabs__active-bar { background: var(--el-color-primary); height: 2px; }
.el-tabs__nav-wrap::after { background: var(--line); height: 1px; }

/* ---------- §5.8 分段选择器（el-radio-button 组胶囊化） ---------- */
.el-radio-group:has(.el-radio-button) {
  background: var(--bg-chip);
  border-radius: 999px;
  padding: 3px;
  display: inline-flex;
  gap: 2px;
}
.el-radio-button__inner {
  border: none !important;
  background: transparent;
  border-radius: 999px !important;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  box-shadow: none !important;
  padding: 7px 14px;
  transition: all .15s;
}
.el-radio-button__inner:hover { color: var(--text-1); }
.el-radio-button.is-active .el-radio-button__inner {
  background: var(--bg-card) !important;
  color: var(--text-1) !important;
  box-shadow: 0 2px 6px rgba(17, 19, 24, .08) !important;
}
.el-radio-button:first-child .el-radio-button__inner,
.el-radio-button:last-child .el-radio-button__inner { border-radius: 999px !important; }

/* ---------- §5.9 表格（Element Plus 覆写） ---------- */
.el-table { --el-table-header-bg-color: #fafbfd; --el-table-row-hover-bg-color: #f8faff; font-size: 13px; }
.el-table th.el-table__cell {
  background: #fafbfd;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
}
.el-table .el-table__cell { padding: 11px 0; }
.el-table, .el-table__expanded-cell { background: var(--bg-card); }

/* ---------- 弹窗/浮层 ---------- */
.el-dialog { border-radius: var(--el-dialog-border-radius); box-shadow: var(--shadow); }
.el-dialog__title { font-weight: 700; }
.el-overlay { backdrop-filter: none; }

/* ---------- 输入控件 ---------- */
.el-input__wrapper { border-radius: 10px; box-shadow: 0 0 0 1px var(--line) inset; }
.el-input__wrapper.is-focus { box-shadow: 0 0 0 1px var(--el-color-primary) inset, 0 0 0 3px rgba(47, 107, 255, .12); }
.el-select__wrapper { border-radius: 10px; }
.el-textarea__inner { border-radius: 10px; }

/* ---------- 标签/角标（语义软底成对） ---------- */
.unread-badge { border-radius: 999px; }
.el-tag { border-radius: 999px; font-weight: 600; }

/* ---------- 作品/结果卡片图标容器（emoji 清除后 SVG 居中） ---------- */
.work-file-box { font-size: 0; color: var(--text-3); }
.work-file-box .xdh-ic { width: 40px; height: 40px; stroke-width: 1.5; }
.doc-card-icon { font-size: 0; }
.doc-card-icon .xdh-ic { width: 22px; height: 22px; }
.doc-card-icon.word  { background: var(--soft); color: var(--primary); }
.doc-card-icon.excel { background: var(--green-soft); color: var(--green); }
.doc-card-icon.ppt   { background: var(--orange-soft); color: var(--orange); }
.doc-card-icon.pdf   { background: var(--red-soft); color: var(--red); }
.attach-file-icon, .attach-icon { display: inline-flex; }
.attach-file-icon .xdh-ic, .attach-icon .xdh-ic { vertical-align: 0; }

/* ---------- 个人中心：积分大卡去渐变，KPI 化（白卡 + 主色大数字等宽） ---------- */
.points-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}
.points-card-num {
  color: var(--brand);
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.5px;
}
.points-card-label { color: var(--text-2); opacity: 1; }
.points-card-total { color: var(--text-3); opacity: 1; }

/* 作业批改任务卡图标块：软底蓝块 */
.hw-task-icon {
  background: var(--brand-light);
  color: var(--brand);
  border-radius: 10px;
}
.hw-task-icon .xdh-ic { width: 20px; height: 20px; }

/* ---------- 动效收敛（§7：hover 只做 .15s 过渡，卡片升影不位移过大） ---------- */
.work-card:hover { transform: translateY(-1px); }

/* ---------- R4：Enter 队列徽章/面板 ---------- */
.queue-btn.el-button { flex: none; }
.queue-tip { font-size: 12px; color: var(--text-3); line-height: 1.6; margin-bottom: 12px; }
.queue-empty { text-align: center; color: var(--text-3); font-size: 13px; padding: 20px 0; }
.queue-item {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--bg);
}
.queue-attach { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.queue-ops { position: absolute; right: 8px; top: 8px; display: flex; gap: 4px; }
.queue-ops .qop {
  width: 22px; height: 22px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-2); cursor: pointer;
  background: var(--card); border: 1px solid var(--line);
  transition: all .15s; user-select: none;
}
.queue-ops .qop:hover { color: var(--brand); border-color: var(--brand); }
.queue-ops .qop.del:hover { color: var(--red); border-color: var(--red); }
.queue-ops .qop.dis { opacity: .35; pointer-events: none; }

/* ---------- R4：段落跳转右轨（flex 行布局兄弟列：布局内常驻，永不滚走/不被裁剪） ---------- */
.chat-area { position: relative; }
.msg-list { position: relative; }
.msg-body { flex: 1; display: flex; min-height: 0; }
.msg-body .msg-list { flex: 1; min-width: 0; }
.msg-rail {
  width: 26px; flex: none;
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.rail-ticks {
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  max-height: 70%; width: 5px; height: 100%;
  padding: 8px 0;
}
.rail-tick {
  flex: 1 1 18px; min-height: 4px; max-height: 18px;
  width: 3px; margin: 0 auto;
  border-radius: 3px; background: #d8dce4; cursor: pointer;
  transition: background .15s, transform .15s;
}
.rail-tick:hover { background: #9aa3af; }
.rail-tick.on { background: var(--brand); transform: scaleX(1.9); }
/* 面板向左弹出（右屏边不裁切）；透明桥覆盖间隙，配合 onRailLeave 150ms 延迟保证可达 */
.rail-panel {
  position: absolute; right: calc(100% + 2px); top: 50%; transform: translateY(-50%);
  width: 264px; max-height: 60vh; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 6px;
}
.rail-panel::before {
  content: ''; position: absolute; left: -30px; top: 0; bottom: 0; width: 30px;
}
.rail-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 8px;
  font-size: 12.5px; color: var(--text-2); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .15s, color .15s;
}
.rail-item i {
  flex: none; width: 3px; height: 14px; border-radius: 3px; background: #d8dce4;
  transition: background .15s;
}
.rail-item span { overflow: hidden; text-overflow: ellipsis; }
.rail-item:hover { background: var(--bg-hover); color: var(--text-1); }
.rail-item.on { background: var(--brand-light); color: var(--brand); font-weight: 600; }
.rail-item.on i { background: var(--brand); }

/* 跳转目标高亮闪一下（功能性反馈，非装饰动画） */
.msg-flash .bubble { animation: xdh-railflash 1.2s ease-out; border-radius: var(--radius-lg); }
@keyframes xdh-railflash {
  0% { box-shadow: 0 0 0 3px rgba(47, 107, 255, .45); }
  100% { box-shadow: 0 0 0 0 rgba(47, 107, 255, 0); }
}

/* ---------- R4：「↓ 最新内容」浮钮（sticky 钉在消息流容器内底部居中，不进录入区） ---------- */
.latest-fab {
  position: sticky; bottom: 14px;
  margin: 0 auto; width: fit-content;
  z-index: 8;
  display: flex; align-items: center; gap: 5px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow-sm);
  padding: 7px 16px; font-size: 12.5px; font-weight: 600; color: var(--text-2);
  cursor: pointer; transition: all .15s;
}
.latest-fab:hover { color: var(--brand); border-color: var(--brand); box-shadow: var(--shadow); }
.latest-fab .xdh-ic { width: 13px; height: 13px; }

/* 窄屏/移动端隐藏右轨 */
@media (max-width: 1100px) {
  .msg-rail { display: none; }
}
