/* =========================================================================
 * 明析教育AI助手 · 全局样式
 * ========================================================================= */
:root {
  --brand: #1B6BFF;
  --brand-d: #0B4FD6;
  --brand-l: #EAF1FF;
  --brand-grad: linear-gradient(135deg, #3D8BFF 0%, #1B6BFF 100%);
  --ink: #10161F;
  --ink-2: #3C4859;
  --ink-3: #6B7A90;
  --ink-4: #9AA7B8;
  --line: #E6EBF2;
  --line-2: #F0F3F8;
  --bg: #F4F6FA;
  --bg-2: #EDF1F7;
  --card: #FFFFFF;
  --ok: #0FA47F;
  --warn: #E8770B;
  --err: #E5484D;
  --purple: #7A5AF8;
  --radius: 14px;
  --radius-s: 10px;
  --shadow-s: 0 1px 2px rgba(16, 22, 31, .05), 0 1px 3px rgba(16, 22, 31, .04);
  --shadow: 0 4px 16px rgba(16, 22, 31, .07);
  --shadow-l: 0 12px 40px rgba(16, 22, 31, .12);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #D3DAE5; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #BFC8D6; }
::-webkit-scrollbar-track { background: transparent; }

/* ----------------------------- 通用组件 ----------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 13.5px; font-weight: 500; cursor: pointer; transition: all .16s;
  white-space: nowrap;
}
.btn:hover { border-color: #CBD6E5; background: #FAFCFF; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-grad); border-color: transparent; color: #fff; box-shadow: 0 2px 8px rgba(27, 107, 255, .25); }
.btn-primary:hover { background: linear-gradient(135deg, #2E7BFF 0%, #0B5CE8 100%); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn-ghost:hover { background: var(--bg-2); }
.btn-danger { color: var(--err); border-color: #F6D2D3; }
.btn-danger:hover { background: #FEF2F2; border-color: #F0B4B6; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: var(--radius-s); font-size: 13.5px; color: var(--ink);
  background: #fff; outline: none; transition: border-color .16s, box-shadow .16s;
  font-family: inherit;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(27, 107, 255, .1); }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--ink-4); margin-top: 5px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-s); }
.card-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-2);
}
.card-hd h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-bd { padding: 18px; }

.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: 20px; font-size: 12px; font-weight: 500;
  background: var(--bg-2); color: var(--ink-3); white-space: nowrap;
}
.tag-blue { background: var(--brand-l); color: var(--brand-d); }
.tag-green { background: #E6F7F1; color: #0A7C60; }
.tag-orange { background: #FEF2E6; color: #B85C05; }
.tag-purple { background: #F1EDFE; color: #5B3FD6; }
.tag-red { background: #FDECEC; color: #C33A3E; }
.tag-grey { background: #EEF1F5; color: #6B7A90; }

.empty { padding: 48px 20px; text-align: center; color: var(--ink-4); font-size: 13.5px; }
.empty .big { font-size: 30px; margin-bottom: 8px; opacity: .5; }

.spin {
  width: 15px; height: 15px; border: 2px solid rgba(27, 107, 255, .2);
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------ Toast ------------------------------ */
.toast-box { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 9px 18px; border-radius: 10px; background: #222C3A; color: #fff;
  font-size: 13px; box-shadow: var(--shadow-l); animation: toastIn .22s ease;
  max-width: 76vw;
}
.toast-ok { background: #0E8F6E; }
.toast-err { background: #D63A3F; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: all .4s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }

/* ============================ C 端对话页 ============================ */
.chat-app { display: flex; height: 100vh; overflow: hidden; background: var(--bg); }

/* 侧边栏 */
.side {
  width: 272px; flex: 0 0 272px; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; transition: margin-left .25s ease;
}
.side-hd { padding: 16px 16px 12px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.brand-logo img, .brand-logo .robot-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-txt b { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.brand-txt span { display: block; font-size: 11.5px; color: var(--ink-4); }
.newchat {
  width: 100%; height: 40px; border-radius: 11px; border: 1px dashed #BFCEE6;
  background: #F7FAFF; color: var(--brand-d); font-size: 13.5px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: all .16s;
}
.newchat:hover { background: var(--brand-l); border-color: var(--brand); }

.side-list { flex: 1; overflow-y: auto; padding: 6px 10px 10px; }
.side-label { font-size: 11.5px; color: var(--ink-4); font-weight: 600; padding: 10px 8px 6px; letter-spacing: .3px; }
.sess {
  padding: 9px 11px; border-radius: 10px; cursor: pointer; margin-bottom: 2px;
  display: flex; align-items: center; gap: 8px; transition: background .14s;
}
.sess:hover { background: var(--bg-2); }
.sess.on { background: var(--brand-l); }
.sess.on .sess-t { color: var(--brand-d); font-weight: 600; }
.sess-ic { font-size: 13px; opacity: .55; }
.sess-t { flex: 1; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess-x { opacity: .35; font-size: 12px; color: var(--ink-4); padding: 4px 6px; margin: -2px -2px; border-radius: 5px; flex-shrink: 0; }
.sess:hover .sess-x { opacity: 1; }
.sess-x:hover { background: #fff; color: var(--err); }

.side-ft { padding: 12px 14px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--ink-4); }
.side-ft a { color: var(--ink-3); }
.side-ft .row { display: flex; align-items: center; justify-content: space-between; }

/* 主区 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 58px; flex: 0 0 58px; background: rgba(255,255,255,.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  padding: 0 18px; gap: 12px; z-index: 5;
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: none; background: transparent;
  cursor: pointer; color: var(--ink-3); font-size: 16px; display: none;
  align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg-2); }
.topbar h1 { font-size: 15px; font-weight: 600; margin: 0; flex: 1; display: flex; align-items: center; gap: 9px; }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(15,164,127,.15); }
.topbar .meta { font-size: 12px; color: var(--ink-4); font-weight: 400; }

.scroll { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.thread { max-width: 780px; margin: 0 auto; padding: 26px 22px 30px; }

/* 欢迎 */
.welcome { padding: 34px 0 8px; }
.welcome-logo {
  width: 101px; height: 101px; border-radius: 26px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;   /* 机器人居中 */
  animation: robot-in .45s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes robot-in { from { transform: scale(.7) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.welcome-logo img, .welcome-logo .robot-img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 8px 20px rgba(27,107,255,.18)); }
/* 机器人 logo SVG 尺寸跟随容器（品牌块 / 欢迎区通用） */
.brand-logo svg, .welcome-logo svg { width: 78%; height: 78%; display: block; }
.welcome h2 { font-size: 22px; margin: 0 0 8px; font-weight: 650; letter-spacing: -.2px; }
.welcome p { color: var(--ink-3); margin: 0 0 20px; font-size: 14px; max-width: 560px; }
.quick { display: flex; flex-wrap: wrap; gap: 9px; }
.quick button {
  padding: 9px 15px; border-radius: 11px; border: 1px solid var(--line); background: #fff;
  font-size: 13px; color: var(--ink-2); cursor: pointer; transition: all .16s; box-shadow: var(--shadow-s);
}
.quick button:hover { border-color: #B9CDF2; color: var(--brand-d); background: #F8FAFF; transform: translateY(-1px); }

/* 消息 */
.msg { display: flex; gap: 12px; margin-bottom: 24px; animation: fadeUp .3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }
.msg.me { flex-direction: row-reverse; }
.avatar {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #fff;
}
.avatar.ai { background: var(--brand-grad); box-shadow: 0 3px 10px rgba(27,107,255,.28); overflow: hidden; }
.avatar.ai img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.me { background: linear-gradient(135deg, #7C8DA6 0%, #5A6B82 100%); }
.msg-body { max-width: calc(100% - 46px); min-width: 0; }
.bubble {
  padding: 12px 16px; border-radius: 14px; font-size: 14px; line-height: 1.72;
  word-break: break-word; overflow-wrap: anywhere;
}
.msg.ai .bubble { background: #fff; border: 1px solid var(--line); border-top-left-radius: 5px; box-shadow: var(--shadow-s); }
.msg.me .bubble { background: var(--brand-grad); color: #fff; border-top-right-radius: 5px; box-shadow: 0 3px 12px rgba(27,107,255,.22); }
.msg.me .bubble a { color: #fff; text-decoration: underline; }

.bubble p { margin: 0 0 9px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble h3, .bubble h4, .bubble h5 { margin: 12px 0 7px; font-size: 14.5px; font-weight: 650; }
.bubble h3:first-child, .bubble h4:first-child { margin-top: 0; }
.bubble ul, .bubble ol { margin: 6px 0 9px; padding-left: 21px; }
.bubble li { margin: 3px 0; }
.bubble code { background: var(--bg-2); padding: 2px 5px; border-radius: 5px; font-size: 12.5px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.bubble .md-pre { background: #F7F9FC; border: 1px solid var(--line); padding: 11px 13px; border-radius: 10px; overflow-x: auto; }
.bubble .md-pre code { background: none; padding: 0; }
.bubble blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid #C9D9F5; background: #F8FAFF; color: var(--ink-2); border-radius: 0 8px 8px 0; }
.bubble hr { border: none; border-top: 1px solid var(--line); margin: 12px 0; }

.msg-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-4); }
.msg.me .msg-meta { justify-content: flex-end; }

/* 状态条 */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 9px;
  border-radius: 20px; font-size: 11.5px; background: var(--bg-2); color: var(--ink-3); font-weight: 500;
}
.chip b { font-weight: 650; }
.chip-blue { background: var(--brand-l); color: var(--brand-d); }
.chip-green { background: #E6F7F1; color: #0A7C60; }
.chip-orange { background: #FEF2E6; color: #B85C05; }
.chip-red { background: #FDECEC; color: #C33A3E; }
.chip-purple { background: #F1EDFE; color: #5B3FD6; }

/* 来源 */
.sources { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.sources-hd { font-size: 12px; color: var(--ink-4); margin-bottom: 7px; display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.src-list { display: flex; flex-direction: column; gap: 6px; }
.src {
  display: flex; gap: 9px; padding: 9px 11px; background: #F8FAFD; border: 1px solid var(--line-2);
  border-radius: 10px; font-size: 12.5px; transition: all .16s;
}
.src:hover { background: #F2F7FF; border-color: #D3E2FA; }
.src-n { flex: 0 0 20px; height: 20px; border-radius: 6px; background: var(--brand-l); color: var(--brand-d); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.src-c { min-width: 0; }
.src-t { font-weight: 600; color: var(--ink-2); margin-bottom: 2px; }
.src-s { color: var(--ink-4); font-size: 12px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* 视频卡片 */
.videos { margin-top: 11px; }
.videos-hd { font-size: 12px; color: var(--ink-4); margin-bottom: 7px; }
.vcard {
  display: flex; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; margin-bottom: 8px; transition: all .18s; cursor: pointer; text-decoration: none; color: inherit;
}
.vcard:hover { border-color: #B9CDF2; box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.vthumb {
  flex: 0 0 104px; height: 62px; border-radius: 9px;
  background: linear-gradient(135deg, #2B6BE4 0%, #7A5AF8 100%);
  display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden;
}
.vthumb .play {
  width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.94);
  display: flex; align-items: center; justify-content: center; color: var(--brand);
  font-size: 11px; padding-left: 2px;
}
.vthumb .dur { position: absolute; right: 5px; bottom: 4px; font-size: 10px; color: #fff; background: rgba(0,0,0,.45); padding: 0 5px; border-radius: 4px; }
.vmeta { min-width: 0; flex: 1; }
.vmeta .vt { font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.vmeta .vs { font-size: 12px; color: var(--ink-4); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 转人工 */
.transfer {
  margin-top: 11px; padding: 13px 15px; border-radius: 12px;
  background: linear-gradient(135deg, #FFF7ED 0%, #FEF2E6 100%);
  border: 1px solid #FBDDB8;
}
.transfer-hd { display: flex; align-items: center; gap: 8px; font-weight: 650; color: #A9540A; font-size: 13.5px; margin-bottom: 5px; }
.transfer-bd { font-size: 12.5px; color: #8A5A20; }
.transfer-bd ul { margin: 5px 0 0; padding-left: 19px; }
.transfer-bd li { margin: 2px 0; }
/* 转人工卡片内的微信联系方式（后台可配置） */
.transfer-wx {
  margin-top: 11px; padding: 12px 13px; border-radius: 10px;
  background: rgba(255, 255, 255, .75); border: 1px dashed #F3C892;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.transfer-wx-hd { font-size: 12.5px; font-weight: 600; color: #A9540A; }
.transfer-wx-qr {
  width: 132px; height: 132px; border-radius: 10px; background: #fff;
  border: 1px solid #FBDDB8; object-fit: contain;
}
.transfer-wx-id-row { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.transfer-wx-id {
  font-size: 13.5px; font-weight: 650; color: #7A4A10;
  font-family: Consolas, Monaco, monospace; letter-spacing: .3px;
  background: #FFF3E2; border: 1px solid #F3C892; border-radius: 8px; padding: 5px 10px;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.transfer-wx-copy {
  height: 30px; padding: 0 12px; border-radius: 8px; border: none; cursor: pointer;
  background: #A9540A; color: #fff; font-size: 12.5px; flex-shrink: 0;
}
.transfer-wx-copy:active { opacity: .85; }
.transfer-wx-tip { font-size: 12px; color: #A97B3C; line-height: 1.5; }

/* 评价 */
.fb { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.fb-btn {
  height: 28px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-size: 12.5px; color: var(--ink-3);
  display: inline-flex; align-items: center; gap: 5px; transition: all .16s;
}
.fb-btn:hover { border-color: #C3D3EC; background: #F8FAFF; }
.fb-btn.on-up { background: #E6F7F1; border-color: #9FDCC9; color: #0A7C60; }
.fb-btn.on-down { background: #FDECEC; border-color: #F3BFC1; color: #C33A3E; }
.fb-done { font-size: 12.5px; color: var(--ink-4); display: inline-flex; align-items: center; gap: 5px; }
.fb-box { margin-top: 9px; padding: 11px 13px; background: #F8FAFD; border: 1px solid var(--line-2); border-radius: 11px; }
.fb-box .row { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }

/* 追问建议 */
.followups { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.followups button {
  padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line);
  background: #fff; font-size: 12.5px; color: var(--ink-2); cursor: pointer; transition: all .16s;
}
.followups button:hover { border-color: #B9CDF2; background: #F8FAFF; color: var(--brand-d); }

/* 输入区 */
.composer { flex: 0 0 auto; padding: 12px 22px 18px; background: linear-gradient(to top, var(--bg) 62%, rgba(244,246,250,0)); }
.composer-inner { max-width: 780px; margin: 0 auto; }
.cbox {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 10px 12px 8px; transition: border-color .16s, box-shadow .16s;
}
.cbox:focus-within { border-color: #B9CDF2; box-shadow: 0 4px 20px rgba(27,107,255,.12); }
.cbox textarea {
  width: 100%; border: none; outline: none; resize: none; font-size: 14px;
  line-height: 1.6; max-height: 150px; min-height: 24px; font-family: inherit;
  color: var(--ink); background: transparent;
}
.cbox textarea::placeholder { color: var(--ink-4); }
.cbar { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.cbar .left { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-4); }
.send {
  width: 32px; height: 32px; border-radius: 10px; border: none; cursor: pointer;
  background: var(--brand-grad); color: #fff; display: flex; align-items: center;
  justify-content: center; font-size: 15px; transition: all .16s;
  box-shadow: 0 3px 10px rgba(27,107,255,.28);
}
.send:hover { transform: translateY(-1px); }
.send[disabled] { background: #D7DEE9; box-shadow: none; cursor: not-allowed; transform: none; }
.stop { background: linear-gradient(135deg, #F0705F 0%, #E5484D 100%); box-shadow: 0 3px 10px rgba(229,72,77,.28); }


/* 思考中 */
.thinking { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-3); padding: 3px 0; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.cursor-blink { display: inline-block; width: 7px; height: 15px; background: var(--brand); vertical-align: -2px; animation: blink .9s step-end infinite; border-radius: 1px; }

/* ============================ B 端后台 ============================ */
.admin { min-height: 100vh; display: flex; flex-direction: column; }
.abar {
  height: 56px; flex: 0 0 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 20px; gap: 14px; position: sticky; top: 0; z-index: 30;
}
.abar .brand { margin: 0; gap: 9px; }
.abar .brand-logo { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
.abar .spacer { flex: 1; }
.auser { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-2); }
.auser .who { text-align: right; line-height: 1.25; }
.auser .who b { display: block; font-size: 13px; font-weight: 600; }
.auser .who span { font-size: 11.5px; color: var(--ink-4); }

.awrap { flex: 1; display: flex; align-items: flex-start; }
.anav {
  width: 210px; flex: 0 0 210px; padding: 16px 12px; position: sticky; top: 56px;
  align-self: flex-start; height: calc(100vh - 56px); overflow-y: auto;
}
.anav button {
  width: 100%; height: 38px; border: none; background: transparent; text-align: left;
  padding: 0 12px; border-radius: 10px; font-size: 13.5px; color: var(--ink-2);
  cursor: pointer; display: flex; align-items: center; gap: 9px; margin-bottom: 2px; transition: all .14s;
}
.anav button:hover { background: #fff; }
.anav button.on { background: var(--brand-l); color: var(--brand-d); font-weight: 600; }
.anav .grp { font-size: 11.5px; color: var(--ink-4); padding: 14px 12px 6px; font-weight: 600; }

.acontent { flex: 1; min-width: 0; padding: 20px 24px 60px; }
.acontent > section { display: none; animation: fadeUp .24s ease; }
.acontent > section.on { display: block; }

.page-hd { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-hd h2 { margin: 0; font-size: 19px; font-weight: 650; }
.page-hd p { margin: 3px 0 0; font-size: 13px; color: var(--ink-4); }

.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3, .g2 { grid-template-columns: 1fr; } }

.stat { padding: 16px 18px; }
.stat .k { font-size: 12.5px; color: var(--ink-4); display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.5px; line-height: 1.1; }
.stat .s { font-size: 12px; color: var(--ink-4); margin-top: 6px; }
.stat .v.blue { color: var(--brand); }
.stat .v.green { color: var(--ok); }
.stat .v.orange { color: var(--warn); }
.stat .v.red { color: var(--err); }
.stat .v.purple { color: var(--purple); }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.bar-row .lbl { flex: 0 0 90px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .track { flex: 1; height: 8px; background: var(--bg-2); border-radius: 6px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 6px; background: var(--brand-grad); transition: width .5s ease; }
.bar-row .num { flex: 0 0 54px; text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 130px; padding-top: 8px; }
.spark .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; min-width: 0; }
.spark .b1 { width: 100%; background: var(--brand-grad); border-radius: 3px 3px 0 0; min-height: 2px; transition: height .5s ease; }
.spark .b2 { width: 60%; background: #BFD4F7; border-radius: 3px 3px 0 0; min-height: 2px; transition: height .5s ease; }
.spark-x { display: flex; gap: 3px; margin-top: 6px; }
.spark-x span { flex: 1; text-align: center; font-size: 10px; color: var(--ink-4); overflow: hidden; white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-3); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th {
  text-align: left; padding: 10px 12px; font-weight: 600; color: var(--ink-3);
  background: #FAFBFD; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12.5px;
}
table.tb td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tb tr:hover td { background: #FAFCFF; }
table.tb .ell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-wrap { overflow-x: auto; }

.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--ink-3); }
.pager .pg { display: flex; gap: 6px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.filters .field { margin: 0; }
.filters .field label { font-size: 12px; }
.filters .input, .filters .select { height: 34px; min-width: 130px; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(16,22,31,.42); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .16s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-l); animation: popIn .2s ease;
}
@keyframes popIn { from { opacity: 0; transform: scale(.97) translateY(8px); } }
.modal.wide { max-width: 820px; }
.modal-hd { padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; }
.modal-hd h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.modal-bd { padding: 18px 20px; overflow-y: auto; }
.modal-ft { padding: 13px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 9px; }
.x-btn { border: none; background: transparent; font-size: 19px; color: var(--ink-4); cursor: pointer; line-height: 1; padding: 2px 6px; border-radius: 7px; }
.x-btn:hover { background: var(--bg-2); color: var(--ink-2); }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(150deg, #EEF4FF 0%, #F4F6FA 45%, #F0EDFE 100%); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; box-shadow: var(--shadow-l); padding: 32px 30px; }
.login-card .brand { justify-content: center; margin-bottom: 18px; }
.login-card h2 { text-align: center; font-size: 19px; margin: 0 0 4px; font-weight: 650; }
.login-card .sub { text-align: center; font-size: 13px; color: var(--ink-4); margin-bottom: 22px; }
.tabs { display: flex; background: var(--bg-2); border-radius: 11px; padding: 3px; margin-bottom: 18px; }
.tabs button {
  flex: 1; height: 32px; border: none; background: transparent; border-radius: 9px;
  font-size: 13px; color: var(--ink-3); cursor: pointer; font-weight: 500; transition: all .16s;
}
.tabs button.on { background: #fff; color: var(--brand-d); font-weight: 650; box-shadow: var(--shadow-s); }
.row-flex { display: flex; gap: 9px; }
.row-flex .input { flex: 1; }

/* 转人工卡片 */
.ticket { padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: #fff; }
.ticket.pending { border-left: 3px solid var(--warn); }
.ticket.accepted { border-left: 3px solid var(--brand); }
.ticket.closed { border-left: 3px solid var(--ok); opacity: .82; }
.ticket .th { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; flex-wrap: wrap; }
.ticket .tt { font-weight: 600; font-size: 13.5px; }
.ticket .tb2 { font-size: 12.5px; color: var(--ink-3); }

.kb-item { padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: #fff; transition: all .16s; }
.kb-item:hover { border-color: #C9D9F5; box-shadow: var(--shadow-s); }
.kb-item .kh { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.kb-item .kt { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.kb-item .ks { font-size: 12.5px; color: var(--ink-4); margin-bottom: 8px; }
.kb-item .ka { display: flex; gap: 7px; flex-wrap: wrap; }

.msg-pair { padding: 10px 0; border-bottom: 1px dashed var(--line-2); }
.msg-pair:last-child { border-bottom: none; }
.msg-pair .q { font-size: 13px; color: var(--ink); margin-bottom: 5px; display: flex; gap: 8px; }
.msg-pair .a { font-size: 13px; color: var(--ink-3); display: flex; gap: 8px; }
.msg-pair .rl { flex: 0 0 44px; font-size: 11.5px; color: var(--ink-4); padding-top: 1px; }

.hl { background: #FFF6D6; border-radius: 3px; padding: 0 2px; }

/* 响应式 */
@media (max-width: 860px) {
  .side { position: fixed; z-index: 100; height: 100vh; margin-left: -272px; box-shadow: var(--shadow-l); }
  .side.open { margin-left: 0; }
  .icon-btn { display: flex; }
  .thread { padding: 18px 14px 22px; }
  .composer { padding: 10px 12px 14px; }
  .anav { position: fixed; z-index: 90; background: var(--bg); height: calc(100vh - 56px); margin-left: -210px; transition: margin-left .22s; }
  .anav.open { margin-left: 0; box-shadow: var(--shadow-l); }
  .acontent { padding: 16px 14px 50px; }
  .brand-txt span { display: none; }
}
