/* 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;          /* 次要文字 */
  --t3: #8b929e;          /* 辅助 / 占位 */

  /* 用户气泡：比品牌 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-ghost { border-color: transparent; background: transparent; color: var(--t2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; color: var(--t1); }

.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; }
.pwd-eye svg { width: 17px; height: 17px; display: block; }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

.switch { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--t2); cursor: pointer; }

/* ==================== 登录页 ==================== */

.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); }

.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 { opacity: 1; }
.si-del:hover { background: var(--danger-bg); color: var(--danger); }

.sb-empty { padding: 14px 11px; font-size: 12.5px; color: var(--t3); }

.sb-foot {
  position: relative; flex: 0 0 auto;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
}
.sb-user {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 8px; border: none; background: transparent;
  border-radius: var(--r-sm); text-align: left;
  transition: background .13s var(--ease);
}
.sb-user:hover { background: var(--surface-3); }
.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;
}
.sb-user-txt { flex: 1 1 auto; min-width: 0; }
.sb-user-txt b { display: block; font-size: 13px; font-weight: 550; color: var(--t1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-txt span { display: block; font-size: 11px; color: var(--t3); }
.sb-user .svg-ico { color: var(--t3); }

.quota-mini { padding: 8px 9px 2px; }
.quota-mini .qm-top {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 11.5px; color: var(--t3);
}
.quota-mini .qm-top b { color: var(--t2); font-weight: 600; font-size: 12px; }
.quota-mini .qm-bar {
  height: 4px; border-radius: 2px; background: var(--surface-3);
  margin-top: 6px; overflow: hidden;
}
.quota-mini .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);
}
.quota-mini .qm-bar > i.full { background: linear-gradient(90deg, #f59e0b, var(--danger)); }

/* 用户菜单气泡 */
.pop-mask { position: fixed; inset: 0; z-index: 55; }
.pop {
  position: absolute; left: 10px; right: 10px; bottom: calc(100% - 6px);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--sh-3);
  padding: 5px; z-index: 60;
  animation: pop .16s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.pop-head {
  padding: 9px 10px 8px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.pop-head b { display: block; font-size: 13.5px; font-weight: 600; }
.pop-head span { display: block; font-size: 11.5px; color: var(--t3); margin-top: 2px; }
/* 菜单里的分组线：上面是「管理 / 加到桌面」这类功能入口，下面是「修改密码 / 退出登录」这类账号操作 */
.pop-sep { height: 1px; background: var(--line); margin: 4px 8px; }
.pop button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 10px; border: none; background: none;
  border-radius: var(--r-xs);
  font-size: 13.5px; color: var(--t2); text-align: left;
  transition: .13s var(--ease);
}
.pop button:hover { background: var(--surface-2); color: var(--t1); }
.pop button.danger:hover { background: var(--danger-bg); color: var(--danger); }
/* 菜单最底的版本号：只读信息，做成弱化的一行，不像一个可点的菜单项 */
.pop-ver {
  padding: 7px 10px 5px; font-size: 11.5px; letter-spacing: .2px;
  color: var(--t3); text-align: center;
}

/* ---------- 主区 ---------- */

.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 {
  display: none; width: 32px; height: 32px; 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; }
.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; }
.page-head { margin-bottom: 18px; }
.page-head h2 { margin: 0 0 4px; font-size: 19px; font-weight: 650; letter-spacing: -.2px; }
.page-head p { margin: 0; color: var(--t3); font-size: 13px; }

/* 场景选择器（顶栏右侧） */
.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;
  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; }

.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; }

/* ==================== 界面外观（管理页，只读） ==================== */

.ui-note { margin: 0; font-size: 13px; line-height: 1.8; color: var(--t2); }
.ui-note b { color: var(--t1); font-weight: 600; }
.ui-note + .ui-changed { margin-top: 14px; }

.ui-changed-title {
  font-size: 11.5px; font-weight: 600; letter-spacing: .4px;
  color: var(--t3); margin-bottom: 8px;
}
.ui-changed-row {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--brand-50); border: 1px solid var(--brand-100);
  margin-bottom: 6px; font-size: 13px;
}
.ui-changed-row:last-child { margin-bottom: 0; }
.ui-changed-row b { flex: 0 0 104px; font-weight: 550; }
.ui-before { font-family: var(--mono); font-size: 12px; color: var(--t3); }
.ui-arrow { color: var(--t3); }
.ui-after { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--brand); }

/* ==================== 变更申请（管理页） ==================== */

.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); }

/* 管理页里"启用"的说明性徽章（管理员账号那行用）*/
.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); }
.alert.info { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }

.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);
}
@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; }
.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); }

.ce-label {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 10px; font-size: 11.5px; font-weight: 600;
  letter-spacing: .5px; color: var(--t3); text-align: left;
}
.ce-label::after { content: ''; flex: 1 1 auto; height: 1px; background: var(--line); }

.ce-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 26px; }
.ce-card {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
  transition: .16s var(--ease);
}
.ce-card:hover {
  border-color: var(--brand-200); background: var(--brand-50);
  transform: translateY(-1px); box-shadow: var(--sh-2);
}
.ce-card .ic { font-size: 18px; line-height: 1.3; flex: 0 0 auto; }
.ce-card-txt { min-width: 0; }
.ce-card-txt b { display: block; font-size: 13.5px; font-weight: 550; color: var(--t1); margin-bottom: 2px; }
.ce-card-txt span {
  display: block; font-size: 11.5px; color: var(--t3); line-height: 1.6;
  overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.ce-card:hover .ce-card-txt b { color: var(--brand-700); }

.ce-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; }
.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); }

.msg-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; min-height: 18px; }
.mini {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: var(--r-xs);
  border: none; background: transparent;
  font-size: 12px; color: var(--t3);
  opacity: 0; transition: .15s var(--ease);
}
.msg:hover .mini, .mini:focus-visible { opacity: 1; }
.mini:hover { background: var(--surface-2); color: var(--t2); }
.mini-txt { font-size: 11.5px; color: var(--t3); opacity: 0; transition: opacity .15s var(--ease); }
.msg:hover .mini-txt { opacity: .8; }

/* ---------- 危险操作确认卡 ---------- */

.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); }

.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; }

/* ==================== 输出区（记录详情 / 公文预览） ==================== */

.output {
  min-height: 160px; max-height: 60vh; overflow-y: auto;
  padding: 18px 20px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2);
  word-break: break-word;
}
.output.plain { white-space: pre-wrap; font-size: 14.5px; line-height: 1.85; }
.output.code {
  white-space: pre-wrap; font-family: var(--mono);
  font-size: 12.5px; line-height: 1.75; color: #334155; background: #f8fafc;
}
.output.small { min-height: 84px; max-height: 40vh; }

.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 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; }
.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);
}
.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; }

/* ==================== 手机端底部导航栏 ====================
   桌面完全不显示（侧栏已经承担导航）；窄屏才出现，替代"每次都去拉抽屉"。

   高度写进 --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); }

/* ==================== 「我的」底部抽屉 ====================
   从屏幕底部滑上来，比居中弹窗更贴近手机上的操作习惯（拇指在下半屏）。 */

.sheet-mask { align-items: flex-end; padding: 0; }
.sheet {
  width: 100%; max-width: 560px;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 8px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -18px 48px rgba(16, 24, 40, .22);
  animation: sheetIn .22s var(--ease);
}
@keyframes sheetIn { from { transform: translateY(100%); } }
.sheet-grip {
  width: 38px; height: 4px; border-radius: 999px; margin: 0 auto 14px;
  background: var(--line-2);
}

.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; }

.me-close { width: 100%; margin-top: 16px; }

/* ==================== 手机 / 窄屏 ==================== */

.hide-sm { display: initial; }
.scrim { display: none; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 80;
    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; }
  .tb-title { max-width: 52%; }
  .page-wrap { padding: 18px 14px 40px; }

  /* ---------- 底部导航 ---------- */
  /* z-index 60：低于抽屉(80)和遮罩(70)，所以拉开抽屉时底栏会被一起压暗，
     不会出现"抽屉在上面飘、底栏还亮着"的分裂感。 */
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 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; }

  .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; }
  .ce-cards { grid-template-columns: 1fr; gap: 8px; margin-bottom: 22px; }
  .ce-card { padding: 11px 13px; }

  /* 底部安全区由 --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; }
  .confirm-card { max-width: none; }
  .ccf-k { flex: 0 0 62px; }
  .cc-foot { flex-wrap: wrap; }
  .cc-hint { width: 100%; }
  .output { max-height: none; }
  .modal { max-height: 93vh; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* 界面外观：手机上标签与数值改上下排 */
  .ui-changed-row { flex-direction: column; gap: 4px; }
  .ui-changed-row b { flex: 0 0 auto; }
  .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 问答） ==================== */

.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; }
.kb-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;
}

/* 对话气泡下面的「参考来源」——正文里的【1】【2】靠它才落得了地 */
.src-box {
  margin-top: 10px; padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.src-head {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px; font-size: 12px; color: var(--t3);
}
.src-item { display: flex; gap: 8px; padding: 4px 0; font-size: 13px; }
.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;
}
.src-main { min-width: 0; display: flex; flex-direction: column; }
.src-main b { color: var(--t1); font-weight: 500; }
.src-meta { margin-top: 1px; font-size: 11.5px; color: var(--t3); }

/* 「参考来源」那套样式（.src-box / .src-head / .src-item / .src-main / .src-meta）
   2026-10-06 起对话气泡不再用了（用户要求不带出处），但**没删**：
   `.src-no` 还被知识库页的「试查一下」结果用着，而且万一以后要重新开启引用，
   样式还在原地。只留着不碍事，删错了要重新对一遍。 */

@media (max-width: 720px) {
  .kb-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-600, #185FA5);
}
.upd-bar:hover { background: var(--brand-700, #0C447C); }

/* ==================== 科室分工（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; }
.task-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; }
.task-head:hover { background: var(--surface-2); }
.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); }

@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; }
}
