/* ============================================================
   知识星球智能客服系统 — 设计系统 v2
   样式规范源 = docs/需求记录/2026-08-08/20260808_知识星球智能客服系统三端原型.html
   的 <style> 块（L9-L55），段落序与原型 style 块对应。三端页面级样式
   （agent-grid / admin-page 等）全在本文件，模板里不写 <style>，用户端 / 客服端 /
   管理端改版原则上只写模板与 JS，不新增大段 CSS。
   唯一例外：登录 / 注册页——原型本身没有登录流程，其 .auth-* 样式在文件
   末尾单独一节自建，复用本文件的 tokens 与 .btn / .control 等通用组件。
   ============================================================ */

/* ----------------------------------------------------------
   tokens（原型 L10-16）
   ---------------------------------------------------------- */
:root {
  --brand:#19b69a; --brand-dark:#0e806c; --brand-soft:#e8f8f4;
  --bg:#f4f6f7; --surface:#fff; --line:#e1e6e9; --line-strong:#cbd3d8;
  --text:#202529; --muted:#6f7880; --warning:#cf8218; --warning-soft:#fff6e7;
  --danger:#df6048; --danger-soft:#fff1ed; --success:#188664; --success-soft:#e8f6f0;
  --purple:#6d59a8; --purple-soft:#f2eefb; --shadow:0 14px 40px rgba(28,43,49,.12);
  --radius:6px;
  /* 管理端页头带高：右侧 .admin-topbar 与左栏首个分组标题共用，两列首行才齐平 */
  --topbar-height:48px;
}

/* ----------------------------------------------------------
   基础重置（原型 L17-19）
   ---------------------------------------------------------- */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  /* 微信 iOS 按字体档位给 body 写行内 text-size-adjust、只缩放文字：档位偏小时 16px 输入框
     实际不足 16px，聚焦即整页放大。锁 100%，!important 才压得住行内样式 */
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

/* touch-action：触屏默认要等双击缩放判定才派发 click，表现为「第一次点没反应」 */
a,
button {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

/* ----------------------------------------------------------
   全局壳：shell / app-main / mode-pill；.brand-mark 供登录 / 注册页的
   .auth-brand-mark 复用
   ---------------------------------------------------------- */
.shell {
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  min-height: 0;
  display: flex;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--brand);
  border-radius: 6px;
  font-weight: 750;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 2px 8px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 4px;
  font-size: 12px;
}

.mode-pill.manual {
  color: var(--danger);
  background: var(--danger-soft);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ----------------------------------------------------------
   通用组件：按钮 / 控件 / 面板 / toast / modal / 状态色
   （原型 L26-30，.status 四色原型物理位置在 L43，按用途归入通用组件）
   ---------------------------------------------------------- */
.btn {
  min-height: 34px;
  /* 按钮也可能是 <a>（微信登录 / 跨台入口 / 附件下载）：链接默认带下划线，看着不像按钮 */
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  white-space: nowrap;
}

.btn:hover {
  background: #f8faf9;
  border-color: #a6b0b5;
}

.btn.primary {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.btn.primary:hover {
  background: #119b82;
}

.btn.danger {
  color: var(--danger);
  border-color: #efb8ad;
}

.btn.danger.filled {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.btn.icon {
  width: 34px;
  padding: 0;
}

.btn.small {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

/* 表格操作列：同排按钮之间留出距离，别紧贴（账号管理的通过 / 拒绝就是这一排） */
.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.control {
  height: 34px;
  padding: 0 10px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
}

.control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(25, 182, 154, .12);
}

textarea.control {
  height: auto;
  padding: 9px 10px;
  line-height: 1.6;
  resize: vertical;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel-head {
  min-height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 {
  margin: 0;
  font-size: 15px;
}

.panel-body {
  padding: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translate(-50%, 18px);
  padding: 10px 14px;
  color: #fff;
  background: #263237;
  border-radius: 5px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: .18s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(21, 30, 34, .46);
}

.modal-backdrop.open {
  display: grid;
}

.modal {
  /* 百分比相对遮罩内容区（已扣 20px 内边距）；vw 会把内边距算漏，手机上溢出 */
  width: min(560px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.modal-head,
.modal-foot {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-head {
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 17px;
}

.modal-body {
  padding: 16px;
}

/* 确认类弹层：正文只有一句话，头尾的分区线纯属噪声（分区线是给可滚动长表单用的） */
.modal.confirm .modal-head {
  border-bottom: 0;
  padding-bottom: 0;
}

.modal.confirm .modal-foot {
  border-top: 0;
  padding-top: 0;
}

.modal-foot {
  border-top: 1px solid var(--line);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 12px;
}

.status.success {
  color: var(--success);
  background: var(--success-soft);
}

.status.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.status.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.status.ai {
  color: var(--purple);
  background: var(--purple-soft);
}

/* 用户自填内容（用户名 / 昵称 / 文件名 / 消息正文 / 引用原文）可能没有断行机会：允许任意断行，不撑破容器 */
.agent-msg-name,
.conv-head,
.chat-head,
.kv,
.quote,
.attachment-chip,
.message-body {
  overflow-wrap: anywhere;
}

/* ----------------------------------------------------------
   用户端结构样式：单栏自适应聊天页
   桌面居中一栏（最宽 900px，两侧留 --bg 底衬），窄屏走 ≤760px 断点铺满全宽；
   消息区是头像 + 无边框圆角气泡、输入区是胶囊样式（参考稿
   docs/需求记录/2026-09-14/图片和附件/image1.png 右图）。
   ---------------------------------------------------------- */

/* 本页品牌绿 = 产品 LOGO 绿：只覆盖用户对话页（body 级的确认弹层与提示条一并生效），
   :root 取自原型的 token 与客服端 / 管理端不动 */
.user-chat-page {
  --brand: #20af90;
  --brand-dark: #20af90;
}

.chat-app {
  width: min(900px, 100%);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f7f7f7;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.app-head {
  min-height: 54px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

/* 页头一行：当前接待方昵称（过长省略）+ 状态。状态放不下（如「消息过长…」这类长提示）时整段换到
   昵称下一行、再长就折行，不压住右侧按钮、也不把昵称挤没 */
.app-head-title {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
}

.app-head h1 {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.app-head-sub {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

/* 昵称后的状态只在排队时有字：空着时连同后面的分隔点一起不占位 */
.chat-state:empty,
.chat-state:empty + span {
  display: none;
}

.app-head-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.app-head-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.app-messages {
  flex: 1;
  min-height: 0;
  padding: 16px 13px;
  overflow-y: auto;
}

.msg-row {
  margin-bottom: 14px;
}

/* 头像与内容（气泡 / 参考图 / 附件）同一行、顶边对齐；评价与时间行在下方，与气泡边缘对齐 */
.msg-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.msg-row.user .msg-line {
  flex-direction: row-reverse;
}

.msg-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

/* 产品 LOGO 头像：白色圆底 + 浅灰描边，LOGO 居中 16px */
.msg-avatar.is-service {
  padding: 9px;
  background: #fff;
  border: 1px solid #e3e7e9;
}

.msg-block {
  min-width: 0;
  max-width: 78%;
}

/* 排在最前的一项不留上边距：纯图片消息没有气泡，附件列表与气泡之间的间距会让图片低于头像 */
.msg-block > :first-child {
  margin-top: 0;
}

.msg-row > .feedback-actions,
.msg-row > .msg-time {
  margin-left: 46px;
}

.msg-row.user > .msg-time {
  margin-right: 46px;
  text-align: right;
}

/* 气泡按内容收窄：msg-block 的宽度由最宽子项（常是附件列表）决定，块级气泡会被撑到同宽 */
.msg-bubble {
  width: fit-content;
  max-width: 100%;
  padding: 11px 16px;
  background: #fff;
  border-radius: 18px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

/* 用户气泡：浅 LOGO 绿底 + 正文深色字（LOGO 绿按 25% 叠在白色上，对比度约 12:1） */
.msg-row.user .msg-bubble {
  margin-left: auto;
  background: #c7ebe3;
}

/* 附件在气泡外、与气泡并列：用户侧同样靠右，否则短正文 + 缩略图会一右一左 */
.msg-row.user .attachment-list {
  justify-content: flex-end;
}

.msg-time {
  margin: 3px 5px 0;
  color: #9aa2a6;
  font-size: 10px;
}

.system-msg {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  width: fit-content;
  max-width: 94%;
  margin: 12px auto;
  padding: 6px 9px;
  color: #677278;
  background: #e1e7e9;
  border-radius: 4px;
  font-size: 11px;
  text-align: center;
}

.feedback-actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
}

.feedback-actions button {
  width: 28px;
  height: 26px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.feedback-actions button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.feedback-actions button.active {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-soft);
}

.app-composer {
  padding: 9px 10px calc(12px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--line);
}

.composer-line {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 66px;
  gap: 7px;
  align-items: end;
}

/* 输入框：浅灰胶囊、无边框（键盘聚焦描边走全局 :focus-visible） */
.composer-line textarea {
  min-height: 38px;
  max-height: 90px;
  padding: 8px 14px;
  resize: none;
  background: #f1f1f1;
  border: 0;
  border-radius: 19px;
}

.composer-line button {
  height: 38px;
}

/* 回形针：无边框灰色图标，点击区域不变 */
.composer-line .btn.icon {
  color: #8a9398;
  background: transparent;
  border: 0;
}

.composer-line .btn.icon svg {
  width: 22px;
  height: 22px;
}

.composer-line .btn.primary {
  border-radius: 19px;
  font-weight: 650;
}

/* ----------------------------------------------------------
   聊天共用小件回补（原型没有对应演示：登录身份、Markdown 正文排版、
   附件 chip、结束面板）。类名沿用既有约定，客服端 / 管理端复用同一套。
   ---------------------------------------------------------- */
.profile-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 50%;
}

.profile-avatar svg {
  width: 18px;
  height: 18px;
}

.is-online {
  color: var(--success);
}

.is-warning {
  color: var(--warning);
}

.btn:disabled,
.feedback-actions button:disabled {
  opacity: .55;
}

.message-body > :first-child {
  margin-top: 0;
}

.message-body > :last-child {
  margin-bottom: 0;
}

.message-body img {
  max-width: 100%;
}

.message-body pre {
  padding: 8px 9px;
  overflow-x: auto;
  background: #f5f7f8;
  border-radius: 4px;
}

.message-body ul,
.message-body ol {
  margin: 6px 0;
  padding-left: 20px;
}

.attachment-list,
.reference-image-list,
.pending-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attachment-list,
.reference-image-list {
  margin-top: 6px;
}

.attachment-list:empty,
.reference-image-list:empty {
  display: none;
}

/* 拖文件悬停在落点（聊天区）上时的接收高亮（common.js 深度计数控制加减） */
.is-attachment-drop-active {
  outline: 2px dashed var(--brand);
  outline-offset: -6px;
  background: var(--brand-soft);
}

.attachment-chip {
  max-width: 100%;
  padding: 4px 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--brand-dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  text-decoration: none;
}

.attachment-chip img,
.reference-image img {
  max-width: 100%;
  max-height: 120px;
  border-radius: 4px;
}

.pending-attachments {
  margin-bottom: 7px;
}

.pending-attachment-chip {
  max-width: 100%;
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f5f7f8;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
}

.pending-attachment-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-attachment-remove {
  padding: 0 2px;
  color: var(--muted);
  background: transparent;
  border: 0;
}

.closed-panel {
  padding: 12px;
  display: grid;
  gap: 8px;
  justify-items: center;
  background: #fff;
  border-top: 1px solid var(--line);
  text-align: center;
}

.closed-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

/* ----------------------------------------------------------
   客服端结构样式（原型 L40-43 / Agent web）
   ---------------------------------------------------------- */
.agent-shell {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: 54px minmax(0, 1fr);
  overflow: hidden;
  background: #eef2f3;
}

.agent-top {
  padding: 0 16px;
  display: flex;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.agent-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-status-select {
  height: 30px;
  padding: 0 28px 0 9px;
  color: var(--brand-dark);
  background: #fff;
  border: 1px solid #a9ded2;
  border-radius: 5px;
  font-weight: 650;
}

/* 顶栏之下：左侧两项导航（当前对话 / 会话记录，复用 .admin-nav 样式）+ 右侧页面区
   （工作台三栏 或 会话记录页二选一显示） */
.agent-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  overflow: hidden;
}

.agent-nav {
  padding-top: 8px;
}

.agent-pages {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.agent-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 290px minmax(420px, 1fr) 290px;
  overflow: hidden;
}

.agent-list {
  min-height: 0;
  overflow: auto;
  background: #fff;
  border-right: 1px solid var(--line);
}

.list-summary {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
}

.list-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mini-stat {
  padding: 7px 5px;
  color: var(--text);
  text-align: center;
  background: #f5f7f8;
  border: 1px solid transparent;
  border-radius: 4px;
}

.mini-stat:hover {
  border-color: #a8dace;
}

.mini-stat.active {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: var(--brand);
}

.mini-stat strong {
  display: block;
  font-size: 17px;
}

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

.mini-stat.active span {
  color: var(--brand-dark);
}

.list-section-label {
  padding: 10px 13px 6px;
  color: var(--muted);
  background: #f8faf9;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 650;
}

.list-section-label span {
  float: right;
  color: var(--brand-dark);
}

.conv-item {
  width: 100%;
  min-height: 82px;
  padding: 11px 13px;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #edf0f2;
  text-align: left;
}

.conv-item:hover {
  background: #fafcfc;
}

.conv-item.active {
  background: var(--brand-soft);
  box-shadow: inset 3px 0 var(--brand);
}

/* 卡片铺满滚动列表的整宽：焦点环画在卡片内侧，否则左右两边被列表裁掉 */
.conv-item:focus-visible {
  outline-offset: -2px;
}

.conv-item.ended {
  background: #fafbfb;
}

/* 已结束分节底部的「更早的会话」分页按钮 */
.list-more-btn {
  width: 100%;
  padding: 10px 13px;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #edf0f2;
  color: var(--brand-dark);
  font-size: 12px;
  text-align: center;
}

.list-more-btn:hover {
  background: #fafcfc;
}

.list-more-btn:disabled {
  color: var(--muted);
}

.conv-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.conv-head .status {
  flex-shrink: 0;
}

.conv-preview {
  margin: 6px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #566269;
}

.conv-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.agent-chat {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-head {
  min-height: 58px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.chat-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.capacity-text {
  color: var(--muted);
  font-size: 12px;
}

.capacity-text strong {
  color: var(--brand-dark);
}

.chat-messages {
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
}

.agent-msg {
  display: flex;
  margin-bottom: 13px;
}

.agent-msg.right {
  justify-content: flex-end;
}

.agent-msg-wrap {
  max-width: min(76%, 620px);
}

.agent-msg-name {
  margin: 0 4px 4px;
  color: var(--muted);
  font-size: 11px;
}

.agent-msg.right .agent-msg-name,
.agent-msg.right .msg-time {
  text-align: right;
}

.agent-bubble {
  position: relative;
  width: fit-content;
  max-width: 100%;
  padding: 9px 10px;
  background: #fff;
  border: 1px solid #dfe5e7;
  border-radius: 6px;
  line-height: 1.6;
}

/* 右侧绿底只属人工，AI 白泡不变色：AI / 人工的颜色区分（Bad Case 旗标只打 AI 消息）
   对客服有信息量 */
.agent-msg.right .agent-bubble.ai-bubble {
  background: #fff;
  border-color: var(--line);
}

.agent-msg.right .agent-bubble {
  margin-left: auto;
  background: #dff4ef;
  border-color: #c5e8df;
}

.ai-bubble {
  padding-right: 38px;
}

.badcase-mark {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  color: #869095;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.badcase-mark:hover,
.badcase-mark.marked {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efb8ad;
}

.agent-system {
  white-space: pre-wrap;
  width: fit-content;
  max-width: 90%;
  margin: 11px auto;
  padding: 5px 8px;
  color: #6f797f;
  background: #dfe5e7;
  border-radius: 3px;
  font-size: 11px;
}

/* 发起会话弹层的留言字段：标签在上、文本域撑满 */
.initiate-field {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  font-size: 13px;
}

.initiate-field textarea {
  width: 100%;
  resize: vertical;
}

/* 操作时间线事件行（接入 / 排队 / 结束原因）：与系统胶囊同位、更轻 */
.agent-system.agent-event {
  background: transparent;
  border: 1px dashed #c9d3d6;
}

.agent-system.agent-event time {
  margin-right: 4px;
  color: #98a2a7;
}

.agent-composer {
  padding: 9px 12px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.agent-composer #agentInput {
  max-height: 180px;
}

.agent-compose-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.agent-compose-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 8px;
}

.agent-compose-box textarea {
  min-height: 70px;
}

.agent-aside {
  min-height: 0;
  overflow: auto;
  background: #fff;
  border-left: 1px solid var(--line);
}

.aside-section {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.aside-section h3 {
  margin: 0 0 9px;
  font-size: 14px;
}

.kv {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 7px;
  margin: 7px 0;
}

.kv span:first-child {
  color: var(--muted);
  font-size: 12px;
}

/* ----------------------------------------------------------
   客服端小件（原型没有对应演示：登录身份 / 服务记录列表 / 历史会话内联 /
   只读评价徽标 / 附件字段卡 / 附件预览）。类名沿用既有约定，管理端复用同一套，
   不再各写一份。
   ---------------------------------------------------------- */
.agent-top-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-title .profile-avatar {
  width: 28px;
  height: 28px;
}

.note-composer {
  display: grid;
  gap: 8px;
}

.note-composer textarea {
  min-height: 62px;
}

.note-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.note-item,
.history-note {
  padding: 8px 9px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.note-item p,
.history-note p {
  margin: 4px 0 0;
  white-space: pre-wrap;
}

.note-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.is-empty {
  margin: 4px 0;
  color: var(--muted);
  font-size: 12px;
}

.feedback-badge {
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 3px;
  background: #f1f3f4;
  color: var(--muted);
  font-size: 11px;
}

.feedback-badge.is-up {
  color: var(--success);
  background: var(--success-soft);
}

.feedback-badge.is-down {
  color: var(--danger);
  background: var(--danger-soft);
}

.bad-case-toggle {
  padding: 1px 6px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 11px;
}

.bad-case-toggle.is-marked {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efb8ad;
}

.attachment-fields {
  width: 100%;
  margin: 6px 0 0;
  padding: 7px 8px;
  display: grid;
  gap: 3px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
}

.attachment-field {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 6px;
}

.attachment-field dt {
  color: var(--muted);
}

.attachment-field dd {
  margin: 0;
}

/* 附件预览弹层正文：图片 / 视频 / PDF 居中，随视口限高 */
.attachment-preview-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  gap: 10px;
}

.attachment-preview-body img,
.attachment-preview-body video {
  max-width: 100%;
  max-height: min(600px, 70dvh);
  border-radius: 8px;
}

.attachment-preview-body iframe {
  width: 100%;
  height: min(600px, 70dvh);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-section + .history-section {
  margin-top: 14px;
}

.history-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.history-conversation {
  margin-bottom: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.history-conversation-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* 中栏历史会话内联块：住在消息流滚动区顶部，折叠时只有一个按钮，展开后历史分组插在
   当前对话上方、随消息流一起滚动 */
.history-inline {
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafcfb;
}

.history-inline #historyInlineContent {
  margin-top: 8px;
  display: grid;
  gap: 10px;
}

.history-notes {
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.history-notes.is-inline-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.history-note-empty {
  color: var(--muted);
}

.history-wiki-sources,
.wiki-source-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
}

.wiki-source {
  padding: 2px 6px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 3px;
  text-decoration: none;
}

/* Wiki 原文弹窗与文档级 Markdown 排版（wiki_viewer.js + markdown.js
   renderMarkdownDocument；客服端与管理端共用）。 */
.wiki-viewer-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.wiki-viewer-path {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wiki-viewer-body {
  max-height: min(620px, 70dvh);
  overflow: auto;
}

.wiki-viewer-status {
  color: var(--muted);
  font-size: 12px;
}

.markdown-doc {
  line-height: 1.75;
  word-break: break-word;
}

.markdown-doc > :first-child {
  margin-top: 0;
}

.markdown-doc h1,
.markdown-doc h2,
.markdown-doc h3,
.markdown-doc h4 {
  margin: 18px 0 8px;
  line-height: 1.4;
}

.markdown-doc h1 { font-size: 19px; }
.markdown-doc h2 { font-size: 17px; }
.markdown-doc h3 { font-size: 15px; }
.markdown-doc h4 { font-size: 14px; }

.markdown-doc p,
.markdown-doc ul,
.markdown-doc ol {
  margin: 8px 0;
}

.markdown-doc ul,
.markdown-doc ol {
  padding-left: 22px;
}

.markdown-doc blockquote {
  margin: 10px 0;
  padding: 8px 12px;
  color: #49615c;
  background: #f1f8f6;
  border-left: 3px solid var(--brand);
  border-radius: 0 4px 4px 0;
}

.markdown-doc hr {
  margin: 16px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.markdown-doc table {
  display: block;
  overflow-x: auto;
  margin: 10px 0;
  font-size: 13px;
}

.markdown-doc th,
.markdown-doc td {
  padding: 6px 10px;
  border: 1px solid var(--line);
  text-align: left;
}

.markdown-doc th {
  background: #f6f8f8;
}

.markdown-doc code {
  padding: 1px 5px;
  background: #f1f4f4;
  border-radius: 3px;
  font-size: 12px;
}

.markdown-doc img {
  max-width: 100%;
  border-radius: 4px;
}

.markdown-image-missing {
  display: inline-block;
  padding: 2px 6px;
  color: var(--muted);
  background: #f1f4f4;
  border-radius: 3px;
  font-size: 12px;
}

/* 概览可下钻的 KPI 卡（AI正在咨询 → 会话记录预筛） */
.kpi-link {
  cursor: pointer;
}

.kpi-link:hover {
  border-color: var(--brand);
}

.admin-note {
  padding: 7px 8px;
  margin-bottom: 6px;
  background: #f6f8f8;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
}

.admin-note p {
  margin: 4px 0 0;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ----------------------------------------------------------
   管理端结构样式（原型 L45-52 / Admin）
   ---------------------------------------------------------- */
.admin-shell {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
}

.admin-nav {
  /* 顶部不留内边距：首个分组标题自带 --topbar-height 的带高，右侧顶栏也从 0 起，
     两列首行才落在同一水平线上 */
  padding: 0 9px 12px;
  overflow: auto;
  background: #f8faf9;
  border-right: 1px solid var(--line);
}

.nav-group {
  padding: 9px 11px 5px;
  color: var(--muted);
  font-size: 13px;
}

/* 首个分组标题与右侧顶栏同高、文字垂直居中——两列的第一行因此落在同一水平线上 */
.admin-nav .nav-group:first-child {
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}

.admin-nav button {
  width: 100%;
  height: 39px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  margin: 2px 0;
  color: #4f5b61;
  background: transparent;
  border: 0;
  border-radius: 5px;
  text-align: left;
}

.admin-nav button:hover {
  color: var(--brand-dark);
  background: #eef6f3;
}

.admin-nav button.active {
  color: var(--brand-dark);
  background: var(--brand-soft);
  box-shadow: inset 3px 0 var(--brand);
  font-weight: 650;
}

.admin-nav button svg {
  width: 16px;
  height: 16px;
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  color: #fff;
  background: var(--danger);
  border-radius: 9px;
  font-size: 10px;
  text-align: center;
}

.admin-main {
  min-width: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.admin-topbar {
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

/* 页头身份（客服端与管理端共用）：姓名与连接状态同处一个行盒，字号一致、基线自然
   重合。拆成两个字号时即便盒子居中，字形的视觉重心仍会差一点、看着像没对齐。 */
.top-identity {
  font-size: 13px;
  color: var(--muted);
}

.admin-topbar .top-identity {
  margin-right: auto;
}

.admin-page {
  display: none;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

.admin-page.active {
  display: flex;
  flex-direction: column;
}

.page-head {
  flex-shrink: 0;
  min-height: 66px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.page-head h2 {
  margin: 0;
  font-size: 20px;
}

.page-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  flex: 1;
  min-height: 0;
  padding: 16px 20px 24px;
  overflow: auto;
}

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

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.kpi {
  min-height: 88px;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
}

.kpi:last-child {
  border-right: 0;
}

.kpi-label {
  color: var(--muted);
  font-size: 11px;
}

.kpi-value {
  margin-top: 5px;
  font-size: 23px;
  font-weight: 680;
}

.kpi-note {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .8fr);
  gap: 14px;
}

.chart {
  height: 220px;
  padding: 12px 14px;
}

.chart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-grid {
  stroke: #e5eaec;
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 3;
}

.chart-area {
  fill: rgba(25, 182, 154, .10);
}

.chart-point {
  fill: #fff;
  stroke: var(--brand);
  stroke-width: 2;
}

.chart-label {
  fill: #7d878c;
  font-size: 11px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid #edf0f2;
  text-align: left;
  font-size: 12px;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #fafbfb;
  font-weight: 600;
}

tbody tr:hover {
  background: #fafcfc;
}

.split-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 14px;
}

.record-list {
  min-height: 0;
  overflow: auto;
}

/* 会话记录页（管理端 / 客服端共用 _records_page.html）：页头、过滤条在上，下方同页三栏
   （左会话卡片 / 中完整对话 / 右会话信息与用户历史）各自滚动。卡片、会话头、消息流、信息栏
   沿用工作台同名样式，这里只管过滤条、栏宽、列表头与 tab；三栏头与 .chat-head 同为 58px 高、底边对齐 */
.records-filters {
  padding: 10px 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.records-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr) 300px;
  overflow: hidden;
}

.records-list-pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--line);
}

.records-list-head {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
}

.records-cards {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.records-info-pane {
  min-height: 0;
  overflow-y: auto;
  background: #fff;
  border-left: 1px solid var(--line);
}

.records-tabs {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.records-tabs button {
  height: 57px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
}

.records-tabs button.active {
  color: var(--brand-dark);
  border-bottom-color: var(--brand);
  font-weight: 650;
}

.quality-card {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 8px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  text-align: left;
}

.quality-card:hover {
  border-color: #a6dcd1;
}

.quality-card.active {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.quality-card.danger-card.active {
  background: var(--danger-soft);
  border-color: #e7a495;
}

.quality-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.quality-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 14px;
}

.detail-block {
  margin-bottom: 13px;
}

.detail-block h4 {
  margin: 0 0 6px;
  font-size: 13px;
}

.quote {
  padding: 11px 12px;
  background: #f6f8f8;
  border: 1px solid var(--line);
  border-radius: 5px;
  line-height: 1.7;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(470px, 1.1fr) minmax(350px, .9fr);
  gap: 14px;
}

.form-row {
  margin-bottom: 15px;
}

.form-row > label {
  display: block;
  margin-bottom: 6px;
  font-weight: 650;
}

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

.day {
  min-width: 48px;
  padding: 7px 8px;
  color: #546067;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.day.active {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: #a9ded2;
}

.time-line {
  display: grid;
  grid-template-columns: 90px 110px 18px 110px auto;
  gap: 7px;
  align-items: center;
  margin: 8px 0;
}

.prompt-list {
  display: grid;
  gap: 8px;
}

.prompt-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.prompt-head {
  min-height: 45px;
  padding: 0 11px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.prompt-num {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 4px;
  font-size: 11px;
}

.prompt-body {
  display: none;
  padding: 11px;
  border-top: 1px solid var(--line);
  background: #fbfcfc;
}

.prompt-item.open .prompt-body {
  display: block;
}

.mode-card {
  padding: 22px;
}

.mode-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.mode-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 6px;
}

.mode-card.manual .mode-icon {
  color: var(--danger);
  background: var(--danger-soft);
}

.mode-card h3 {
  margin: 0 0 6px;
  font-size: 19px;
}

.mode-card p {
  margin: 0;
  color: var(--muted);
}

.notice {
  padding: 10px 12px;
  color: #76541b;
  background: var(--warning-soft);
  border: 1px solid #efd6a7;
  border-radius: 5px;
  font-size: 12px;
}

.checkbox-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 11px;
  background: #f7f9f9;
  border-radius: 5px;
}

.checkbox-line input {
  margin-top: 3px;
}

/* 账号管理「注册管理」：两个勾选排一行 */
.registration-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ----------------------------------------------------------
   响应式（原型 L54-55；≤760px 让 .chat-app 铺满全宽）
   ---------------------------------------------------------- */
@media (max-width: 1050px) {
  .agent-grid {
    grid-template-columns: 250px minmax(390px, 1fr);
  }
  .agent-aside {
    display: none;
  }
  /* 会话记录：右栏移到中栏下方，列表占满左侧整高 */
  .records-grid {
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-rows: minmax(0, 3fr) minmax(0, 2fr);
  }
  .records-list-pane {
    grid-row: 1 / 3;
  }
  .records-info-pane {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .kpis {
    grid-template-columns: repeat(3, 1fr);
  }
  .kpi:nth-child(3) {
    border-right: 0;
  }
  .kpi:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }
  .detail-grid,
  .settings-grid,
  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  /* 移动端：聊天页铺满全宽、去掉两侧描边；页头收起右侧的用户图标与名字，只留昵称、状态与按钮 */
  .chat-app {
    width: 100%;
    border-left: 0;
    border-right: 0;
  }
  .app-head {
    padding: 8px 10px;
  }
  .app-head-name,
  .app-head .profile-avatar {
    display: none;
  }
  .app-messages {
    padding: 14px 10px;
  }
  /* 移动端字阶（未列出的元素沿用桌面值）：正文与输入框 16px 同时是 iOS / 微信 WebView
     聚焦不自动放大的门槛（<16px 会放大整页） */
  .chat-app,
  .control {
    font-size: 16px;
  }
  .app-head h1 {
    font-size: 17px;
  }
  .system-msg,
  .pending-attachment-chip {
    font-size: 12px;
  }
  .msg-time {
    font-size: 11px;
  }
  .btn.small {
    font-size: 13px;
  }
  /* 字号 16（行高 24）把输入框撑到 42px，胶囊圆角随之取半高；回形针点击区同高；
     「发送」胶囊保持 38px，底边上移 2px 与单行输入框居中 */
  .composer-line textarea {
    min-height: 42px;
    border-radius: 21px;
  }
  .composer-line button {
    height: 42px;
  }
  .composer-line .btn.primary {
    height: 38px;
    margin-bottom: 2px;
  }
  .agent-grid {
    grid-template-columns: 1fr;
  }
  .agent-list {
    display: none;
  }
  .agent-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  /* 窄屏顶栏：解开固定 54px 行高让内容换行（原来会挤成竖排单字），
     并收起标题与昵称——三态下拉 / 容量 / 模式徽标 / 注销才是要留的操作 */
  .agent-shell {
    grid-template-rows: auto minmax(0, 1fr);
  }
  .agent-top {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .agent-title {
    flex-wrap: wrap;
    gap: 8px;
  }
  .agent-title .top-identity {
    display: none;
  }
  .agent-top-status {
    gap: 8px;
  }
  .agent-status-select {
    max-width: 90px;
  }
  /* 单列后两行不能平分高度：导航条只取内容高，正文吃剩余 */
  .admin-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .admin-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  /* 首分组标题的桌面规则特异度更高（.admin-nav .nav-group:first-child），要同名压住 */
  .nav-group,
  .admin-nav .nav-group:first-child {
    display: none;
  }
  .admin-nav button {
    width: auto;
    min-width: max-content;
    padding: 0 10px;
  }
  .workspace {
    padding: 12px;
  }
  /* 页头操作（导出 / 刷新 / 日期等）放不下时整组换到标题下一行，不挤压标题竖排断字 */
  .page-head {
    padding: 10px 12px;
    flex-wrap: wrap;
  }
  .page-head p {
    display: none;
  }
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi:nth-child(2n) {
    border-right: 0;
  }
  .kpi:nth-child(-n + 4) {
    border-bottom: 1px solid var(--line);
  }
  .split-layout {
    display: block;
  }
  .record-list {
    max-height: 260px;
    margin-bottom: 12px;
  }
  /* 会话记录：三块纵向堆叠、整页滚动，列表限高 */
  .records-page.active {
    overflow-y: auto;
  }
  .records-filters {
    padding: 10px 12px;
  }
  .records-grid {
    flex: none;
    display: block;
    overflow: visible;
  }
  .records-list-pane {
    max-height: 260px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .time-line {
    grid-template-columns: 70px 1fr 18px 1fr;
  }
  .mode-hero {
    display: block;
  }
  .mode-hero .btn {
    margin-top: 14px;
  }
}

/* ============================================================
   登录 / 注册（原型无此流程；沿用上方 tokens 与 .btn / .control 自建）
   ============================================================ */
.auth-shell {
  width: 100%;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background: var(--bg);
}

.auth-panel {
  width: min(410px, 100%);
  padding: 34px 32px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 22px;
  text-align: center;
}

.auth-brand-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto;
  font-size: 22px;
  border-radius: 14px;
}

.auth-brand-title {
  margin: 4px 0 0;
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
}

.auth-brand-tagline {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
}

.auth-form .btn.primary {
  min-height: 44px;
  margin-top: 4px;
  font-size: 15px;
  letter-spacing: 2px;
}

.auth-wechat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.auth-wechat-btn {
  width: 100%;
  text-align: center;
  text-decoration: none;
}

/* 微信登录入口按设备形态二选一：
   - 精确指针（桌面）：给二维码，让用户用手机微信扫——桌面直接点授权按钮会撞
     微信公众号 OAuth 的错误页（该流程只在微信内置浏览器里成立）；
   - 粗指针（手机 / 平板）：给直跳按钮，扫自己屏幕上的二维码没有意义。 */
.auth-wechat-scan {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.auth-wechat-inplace {
  display: none;
  width: 100%;
}

/* 媒体查询必须写在两条基础规则之后：同优先级下后写的胜出，写在前面会被基础规则覆盖 */
@media (pointer: coarse) {
  .auth-wechat-scan {
    display: none;
  }

  .auth-wechat-inplace {
    display: block;
  }
}

.auth-wechat-qr {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 6px;
}

.auth-wechat-status {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.auth-wechat-status.is-done {
  color: var(--brand);
}

.auth-wechat-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-alt {
  margin: 14px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.inline-link {
  color: var(--brand-dark);
  text-decoration: none;
}

.inline-link:hover {
  text-decoration: underline;
}

.auth-alt .inline-link {
  margin-left: 4px;
}

.form-message {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.form-message.is-error {
  color: var(--danger);
}

/* 欢迎气泡是纯文本注入（不走 Markdown 渲染），保留文案里的换行 */
.welcome-msg .message-body {
  white-space: pre-wrap;
}

/* 账号管理「角色」列：待审核行的下拉与已通过行的管理员开关，同列同高不跳行 */
.account-role-select {
  width: auto;
  min-width: 128px;
}

.account-role-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

/* markdown.js 给宽表格外套的横向滚动容器：表格自身超宽时页面不横滚 */
.table-scroll {
  overflow-x: auto;
}
