/* AI办公 —— 界面样式
   ------------------------------------------------------------------
   设计依据（均为公开可查的同类产品做法）：
   · 布局：侧栏 260px + 内容列 768px 居中 —— 取自 ChatGPT 的两栏结构规范
   · 消息：助手消息不加气泡，只用留白和头像区分；用户消息才用填充气泡
     —— ChatGPT / Claude / LobeChat 通用做法，比双方都套气泡清爽得多
   · 间距：8px 栅格（4 / 8 / 12 / 16 / 24 / 32）
   · 圆角：按钮 8 / 卡片 12 / 气泡 16 / 输入框 22
   · 动效：150–220ms ease，只做位移和透明度，不做花哨放大
   浅色主题，桌面 / 手机自适应，无外部依赖、无构建步骤。 */

:root {
  /* ---------- 品牌色 ---------- */
  --brand-50:  #eff5ff;
  --brand-100: #dbe8fe;
  --brand-200: #bed5fd;
  --brand-400: #5b93f8;
  --brand:     #2563eb;
  --brand-700: #1d4ed8;

  /* ---------- 中性色 ---------- */
  --bg:        #f6f7f9;   /* 应用底色（侧栏） */
  --surface:   #ffffff;   /* 主内容底 */
  --surface-2: #f3f5f8;   /* 次级块 */
  --surface-3: #e9ecf2;   /* 悬浮 / 进度槽 */
  --line:      #e7eaf0;   /* 分割线 */
  --line-2:    #d7dbe3;   /* 控件描边 */

  --t1: #14161a;          /* 主文字 */
  --t2: #575e6b;          /* 次要文字 */
  /* 辅助 / 占位。2026-10-20 由 #8b929e 调深：原值在白底上对比度只有 3.13、
     在侧栏底色 #f6f7f9 上 2.92，低于 WCAG AA 的 4.5。全站几十处次要文字
     （统计卡标题、时间戳、说明段、底栏文字）都吃这个变量，手机上尤其糊。
     #6b7280 在白底 4.83、侧栏底 4.6，刚过线且不抢主文字的视线。 */
  --t3: #6b7280;

  /* 用户气泡：比品牌 50 稍重一点，否则在白底上几乎看不出是一块 */
  --bubble-user: #e3edff;
  --bubble-user-bd: #cfe0fb;

  /* ---------- 语义色 ---------- */
  --ok: #15803d;      --ok-bg: #f0fdf4;      --ok-bd: #bbf7d0;
  --warn: #b45309;    --warn-bg: #fffaeb;    --warn-bd: #fde9b0;
  --danger: #dc2626;  --danger-bg: #fef3f2;  --danger-bd: #fbd0cb;

  /* ---------- 形状 ---------- */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --sh-1: 0 1px 2px rgba(16, 24, 40, .05);
  --sh-2: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .05);
  --sh-3: 0 2px 6px rgba(16, 24, 40, .06), 0 12px 32px rgba(16, 24, 40, .10);
  --sh-4: 0 24px 64px rgba(16, 24, 40, .22);

  /* ---------- 尺寸 ---------- */
  --sb-w: 262px;      /* 侧栏宽度 */
  --col-w: 768px;     /* 内容列最大宽度 */
  --top-h: 56px;      /* 顶栏高度 */
  --tabbar-h: 56px;   /* 手机端底部导航高度（窄屏才用，见 .tabbar）；.main 靠它留底部空间 */
  --fs-prose: 15.5px; /* 对话正文字号 */

  /* 注意：以上这些值会被 /api/v1/theme.css 覆盖（管理员可在对话里改）。
     改这里的默认值时，记得同步 app/ui_options.py 里对应的 default，
     否则「恢复默认」会跳到另一个值上。 */

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
          "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ==================== 基础 ==================== */

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; padding: 0; }

/* 禁用整页"下拉刷新"（2026-10-16）：
   「我的」这类内容不满一屏的页面，一往下拉就会把浏览器/容器的"整页刷新"手势带出来，
   和原生 App 的手感不符。overscroll-behavior 把手势留在页面内部、不再链到外层容器。
   支持的内核（Chromium 系：安卓 Chrome、多数 WebView 容器）立即生效；
   不支持的浏览器会自然忽略这条声明；iOS Safari 的下拉刷新属系统级手势，网页无法禁用。 */
html, body { overscroll-behavior-y: contain; }

body {
  background: var(--surface);
  color: var(--t1);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

[v-cloak] { display: none !important; }

button { font-family: inherit; font-size: 14px; cursor: pointer; }

/* 细滚动条，别用系统那根粗的 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(16, 24, 40, .13);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(16, 24, 40, .24); background-clip: padding-box; }

.svg-ico { display: block; flex: 0 0 auto; }

/* ==================== 按钮 ==================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--t2);
  font-size: 13.5px;
  white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease),
              color .15s var(--ease), box-shadow .15s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--t3); color: var(--t1); }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .24);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-700); border-color: var(--brand-700); color: #fff;
  box-shadow: 0 3px 10px rgba(37, 99, 235, .28);
}

.btn-danger { color: var(--danger); border-color: var(--danger-bd); background: var(--danger-bg); }
.btn-danger:hover:not(:disabled) { background: #fde5e2; border-color: #f7b4ac; color: var(--danger); }


.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: var(--r-xs); }

/* ==================== 表单控件 ==================== */

input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--t1);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--t3); }
input:focus, textarea:focus, select:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3.5px var(--brand-50);
}
textarea { resize: vertical; line-height: 1.7; }
select { cursor: pointer; appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b929e' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }

label.field { display: block; margin-bottom: 14px; }
label.field > span {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 500; color: var(--t2);
}

/* 密码框右侧的「眼睛」：点一下在明文/密文之间切换。
   空间靠给输入框加右内边距预留，所以按钮用绝对定位贴在右边。 */
.pwd { position: relative; }
.pwd > input { padding-right: 42px; }
.pwd-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; background: none;
  color: var(--t3); cursor: pointer;
  border-radius: var(--r-xs);
  transition: color .13s var(--ease), background .13s var(--ease);
}
.pwd-eye:hover { color: var(--t1); background: var(--surface-2); }
.pwd-eye.on { color: var(--brand); }
.pwd-eye:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 1px; }
/* 34×32 的可见按钮，手指不好点。撑开命中区到 40×40，视觉尺寸不变（2026-10-20） */
.pwd-eye::after { content: ""; position: absolute; inset: -4px; }
.pwd-eye svg { width: 17px; height: 17px; display: block; }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

/* ==================== 登录页 ==================== */

.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 24px 64px;   /* 底部多留 40px：给固定在视口底部的备案号行让位 */
  background:
    radial-gradient(1100px 420px at 50% -8%, #e5efff 0%, rgba(229, 239, 255, 0) 62%),
    linear-gradient(180deg, #f8fafd 0%, #f4f6fa 100%);
}
.login-card {
  width: 100%; max-width: 392px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 32px 26px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 18px 46px rgba(16,24,40,.09);
}
.login-logo {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-400) 0%, var(--brand-700) 100%);
  color: #fff; font-size: 17px; font-weight: 700; letter-spacing: -.5px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .3);
}
.login-card h1 { margin: 0 0 5px; font-size: 22px; font-weight: 650; letter-spacing: -.3px; }
.login-card .sub { margin: 0 0 26px; color: var(--t3); font-size: 13px; }
.login-card .btn-primary { width: 100%; padding: 10px; margin-top: 8px; font-size: 14.5px; }
.login-hint {
  margin: 20px 0 0; padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12.5px; line-height: 1.75; color: var(--t3); text-align: center;
  white-space: pre-line;   /* 管理员可在配置里写多行提示 */
}
/* 登录页版本号：给"登不进去也要报障"的人看的，弱化到不抢视线 */
.login-ver {
  margin: 14px 0 0; font-size: 11.5px; letter-spacing: .2px;
  color: var(--t3); text-align: center; opacity: .75;
}

/* 登录页底部备案信息（ICP 备案号，法律要求展示 + 链接工信部）。
   固定视口底部；容器层不吃点击，只有链接本身可点。 */
.login-foot {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  text-align: center; font-size: 12px; color: var(--t3);
  pointer-events: none;
}
.login-foot a { color: var(--t3); text-decoration: none; pointer-events: auto; }
.login-foot a:hover { text-decoration: underline; }

/* ==================== 应用外壳 ==================== */

.shell { display: flex; height: 100vh; height: 100dvh; background: var(--bg); }

/* ---------- 侧栏 ---------- */

.sidebar {
  flex: 0 0 var(--sb-w); width: var(--sb-w);
  display: flex; flex-direction: column; min-height: 0;
  background: var(--bg);
  border-right: 1px solid var(--line);
}

.sb-brand {
  flex: 0 0 auto; height: var(--top-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
}
.logo {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--brand-400) 0%, var(--brand-700) 100%);
  color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: -.2px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .28);
}
.sb-brand-txt { min-width: 0; }
.sb-brand-txt b { display: block; font-size: 14.5px; font-weight: 650; letter-spacing: -.1px; }
.sb-brand-txt span { display: block; font-size: 11px; color: var(--t3); margin-top: -1px; }

.sb-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 10px 12px; }

.sb-new {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; margin-bottom: 14px;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface); color: var(--t1);
  font-size: 13.5px; font-weight: 500; text-align: left;
  box-shadow: var(--sh-1);
  transition: .15s var(--ease);
}
.sb-new:hover { border-color: var(--brand-200); color: var(--brand); background: var(--brand-50); }
.sb-new .svg-ico { color: var(--brand); }

.sb-nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px;
  border: none; background: transparent; border-radius: var(--r-sm);
  color: var(--t2); font-size: 13.5px; text-align: left;
  transition: background .13s var(--ease), color .13s var(--ease);
}
.nav-item .svg-ico { color: var(--t3); transition: color .13s var(--ease); }
.nav-item:hover { background: var(--surface-3); color: var(--t1); }
.nav-item:hover .svg-ico { color: var(--t2); }
.nav-item.on { background: var(--brand-50); color: var(--brand); font-weight: 550; }
.nav-item.on .svg-ico { color: var(--brand); }

/* 侧栏左下角的「我的」（2026-10-18）：像 WorkBuddy 的账号入口那样钉在最底部，
   不跟着上面的会话列表滚走。放在 .sb-scroll 之外，靠 .sb-scroll 的 flex:1 把它顶到底。 */
.sb-me {
  flex: 0 0 auto;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
}
.sb-me .nav-item { width: 100%; }

.sb-sect { margin-top: 20px; }
.sb-sect-title {
  padding: 0 11px; margin-bottom: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .5px;
  color: var(--t3); text-transform: uppercase;
}
.sb-group {
  padding: 10px 11px 4px;
  font-size: 11px; font-weight: 600; letter-spacing: .4px; color: var(--t3);
}
.sb-group:first-child { padding-top: 2px; }

.session-item {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 9px 7px 11px; margin-bottom: 1px;
  border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--t2); cursor: pointer;
  transition: background .13s var(--ease), color .13s var(--ease);
}
.session-item:hover { background: var(--surface-3); color: var(--t1); }
.session-item.on { background: var(--surface); color: var(--t1); font-weight: 500; box-shadow: var(--sh-1); }
.si-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si-del {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: var(--r-xs);
  display: grid; place-items: center;
  border: none; background: transparent; color: var(--t3);
  opacity: 0; transition: .13s var(--ease);
}
.session-item:hover .si-del, .si-del:focus-visible { opacity: 1; }
.si-del:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 1px; }
.si-del:hover { background: var(--danger-bg); color: var(--danger); }
@media (hover: none) {
  .si-del { width: 28px; height: 28px; opacity: .65; }
}

.sb-empty { padding: 14px 11px; font-size: 12.5px; color: var(--t3); }

/* 侧栏底部账号卡 / 用户菜单气泡（.sb-foot / .sb-user* / .quota-mini / .pop*）已整体删除（2026-10-16）：
   其功能（账号、额度、修改密码、退出登录、加到桌面、管理）统一收进「我的」页，样式随之作废。
   只保留仍在用的 .avatar。 */

.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, #dbe8fe 0%, #bed5fd 100%);
  color: var(--brand-700);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 650;
}

/* 额度进度条：原写法是 .quota-mini .qm-bar（侧栏小条专用），
   于是「我的」页里的 .qm-bar 一直没有样式（2026-10-16 顺手修正）。改为通用类。 */
.qm-bar { height: 4px; border-radius: 2px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.qm-bar > i {
  display: block; height: 100%; border-radius: 2px; min-width: 3px;
  background: linear-gradient(90deg, var(--brand-400), var(--brand));
  transition: width .35s var(--ease);
}
.qm-bar > i.full { background: linear-gradient(90deg, #f59e0b, var(--danger)); }

/* ---------- 主区 ---------- */

.main {
  flex: 1 1 auto; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--surface);
}

.topbar {
  /* 2026-10-16 沉浸式适配：高度把"顶部安全区"算进去。
     在"像 App"的沉浸容器（如 Aira 安装的窗口）里：顶栏背景会一直铺到系统状态栏
     后面、内容自动下移避让，顶部不再显空；普通浏览器里 env(...) 为 0，与原来完全一致。 */
  flex: 0 0 auto;
  height: calc(var(--top-h) + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; gap: 10px;
  padding: env(safe-area-inset-top, 0px) 16px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(1.6) blur(8px);
  z-index: 20;
}
.hamburger {
  /* 2026-10-16 用户要求：三横杠放大到与顶栏「标题 + 版本号」两行合计等高。
     实测该两行 = 标题 14.5px×1.6(23.2) + gap 1px + 版本号 11px×1.25(13.75) ≈ 38px。
     按钮做成 38×38 的透明方形，图标 24px——视觉上与左侧两行文字块齐平。 */
  display: none; width: 38px; height: 38px; margin-left: -4px;
  border: none; background: transparent; border-radius: var(--r-sm);
  color: var(--t2); place-items: center;
}
.hamburger:hover { background: var(--surface-2); color: var(--t1); }
.tb-title {
  font-size: 14.5px; font-weight: 600; letter-spacing: -.1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0; max-width: 46%;
}
.tb-sub { font-size: 12px; color: var(--t3); font-weight: 400; margin-left: 8px; }
/* 对话页顶栏：标题下再压一行版本号（2026-10-16 用户要求「放新对话下面」）。
   列布局让两行都靠左；换会话时标题会变，版本号那一行不动。 */
.tb-title.tb-col { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; }
.tb-ver { font-size: 11px; font-weight: 400; color: var(--t3); opacity: .8; line-height: 1.25; }
.tb-spacer { flex: 1 1 auto; }
.tb-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.main-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.main-body.is-chat { overflow: hidden; display: flex; }

.page-wrap { max-width: 1080px; margin: 0 auto; padding: 24px 24px 48px; }

/* 场景选择器（顶栏右侧） */
.scene-pick { display: flex; align-items: center; gap: 6px; }
.scene-pick select {
  width: auto; min-width: 152px; max-width: 240px;
  padding: 5px 30px 5px 11px; font-size: 12.5px; border-radius: 999px;
  border-color: var(--line-2); color: var(--t2); background-color: var(--surface-2);
}
.scene-pick select:focus { background-color: var(--surface); }
.model-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--t3);
}
.model-pill .dot-ok {
  width: 5px; height: 5px; border-radius: 50%; background: #16a34a;
  box-shadow: 0 0 0 2.5px rgba(22, 163, 74, .16);
}

/* ==================== 卡片 / 统计 / 表格 ==================== */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.card + .card { margin-top: 14px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 600; font-size: 13.5px;
}
.card-body { padding: 16px; }
.card-head .toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 通用工具条（任务详情、提交材料、新建任务草稿区）。
   以前只有 .card-head 里的那份有样式，其余位置那排按钮**一点间距都没有**，
   边框彼此贴在一起（2026-10-19 修）。 */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px 17px; box-shadow: var(--sh-1);
}
.stat .k { font-size: 12.5px; color: var(--t3); margin-bottom: 8px; }
.stat .v { font-size: 24px; font-weight: 650; line-height: 1.15; letter-spacing: -.5px; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--t3); letter-spacing: 0; }
/* 值本身是**文字**而不是数字时（管理页「大模型：已配置 / deepseek-flash」）。
   原来靠行内 style 把字号压到 16px，但 <small> 是行内元素，会和「已配置」挤在同一行：
   窄卡片里「deepseek-flash」直接把卡片撑破，手机上被裁掉半截。
   改成小字单独占一行，并把长模型名允许断开。 */
.stat .v.v-text { font-size: 16px; letter-spacing: 0; line-height: 1.35; word-break: break-word; }
.stat .v.v-text small { display: block; margin-top: 3px; line-height: 1.4; }

/* ==================== 通用小字说明 ==================== */

.ui-note { margin: 0; font-size: 13px; line-height: 1.8; color: var(--t2); }
.ui-note b { color: var(--t1); font-weight: 600; }
/* 管理页那张「界面外观」只读卡 2026-10-16 整块删除，
   它专用的 .ui-changed / .ui-changed-title / .ui-changed-row / .ui-before / .ui-arrow / .ui-after
   一并删掉（死样式）。`.ui-note` 还留着 —— 科室分工等表单在用。 */

/* ==================== 变更申请（管理页） ==================== */

.req {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.req:last-child { border-bottom: none; }
.req-main { flex: 1 1 auto; min-width: 0; }
.req-title { font-size: 14px; font-weight: 550; margin-bottom: 6px; }
.req-detail {
  margin-top: 8px; font-size: 13px; line-height: 1.75; color: var(--t2);
  white-space: pre-line; word-break: break-word;
}
.req-note {
  margin-top: 8px; padding: 7px 11px;
  font-size: 12.5px; color: var(--t2);
  background: var(--surface-2); border-radius: var(--r-xs);
  white-space: pre-line;
}
.req-side {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 7px; align-items: stretch;
}
.req-side select { width: 108px; padding: 5px 28px 5px 10px; font-size: 12.5px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.tbl th {
  font-weight: 600; color: var(--t3); background: var(--surface-2);
  font-size: 12px; letter-spacing: .3px; white-space: nowrap;
}
.tbl tbody tr { transition: background .12s var(--ease); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr:last-child td { border-bottom: none; }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }
.tbl-scroll { overflow-x: auto; }

.badge {
  display: inline-flex; align-items: center;
  font-size: 11.5px; line-height: 1.5;
  padding: 2px 8px; border-radius: 999px;
  background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100);
  white-space: nowrap;
}
.badge.gray { background: var(--surface-2); color: var(--t2); border-color: var(--line); }
.badge.err { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-bd); }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-bd); }

/* ---------- 启用 / 禁用开关（管理页两张表的状态列用） ----------
   用 <button> 而不是 input[type=checkbox]：跟表格里的按钮、徽章同一套观感，
   状态字（启用 / 禁用）直接写在控件里，不用猜滑块方向代表什么。
   语义色沿用原来那个徽章：绿=启用、红=禁用。
   注意：开关只出现在管理页，**后端另有 require_admin 兜底** —— 界面不是安全机制。 */
.sw {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 10px 3px 5px; border-radius: 999px;
  font: inherit; font-size: 12.5px; line-height: 1.6;
  cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--t2);
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.sw-track {
  position: relative; flex: 0 0 auto;
  width: 28px; height: 16px; border-radius: 999px;
  background: var(--line-2); transition: background .15s var(--ease);
}
.sw-knob {
  position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .28);
  transition: transform .15s var(--ease);
}
/* 启用：绿，滑块靠右 */
.sw.on { border-color: var(--ok-bd); background: var(--ok-bg); color: var(--ok); }
.sw.on:hover { background: #e7f7ec; }
.sw.on .sw-track { background: var(--ok); }
.sw.on .sw-knob { transform: translateX(12px); }
/* 禁用：红，滑块归左（沿用原来那个红「禁用」徽章的语义色） */
.sw.off { border-color: var(--danger-bd); background: var(--danger-bg); color: var(--danger); }
.sw.off:hover { background: #fde5e2; }
.sw.off .sw-track { background: var(--danger-bd); }
/* 不可点：场景已停用、管理员这一行、请求在途（2026-10-20 场景可见性弹窗用） */
.sw:disabled { opacity: .45; cursor: not-allowed; }

/* 场景名下面那行：成员可见性（2026-10-20）。
   为什么不放表格右边单开一列：手机屏幕一行只放得下四五个字，
   排到第 6 列就等于藏起来了（上线前实测反馈）。入口跟着场景名走，横滑也不丢。 */
.tpl-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tpl-member { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.sw-mini { padding: 2px 8px 2px 4px; font-size: 12px; }
.sw-mini .sw-track { width: 24px; height: 14px; }
.sw-mini .sw-knob { width: 10px; height: 10px; }
.sw-mini.on .sw-knob { transform: translateX(10px); }

/* 管理页里"启用"的说明性徽章（管理员账号那行用）*/
.badge[title] { cursor: help; }

.empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 180px; padding: 24px; text-align: center;
  color: var(--t3); font-size: 13.5px;
}
/* 富文本空态必须包一层，否则 <br>/<b> 会各自变成 flex item（见 index.html 里的注释） */
.empty-txt { margin: 0; max-width: 560px; line-height: 1.9; }
.empty-txt b { color: var(--t2); font-weight: 600; }

/* ==================== 提示 / 弹层 ==================== */

.alert {
  padding: 10px 14px; border-radius: var(--r-sm);
  font-size: 13.5px; margin-bottom: 14px; border: 1px solid;
}
.alert.err { background: var(--danger-bg); color: #991b1b; border-color: var(--danger-bd); }
.alert.warn { background: var(--warn-bg); color: #92400e; border-color: var(--warn-bd); }
.alert.ok { background: var(--ok-bg); color: #065f46; border-color: var(--ok-bd); }

.toast-wrap {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  padding: 9px 18px; border-radius: 999px; font-size: 13.5px;
  background: rgba(20, 22, 26, .93); color: #fff;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 28px rgba(16, 24, 40, .26);
  animation: toastIn .22s var(--ease);
}
.toast.err { background: rgba(220, 38, 38, .95); }
.toast.ok { background: rgba(21, 128, 61, .95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.96); } }

.mask {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(16, 24, 40, .44);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .16s var(--ease);
  /* 滚动链隔离（2026-10-23）：手指在遮罩空白处往上滑，
     底下那一页会跟着滚，关掉弹窗后位置已经跑了。手机上很常见。 */
  overscroll-behavior: contain;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: var(--r-lg);
  width: 100%; max-width: 620px; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--sh-4);
  animation: modalIn .2s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.985); } }
.modal-head {
  padding: 15px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 14.5px; flex: 0 0 auto;
}
.modal-body {
  padding: 18px 20px; overflow-y: auto;
  /* 滚到底继续上滑时不要把手势传给页面（同上，滚动穿透） */
  overscroll-behavior: contain;
}
.modal-foot {
  padding: 13px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 8px; flex: 0 0 auto;
}
.close-x {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  border: none; background: transparent; color: var(--t3);
  font-size: 19px; line-height: 1; padding: 0;
}
.close-x:hover { background: var(--surface-2); color: var(--t1); }

/* ==================== 对话页 ==================== */

.chat-wrap { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

/* 滚动容器同时也是纵向 flex：
   .chat-col 用 flex:0 0 auto + min-height:100% ——
     · 内容少 → 撑满可用高度，里面的空态用 margin:auto 居中；
     · 内容多 → 跟着内容长高，滚动条正常出现（若用 flex:1 会被压缩，长内容滚不动）。
   这两条都在验收脚本里量过，不是想当然。 */
.chat-scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column;
}

.chat-col {
  flex: 0 0 auto; min-height: 100%; width: 100%;
  max-width: var(--col-w); margin: 0 auto; padding: 0 24px;
  display: flex; flex-direction: column;
}

/* ---------- 空态 ---------- */

/* 空态在可用高度里垂直居中。用 margin:auto 而不是 justify-content:center——
   内容比可视高度还高的时候，auto 外边距会塌成 0，从顶部开始排并正常滚动，
   不会像 center 那样把顶部内容裁到屏幕外面去。 */
.chat-empty {
  width: 100%; max-width: 646px; margin: auto;
  padding: 28px 0 32px; text-align: center;
}
.ce-logo {
  width: 56px; height: 56px; margin: 0 auto 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-400) 0%, var(--brand-700) 100%);
  color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -.3px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 28px rgba(37, 99, 235, .3);
}
.ce-title { margin: 0 0 10px; font-size: 23px; font-weight: 650; letter-spacing: -.5px; }
.ce-sub { margin: 0 auto 32px; max-width: 470px; font-size: 13.5px; line-height: 1.85; color: var(--t2); }

.chip {
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--t2); font-size: 12.5px;
  transition: .15s var(--ease);
}
.chip:hover { border-color: var(--brand-200); color: var(--brand); background: var(--brand-50); }

/* ---------- 消息 ---------- */

.msgs { flex: 0 0 auto; padding: 22px 0 8px; }

.msg { display: flex; gap: 12px; }
.msg + .msg { margin-top: 10px; }
.msg.user + .msg.assistant { margin-top: 20px; }
.msg.assistant + .msg.user { margin-top: 30px; }

.msg-avatar {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700; letter-spacing: -.2px;
  margin-top: 1px;
}
.msg.assistant .msg-avatar {
  background: linear-gradient(135deg, var(--brand-400) 0%, var(--brand-700) 100%);
  color: #fff;
  box-shadow: 0 2px 7px rgba(37, 99, 235, .24);
}
.msg.tool .msg-avatar { background: var(--surface-3); color: var(--t2); font-size: 13px; }

.msg-body { min-width: 0; flex: 1 1 auto; }
.msg.user { justify-content: flex-end; }
.msg.user .msg-body { flex: 0 1 auto; max-width: 74%; display: flex; flex-direction: column; align-items: flex-end; }

/* 助手正文：不加气泡，靠留白和头像区分（ChatGPT / Claude 做法） */
.msg-text { word-break: break-word; }
.msg.assistant .msg-text {
  font-size: var(--fs-prose); line-height: 1.78; color: var(--t1);
  padding-top: 2px;
}
.msg.user .msg-text {
  padding: 10px 15px;
  background: var(--bubble-user);
  border: 1px solid var(--bubble-user-bd);
  border-radius: 16px; border-bottom-right-radius: 6px;
  font-size: 14.5px; line-height: 1.72;
  white-space: pre-wrap; color: var(--t1);
}
.msg.tool .msg-text {
  padding: 8px 13px; font-size: 13px; white-space: pre-wrap;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--t2);
}

.typing { display: inline-flex; gap: 4px; padding: 8px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--t3); animation: bounce 1.25s infinite; }
.typing i:nth-child(2) { animation-delay: .16s; }
.typing i:nth-child(3) { animation-delay: .32s; }
@keyframes bounce { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: .9; transform: translateY(-2px); } }

/* 工具调用轨迹：灰色小字，不用彩色胶囊——画面立刻干净 */
.tools { display: flex; flex-direction: column; gap: 2px; margin: 0 0 8px; }
.tool-line {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--t3); line-height: 1.7;
}
.tool-line .tk { flex: 0 0 auto; width: 13px; height: 13px; display: grid; place-items: center; }
.tool-line .spin {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1.6px solid var(--line-2); border-top-color: var(--t2);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tool-line.done { color: var(--t2); }
.tool-line.done .tk { color: var(--ok); }
.tool-line.bad { color: var(--danger); }

/* 消息底部：复制 / 导出 / 时间。
   ⚠️ 2026-10-18 用户反馈「不醒目，还得鼠标放过去才显示」——原来靠 `.msg:hover` 显形，
   可手机根本没有 hover，等于这些操作在手机上压根不存在。现在一律**默认可见**：
   按钮做成白底浅描边的胶囊（看得出能点，但不跟正文抢视线），时间常显。 */
.msg-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; min-height: 26px; flex-wrap: wrap; }
.mini {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; min-height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-size: 12px; color: var(--t2);
  transition: background .13s var(--ease), color .13s var(--ease), border-color .13s var(--ease);
}
.mini:hover { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand); }
.mini:disabled { opacity: .5; cursor: default; }
/* 时间：常显；等宽数字，一列消息扫下来不会左右跳 */
.mini-txt { font-size: 12px; color: var(--t2); opacity: .9; font-variant-numeric: tabular-nums; }
/* 错误条里的「重试」：红底上要跟错误同色，不能套白底胶囊 */
.alert .mini { background: transparent; border-color: var(--danger-bd); color: var(--danger); }
.alert .mini:hover { background: #fff; border-color: var(--danger); color: var(--danger); }

/* ---------- 危险操作确认卡 ---------- */

.confirm-card {
  margin-top: 12px; max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  box-shadow: var(--sh-2); overflow: hidden;
}
.confirm-card.mid { border-color: var(--warn-bd); }
.confirm-card.high { border-color: var(--danger-bd); }
.cc-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; font-size: 13px; font-weight: 600;
  background: var(--warn-bg); color: var(--warn);
  border-bottom: 1px solid var(--warn-bd);
}
.confirm-card.high .cc-head { background: var(--danger-bg); color: #991b1b; border-bottom-color: var(--danger-bd); }
.cc-ico {
  width: 17px; height: 17px; border-radius: 50%; flex: 0 0 auto;
  font-size: 11.5px; font-weight: 700; line-height: 1;
  background: var(--warn); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.confirm-card.high .cc-ico { background: var(--danger); }
.cc-summary { padding: 13px 14px 6px; font-size: 14.5px; font-weight: 500; line-height: 1.7; }
.cc-fields {
  display: flex; flex-direction: column; gap: 1px;
  padding: 6px 14px 12px;
}
.ccf { display: flex; gap: 12px; font-size: 13px; line-height: 1.8; }
.ccf-k { flex: 0 0 74px; color: var(--t3); }
.ccf-v { color: var(--t1); word-break: break-all; white-space: pre-line; }
.cc-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.cc-foot .spacer { flex: 1 1 auto; }
.cc-hint { font-size: 11.5px; color: var(--t3); }
.cc-note {
  padding: 11px 14px; font-size: 13px; color: var(--t2);
  border-top: 1px solid var(--line); background: var(--surface-2);
}

/* ---------- 输入区 ---------- */

.composer { flex: 0 0 auto; padding: 6px 0 16px; background: var(--surface); }
.composer .alert { margin-bottom: 8px; }
.composer-box {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 9px 9px 9px 16px;
  border: 1px solid var(--line-2); border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 3px 14px rgba(16,24,40,.05);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.composer-box.focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px var(--brand-50), 0 3px 14px rgba(16,24,40,.05);
}
.composer-box.disabled { background: var(--surface-2); }
.composer-box textarea {
  flex: 1 1 auto; width: auto;
  min-height: 26px; max-height: 176px;
  padding: 6px 0 3px;
  border: none; box-shadow: none; background: transparent;
  font-size: 15px; line-height: 1.65; resize: none;
}
.composer-box textarea:focus { border: none; box-shadow: none; }
.send-btn {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  border: none; background: var(--brand); color: #fff;
  transition: .15s var(--ease);
  box-shadow: 0 1px 3px rgba(37, 99, 235, .3);
}
.send-btn:hover:not(:disabled) { background: var(--brand-700); }
.send-btn:disabled { background: var(--surface-3); color: var(--t3); box-shadow: none; cursor: not-allowed; }
.stop-btn {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--t2);
}
.stop-btn:hover { background: var(--surface-2); color: var(--t1); }

/* ---------- 对话附件（图片 / 文档，2026-10-17）---------- */

/* 隐藏的原生 file input：入口是旁边那个回形针按钮 */
.att-file { display: none; }

.att-btn {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  /* 与发送按钮同一行、底部对齐（.composer-box 是 align-items:flex-end）。
     2026-10-17 用户要求：不用左侧回形针，改成发送按钮左边的「＋」。 */
  border: 1px solid transparent; background: transparent; color: var(--t2);
  transition: .15s var(--ease);
}
.att-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--t1); }
.att-btn:disabled { opacity: .45; cursor: not-allowed; }

/* 已选附件条：**横向滚动不换行**。换行会让输入区随张数往上长，
   手机上一张图就能把输入框顶出可视区。 */
.att-strip {
  display: flex; align-items: center; gap: 8px;
  padding: 0 0 8px; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
}
.att-strip::-webkit-scrollbar { display: none; }

.att-chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px;
  max-width: 190px; padding: 4px 6px 4px 4px;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface-2); font-size: 12px; color: var(--t2);
}
.att-chip img { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; }
.att-chip .att-ic {
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--t2); font-size: 12px;
}
.att-chip .att-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-chip .att-x {
  width: 18px; height: 18px; border: none; background: transparent;
  color: var(--t3); font-size: 14px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; border-radius: 50%;
}
.att-chip .att-x:hover { background: var(--surface-3); color: var(--t1); }
.att-chip.busy { padding: 6px 10px; color: var(--t3); }

/* 消息里的附件：用户消息不加气泡，附件也只做小图 / 小徽标 */
.msg-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.msg-att-img { display: block; line-height: 0; }
.msg-att-img img {
  max-width: 220px; max-height: 220px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line);
}
.msg-att-doc {
  max-width: 240px; padding: 4px 9px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--t2);
  font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.composer-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px 0;
  font-size: 11.5px; color: var(--t3);
}
.composer-foot .kbd {
  display: inline-block; padding: 0 4px; border-radius: 4px;
  border: 1px solid var(--line-2); background: var(--surface-2);
  font-size: 10.5px; font-family: var(--mono);
}

/* ==================== 列表行（知识库文档 / 模板 / 变更记录 / 消息共用） ==================== */

.rec {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .12s var(--ease);
}
.rec:last-child { border-bottom: none; }
.rec:hover { background: var(--surface-2); }
.rec-main { flex: 1 1 auto; min-width: 0; }
.rec-title {
  font-size: 14px; font-weight: 500; margin-bottom: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rec-meta { font-size: 12px; color: var(--t3); display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

/* ---------- 我的产物（2026-10-18） ----------
   列表行沿用 .rec 的观感，但整行不可点（点是下载按钮，不是行），所以光标恢复默认。
   右侧按钮组用共用的 .rec-acts；手机上两个按钮并排会挤掉文件名，所以窄屏右对齐收窄。 */
.art-row { cursor: default; }
@media (max-width: 520px) {
  .art-row .rec-acts { justify-content: flex-end; max-width: 96px; }
}

/* 定稿回传（2026-10-23）：链接式入口放在标题下面一行，
   不跟「下载 / 删除」抢右侧那 96px，手机上也就不会把文件名挤没。 */
.art-final { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px; }
.art-final .ui-note { font-size: 12px; }

/* ==================== 消息（2026-10-16 取代「我的记录」页） ==================== */

/* 侧栏导航 / 手机底栏的未读角标。数字很小时就是一个圆点，两处共用一套形状。 */
.nav-dot {
  margin-left: auto; min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 600; line-height: 17px; text-align: center;
}
.tabbar .tab .tab-dot {
  display: inline-block; min-width: 15px; height: 15px; padding: 0 4px; margin-left: 3px;
  border-radius: 8px; background: var(--danger); color: #fff;
  font-size: 10px; font-style: normal; font-weight: 600;
  line-height: 15px; text-align: center; vertical-align: 1px;
}

/* 消息页顶部那段说明（只给管理员看） */
/* 卡片顶部的一段说明（消息页 / 我的产物页共用）：
   .card 自己不带内边距，说明区必须自己给，否则文字会贴着卡片边线。 */
.msg-tip, .art-tip { padding: 14px 16px; border-bottom: 1px solid var(--line); }

/* 列表行：未读的标题加粗，右边一个小红点 */
.msg-row.unread .rec-title { font-weight: 600; }
.msg-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

/* 详情弹窗：正文保留换行（用户敲的段落不能挤成一坨）
   ⚠️ 类名叫 .msg-detail-body，**不能叫 .msg-body** —— 后者是聊天区的消息容器
   （flex:1 + min-width:0）。两个同名同特异性的规则打架，后写的会把聊天消息
   整块染成灰底带内边距（2026-10-19 修）。 */
.msg-detail-body {
  padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 14px; line-height: 1.85; color: var(--t1);
  white-space: pre-wrap; word-break: break-word;
}
.msg-sect {
  margin: 18px 0 8px;
  font-size: 12px; font-weight: 600; letter-spacing: .4px; color: var(--t3);
}
.msg-none { font-size: 13px; color: var(--t3); }
.msg-reply {
  padding: 10px 12px; margin-bottom: 8px;
  border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line);
}
.msg-reply:last-child { margin-bottom: 0; }
.msg-reply-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.msg-reply-head b { font-weight: 600; }
.msg-reply-time { margin-left: auto; font-size: 11.5px; color: var(--t3); }
.msg-choice-tag {
  padding: 1px 8px; border-radius: 999px; font-size: 12px;
  color: var(--brand); background: var(--brand-50); border: 1px solid var(--brand-100);
}
.msg-reply-body {
  margin-top: 6px; font-size: 13.5px; line-height: 1.75; color: var(--t2);
  white-space: pre-wrap; word-break: break-word;
}

/* 成员回复区：选项按钮 + 输入框 */
.msg-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.msg-choice {
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 13.5px;
  color: var(--t2); background: var(--surface-2); border: 1px solid var(--line-2);
  transition: .13s var(--ease);
}
.msg-choice:hover { color: var(--t1); border-color: var(--t3); }
.msg-choice.on {
  color: var(--brand); background: var(--brand-50);
  border-color: var(--brand-400); font-weight: 600;
}
.msg-input {
  width: 100%; box-sizing: border-box; padding: 10px 12px;
  font: inherit; font-size: 14px; line-height: 1.7; color: var(--t1);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  resize: vertical;
}
.msg-input:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-50); }

.cursor::after {
  content: '';
  display: inline-block; width: 2px; height: 1.05em;
  margin-left: 3px; vertical-align: text-bottom;
  background: var(--brand); border-radius: 1px;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ==================== Markdown 渲染 ==================== */

.md {
  /* 长表格（3 列以上 + 中文）在手机上一定超出气泡宽度，
     让整块横向滚动，不要撑宽整个消息列。 */
  overflow-x: auto;
}
.md h1, .md h2, .md h3, .md h4 { margin: 1.35em 0 .5em; line-height: 1.45; font-weight: 650; letter-spacing: -.2px; }
.md h1 { font-size: 20px; }
.md h2 { font-size: 17.5px; }
.md h3 { font-size: 15.5px; }
.md h4 { font-size: 14.5px; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 .8em; line-height: 1.8; }
.md ul, .md ol { margin: 0 0 .8em; padding-left: 1.4em; }
.md li { margin-bottom: .28em; line-height: 1.78; }
.md li::marker { color: var(--t3); }
.md strong { font-weight: 650; }
.md code {
  font-family: var(--mono); font-size: .86em;
  background: var(--surface-3); padding: 1.5px 5px; border-radius: 5px; color: #b45309;
}
.md pre {
  background: #f7f9fc; border: 1px solid var(--line);
  padding: 13px 15px; border-radius: var(--r-sm); overflow-x: auto; margin: 0 0 .8em;
}
.md pre code { background: none; padding: 0; color: #334155; font-size: 12.5px; }
.md blockquote {
  margin: 0 0 .8em; padding: 9px 15px;
  border-left: 3px solid var(--brand-200); background: var(--surface-2);
  color: var(--t2); border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.md hr { border: none; border-top: 1px solid var(--line); margin: 1.3em 0; }
.md table { border-collapse: collapse; margin: 0 0 .8em; font-size: 13.5px; width: 100%; }
.md th, .md td { border: 1px solid var(--line-2); padding: 7px 11px; text-align: left; }
.md th { background: var(--surface-2); font-weight: 600; }

/* 手机上多列表格会被压成一字一行（2026-10-19 截图：6 列表格竖着念）。
   窄屏改成横向滚动 + 单元格不折行：宁可手指横滑一下，也不要竖排单字。
   桌面保持原来的 100% 自适应，不受影响。 */
@media (max-width: 720px) {
  .md table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .md th, .md td { white-space: nowrap; }
}
.md a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

/* ==================== 加到桌面 ==================== */

.page-wrap-narrow { max-width: 760px; }

.install-hero { display: flex; align-items: center; gap: 24px; }
.install-icon {
  flex: 0 0 auto; width: 104px; height: 104px; border-radius: 24px;
  box-shadow: 0 10px 26px rgba(37, 99, 235, .26), 0 2px 6px rgba(16, 24, 40, .08);
}
.install-hero-txt { min-width: 0; }
.install-hero-txt h3 { margin: 0 0 8px; font-size: 18px; font-weight: 650; letter-spacing: -.2px; }
.install-hero-txt p {
  margin: 0 0 16px; font-size: 13.5px; line-height: 1.85; color: var(--t2); max-width: 520px;
}

.steps { list-style: none; counter-reset: st; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 13px; }
.steps li { counter-increment: st; display: flex; gap: 12px; align-items: flex-start;
  font-size: 13.5px; line-height: 1.75; color: var(--t1); }
.steps li > span { min-width: 0; }
.steps li b { font-weight: 650; color: var(--t1); }
.steps li::before {
  content: counter(st);
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: 1px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100);
  font-size: 12px; font-weight: 650;
}

/* 手机浏览器「菜单在哪」示意图 */
.menu-demo-wrap { margin: 0 0 20px; }
.menu-demo {
  display: block; width: 100%; max-width: 320px; height: auto;
  border-radius: 16px; box-shadow: var(--sh-1);
}
.menu-demo-cap { margin: 10px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--t2); }

.device-line {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--t3); display: flex; align-items: center;
  gap: 4px; flex-wrap: wrap;
}
.device-line b { color: var(--t2); font-weight: 550; }
.link-btn {
  background: none; border: none; padding: 0 2px; cursor: pointer;
  font-size: 12px; color: var(--brand); font-family: inherit;
  text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: var(--brand-700); }

/* flex-start 而不是 flex-end：三个示意图高度不一样，按底边对齐会让上方标题高低错落 */
.install-showcase { display: flex; gap: 40px; align-items: flex-start; flex-wrap: wrap; }
.showcase-item { display: flex; flex-direction: column; gap: 10px; }
.showcase-cap { font-size: 11.5px; color: var(--t3); }

.mob-mock {
  width: 118px; padding: 13px 10px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: var(--sh-2);
}
.mob-mock img { border-radius: 13px; }
.mob-mock b { font-size: 11px; font-weight: 500; }

.bar-mock {
  display: flex; align-items: center; gap: 10px;
  background: #1b1f2a; border-radius: 11px; padding: 9px 15px;
  color: #e8eaf0; font-size: 13px; width: 168px;
}
.bar-mock img { border-radius: 5px; }

.tab-mock {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--line); border-bottom: none;
  border-radius: 10px 10px 0 0; padding: 9px 14px; font-size: 13px;
  width: 148px; box-shadow: 0 -1px 3px rgba(16, 24, 40, .04);
}

.install-note { margin: 18px 0 0; font-size: 13px; line-height: 1.8; color: var(--t2); }

/* ==================== 场景模板页（底部栏「模板」） ==================== */

.tpl-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
.tpl-card {
  display: flex; align-items: flex-start; gap: 12px; text-align: left;
  padding: 14px 15px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--t1);
  transition: .16s var(--ease);
  cursor: pointer;                     /* 2026-10-19 起是 div（里面要放「个性化」按钮） */
}
.tpl-card:hover {
  border-color: var(--brand-200); background: var(--brand-50);
  box-shadow: var(--sh-2);
}
.tpl-card .tc-ic { font-size: 20px; line-height: 1.25; flex: 0 0 auto; }
.tpl-card .tc-body { flex: 1 1 auto; min-width: 0; display: block; }
.tpl-card .tc-body b { display: block; font-size: 14px; font-weight: 550; margin-bottom: 3px; }
.tpl-card .tc-desc {
  font-size: 12.5px; color: var(--t3); line-height: 1.65;
  /* 说明长短不一，统一压到两行，卡片高度才整齐 */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tpl-card .tc-go {
  flex: 0 0 auto; align-self: center;
  font-size: 12px; font-weight: 550; color: var(--brand);
  opacity: 0; transition: opacity .16s var(--ease);
}
.tpl-card:hover .tc-go { opacity: 1; }

/* 个性化（2026-10-19）：入口收成右侧一个小胶囊，不抢「用这个」的主次 */
.tpl-tip { margin-bottom: 10px; }
/* 场景编辑弹窗里的「标识锁死」说明。单独成行放，别塞进 label.field ——
   那里 label.field > span 的权重比 .sub-hint 高，会被当成第二个字段标签渲染。 */
.tpl-hint { margin: -8px 0 14px; color: var(--t3); font-size: 12px; line-height: 1.7; }
.tpl-card .tc-mine {
  margin-left: 6px; padding: 1px 5px; border-radius: 999px;
  font-size: 10.5px; font-weight: 500;
  color: var(--brand); background: var(--brand-50); border: 1px solid var(--brand-200);
}
.tpl-card .tc-side {
  flex: 0 0 auto; display: flex; flex-direction: column;
  align-items: flex-end; justify-content: center; gap: 8px;
}
.tpl-card .tc-edit {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--t2);
  font-size: 11.5px; line-height: 1.4; padding: 3px 8px; border-radius: 999px;
}
.tpl-card .tc-edit:hover {
  color: var(--brand); border-color: var(--brand-200); background: var(--brand-50);
}

/* ==================== 手机端底部导航栏 ====================
   桌面完全不显示（侧栏已经承担导航）；窄屏才出现，替代"每次都去拉抽屉"。

   高度写进 --tabbar-h，因为 .main 要靠它留出底部空间 ——
   否则固定定位的底栏会压住对话输入框和列表最后一行。 */

.tabbar { display: none; }

.tabbar .tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 0;
  border: none; background: none; cursor: pointer;
  color: var(--t3); font-size: 11px; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: color .14s var(--ease);
}
.tabbar .tab svg { width: 22px; height: 22px; }
.tabbar .tab.on { color: var(--brand); }
.tabbar .tab.on span { font-weight: 600; }
.tabbar .tab:active { color: var(--brand-400); }

/* 「我的」页（2026-10-16 起由底部抽屉改为全屏页面）。
   抽屉时代的 .sheet-mask / .sheet / .sheet-grip / .me-close 已删（死样式）。 */
.me-head { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; }
.me-avatar { width: 44px; height: 44px; border-radius: 50%; font-size: 17px; }
.me-id { min-width: 0; }
.me-id b { display: block; font-size: 15.5px; font-weight: 600; }
.me-id span { display: block; font-size: 12.5px; color: var(--t3); margin-top: 2px; }

.me-quota {
  background: var(--surface-2); border-radius: var(--r-md);
  padding: 12px 14px; margin-bottom: 14px;
}
.me-quota-top {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--t2); margin-bottom: 9px;
}
.me-quota-top b { color: var(--t1); }
.me-quota-hint { margin-top: 9px; font-size: 12px; color: var(--warn); }

.me-list { display: flex; flex-direction: column; }
.me-list button {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 13px 2px; text-align: left;
  border: none; background: none; cursor: pointer; font-family: inherit;
  color: var(--t1); font-size: 14.5px;
  border-bottom: 1px solid var(--line);
  transition: background .13s var(--ease);
}
.me-list button:last-child { border-bottom: none; }
.me-list button:active { background: var(--surface-2); }
.me-list button svg { width: 19px; height: 19px; color: var(--t3); flex: 0 0 auto; }
.me-list button.danger, .me-list button.danger svg { color: var(--danger); }
.me-lbl { flex: 1 1 auto; }
.me-go { color: var(--t3); font-size: 18px; line-height: 1; }
/* 版本号弱化小字（2026-10-16）：对话空态页与「我的」页共用。
   只读信息，做得比正文更淡，不抢视线 */
.ver-line {
  margin: 18px 0 0; font-size: 11.5px; letter-spacing: .2px;
  color: var(--t3); text-align: center; opacity: .75;
}


/* ==================== 手机 / 窄屏 ==================== */

.hide-sm { display: initial; }
.scrim { display: none; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 80;
    /* 刘海屏 / 沉浸容器：侧栏顶部不要压在状态栏下面 */
    padding-top: env(safe-area-inset-top, 0px);
    background: var(--surface);
    box-shadow: var(--sh-4);
    transform: translateX(-102%);
    transition: transform .24s var(--ease);
  }
  .sidebar.open { transform: none; }
  .scrim {
    display: block; position: fixed; inset: 0; z-index: 70;
    background: rgba(16, 24, 40, .42);
    backdrop-filter: blur(1.5px);
    animation: fadeIn .2s var(--ease);
  }
  .hamburger { display: grid; }
  /* 侧栏变成抽屉后，只保留「对话 / 我的产物 / 知识库」三项：
     消息和工作分工在底部栏已经有了，抽屉里再列一遍就是重复入口（用户 2026-10-19 定）。 */
  .nav-wide { display: none; }
  /* 「我的」在手机上由底部栏第四格承担，抽屉里不再重复出现（2026-10-16） */
  .sb-me { display: none; }
  .tb-title { max-width: 52%; }
  .page-wrap { padding: 18px 14px 40px; }

  /* ---------- 底部导航 ---------- */
  /* z-index 60：低于抽屉(80)和遮罩(70)，所以拉开抽屉时底栏会被一起压暗，
     不会出现"抽屉在上面飘、底栏还亮着"的分裂感。 */
  .tabbar {
    /* 2026-10-19 起格数不再固定：管理员去掉「管理」后是 4 格，成员带「模板」是 5 格。
       固定 repeat(5) 会让管理员那行空出一格，改成按实际按钮数均分。 */
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: saturate(1.6) blur(10px);
    border-top: 1px solid var(--line);
  }

  /* 底栏是 fixed 的，会盖住内容 —— 让 .main 自己收掉这块高度，
     而不是给每个页面单独加 padding-bottom（那样一定会漏掉某一页）。 */
  .main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  /* 安全区已经在 .main 里留过一次，输入框不再重复加，否则底部多出一大截空白 */
  .composer { padding-bottom: 10px; }
}

@media (max-width: 760px) {
  .hide-sm { display: none !important; }
  .row { flex-direction: column; gap: 0; }
  .tb-sub { display: none; }
  .model-pill { display: none; }
  .scene-pick select { min-width: 112px; max-width: 150px; }

  .chat-col { padding: 0 14px; }
  .msgs { padding: 16px 0 6px; }
  .msg.assistant .msg-text { font-size: calc(var(--fs-prose) - .5px); }
  .msg.user .msg-body { max-width: 86%; }
  .msg-avatar { width: 26px; height: 26px; border-radius: 8px; }
  .msg + .msg { margin-top: 9px; }
  .msg.assistant + .msg.user { margin-top: 24px; }
  /* 手机是手指点：按钮放大到 32px 高（桌面 26px），横向内边距收窄一点，
     好让「复制 / 导出Word / 导出Excel / 时间」四个挤在一行里不折行。 */
  .msg-foot { gap: 5px; margin-top: 9px; min-height: 32px; }
  .mini { min-height: 32px; padding: 5px 8px; font-size: 12px; }
  .mini-txt { font-size: 12px; }

  .chat-empty { padding: 4vh 0 20px; }
  .ce-logo { width: 48px; height: 48px; border-radius: 15px; font-size: 13px; margin-bottom: 16px; }
  .ce-title { font-size: 20px; }
  .ce-sub { font-size: 13px; margin-bottom: 24px; }

  /* 底部安全区由 --tabbar-h + .main 的 padding 统一负责，这里不再重复补 */
  .composer { padding: 4px 0 10px; }
  .composer-box { padding: 8px 8px 8px 14px; border-radius: 20px; }
  /* 16px 是 iOS Safari 的阈值：低于它，输入框聚焦时 Safari 会自动放大整个页面
     （原来 15.5px，被放大过一次就得手动缩回去 —— 排 bug 报告 L15） */
  .composer-box textarea { font-size: 16px; }
  .composer-foot { display: none; }
  /* 手机是手指点：默认按钮高度从 32px 提到36px，减小误触。
     .btn-sm 在表格/任务卡里大量使用，集体抬一点比逐处改更一致。 */
  .btn { padding: 9px 14px; }
  .btn-sm { padding: 8px 11px; min-height: 36px; }
  .confirm-card { max-width: none; }
  .ccf-k { flex: 0 0 62px; }
  .cc-foot { flex-wrap: wrap; }
  .cc-hint { width: 100%; }
  .modal { max-height: 93vh; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  .req { flex-direction: column; gap: 10px; }
  .req-side { flex-direction: row; align-items: center; justify-content: flex-end; }

  /* 模板页：手机上单列，双列会把说明挤成两三个字一行 */
  .tpl-grid { grid-template-columns: 1fr; }
  .tpl-card .tc-go { opacity: 1; }   /* 手机没有 hover，直接亮出来 */

  /* 管理页表格：窄屏**不压列**，改成横向滚动。
     压到每列两个字（「中英互译」「管理员」竖着排）比滚动难读得多。
     760px ≈ 账号表 7 列 / 场景表 7 列在中文下不换行的最小宽度
     （状态列从徽章换成开关后变宽 ~40px，680 → 760，实测单行不换行）。 */
  .tbl { min-width: 760px; }
  /* 窄屏下单元格一律不换行：min-width 只是"差不多够"，真实姓名/用户名一长
     （「开关测试账号」这种）最后一列的时间就会被挤成两行。
     表格本身已经能横向滚动，所以让列保持单行、溢出交给滚动条最稳。
     需要的宽度可以用 _verify/probe_table_width.js 量。 */
  .tbl td { white-space: nowrap; }

  /* 加到桌面：图标与文字改上下排 */
  .install-hero { flex-direction: column; align-items: flex-start; gap: 18px; }
  .install-icon { width: 84px; height: 84px; border-radius: 20px; }
  .install-hero-txt h3 { font-size: 16.5px; }
  .install-showcase { gap: 26px; }
}

/* ==================== 知识库（P3 上传检索 / P4 问答） ==================== */

/* ---------- 知识库：公共库 / 我的库 两个页签（2026-10-20） ---------- */
.kb-tabs {
  display: flex; gap: 6px; margin-bottom: 12px;
  padding: 4px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.kb-tabs button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 10px; border: 0; border-radius: 9px; background: none;
  color: var(--t2); font-size: 13.5px; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.kb-tabs button.on {
  background: var(--surface); color: var(--t1); font-weight: 500;
  box-shadow: 0 1px 2px rgba(20, 22, 26, .08);
}
.kb-tab-cnt {
  min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--surface-3); color: var(--t2);
  font-size: 11.5px; line-height: 18px; text-align: center;
}
.kb-tabs button.on .kb-tab-cnt { background: var(--brand-100); color: var(--brand-700); }

/* 成员的公共库页：原本上传框的位置换成说明块，告诉他该走哪条路 */
.kb-apply-note {
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--brand-50); border: 1px solid var(--brand-200);
  color: var(--t2); font-size: 13px; line-height: 1.85;
}
.kb-apply-note b { color: var(--brand-700); }

.kb-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 26px 18px; text-align: center;
  border: 1.5px dashed var(--line-2); border-radius: var(--r-md);
  background: var(--surface-2); color: var(--t2); cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.kb-drop:hover { border-color: var(--brand-400); background: var(--brand-50); }
.kb-drop.busy { cursor: progress; opacity: .72; }
.kb-drop b { font-size: 14px; color: var(--t1); font-weight: 500; }
.kb-drop span { font-size: 12px; color: var(--t3); }
/* 常驻的「别传照片」提示。要盖过上面的 .kb-drop span，选择器必须多一层 */
.kb-drop .kb-drop-note { color: var(--warn); }
.kb-file { display: none; }        /* 真正被点的是上面那块区域，input 只是载体 */

/* 折叠说明：默认收起，只占一行，不跟上传区抢注意力 */
.kb-tip-toggle {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px; padding: 0; border: 0; background: none;
  font: inherit; font-size: 12.5px; color: var(--brand);
  cursor: pointer;
}
.kb-tip-toggle:hover { color: var(--brand-700); text-decoration: underline; }
.kb-tip-arrow {
  display: inline-block; font-size: 15px; line-height: 1;
  transition: transform .15s var(--ease);
}
.kb-tip-arrow.open { transform: rotate(90deg); }
.kb-tip-body {
  margin-top: 10px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 12.5px; line-height: 1.85; color: var(--t2);
}
.kb-tip-body p { margin: 0 0 8px; }
.kb-tip-body p:last-child { margin-bottom: 0; }
.kb-tip-body b { color: var(--t1); font-weight: 600; }
.kb-tip-body ol { margin: 0 0 8px; padding-left: 20px; }
.kb-tip-body li { margin-bottom: 6px; }
.kb-tip-body li:last-child { margin-bottom: 0; }
.kb-tip-note { color: var(--warn); }

.kb-stat { margin-top: 12px; font-size: 12.5px; color: var(--t2); }
.kb-stat b { color: var(--t1); }
.kb-bad { color: var(--danger); }
.kb-cap { color: var(--t3); margin-left: 4px; }

/* 文档行没有详情页可点，去掉手型光标，免得用户以为点得进去 */
.kb-rec { cursor: default; }
/* 列表行右侧的按钮组（知识库文档行 / 我的产物行共用） */
.rec-acts { display: flex; gap: 6px; flex: 0 0 auto; }
.rec-err {
  margin-top: 6px; padding: 5px 8px; font-size: 12px; line-height: 1.6;
  color: var(--danger); background: var(--danger-bg);
  border: 1px solid var(--danger-bd); border-radius: var(--r-xs);
}

.kb-probe { display: flex; gap: 8px; }
.kb-input {
  flex: 1 1 auto; min-width: 0; padding: 9px 12px;
  font: inherit; font-size: 14px; color: var(--t1); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
}
.kb-input:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-50); }
.kb-note { margin-top: 10px; font-size: 12.5px; color: var(--t3); }
.kb-hit { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.kb-hit-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--surface-2);
  font-size: 12.5px; color: var(--t2);
}
.kb-hit-head b { color: var(--t1); font-weight: 500; }
.kb-hit-body {
  padding: 10px 12px; font-size: 13px; line-height: 1.75; color: var(--t2);
  max-height: 200px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}

/* ⚠️ 「参考来源」那套（.src-box / .src-head / .src-item / .src-main / .src-meta）
   v1.0.0 下线出处时已经**真删**（2026-10-17）。只剩 .src-no 有用 ——
   知识库页「试查一下」的结果列表拿它当序号格子，别一起删。 */
.src-no {
  flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-100); color: var(--brand-700);
  font-size: 11px; font-weight: 600;
}

@media (max-width: 720px) {
  .rec-acts { flex-wrap: wrap; }
  .kb-probe { flex-wrap: wrap; }
}

/* ==================== 成员产出 → 入库申请（2026-10-06） ==================== */

/* ⚠️ 成员端**故意不给任何提示**（用户明确要求「不需要成员知道」）：
   他写的东西被工具自动交去审核这件事，界面上一个字都不出现。
   所以这里没有「气泡下状态条」那类样式，投稿状态只有管理员的「入库申请」页能看到。 */

/* 管理页「入库申请」卡里的 AI 判断理由 */
.sub-ai {
  margin-top: 6px; padding: 7px 10px; font-size: 12.5px; line-height: 1.7;
  color: var(--t2); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.sub-ai b { color: var(--t1); font-weight: 550; }

/* 展开的投稿全文 */
.sub-full { margin-top: 8px; }
.sub-pre {
  margin: 0; padding: 10px 12px; max-height: 260px; overflow: auto;
  font: inherit; font-size: 12.5px; line-height: 1.75; color: var(--t2);
  background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  white-space: pre-wrap; word-break: break-word;
}

/* 驳回理由输入区 */
.sub-reject { margin-top: 8px; }
.sub-reject .kb-input { width: 100%; }
.sub-hint { color: var(--t3); font-size: 12px; }

/* ==================== 资源版本自检提示条（2026-10-06） ====================
   只在新旧版本不一致时出现。
   ⚠️ 必须 `fixed`、不能 `sticky`：页面外壳 `.shell` 写死了 `height: 100dvh`，
   而这条只是 `#app` 的前一个兄弟节点 —— 用 sticky 它会**占 36px 常规流高度**，
   把整个 shell 往下推：桌面端输入框被挤出首屏，手机端输入框被 fixed 的底栏盖住。 */
.upd-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  padding: 9px 14px; text-align: center; cursor: pointer;
  font-size: 13px; line-height: 1.4; color: #fff;
  background: var(--brand);
}
.upd-bar:hover { background: var(--brand-700); }

/* ==================== 科室分工（P6，2026-10-06） ==================== */

/* 分段切换：人员档案 / 任务分工 */
.seg {
  display: inline-flex; padding: 3px; gap: 3px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
}
.seg button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--t2); border-radius: 8px;
}
.seg button.on {
  background: var(--surface); color: var(--t1); font-weight: 550;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}

/* 多选标签容器（专长 / 需要的专业方向）—— .chip 本体沿用空态那套 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip.on {
  border-color: var(--brand-400); color: var(--brand-700);
  background: var(--brand-50); font-weight: 550;
}

/* 任务卡片：标题一行可点开 */
.task-card { margin-top: 12px; }
/* 任务名就是这张卡的信息主体，一行截断在手机上基本看不出是什么活。
   只放开换行、不做行数限制 —— 用 -webkit-line-clamp 会把同一行的徽章一起裁掉。 */
.task-head .rec-title {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.task-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; }
.task-head:hover { background: var(--surface-2); }
/* 卡片头上的「删除」（2026-11-01）：不参与挤压、不换行，标题该省略的由 .task-main 去省略 */
.task-del { flex: 0 0 auto; }
.task-main { flex: 1 1 auto; min-width: 0; }
.task-arrow {
  flex: 0 0 auto; color: var(--t3); font-size: 18px; line-height: 1;
  transition: transform .15s;
}
.task-arrow.open { transform: rotate(90deg); }
.task-body { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.task-detail {
  margin-top: 10px; padding: 9px 11px; font-size: 13px; line-height: 1.75;
  color: var(--t2); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  white-space: pre-wrap; word-break: break-word;
}

/* 分工行：姓名 / 角色 / 负责内容 / 期限 / 删除，全都能就地改 */
.asg-list { margin-top: 4px; }
.asg-row {
  display: grid; grid-template-columns: 118px 78px minmax(0, 1fr) 132px 46px;
  gap: 6px; align-items: center; padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.asg-row:last-child { border-bottom: 0; }
.asg-row select, .asg-row input {
  width: 100%; padding: 5px 8px; font: inherit; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--t1);
}
.asg-row select:focus, .asg-row input:focus {
  outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-50);
}
.asg-reason { grid-column: 1 / -1; font-size: 12px; line-height: 1.6; color: var(--t3); }

/* ---------- 执行段：交付物 / 状态 / 提交验收（2026-10-19 二期）----------
   这几块都靠 grid-column: 1 / -1 横跨整行，网格本身不动 ——
   手机上的两列布局照旧，只是每个分工行下面多几行信息。 */
.asg-deliver {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--t2);
}
.asg-deliver input {
  flex: 1 1 auto; min-width: 0;
}
.asg-k {
  flex: 0 0 46px; color: var(--t3); font-size: 12px;
}
.asg-status {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px;
}
.asg-acts {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.asg-acts .btn { font-size: 12px; padding: 4px 10px; }

/* 「我的任务」里的卡片：一列到底，不需要编辑控件 */
.mine-row { grid-template-columns: 1fr; gap: 8px; }
.asg-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.asg-line b { font-weight: 550; color: var(--t1); }

.submit-brief {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--surface-2); border-radius: 9px;
  font-size: 13px; color: var(--t2); line-height: 1.6;
}

@media (max-width: 720px) {
  /* 手机上五列放不下：拆成两列 —— 姓名+角色在一行，负责内容整行，期限和删除再一行 */
  .asg-row { grid-template-columns: 1fr 84px; }
  .asg-part { grid-column: 1 / -1; }
  .asg-due { grid-column: 1 / 2; }
  .asg-row > .btn { grid-column: 2 / 3; }
  .seg { display: flex; }
  .seg button { flex: 1 1 0; justify-content: center; }
}

/* ---------- 新建任务里的「AI 读材料」区（2026-10-19）----------
   把「说一句 + 传文件」和下面的手填字段分开：两者是替代关系，不是同一级。
   底色用 --bg（侧栏同色），和弹窗白底区分开，边界靠 1px 描边。 */
.draft-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px 8px;
  margin-bottom: 14px;
}
.draft-box .field > span { font-size: 13px; }

/* ---------- 拍照按钮：只在窄屏出现（2026-10-19）----------
   手机上有相机，桌面上 capture 无效、只会退化成选文件，露出来反而多一个没用的按钮。
   两种载体分开写：输入区的圆形按钮用 grid 居中，弹窗里的普通按钮用 inline-flex。 */
.att-btn.cam-only { display: none; }
.btn.cam-only { display: none; }
@media (max-width: 900px) {
  .att-btn.cam-only { display: grid; }
  .btn.cam-only { display: inline-flex; }
}


/* ---------- 「＋」菜单与拍摄预览（2026-10-19 第二轮）----------
   菜单挂在 .composer-box 里，靠它做定位锚点（给父级加 position:relative）。 */
.composer-box { position: relative; }

/* 视觉隐藏但仍可被脚本点击。display:none / visibility:hidden 的 file input
   在鸿蒙和部分国产内核上 click() 会被拦掉，这是任务弹窗拍照点不动的根因之一。
   2026-10-19 第四轮。 */
.sr-file {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; overflow: hidden; border: 0; padding: 0; margin: -1px;
}

.att-menu {
  position: absolute; left: 6px; bottom: 46px; z-index: 45;
  min-width: 168px; padding: 5px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 8px 26px rgba(16, 24, 40, .14);
}
.att-menu button {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 10px;
  border: 0; background: transparent; border-radius: 8px;
  font-size: 13px; color: var(--t1); text-align: left; cursor: pointer;
}
.att-menu button:hover { background: var(--surface-2); }
.att-menu .am-ic { font-size: 15px; line-height: 1; }

/* ---- 拍照 / 截图全屏舞台（2026-10-19 第三轮）---- */
.shoot-mask {
  position: fixed; inset: 0; z-index: 2000;
  background: #000;
  display: flex; align-items: center; justify-content: center;
}

/* 拍照：铺满屏幕的取景 + 底部圆形快门 */
.cam-loading {
  color: rgba(255, 255, 255, .82); font-size: 14px; letter-spacing: .3px;
}
.cam-stage { position: relative; width: 100%; height: 100%; background: #000; }
.cam-video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.cam-x {
  position: absolute; top: 14px; left: 14px; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16);
  color: #fff; font-size: 22px; line-height: 1; display: grid; place-items: center;
  cursor: pointer;
}
.cam-flip {
  position: absolute; top: 18px; right: 14px; padding: 8px 14px;
  border: 0; border-radius: 20px; background: rgba(255, 255, 255, .16);
  color: #fff; font-size: 13px; cursor: pointer;
}
.cam-bar {
  position: absolute; left: 0; right: 0;
  bottom: calc(24px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 30px;
}
.cam-side {
  min-width: 58px; background: transparent; border: 0;
  color: #fff; font-size: 13px; opacity: .88; cursor: pointer; text-align: center;
}
.cam-side.ghost { visibility: hidden; }
.cam-shutter {
  width: 74px; height: 74px; border-radius: 50%; padding: 0;
  background: transparent; border: 4px solid rgba(255, 255, 255, .9);
  display: grid; place-items: center; cursor: pointer;
}
.cam-shutter span {
  width: 58px; height: 58px; border-radius: 50%;
  background: #fff; display: block; transition: transform .1s var(--ease);
}
.cam-shutter:active span { transform: scale(.9); }

/* ==================== 2026-10-20 可读性与触摸区修正 ==================== */
/* 这一段的每一条都对应一次实测（audit_dom.js：量对比度、量命中区、量溢出），
   不是凭感觉调的。改动只影响窄屏，桌面观感不变。 */

@media (max-width: 900px) {
  /* 输入框右侧两个圆钮视觉上是 34px（跟输入框同高才好看），但手指点不住。
     用透明伪元素把命中区往外撑到 44px，视觉尺寸不动。 */
  .att-btn, .send-btn, .stop-btn { position: relative; }
  .att-btn::after, .send-btn::after, .stop-btn::after {
    content: ""; position: absolute; inset: -5px; border-radius: 50%;
  }
  /* 顶栏汉堡同理：38px 是为了跟「标题 + 版本号」两行齐平，不能放大，
     只把可点范围补到 46px。 */
  .hamburger { position: relative; }
  .hamburger::after { content: ""; position: absolute; inset: -4px; }

  /* 底栏文字 11px 在 390 宽的手机上偏小，11.5 是能读清又不挤的下限 */
  .tabbar .tab { font-size: 11.5px; }

  /* 知识库文档名的「出厂 / 购进」差别在最后几个字上，单行省略会全部截掉，
     两份材料在列表里长得一模一样。窄屏放开到两行。 */
  .rec-title {
    white-space: normal;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    overflow: hidden;
  }

  /* 管理页表格比屏宽（min-width 760），右边一定有内容看不到。
     内阴影是"还能往右滑"的通用暗示，不加文案、不改结构。 */
  .tbl-scroll { box-shadow: inset -14px 0 12px -12px rgba(16, 24, 40, .22); }

  /* 账号表 / 场景表：窄屏各砍两列次要信息，让剩下的列一屏放得下。
     账号表砍「本月用量」「最后登录」，场景表砍「输出格式」「排序」——
     这四项都是"想细看时到电脑上看"的信息，而「状态」开关和「操作」按钮
     必须能在手机上直接点到（原来是横向拖到底才看得见，等于藏起来了）。
     人员档案表不动：那 7 列都是判断派活的依据，砍哪一列都会误导。 */
  .tbl-users { min-width: 0; }
  .tbl-users th, .tbl-users td { white-space: normal; padding: 10px 8px; }
  .tbl-users th:nth-child(5), .tbl-users td:nth-child(5),
  .tbl-users th:nth-child(6), .tbl-users td:nth-child(6) { display: none; }
  /* 五列仍塞不进 390。再让两样东西让位：
     ① 登录名（第 1 列）—— 科室内靠姓名认人，登录名在「编辑」里看得到；
     ② 开关里的「启用 / 禁用」两个字 —— 滑块位置和颜色已经说明了状态。
     这两处让出来的宽度全给「状态」和「操作」，让它们能在首屏直接点到。 */
  .tbl-users th:nth-child(1), .tbl-users td:nth-child(1) { display: none; }
  .tbl-users .sw-txt { display: none; }
  .tbl-users .sw { padding: 4px 6px; gap: 0; }
  .tbl-users th:nth-child(2), .tbl-users td:nth-child(2) { white-space: nowrap; }
  .tbl-users td:nth-child(7) .btn-sm { padding: 8px 7px; }
  /* 「编辑 / 删除」两列不再钉右侧：五列压到 390 以内以后不需要横滑，
     钉住反而把操作列推到容器最右，中间空出一块白。
     只有 320~360 这类极窄屏放不下时才钉，那里横滑是必须的。 */
  @media (max-width: 380px) {
    .tbl-users th:nth-child(7), .tbl-users td:nth-child(7) {
      position: sticky; right: 0; background: var(--surface);
      box-shadow: -6px 0 6px -6px rgba(16, 24, 40, .10);
    }
  }

  .tbl-tpls { min-width: 0; }
  .tbl-tpls th, .tbl-tpls td { white-space: normal; padding: 10px 9px; }
  .tbl-tpls th:nth-child(3), .tbl-tpls td:nth-child(3),
  .tbl-tpls th:nth-child(6), .tbl-tpls td:nth-child(6) { display: none; }
}
