/* ============================================================
   启航升学教育 AI 助教系统 · 管理后台样式
   字体/控件尺寸已整体上调一档，更护眼
   ============================================================ */
:root {
  --primary: #2f6feb;
  --primary-dark: #2659bc;
  --primary-light: #eaf1fd;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --ink: #1f2d3d;
  --muted: #7a8699;
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #ebeef5;
  --sidebar: #ffffff;
  --sidebar-text: #4a5666;
  --surface-2: #f7f9fc;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 18px rgba(15, 23, 42, .06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 16px;
}
.hidden { display: none !important; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #16233a 0%, #2659bc 100%);
}
.login-card {
  width: 400px; background: #fff; border-radius: 16px; padding: 44px 40px;
  box-shadow: 0 20px 50px rgba(0,0,0,.3); text-align: center;
}
.login-logo { margin-bottom: 14px; }
.login-card h1 { font-size: 24px; letter-spacing: 1px; }
.login-sub { color: var(--muted); font-size: 15px; margin: 8px 0 30px; }
.login-form { text-align: left; }
.login-form label { display: block; font-size: 15px; color: var(--muted); margin: 16px 0 6px; }
.login-form label .hint { font-weight: normal; color: #9aa4b5; }
.login-form select, .login-form input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 16px; background: var(--surface-2); outline: none;
}
.login-form input:focus, .login-form select:focus { border-color: var(--primary); }
.login-error { color: var(--danger); font-size: 15px; margin-top: 12px; min-height: 20px; }

/* ---------------- 布局 ---------------- */
.app-wrap { display: flex; height: 100vh; }
.sidebar {
  width: 240px; background: var(--sidebar); color: var(--sidebar-text); display: flex;
  flex-direction: column; flex-shrink: 0; border-right: 1px solid var(--border);
}
.brand { display: flex; gap: 10px; align-items: center; padding: 22px 18px 18px; border-bottom: 1px solid var(--border); }
.brand-name { color: var(--ink); font-weight: 600; font-size: 17px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 8px;
  cursor: pointer; color: var(--sidebar-text); margin-bottom: 3px; font-size: 16px; transition: all .15s;
}
.nav a:hover { background: #f2f5fb; color: var(--ink); }
.nav a.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-icon { width: 22px; text-align: center; font-size: 16px; }
.nav-badge {
  background: var(--danger); color: #fff; border-radius: 12px; font-size: 12px;
  padding: 2px 8px; margin-left: auto; min-width: 20px; text-align: center;
}
/* 可展开的一级菜单 + 二级菜单（展开态由 .nav-group.open 控制） */
.nav-parent { font-weight: 600; }
.nav-caret { margin-left: auto; font-size: 12px; opacity: .7; transition: transform .15s; }
.nav-group.open > .nav-parent { color: var(--ink); }
.nav-group.open .nav-caret { transform: rotate(180deg); }
.nav-sub { display: none; }
.nav-group.open .nav-sub { display: block; }
.nav-sub a { padding-left: 26px; font-size: 15px; }
.nav-top { margin-top: 6px; font-weight: 600; }
.sidebar-footer { padding: 14px; border-top: 1px solid var(--border); }
.user-chip { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.user-name { color: var(--ink); font-size: 15px; }
.user-code { font-size: 12px; color: var(--muted); }
.content { flex: 1; overflow-y: auto; padding: 24px 28px; }

/* ---------------- 视图通用 ---------------- */
.view-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.view-header h2 { font-size: 22px; }
.header-note { color: var(--muted); font-size: 13px; font-weight: normal; }
.header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel h3 { font-size: 16px; margin-bottom: 14px; color: var(--ink); }
.panel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.empty { color: #9aa4b5; text-align: center; padding: 26px; font-size: 15px; }

/* ---------------- 按钮 / 输入 ---------------- */
.btn {
  padding: 10px 16px; border-radius: 8px; border: 1px solid var(--border); background: #fff;
  cursor: pointer; font-size: 15px; color: var(--ink); transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-success { color: var(--success); }
.btn-success:hover { border-color: var(--success); }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { color: var(--primary); border-color: var(--primary); }
.input {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px;
  outline: none; background: #fff; min-width: 0;
}
.input:focus { border-color: var(--primary); }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 15px; color: var(--muted); }
.seg button.active { background: var(--primary); color: #fff; }

/* ---------------- 统计卡 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-num { font-size: 30px; font-weight: 700; margin: 4px 0; }
.stat-label { color: var(--muted); font-size: 14px; }
.stat-card.warn .stat-num { color: var(--warning); }
.stat-card.good .stat-num { color: var(--success); }
.stat-card.info .stat-num { color: var(--primary); }

/* ---------------- 状态列表 / 开关 ---------------- */
.status-list .row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px dashed var(--border); font-size: 15px; }
.status-list .row:last-child { border-bottom: none; }
.status-list .k { color: var(--muted); }

/* ---------------- 面板标题行 ---------------- */
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; }
.panel-head .btn { margin-left: auto; }
.badge { padding: 3px 11px; border-radius: 10px; font-size: 14px; display: inline-block; }
.badge.on { background: #e7f7ee; color: var(--success); }
.badge.off { background: #fdeaea; color: var(--danger); }
.badge.warn { background: #fdf3e4; color: var(--warning); }
.badge.info { background: var(--primary-light); color: var(--primary); }
.badge.gray { background: #eef1f6; color: var(--muted); }
.switch-row { display: flex !important; justify-content: space-between; align-items: center; font-size: 15px; color: var(--ink); }
.switch-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); }
.quick-switch { display: flex; align-items: center; gap: 8px; font-size: 15px; }

/* ---------------- 动态流 ---------------- */
.activity-feed { max-height: 300px; overflow-y: auto; }
.activity-item { padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 15px; }
.activity-item .t { color: #9aa4b5; font-size: 12px; }

/* ---------------- 审批卡片 ---------------- */
.approval-list { display: grid; gap: 14px; }
.approval-batch { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.approval-batch label { display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--ink); }
.task-head .ap-pick { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); flex: none; }
.task-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.task-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.task-head .chat { font-weight: 600; font-size: 15px; }
.task-head .who { color: var(--muted); font-size: 14px; }
.task-head .time { margin-left: auto; color: #9aa4b5; font-size: 14px; }
.task-ctx { padding: 10px 18px; background: #f3f6fa; border-bottom: 1px solid var(--border); }
.task-ctx .ctx-line { font-size: 14px; color: var(--muted); line-height: 1.7; white-space: pre-wrap; word-break: break-all; }
.task-ctx .ctx-line + .ctx-line { margin-top: 2px; }
.task-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.task-q, .task-a { padding: 16px 18px; }
.task-q { border-right: 1px solid var(--border); background: var(--surface-2); }
.task-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.task-q .text { font-size: 16px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.task-a textarea {
  width: 100%; min-height: 104px; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 15px; font-family: inherit; resize: vertical; outline: none; line-height: 1.6;
}
.task-a textarea:focus { border-color: var(--primary); }
.task-refs { padding: 0 18px 12px; }
.task-refs .ref { font-size: 14px; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 7px 11px; margin-top: 4px; }
.task-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); align-items: center; }
.task-foot .learn-hint { font-size: 14px; color: var(--muted); margin-right: auto; }
.task-shot img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); margin-top: 8px; }

/* ---------------- Agent 聊天 ---------------- */
.agent-layout { display: grid; grid-template-columns: 210px 1fr 300px; gap: 16px; height: calc(100vh - 130px); }
/* 左侧「历史对话」栏 */
.chat-history { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.ch-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 12px; border-bottom: 1px solid var(--border); }
.ch-head .ch-title { font-weight: 600; font-size: 14px; color: var(--muted); }
.ch-list { flex: 1; overflow-y: auto; padding: 6px; }
.ch-item { display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: 9px; cursor: pointer; font-size: 14px; color: var(--ink); transition: background .15s ease; }
.ch-item:hover { background: #f2f5fa; }
.ch-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.ch-item .ch-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-item .ch-time { font-size: 12px; color: #9aa4b5; flex-shrink: 0; }
.ch-item .ch-del { display: none; border: none; background: transparent; cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1; padding: 2px 3px; border-radius: 5px; flex-shrink: 0; }
.ch-item:hover .ch-time { display: none; }
.ch-item:hover .ch-del { display: inline-block; }
.ch-item .ch-del:hover { color: var(--danger); background: rgba(220,38,38,.08); }

.chat-panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: #f7f9fc; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); padding: 24px; }
.chat-empty .ce-icon { font-size: 46px; animation: floatY 3s ease-in-out infinite; }
.chat-empty .ce-title { font-size: 19px; font-weight: 600; color: var(--ink); margin: 12px 0 8px; }
.chat-empty .ce-sub { font-size: 14px; line-height: 1.7; max-width: 460px; }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.bubble { max-width: 80%; padding: 12px 16px; border-radius: 14px; font-size: 16px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
/* 入场动画只给智能管家：#msg-chat 也是 .chat-scroll，一条会话几百条消息时不该整屏重放动画 */
#agent-chat .bubble { animation: bubbleIn .28s cubic-bezier(.2,.8,.3,1); }
.bubble.user { align-self: flex-end; background: linear-gradient(135deg, #2f6feb, #4d86f2); color: #fff; border-bottom-right-radius: 4px; box-shadow: 0 2px 10px rgba(47,111,235,.22); }
.bubble.bot { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(16,24,40,.05); }
.bubble.bot img { max-width: 100%; border-radius: 8px; margin-top: 6px; }

/* 智能管家回复的 Markdown 排版（QH.md 渲染）：reset 气泡的 pre-wrap，收回浏览器默认大间距 */
.md { white-space: normal; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 10px 0 6px; font-weight: 700; line-height: 1.35; }
.md h1 { font-size: 1.25em; }
.md h2 { font-size: 1.15em; }
.md h3 { font-size: 1.05em; }
.md h4, .md h5, .md h6 { font-size: 1em; }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 1.5em; }
.md li { margin: 2px 0; }
.md code { background: rgba(127,127,127,.16); padding: 1px 5px; border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; }
.md pre { background: rgba(127,127,127,.14); padding: 8px 10px; border-radius: 6px;
  overflow-x: auto; margin: 6px 0; }
.md pre code { background: none; padding: 0; white-space: pre; }
.md blockquote { margin: 6px 0; padding: 2px 0 2px 10px; border-left: 3px solid rgba(127,127,127,.45); opacity: .92; }
.md hr { border: none; border-top: 1px solid rgba(127,127,127,.3); margin: 8px 0; }
.md a { color: var(--primary, #2f6feb); text-decoration: underline; }
.bubble .meta { display: block; font-size: 12px; color: #9aa4b5; margin-top: 4px; }
.bubble.user .meta { color: rgba(255,255,255,.7); }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

/* 流式打字光标 */
.stream-body.streaming::after { content: "▍"; color: var(--primary); margin-left: 1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
/* 等待首字的三点动画 */
.typing { display: inline-flex; gap: 5px; padding: 4px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #b9c6da; animation: typingDot 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typingDot { 0%,60%,100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }

/* 智能管家流式输出：工具调用卡片 + 可折叠思考过程 */
.tool-calls { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.tool-call { display: flex; align-items: center; gap: 8px; padding: 7px 11px; border-radius: 10px; font-size: 13px;
  background: linear-gradient(90deg, #eef4ff, #f8fbff); border: 1px solid #dbe6fb; color: #3b5b96; animation: bubbleIn .25s ease; }
.tool-call.running { animation: bubbleIn .25s ease, pulseRing 1.7s ease-out infinite; }
.tool-call .tc-spin { width: 12px; height: 12px; border: 2px solid #b9cdf0; border-top-color: var(--primary);
  border-radius: 50%; flex-shrink: 0; animation: spin .7s linear infinite; }
.tool-call .tc-name { font-weight: 600; flex-shrink: 0; }
.tool-call .tc-state { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-call.done { background: #f1f8f3; border-color: #cfe9d6; color: #2f7d4f; }
.tool-call.done .tc-spin { border: none; width: auto; height: auto; animation: none; font-size: 13px; }
.tool-call.done .tc-spin::after { content: "✓"; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 rgba(47,111,235,.30); } 100% { box-shadow: 0 0 0 9px rgba(47,111,235,0); } }

.bubble .think { margin-bottom: 6px; font-size: 14px; }
.bubble .think summary { cursor: pointer; color: #7b8794; user-select: none; }
.bubble .think-body { white-space: pre-wrap; max-height: 220px; overflow: auto; margin-top: 4px;
  padding: 4px 10px; border-left: 2px solid var(--border); color: #6b7280; font-size: 13.5px; }
.bubble .stream-body { white-space: pre-wrap; }
.chat-quick { display: flex; gap: 6px; padding: 10px 14px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.chip { border: 1px solid var(--border); background: #fff; border-radius: 16px; padding: 6px 14px; font-size: 14px; cursor: pointer; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chat-input-row { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); }
.chat-input-row textarea {
  flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px;
  font-size: 16px; font-family: inherit; resize: none; outline: none;
}
.chat-input-row textarea:focus { border-color: var(--primary); }
.agent-side { display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.cmd-list { list-style: none; }
.cmd-list li { font-size: 14px; color: var(--muted); padding: 7px 0; border-bottom: 1px dashed var(--border); }
.cmd-list code { background: var(--primary-light); color: var(--primary-dark); border-radius: 4px; padding: 2px 6px; font-size: 13px; }
.receipts .receipt { padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.receipt img { max-width: 100%; border-radius: 6px; margin-top: 4px; border: 1px solid var(--border); }

/* ---------------- 消息记录 ---------------- */
.messages-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; height: calc(100vh - 130px); }
.conv-list { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow-y: auto; }
.conv-item { padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.conv-item:hover { background: #f7f9fc; }
.conv-item.active { background: var(--primary-light); }
.conv-item .name { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.conv-item .digest { color: var(--muted); font-size: 14px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .time { float: right; color: #9aa4b5; font-size: 13px; }
.msg-in .bubble { align-self: flex-start; background: #fff; }
.msg-out .bubble { align-self: flex-end; background: #d8e9d0; }
.sender-name { font-size: 13px; color: var(--muted); margin-bottom: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.msg-ops { margin-left: auto; display: inline-flex; gap: 4px; }
.btn-link.revoke-btn { background: none; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--primary); padding: 1px 8px; cursor: pointer; }
.btn-link.revoke-btn:hover { background: rgba(22,128,99,.08); }
.btn-link.revoke-btn:disabled { color: #9aa4b5; cursor: default; opacity: .6; }
.revoked-tag { color: #c00; font-size: 12px; }
.bubble.bubble-revoked { color: var(--muted); opacity: .75; font-style: italic; }
.msg-in .bubble .media-thumb { max-width: min(240px, 100%); max-height: 320px; border-radius: 10px; display: block; cursor: zoom-in; margin-bottom: 6px; }
.msg-in .bubble .media-label { display: block; font-size: 12px; color: var(--muted); }
.msg-in .bubble .media-img { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.msg-in .bubble .media-img .media-thumb { margin-bottom: 0; }
.msg-in .bubble .media-img-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.msg-in .bubble .media-img-meta .img-dl { font-size: 12px; color: var(--primary); text-decoration: none; border: 1px solid var(--border); padding: 1px 8px; border-radius: 6px; }
.msg-in .bubble .media-img-meta .img-dl:hover { background: rgba(22,128,99,.08); }
.msg-in .bubble .file-card { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: #f7f8fa; font-size: 15px; }
.msg-in .bubble .file-card .file-name { color: var(--primary); font-weight: 600; cursor: pointer; word-break: break-all; }
.msg-in .bubble .file-card.link .file-name { color: #576b95; }
.msg-in .bubble .media-voice { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 240px; }
.msg-in .bubble .media-voice audio { width: 100%; height: 36px; }
.msg-in .bubble .media-voice .file-name, .msg-in .bubble .media-video .file-name { color: var(--muted); font-size: 13px; text-decoration: none; }
.msg-in .bubble .media-video { display: flex; flex-direction: column; gap: 6px; }
.msg-in .bubble .media-video video { max-width: min(320px, 100%); max-height: 320px; border-radius: 10px; background:#000; }

/* ---------------- 表格 ---------------- */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; padding: 13px 16px; background: var(--surface-2); color: #465469; font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }
.pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; align-items: center; font-size: 15px; color: var(--muted); }

/* 表格里的次要文本 */
.muted { color: var(--muted); font-size: 13px; }
.kb-stats { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.kb-stat { background: var(--card); border-radius: 10px; padding: 12px 18px; box-shadow: var(--shadow); font-size: 15px; }
.kb-stat b { color: var(--primary); margin-left: 6px; }

/* ---------------- 设置 ---------------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; align-items: start; }
.form label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 5px; }
.form label .hint { font-weight: normal; color: #9aa4b5; font-size: 12px; }
.form .input { width: 100%; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.form-result { font-size: 14px; margin-top: 8px; min-height: 16px; }
.form-result.ok { color: var(--success); }
.form-result.err { color: var(--danger); }

/* wecomapi 多账号槽位 */
.wecom-slots { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.wecom-slot { display: grid; grid-template-columns: 22px 100px 1.25fr 1fr; gap: 8px; align-items: center; padding: 3px 4px; border-radius: 8px; }
.wecom-slot.on { background: var(--primary-light); }
.wecom-slot input[type=radio] { width: 18px; height: 18px; accent-color: var(--primary); }
.wecom-slot .input { width: 100%; }

/* ---------------- 弹窗 / Toast ---------------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 14px; padding: 26px; width: 600px; max-width: 92vw; max-height: 88vh; overflow-y: auto; }
.modal h3 { margin-bottom: 16px; font-size: 18px; }
.modal .form-actions { margin-top: 20px; justify-content: flex-end; }
#toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1e2633; color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 15px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: slideIn .25s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1100px) {
  .agent-layout, .messages-layout { grid-template-columns: 1fr; height: auto; }
  .panel-row { grid-template-columns: 1fr; }
  .task-body { grid-template-columns: 1fr; }
  .task-q { border-right: none; border-bottom: 1px solid var(--border); }
  .conv-list { max-height: 260px; }
  .chat-scroll { min-height: 380px; }
  .chat-history { max-height: 220px; }
}

/* ---------------- 移动端基础（桌面隐藏） ---------------- */
.mobile-bar { display: none; }
.sidebar-backdrop { display: none; }

/* ---------------- 移动端自适应 ≤768px ---------------- */
@media (max-width: 768px) {
  /* —— 侧边栏 → 抽屉 —— */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 260px; z-index: 110;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .sidebar.open { transform: none; box-shadow: 2px 0 24px rgba(0,0,0,.25); }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 105; opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

  /* —— 移动端顶栏 —— */
  .mobile-bar {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    background: var(--card); box-shadow: var(--shadow); border-radius: var(--radius);
    margin-bottom: 14px; position: sticky; top: 0; z-index: 50;
  }
  .menu-toggle {
    border: 1px solid var(--border); background: #fff; border-radius: 8px;
    padding: 7px 10px; cursor: pointer; line-height: 1; display: flex; align-items: center;
    color: var(--ink);
  }
  .menu-toggle:active { background: var(--primary-light); }
  .mobile-title { font-size: 16px; font-weight: 600; color: var(--ink); }

  /* —— 内容区 —— */
  .content { padding: 12px 14px; }

  /* —— 登录 —— */
  .login-card { width: calc(100% - 32px); max-width: 400px; padding: 32px 24px; }

  /* —— 视图标题 —— */
  .view-header { flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 16px; }
  .view-header h2 { font-size: 20px; }
  .header-note { font-size: 12px; }
  .header-actions { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .header-actions .input { flex: 1 1 100%; }

  /* —— 统计卡 —— */
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 10px; }
  .stat-card { padding: 14px 16px; }
  .stat-num { font-size: 24px; }
  .stat-label { font-size: 13px; }

  /* —— 面板 —— */
  .panel { padding: 16px; }
  .panel-row { grid-template-columns: 1fr; gap: 12px; }

  /* —— 分段按钮 → 横向滚动 —— */
  .seg { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
  .seg button { white-space: nowrap; flex-shrink: 0; padding: 7px 14px; }

  /* —— 审批卡片 —— */
  .task-head { padding: 12px 14px; }
  .task-q, .task-a { padding: 14px; }
  .task-foot { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 14px; }
  .task-foot .learn-hint { margin-right: 0; margin-bottom: 2px; font-size: 13px; }
  .task-foot .btn { width: 100%; justify-content: center; font-size: 14px; padding: 12px 14px; min-height: 46px; }

  /* —— Agent 聊天 —— */
  .agent-layout { height: auto; }
  .agent-side { display: none; }            /* 移动端隐藏侧栏，聚焦聊天 */
  .chat-history { max-height: 170px; }
  /* 触屏没有 hover，删除按钮必须常显，否则移动端根本删不掉会话 */
  .ch-item .ch-del { display: inline-block; }
  .ch-item .ch-time { display: none; }
  .chat-scroll { min-height: 280px; padding: 14px; }
  .bubble { max-width: 85%; font-size: 15px; }
  .chat-quick { padding: 8px 10px; }
  .chip { padding: 5px 12px; font-size: 13px; }
  .chat-input-row { gap: 6px; padding: 10px; }
  .chat-input-row textarea { font-size: 15px; }

  /* —— 消息记录 —— */
  .messages-layout { height: auto; }
  .conv-list { max-height: 200px; }

  /* —— 表格 → 横向滚动 —— */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 560px; }
  .table th, .table td { padding: 10px 12px; font-size: 14px; }

  /* —— 分页 —— */
  .pager { justify-content: center; font-size: 14px; }

  /* —— 知识库统计 —— */
  .kb-stats { gap: 8px; }
  .kb-stat { padding: 10px 14px; font-size: 14px; }

  /* —— 设置 → 单列 —— */
  .settings-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  /* —— 动态流 —— */
  .activity-feed { max-height: 220px; }

  /* —— 弹窗 —— */
  .modal { width: auto; margin: 12px; padding: 18px; max-width: calc(100vw - 24px); }

  /* —— Toast → 底部 —— */
  #toast-wrap { top: auto; bottom: 16px; right: 12px; left: 12px; }
  .toast { font-size: 14px; padding: 10px 16px; }

  /* —— 按钮 touch 优化 & 触控目标 ≥44px —— */
  .btn, .chip, .seg button, .menu-toggle, .quick-switch {
    touch-action: manipulation; min-height: 44px;
  }
  .seg button { min-height: 44px; }
  .quick-switch { min-height: 44px; }
  .menu-toggle { width: 44px; height: 44px; justify-content: center; }
}
/* ============================================================
 * 群发消息视图 · 精致卡片式布局
 * ============================================================ */
.broadcast-layout {
  display: grid; grid-template-columns: minmax(340px, 7fr) minmax(320px, 5fr);
  gap: 18px; height: calc(100vh - 150px); min-height: 460px;
}

/* —— 左：目标选择卡片 —— */
.bc-left { display: flex; flex-direction: column; min-width: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.bc-toolbar { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.bc-title-row { display: flex; align-items: center; gap: 8px; }
.bc-title-row h3 { font-size: 16px; }
.bc-status { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.bc-status .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #9aa4b5; margin-right: 5px; vertical-align: 1px; }
.bc-status.ok .dot { background: var(--success); }
.bc-status.loading .dot { background: var(--warning); animation: bcPulse 1s infinite; }
@keyframes bcPulse { 50% { opacity: .35; } }
.bc-search-row { display: flex; gap: 8px; align-items: center; }
.bc-search { flex: 1; position: relative; }
.bc-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #9aa4b5; pointer-events: none; }
.bc-search input { width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--border); border-radius: 9px; font-size: 14.5px; outline: none; background: var(--surface-2); transition: border-color .15s, background .15s; }
.bc-search input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(47,111,235,.1); }
.bc-refresh { flex: none; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; padding: 0; }
.bc-refresh svg { transition: transform .4s; }
.bc-refresh.spin svg { animation: bcSpin .8s linear infinite; }
@keyframes bcSpin { to { transform: rotate(360deg); } }

/* Tab 切换 */
.bc-tabs { display: flex; gap: 4px; background: #f0f3f8; border-radius: 10px; padding: 4px; }
.bc-tabs button {
  flex: 1; border: none; background: transparent; padding: 8px 10px; border-radius: 8px;
  font-size: 14px; color: var(--muted); cursor: pointer; transition: all .18s; font-family: inherit;
}
.bc-tabs button:hover { color: var(--ink); }
.bc-tabs button.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(16,24,40,.1); }
.bc-tabs .num { font-size: 12px; color: #9aa4b5; margin-left: 3px; font-weight: normal; }
.bc-tabs button.active .num { color: var(--primary); }

/* 联系人子筛选（企微 / @微信） */
.bc-subfilter { display: flex; gap: 4px; margin-top: 8px; }
.bc-subfilter button {
  flex: 1; border: 1px solid #e3e9f2; background: #fff; padding: 6px 8px; border-radius: 8px;
  font-size: 13px; color: var(--muted); cursor: pointer; transition: all .18s; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.bc-subfilter button:hover { border-color: #c9d5ea; color: var(--ink); }
.bc-subfilter button.active { border-color: var(--primary); color: var(--primary); background: #f3f7ff; font-weight: 600; }
.bc-subfilter .num { font-size: 11px; color: #9aa4b5; font-weight: normal; }
.bc-subfilter button.active .num { color: var(--primary); }

/* 全选 / 重置（群发目标工具栏） */
.bc-actions { display: flex; gap: 8px; }
.bc-actions button {
  flex: 1; border: 1px solid #e3e9f2; background: #fff; padding: 6.5px 8px; border-radius: 8px;
  font-size: 13px; color: var(--muted); cursor: pointer; transition: all .18s; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.bc-actions button:hover { border-color: var(--primary); color: var(--primary); background: #f3f7ff; }
.bc-actions button:active { transform: scale(.97); }

/* 批量匹配状态条 */
.bc-batchbar {
  display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap;
  background: #eef4ff; border: 1px solid #cfe0ff; border-radius: 8px;
  padding: 7px 9px; font-size: 12.5px; color: #2e5399;
}
.bc-batchbar .bc-binfo { font-weight: 600; flex: none; }
.bc-batchbar .bc-bmiss { color: #b45309; flex: 1 1 200px; word-break: break-all; }
.bc-batchbar .bc-bclear {
  flex: none; border: none; background: transparent; color: #6b7686; cursor: pointer;
  font-size: 13px; line-height: 1; padding: 2px; margin-left: auto;
}
.bc-batchbar .bc-bclear:hover { color: #dc2626; }

/* 弹窗说明文字 */
.modal-hint { color: var(--muted); font-size: 13px; line-height: 1.7; margin-bottom: 14px; }
.modal-hint b { color: inherit; font-weight: 600; }

/* 联系人类型角标（头像右下） */
.bc-kbadge {
  position: relative; margin-left: -12px; margin-top: 18px; z-index: 2; flex: none;
  font-size: 9px; line-height: 1; padding: 2.5px 4px; border-radius: 5px;
  color: #fff; font-weight: 600; border: 1.5px solid #fff;
}
.bc-kbadge.wecom { background: #2f6feb; }
.bc-kbadge.wx { background: #07c160; padding: 2.5px 3px; }

/* 列表 */
.bc-list { flex: 1; overflow-y: auto; padding: 8px; min-height: 140px; }
.bc-list::-webkit-scrollbar { width: 8px; }
.bc-list::-webkit-scrollbar-thumb { background: #d5dbe6; border-radius: 4px; }
.bc-list::-webkit-scrollbar-thumb:hover { background: #b9c2d2; }
.bc-item {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px;
  cursor: pointer; font-size: 14.5px; transition: background .13s; user-select: none;
}
.bc-item:hover { background: #f3f6fc; }
.bc-item.on { background: #edf3ff; }
.bc-avatar {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 600;
}
.bc-avatar.grp { border-radius: 50%; font-size: 13px; }
.bc-body { flex: 1; min-width: 0; }
.bc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.35; }
.bc-sub { font-size: 12px; color: #9aa4b5; line-height: 1.3; margin-top: 1px; }
/* 自定义勾选圆 */
.bc-check {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid #cdd6e4; flex: none;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.bc-check svg { opacity: 0; transform: scale(.4); transition: all .15s; color: #fff; }
.bc-item:hover .bc-check { border-color: var(--primary); }
.bc-item.on .bc-check { background: var(--primary); border-color: var(--primary); }
.bc-item.on .bc-check svg { opacity: 1; transform: scale(1); }

/* —— 右：编辑 + 已选 + 结果 —— */
.bc-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.bc-panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bc-panel-head { display: flex; align-items: center; gap: 8px; }
.bc-panel-head h3 { font-size: 15.5px; }
.bc-panel-head .sub { font-size: 12.5px; color: var(--muted); margin-left: auto; }

/* 消息类型选择 */
.bc-types { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.bc-types button {
  border: 1px solid #e3e9f2; background: #fff; padding: 6px 11px; border-radius: 8px;
  font-size: 13.5px; color: var(--muted); cursor: pointer; transition: all .18s; font-family: inherit;
  display: inline-flex; align-items: center; gap: 5px;
}
.bc-types button:hover { border-color: #c9d5ea; color: var(--ink); }
.bc-types button.active { border-color: var(--primary); color: var(--primary); background: #f3f7ff; font-weight: 600; }

/* 动态消息表单 */
.bc-form { display: flex; flex-direction: column; gap: 9px; }
.bc-field { display: flex; flex-direction: column; gap: 4px; }
.bc-field label { font-size: 12.5px; color: var(--muted); }
.bc-field label .req { color: #dc2626; margin-left: 2px; }
.bc-field .input { width: 100%; box-sizing: border-box; font-size: 14px; padding: 9px 12px; }
.bc-field textarea {
  width: 100%; resize: vertical; min-height: 108px; max-height: 260px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px;
  font-size: 14.5px; line-height: 1.65; font-family: inherit; outline: none;
  background: var(--surface-2); transition: border-color .15s, box-shadow .15s;
}
.bc-field textarea:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(47,111,235,.1); }
.bc-field textarea::placeholder { color: #a8b1c2; }
/* 输入框 + 行内小按钮（如小程序封面「选图获取地址」） */
.bc-input-row { display: flex; align-items: center; gap: 8px; }
.bc-input-row .input { flex: 1; min-width: 0; }
.bc-input-row .btn-sm { padding: 8px 11px; font-size: 13px; white-space: nowrap; }
.bc-input-row .btn-sm:disabled { opacity: .65; cursor: default; }
.bc-form-hint {
  font-size: 13px; color: var(--muted); background: #f8fafd;
  border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px; line-height: 1.6;
}

/* 卡片采集（从主人） */
.bc-collect-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  background: #f5f8ff; border: 1px solid #dbe6fb; border-radius: 10px;
  padding: 9px 11px; margin-bottom: 3px;
}
.bc-collect-bar .bc-collect-tip { font-size: 12.5px; color: var(--muted); margin-right: auto; }
.bc-collect-bar .btn-sm { padding: 5px 11px; font-size: 13px; }

.bc-card-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow-y: auto; margin: 4px 0 2px; }
.bc-card-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  transition: border-color .15s, background .15s;
}
.bc-card-item:hover { border-color: var(--primary); background: #f7faff; }
.bc-card-thumb {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 8px; object-fit: cover;
  background: #eef2f8; display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.bc-card-thumb.ph { color: #9aa4b5; }
.bc-card-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.bc-card-title { font-size: 14px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-card-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-card-use {
  flex: 0 0 auto; font-size: 12.5px; color: var(--primary); border: 1px solid #cfe0fc;
  background: #eef3ff; border-radius: 7px; padding: 4px 10px;
}
.bc-card-del {
  flex: 0 0 auto; border: none; background: none; cursor: pointer; line-height: 1;
  font-size: 15px; padding: 5px 6px; border-radius: 7px; color: var(--muted);
}
.bc-card-del:hover { background: #fdecec; color: #d64545; }
.bc-attach-area.required .bc-attach-btn { border-color: var(--primary); color: var(--primary); }

/* 已选目标标签 */
.bc-chips { display: flex; flex-wrap: wrap; gap: 7px; max-height: 128px; overflow-y: auto; }
.bc-chips:empty::before { content: "尚未选择目标，点击左侧列表添加"; color: #9aa4b5; font-size: 13px; padding: 4px 0; }
.bc-chip {
  display: inline-flex; align-items: center; gap: 6px; background: #eef3ff; color: var(--primary-dark);
  border: 1px solid #d4e2fc; border-radius: 8px; padding: 4px 9px; font-size: 13.5px; max-width: 100%;
  animation: chipIn .18s ease;
}
@keyframes chipIn { from { transform: scale(.8); opacity: 0; } }
.bc-chip .cn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-chip .cx {
  display: flex; align-items: center; justify-content: center; width: 17px; height: 17px;
  border-radius: 50%; cursor: pointer; color: #7d95c9; transition: all .13s; flex: none; font-size: 13px; line-height: 1;
}
.bc-chip .cx:hover { background: var(--danger); color: #fff; }

/* 发送区 */
.bc-send-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bc-count-p { font-size: 13px; color: var(--muted); }
.bc-count-p b { color: var(--primary); font-size: 16px; }
/* 群发可勾选开关（限频自动降速 / 随机频率 / 分批 / 并行）：均为可选，默认不勾选 */
.bc-opts { margin-left: auto; display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bc-opts .bc-parallel { margin-left: 0; }
/* 并行群发开关：默认不勾选（官方文档不建议并发发送，故标注「慎重」） */
.bc-parallel {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: #b45309; cursor: pointer; white-space: nowrap; user-select: none;
}
.bc-parallel input { width: 15px; height: 15px; accent-color: #f59e0b; cursor: pointer; margin: 0; }
#bc-send {
  margin-left: auto; padding: 11px 26px; font-size: 15.5px; border-radius: 10px;
  display: inline-flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(47,111,235,.28); transition: all .18s;
}
#bc-send:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(47,111,235,.36); }
#bc-send:disabled { opacity: .55; transform: none; cursor: not-allowed; box-shadow: none; }

/* 结果面板 */
.bc-result-panel { flex: 1; min-height: 150px; overflow: hidden; }
.bc-progress-wrap { display: none; }
.bc-progress-wrap.show { display: block; }
.bc-progress-nums { display: flex; align-items: center; gap: 10px; font-size: 13.5px; flex-wrap: wrap; }
.bc-progress-nums b { font-size: 16px; }
.bc-progress-nums .ok-n { color: var(--success); }
.bc-progress-nums .fail-n { color: var(--danger); }
.bc-bar { height: 7px; border-radius: 4px; background: #edf0f6; overflow: hidden; margin-top: 8px; }
.bc-bar > i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #4c86f0, #2f6feb); transition: width .4s ease; }
.bc-rows { list-style: none; margin: 0; padding: 0 8px 6px; }
.bc-rows li {
  display: flex; align-items: center; gap: 8px; padding: 6px 4px;
  border-bottom: 1px dashed #eef0f6; font-size: 13.5px; animation: chipIn .2s ease;
}
.bc-rows li:last-child { border-bottom: none; }

/* 结果分组折叠容器（失败组在上、成功组在下；最新发送置顶） */
.bc-groups { flex: 1; min-height: 0; overflow-y: auto; margin: 6px 0 0; padding: 0 2px 4px; }
.bc-group { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: #fbfcfe; overflow: hidden; }
.bc-group.fail { border-color: #f5c6c6; background: #fff8f8; }
.bc-group-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 12px; border: none; background: none; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--text); text-align: left;
}
.bc-group-head:hover { background: rgba(47,111,235,.06); }
.bc-caret {
  width: 0; height: 0; flex: none;
  border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent;
  border-left: 6px solid #8a94a6; transition: transform .18s ease;
}
.bc-group.open .bc-caret { transform: rotate(90deg); }
.bc-group.fail .bc-caret { border-left-color: #dc2626; }
.bc-gtitle { flex: 1; }
.bc-gcount {
  min-width: 26px; height: 20px; padding: 0 7px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; background: #e8edf5; color: #475569;
}
.bc-group.fail .bc-gcount { background: #fee2e2; color: #b91c1c; }
.bc-group.ok .bc-gcount { background: #dcfce7; color: #15803d; }
/* 中途停止：未发送组（灰调，默认展开） */
.bc-group.skip { border-color: #dde3ea; background: #f7f8fa; }
.bc-group.skip .bc-gcount { background: #e9edf2; color: #55606e; }
/* -4048 重试 2 次仍失败：限流拦截组（琥珀调，默认展开，便于换账号补发） */
.bc-group.freq { border-color: #fde68a; background: #fffdf5; }
.bc-group.freq .bc-gcount { background: #fef3c7; color: #b45309; }
.bc-group.freq .bc-caret { border-left-color: #d97706; }
.bc-group-rows { display: none; border-top: 1px dashed var(--border); }
.bc-group.open .bc-group-rows { display: block; }
.bc-ricon { width: 19px; height: 19px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; }
.bc-rows li.good .bc-ricon { background: var(--success); }
.bc-rows li.bad .bc-ricon { background: var(--danger); }
.bc-rows li.skip .bc-ricon { background: #98a2b3; }
.bc-rname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-rerr { color: var(--danger); font-size: 12px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-empty { text-align: center; color: #9aa4b5; font-size: 13.5px; padding: 18px 8px; }

/* 结果行：错误类型徽标与重试次数 */
.bc-rtype {
  flex: none; padding: 1px 7px; border-radius: 9px; font-size: 11px; font-weight: 600;
  background: #eef1f6; color: #64748b;
}
.bc-rtype.freq { background: #fef3c7; color: #b45309; }
.bc-rtype.blocked { background: #ede9fe; color: #6d28d9; }
.bc-rtype.other { background: #fee2e2; color: #b91c1c; }
.bc-rtype.skipped { background: #e9edf2; color: #55606e; }
.bc-rretry { flex: none; font-size: 11.5px; color: #d97706; background: #fffbeb; border: 1px solid #fde68a; border-radius: 9px; padding: 1px 6px; }

/* 确认弹窗：附件提示与预计耗时 */
.bc-confirm-hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
/* 并行发送风险提示（确认弹窗内） */
.bc-confirm-warn {
  font-size: 12.5px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 8px; padding: 8px 12px; line-height: 1.65; margin: 6px 0 0;
}
.bc-confirm-warn b { color: #b45309; }
.bc-confirm-est {
  font-size: 13px; color: #6b7280; background: #f0f6ff; border: 1px solid #dbe8fb;
  border-radius: 8px; padding: 8px 12px; line-height: 1.6;
}
.bc-confirm-est b { color: var(--primary); }

/* 确认弹窗 */
.bc-confirm { display: flex; flex-direction: column; gap: 14px; }
.bc-confirm-nums { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.bc-confirm-nums b { color: var(--primary); font-size: 17px; }
.bc-confirm-nums .sep::before { content: "·"; margin-right: 10px; color: #c3cbd9; }
.bc-confirm-box {
  border: 1px solid var(--border); background: #f8fafd; border-radius: 10px;
  padding: 12px 14px; font-size: 14.5px; line-height: 1.65; white-space: pre-wrap;
  word-break: break-word; max-height: 220px; overflow-y: auto;
}

/* 响应式 */
@media (max-width: 1100px) {
  .broadcast-layout { grid-template-columns: 1fr; height: auto; }
  .bc-list { max-height: 320px; }
  .bc-result-panel { min-height: 120px; }
  .bc-groups { max-height: 300px; }
}

/* 群发附件区域 */
.bc-attach-panel { }
.bc-attach-area {
  display: flex; gap: 8px; align-items: center; padding: 6px 0;
}
.bc-attach-btn { font-size: 13.5px; }
.bc-attach-preview {
  display: flex; gap: 10px; flex-wrap: wrap; padding: 8px 0;
}
.bc-attach-card {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: #f8fafd;
  max-width: 100%;
}
.bc-attach-card .ba-icon { font-size: 22px; }
.bc-attach-card .ba-info { flex: 1; min-width: 0; }
.bc-attach-card .ba-name {
  font-size: 13px; font-weight: 500; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}
.bc-attach-card .ba-meta { font-size: 11px; color: var(--muted); }
.bc-attach-card .ba-remove {
  cursor: pointer; color: var(--muted); font-size: 16px; padding: 2px 6px;
  border: none; background: none;
}
.bc-attach-card .ba-remove:hover { color: #dc2626; }
.bc-attach-img-thumb {
  max-width: 80px; max-height: 80px; border-radius: 6px; border: 1px solid var(--border);
}

/* ---------------- 图片大图预览（lightbox） ---------------- */
.qhlb { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; }
.qhlb-back { position: absolute; inset: 0; background: rgba(0,0,0,.86); cursor: zoom-out; }
.qhlb-figure { position: relative; max-width: 92vw; max-height: 94vh; margin: 0; display: flex; flex-direction: column; }
.qhlb-img { max-width: 92vw; max-height: 84vh; object-fit: contain; border-radius: 8px; background: #000; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.qhlb-bar { display: flex; align-items: center; gap: 12px; padding: 8px 2px 0; color: #fff; font-size: 13px; }
.qhlb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .9; }
.qhlb-dl { color: #fff; background: rgba(255,255,255,.16); text-decoration: none; padding: 4px 12px; border-radius: 6px; border: 1px solid rgba(255,255,255,.35); }
.qhlb-dl:hover { background: rgba(255,255,255,.3); }
.qhlb-close { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; width: 30px; height: 30px; cursor: pointer; font-size: 15px; line-height: 1; }
.qhlb-close:hover { background: rgba(255,255,255,.3); }

/* ---------------- 学生多模态 ---------------- */
.mm-layout { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
@media (max-width: 1024px) { .mm-layout { grid-template-columns: 1fr; } }
/* 数字人合成：参数列收窄、结果列加宽（结果视频更适合宽屏） */
.mm-layout--dh { grid-template-columns: minmax(300px, 400px) 1fr; }
@media (max-width: 1024px) { .mm-layout--dh { grid-template-columns: 1fr; } }
.mm-form { margin-bottom: 0; }
.mm-side { display: flex; flex-direction: column; gap: 14px; }

.mm-subj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; margin-bottom: 14px; }
.mm-subj { display: flex; flex-direction: column; gap: 4px; }
.mm-subj label { font-size: 12px; color: var(--muted, #666); }
.mm-subj .input { text-align: center; }

.mm-holland-row { display: flex; gap: 16px; flex-wrap: wrap; }
.mm-holland-col { flex: 1; min-width: 260px; }
.h-line { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.h-line label { flex: 1; font-size: 13px; }
.h-line .input { width: 110px; }

.mm-opt { border: 1px dashed var(--border, #d9e2f0); border-radius: 10px; padding: 10px 12px; margin: 14px 0; }
.mm-opt summary { cursor: pointer; font-weight: 600; color: var(--primary, #2f6feb); font-size: 14px; }
.mm-opt[open] summary { margin-bottom: 12px; }

/* 意向专业勾选窗：本科/专科 → 专业类（一级，可折叠）→ 具体专业（二级，可勾选） */
.mm-pick-bar { display: flex; gap: 8px; margin: 4px 0 10px; }
.mm-major-wrap { max-height: 46vh; overflow-y: auto; padding-right: 2px; }
.mm-major-sec { margin-bottom: 12px; }
.mm-major-sec-title { font-size: 13px; font-weight: 700; color: var(--muted, #6b7688); margin: 0 0 6px; }
.mm-major-group { border: 1px solid var(--border, #e3ecf6); border-radius: 8px; margin-bottom: 8px; background: #fcfeff; }
.mm-major-group > summary { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; }
.mm-major-group > summary em { font-style: normal; font-weight: 400; font-size: 11.5px; color: var(--muted, #8a94a6); }
.mm-major-group .mm-major-item { border: none; border-top: 1px dashed #e6eefa; border-radius: 0; padding: 6px 10px 6px 20px; }
.mm-major-item { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border, #e3ecf6); border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.mm-major-item:hover { background: #f5f9ff; }
.mm-major-name { flex: 1; font-size: 13px; }
.mm-major-meta { font-size: 11px; color: var(--muted, #888); font-style: normal; white-space: nowrap; }

.mm-slot { border: 1px solid var(--border, #e3ecf6); background: #f8fafd; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.mm-slot-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.mm-slot-head > span { font-weight: 600; color: var(--muted, #666); font-size: 13px; }
.mm-slot-label { width: 150px; }

/* 自动汇总总分 */
.mm-slot-total { margin-top: 8px; padding-top: 7px; border-top: 1px dashed #dbe5f3; font-size: 13px;
  color: var(--muted, #6b7688); text-align: right; }
.mm-total { margin: 4px 0 14px; padding: 10px 14px; border-radius: 10px; font-size: 13.5px;
  color: var(--primary-dark, #1d4fb3); background: linear-gradient(135deg, #eef4ff, #e6f7ff);
  border: 1px solid #d6e4ff; }
.mm-total b { font-size: 17px; font-weight: 800; color: var(--primary-dark, #1d4fb3); }

/* 历史列表 */
.mm-history { max-height: 560px; overflow-y: auto; }
.mm-item { padding: 10px 2px; border-bottom: 1px solid #eef2f8; }
.mm-item:last-child { border-bottom: none; }
.mm-item-top { display: flex; justify-content: space-between; align-items: center; }
.mm-item-sub { color: var(--muted, #888); font-size: 12px; margin: 3px 0; }
.mm-item-summary { font-size: 12px; color: #4a5568; background: #f5f8fd; border-radius: 6px; padding: 6px 8px; line-height: 1.5; margin-top: 4px; }
.mm-item-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.mm-item-actions .mm-act { font-size: 12px; }

.mm-item-top b:hover { color: var(--primary, #2f6feb); }

/* 报告预览弹窗：占满可视区域（覆盖通用 .modal 的 600px 限制） */
#modal-box:has(.mm-report-modal) {
  width: min(1280px, 95vw); max-width: 95vw; height: 94vh; max-height: 94vh; padding: 14px 16px 16px;
  overflow: hidden; display: flex; flex-direction: column;
}
.mm-report-modal { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; }
.mm-report-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  flex-wrap: wrap; padding: 10px 16px; border-radius: 10px; border: none; margin-bottom: 10px;
  background: linear-gradient(120deg, #2563eb, #1d4fb3 55%, #22b8d8); color: #fff;
  box-shadow: 0 4px 14px rgba(29, 79, 179, .28); }
.mm-report-bar b { font-size: 15px; letter-spacing: .3px; }
.mm-report-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mm-report-actions a { text-decoration: none; }
.mm-btn-light { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.45);
  backdrop-filter: blur(2px); }
.mm-btn-light:hover { background: rgba(255,255,255,.34); color: #fff; }
.mm-report-frame { flex: 1 1 auto; min-height: 0; width: 100%; border: 1px solid var(--border, #e3ecf6);
  border-radius: 10px; background: #fff; }
.mm-report-frame.mm-editing { outline: 2px dashed var(--primary); outline-offset: -3px; }
@media (max-width: 640px) {
  #modal-box:has(.mm-report-modal) { width: 96vw; max-width: 96vw; height: 92vh; max-height: 92vh; padding: 10px; }
  .mm-report-bar { padding: 8px 10px; }
}

/* ---------------- 生成中动画（旧角落进度条已由全屏 QH.gen 弹窗取代） ---------------- */
@keyframes mm-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.16); } }
@keyframes mm-flow { to { background-position: -200% 0; } }
@keyframes mm-fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ---------------- 全屏「生成中」弹窗（数字人 / 学生多模态共用） ---------------- */
.gen-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: radial-gradient(1200px 700px at 50% 20%, rgba(37,99,235,.10), rgba(15,23,42,.38) 70%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  font-family: var(--font, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif);
}
.gen-card {
  width: min(1080px, 94vw); height: min(760px, 90vh);
  background: #fff;
  border: 1px solid #e3e6ea; border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15,23,42,.18);
  color: #1f2328; display: flex; flex-direction: column;
  padding: 26px 30px 22px; overflow: hidden;
}
.gen-head { display: flex; align-items: center; gap: 22px; }
.gen-ring {
  width: 130px; height: 130px; flex: none; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.gen-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gen-ring-bg { fill: none; stroke: rgba(37,99,235,.14); stroke-width: 8; }
.gen-ring-fg {
  fill: none; stroke: #2563eb; stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7;
  transform-box: fill-box; transform-origin: center;
  filter: drop-shadow(0 0 6px rgba(37,99,235,.35));
  animation: gen-spin 1.6s linear infinite;
}
.gen-ring-core { position: absolute; left: 0; right: 0; top: 12px; text-align: center; font-size: 34px; animation: mm-pulse 1.6s ease-in-out infinite; }
.gen-ring-num { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-size: 17px; font-weight: 700; color: #2563eb; }
.gen-titles { min-width: 0; }
.gen-title { font-size: 22px; font-weight: 800; letter-spacing: .4px; color: #101828; }
.gen-step { margin-top: 8px; font-size: 15px; color: #475467; min-height: 22px; }
.gen-step.in { animation: mm-fade .5s ease; }
.gen-eta-line { margin-top: 6px; font-size: 13px; color: #667085; }
.gen-eta-line b { color: #2563eb; font-weight: 700; }
.gen-bar {
  margin: 22px 0 18px; height: 9px; border-radius: 999px;
  background: #eef2f7; overflow: hidden; position: relative;
}
.gen-bar i {
  display: block; height: 100%; width: 0; border-radius: 999px; min-width: 12px;
  background: linear-gradient(90deg, #2563eb, #38bdf8, #22d3ee); background-size: 200% 100%;
  animation: gen-flow 1.6s linear infinite;
  box-shadow: 0 0 10px rgba(56,189,248,.35);
}
.gen-cols { display: grid; grid-template-columns: 300px 1fr; gap: 18px; flex: 1; min-height: 0; }
.gen-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.gen-steps li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #667085; }
.gen-steps li.active { color: #1f2328; font-weight: 700; }
.gen-steps li.done { color: #2563eb; }
.gen-step-dot {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: #f2f5f9; border: 1px solid #dfe4ea;
  font-size: 12px; color: #2563eb;
}
.gen-steps li.active .gen-step-dot { background: linear-gradient(135deg,#2563eb,#22d3ee); border-color: transparent; color: #fff; box-shadow: 0 0 10px rgba(37,99,235,.35); }
.gen-steps li.done .gen-step-dot { background: #0ea5e9; border-color: transparent; color: #fff; }
.gen-console {
  border: 1px solid #e3e6ea; border-radius: 12px; overflow: hidden;
  background: #f8fafc; display: flex; flex-direction: column; min-height: 0;
}
.gen-console-bar {
  display: flex; align-items: center; gap: 7px; padding: 8px 12px;
  background: #f1f5f9; border-bottom: 1px solid #e3e6ea;
  font-size: 12px; color: #667085; font-style: normal;
}
.gen-console-bar .dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.r { background: #f87171; } .dot.y { background: #fbbf24; } .dot.g { background: #34d399; }
.gen-console-bar em { margin-left: 6px; font-style: normal; }
.gen-console-body { flex: 1; overflow-y: auto; padding: 10px 14px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; line-height: 1.8; }
.gen-console-body div { color: #475467; white-space: pre-wrap; }
.gen-log-t { color: #667085; margin-right: 8px; }
.gen-tip { margin-top: 16px; text-align: center; font-size: 13.5px; color: #667085; min-height: 20px; }
@keyframes gen-spin { to { transform: rotate(360deg); } }
@keyframes gen-flow { to { background-position: -200% 0; } }
@media (max-width: 720px) {
  .gen-cols { grid-template-columns: 1fr; }
  .gen-card { padding: 18px 16px; }
  .gen-ring { width: 100px; height: 100px; }
}


/* 学员管理：诊断概览列 */
.stu-diag { max-width: 320px; }
.stu-diag-total { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.stu-view-report { background: none; border: none; color: var(--primary, #2f6feb); cursor: pointer; font-size: 12px; padding: 0; text-decoration: none; }
.stu-view-report:hover { text-decoration: underline; }
.stu-diag-sum { font-size: 12px; color: #4a5568; line-height: 1.5; overflow-wrap: break-word; }


/* ---------------- 工作台 · 想法灵感（漂浮文字） ---------------- */
.idea-panel { margin-top: 16px; }
.idea-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.idea-head h3 { margin: 0; }
.idea-add { margin-left: auto; display: flex; gap: 8px; }
.idea-add .input { width: 280px; }
.idea-stage {
  position: relative; height: 260px; overflow: hidden; border-radius: 10px;
  border: 1px dashed var(--border);
  background: radial-gradient(120% 120% at 15% 15%, #f2f7ff 0%, #eef3fb 45%, #f8fafc 100%);
}
.idea-item {
  position: absolute; top: 0; left: 0; white-space: nowrap; font-weight: 600;
  line-height: 1.25; user-select: none; will-change: transform;
}
.idea-del {
  margin-left: 4px; border: none; background: none; padding: 0;
  color: #94a3b8; font-size: 12px; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.idea-item:hover .idea-del { opacity: 1; color: var(--danger); }



@media (max-width: 900px) {
  .idea-add { width: 100%; }
  .idea-add .input { width: 100%; }
  .idea-stage { height: 300px; }
}
