:root {
  --bg: #0e1116;
  --bg-2: #161b22;
  --bg-3: #1c2330;
  --line: #2a3240;
  --text: #e6edf3;
  --text-dim: #8b98a9;
  --accent: #4c9aff;
  --accent-2: #58e6a9;
  --warn: #ffb454;
  --danger: #ff6b6b;
  --reply-size: 34px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
               "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; overflow: hidden; }

.hidden { display: none !important; }
/* .field 等用了 display:flex，会盖掉浏览器默认的 [hidden]{display:none}，
   于是 JS 里 node.hidden = true 根本不起作用（该藏的藏不住）。
   这条兜住所有情况。 */
[hidden] { display: none !important; }

/* ---------------- 顶栏 ---------------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  /* 必须能换行。
     以前这里既不换行、品牌区也不许收缩，窗口一窄按钮就被顶到屏幕右边 ——
     「设置」「资料库」直接点不到（不是不好看，是**够不着**）。
     开会时想临时改个参数都改不了，这种坑最烦人。 */
  flex-wrap: wrap;
  gap: 8px 14px;
}

.brand { display: flex; align-items: center; gap: 10px; flex: 0 1 auto; min-width: 0; }
.brand strong { white-space: nowrap; }

.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--text-dim);
  box-shadow: 0 0 0 3px rgba(139,152,169,.15);
}
.dot.ok   { background: var(--accent-2); box-shadow: 0 0 0 3px rgba(88,230,169,.15); }
.dot.warn { background: var(--warn);     box-shadow: 0 0 0 3px rgba(255,180,84,.15); }

.badge {
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: var(--bg-3); color: var(--text-dim);
  border: 1px solid var(--line);
}
.badge.ok   { color: var(--accent-2); border-color: rgba(88,230,169,.35); }
.badge.warn { color: var(--warn);     border-color: rgba(255,180,84,.35); }

.top-actions {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; justify-content: flex-end;
}
.meta { font-size: 12px; color: var(--text-dim); margin-right: 6px; white-space: nowrap; }
.top-actions button { white-space: nowrap; }

/* ---------------- 按钮 ---------------- */

button {
  font-family: inherit; font-size: 13px; cursor: pointer;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-3); color: var(--text);
  padding: 7px 13px;
  transition: background .12s, border-color .12s, opacity .12s;
}
button:hover { background: #232b39; border-color: #3a4557; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }

/* 「重置会议」等一下才生效的样子 */
button.danger-armed {
  background: rgba(255,107,107,.22);
  border-color: var(--danger);
  color: #ffb3b3;
  font-weight: 600;
}

button.primary {
  background: var(--accent); border-color: var(--accent);
  color: #06121f; font-weight: 600; padding: 9px 20px; font-size: 14px;
}
button.primary:hover { background: #62a8ff; border-color: #62a8ff; }

button.ghost { background: transparent; }
button.ghost.danger { color: var(--danger); border-color: rgba(255,107,107,.3); }
button.ghost.danger:hover { background: rgba(255,107,107,.1); }
button.sm { padding: 4px 10px; font-size: 12px; }
button.accent { color: var(--accent); border-color: rgba(76,154,255,.4); }

/* 顶栏里的链接（首页入口）。
   按钮的 .ghost 样式只给 button，链接要自己来一套 —— 否则
   「首页」会渲染成一个没有边框的纯文字，看不出能点。 */
a.ghost {
  display: inline-flex; align-items: center;
  padding: 5px 11px; border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent; color: var(--text);
  font-size: 12.5px; font-family: inherit;
  text-decoration: none; white-space: nowrap;
  transition: border-color .15s ease, color .15s ease;
}
a.ghost:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
a.ghost.sm { padding: 4px 10px; font-size: 12px; }

/* 品牌名做成链接后，要去掉链接默认的下划线和颜色 */
a.brand { color: inherit; text-decoration: none; }
a.brand:hover { text-decoration: none; }
a.brand:hover strong { color: var(--accent); }

kbd {
  font-family: inherit; font-size: 11px; opacity: .65;
  background: rgba(0,0,0,.18); padding: 1px 5px; border-radius: 4px; margin-left: 6px;
}

/* ---------------- 布局 ---------------- */

.layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(340px, 5fr) minmax(480px, 8fr);
  gap: 1px;
  background: var(--line);
  min-height: 0;
}

/* overflow-y:auto —— 窗口不够高的时候让这一栏滚动，
   而不是把内容裁掉。
   （原来是 overflow:hidden，窗口一矮 flex 就把「本轮原话」压成 0 高度，
   原文框直接消失，开会时什么都看不到。） */
.pane {
  background: var(--bg); padding: 18px;
  display: flex; flex-direction: column;
  min-height: 0; overflow-y: auto; overflow-x: hidden;
}
.pane-in { background: var(--bg-2); }

.pane-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.pane h2 { font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.hint { font-size: 12px; color: var(--text-dim); }

/* ---------------- 输入 ---------------- */
/* 旧的输入框样式已废弃：「客户刚说的话」现在是只读展示区（.said-box），
   只保留手动输入兜底框 #utteranceInput 的样式。 */

/* ---------------- 客户原话（只读展示） ---------------- */
/* 这块是「显示」，不是「输入」。识别成什么样就显示什么样，
   开会时不该再让人手工抄一遍。 */

.said-block {
  margin-top: 12px;
  display: flex; flex-direction: column;
  /* 不再抢剩余空间 —— 剩余空间留给下面的「字幕历史」。
     以前这里 flex:1 1 auto，原文框把整栏都撑满了，
     字幕历史被挤到折叠线以下，开会时想回看都看不到。 */
  flex: 0 0 auto;
}
.said-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex: 0 0 auto; }
.said-label { font-size: 12px; color: var(--text-dim); letter-spacing: .02em; }
.said-tip { font-size: 11.5px; color: var(--text-dim); opacity: .8; }
/* 用户手动改过识别结果 —— 这时候要明确告诉他「按 ⌘⏎ 重新生成」 */
.said-tip.edited { color: var(--warn); opacity: 1; font-weight: 600; }

.said-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  /* 高度**固定**，不跟着内容长高。
     以前是内容撑开：每多识别出几个字，框就高一点，
     下面的中文翻译、字幕历史跟着整体下移 —— 听写时一直在上下抖，
     眼睛根本没法停在字上。
     现在框的大小恒定，内容在框里滚，外面纹丝不动。 */
  height: 26vh;
  min-height: 150px;
  max-height: 300px;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  animation: fadein .18s ease;
  /* 用 flex 而不是默认的 block：
     pre-wrap 会把 HTML 源码里的换行和缩进当真实空行渲染出来，
     内容就被顶到框底去了。flex 容器会直接丢掉纯空白文本节点。 */
  display: flex; flex-direction: column; justify-content: flex-start;
}
.said-box > * { margin: 0; flex: 0 0 auto; }

/* 框里的英文原话：听写时这是要**盯着读**的东西，字号给足。
   它**自己滚** —— 中文那条在下面独立占位，
   中文刷新时不会把英文的高度挤扁，英文也就不会跟着上下跳。 */
.said-en {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  /* 滚动条的位置先占住：不然内容一长一短，文字会横向重排，还是在抖 */
  scrollbar-gutter: stable;
  padding: 14px 16px;
  font-size: 22px;
  line-height: 1.55;
  color: var(--text);
}

/* 框里的中文翻译：和英文同一个框，上下对照着读。
   高度**固定**（约三行）—— 内容长短不影响它占多高，
   所以中文刷新时英文区的几何完全不变。 */
.said-zh {
  flex: 0 0 auto;
  height: 78px;
  max-height: 40%;
  overflow-y: auto;
  padding: 10px 16px 12px;
  border-top: 1px dashed var(--line);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-dim);
}
.said-zh.pending { color: var(--text-dim); font-style: italic; }
.said-empty { padding: 14px 16px; font-size: 13px; color: var(--text-dim); line-height: 1.7; }

/* 正在说的那半句：颜色浅一点 + 一个闪烁的光标。
   一眼看出「这句还没说完」，别把半句当成完整的话去照着答。 */
.said-live { color: var(--text-dim); }
/* 没有「正在说的半句」时，span 是空的 —— 必须藏起来，
   不然那个 ::after 光标会留在框里闪。 */
.said-live:empty { display: none; }
.said-live::after {
  content: '';
  display: inline-block;
  width: 2px; height: 1em;
  margin-left: 4px;
  vertical-align: -0.15em;
  background: var(--accent);
  animation: caret 1.1s steps(2, start) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

#utteranceInput {
  flex: 0 0 auto;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  min-height: 96px;
  resize: vertical;
  margin-top: 8px;
}
#utteranceInput:focus { outline: none; }

.zh-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex: 0 0 auto; }
.zh-note { font-size: 11.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* 回答依据下面那行：这句话里哪些是模型自己的通用知识 */
.gk-line {
  margin-top: 7px; padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255,180,84,.08);
  border-left: 2px solid var(--warn);
  font-size: 12.5px; line-height: 1.6; color: var(--text-dim);
}
.gk-line b { color: var(--warn); font-weight: 600; }

/* 这句回答的底气来自哪里：本地资料 / 通用知识 */
.src-badge {
  font-size: 11.5px; color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 9px; white-space: nowrap;
}
.src-badge.from-local { color: #6ee7a8; border-color: rgba(110,231,168,.4); }
.src-badge.from-mixed { color: var(--warn); border-color: rgba(255,180,84,.45); }
.src-badge.from-general { color: #ff9d7a; border-color: rgba(255,157,122,.45); }

.input-bar { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex: 0 0 auto; }
.grow { flex: 1 1 auto; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); cursor: pointer; user-select: none; }
.chk input { accent-color: var(--accent); cursor: pointer; }

.status { margin-top: 10px; font-size: 13px; min-height: 20px; color: var(--text-dim); }
.status.err { color: var(--danger); }
.status.loading::after {
  content: ''; display: inline-block; width: 12px; height: 12px;
  margin-left: 8px; vertical-align: -2px;
  border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 手动模式 ---------------- */

.manual {
  margin-top: 14px; padding: 14px;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px;
  display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-height: 0;
}
.manual h3 { font-size: 13px; }
.manual textarea {
  flex: 1 1 auto; min-height: 90px; resize: none;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5;
}
.manual textarea:focus { outline: none; border-color: var(--accent); }
.tip { font-size: 12px; color: var(--text-dim); line-height: 1.6; }
.tip.small { font-size: 11px; }
.tip code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }

/* ---------------- 输出：英文回答 ---------------- */

.pane-out { gap: 14px; }

.reply-block {
  background: linear-gradient(180deg, #182031 0%, #131926 100%);
  border: 1px solid #2d3a52;
  border-radius: 14px;
  padding: 18px 20px;
  flex: 0 0 auto;
}
.reply-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

/* 提词区（.reply-block）是**故意**做深色的 —— 两种主题下都一样，
   像真的提词器一样，文字亮、背景暗。
   ⚠️ 但里面的按钮是 button.ghost，字色继承 var(--text) ——
      亮色主题下 var(--text) 是深灰，深灰字压深底 = **看不见**。
      （实测「A－」「A＋」「我这么说过了」三个按钮在亮色下只剩空框。）
   所以这里显式指定浅色，不让它跟主题走。 */
.reply-block button.ghost {
  color: #c9d5e6;
  border-color: rgba(255, 255, 255, .22);
}
.reply-block button.ghost:hover {
  background: rgba(255, 255, 255, .10);
  border-color: rgba(255, 255, 255, .4);
  color: #fff;
}
.reply-block button.ghost.accent {
  color: #7fb6ff;
  border-color: rgba(127, 182, 255, .45);
}
.reply-block button.ghost.accent:hover { background: rgba(127, 182, 255, .14); }
.reply-head h2 { font-size: 12px; color: var(--accent); letter-spacing: .1em; text-transform: uppercase; }
.reply-tools { display: flex; gap: 6px; }

.reply-en {
  font-size: var(--reply-size);
  font-family: "SF Pro Display", -apple-system, "Segoe UI", sans-serif;
  font-weight: 600;
  line-height: 1.32;
  color: #fff;
  letter-spacing: -.015em;
  min-height: 1.32em;
  word-break: break-word;
}
.reply-en.idle { color: #4a5567; font-weight: 400; font-size: 17px; line-height: 1.6; }

.intent-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.tag {
  font-size: 12px; padding: 4px 11px; border-radius: 999px;
  background: rgba(76,154,255,.14); color: var(--accent);
  border: 1px solid rgba(76,154,255,.3); white-space: nowrap;
}
.note-inline { font-size: 13px; color: var(--warn); }

/* ---------------- 输出：明细 ---------------- */

.detail-block { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; }

.detail {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 13px 15px;
}
.detail h3 { font-size: 11px; color: var(--text-dim); letter-spacing: .09em; text-transform: uppercase; margin-bottom: 7px; }
.detail-body { font-size: 14.5px; line-height: 1.65; color: var(--text); white-space: pre-wrap; }
.warn-detail { border-color: rgba(255,180,84,.28); background: rgba(255,180,84,.05); }
.warn-detail h3 { color: var(--warn); }
.warn-detail .detail-body { color: #ffd7a1; }
.warn-detail.muted { border-color: var(--line); background: var(--bg-2); }
.warn-detail.muted h3, .warn-detail.muted .detail-body { color: var(--text-dim); }

/* ---------------- 抽屉 ---------------- */

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 440px; max-width: 92vw;
  background: var(--bg-2); border-left: 1px solid var(--line);
  box-shadow: -18px 0 46px rgba(0,0,0,.5);
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px; z-index: 50;
  /* 抽屉本身**不滚**，滚的是里面的 .mc-body（头部固定）。
   *
   * 之前抽屉自己是滚动容器，而 .mc-body 是 flex:1 的子项 ——
   * 内容比容器高时，子项会**溢出**到容器的 padding 外面，
   * 于是最后一个卡片正好压在抽屉底边上（看着很挤，
   * 视觉验收里被当成「没有留白」）。
   *
   * 改成：抽屉 overflow:hidden，body 自己 overflow-y:auto，
   * min-height:0 是 flex 子项能真正收缩的关键（不加这行不生效）。
   */
  overflow: hidden;
}
.drawer > .mc-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  /* 滚动条贴边时别把内容顶到边框上 */
  padding-right: 2px;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head h2 { font-size: 15px; }

/* 设置面板的内容（服务商 + 模型 + 凭证 + 高级项 + 术语 + 热键）加起来
   有一千多像素，比视口高。没有滚动容器的话，下半截（语音识别那整段）
   永远够不着 —— body 又是 overflow:hidden，滚不动。
   其它三个抽屉各自有 .card-list / .history-list / .kb-list 自己滚，
   所以这里只给设置面板加。 */
#settingsDrawer { overflow-y: auto; overscroll-behavior: contain; }
/* 标题条跟着吸在顶上，滚到下面也还能看到「模型设置 / 关闭」 */
#settingsDrawer .drawer-head {
  position: sticky; top: 0; z-index: 3;
  background: var(--bg-2);
  margin: 0 -18px; padding: 18px 18px 6px;
}

#cardSearch {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
  font-family: inherit; font-size: 14px;
}
#cardSearch:focus { outline: none; border-color: var(--accent); }

.card-list, .history-list { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; }

.qcard {
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 9px; padding: 11px 13px; cursor: pointer;
}
.qcard:hover { border-color: var(--accent); }
.qcard .q { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.qcard .a { font-size: 12.5px; color: var(--accent-2); line-height: 1.5; }
.qcard .n { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; line-height: 1.5; }

.turn { padding: 9px 12px; border-radius: 9px; background: var(--bg-3); border-left: 3px solid var(--line); }
.turn.them { border-left-color: var(--accent); }
.turn.me   { border-left-color: var(--accent-2); }
.turn .who { font-size: 11px; color: var(--text-dim); margin-bottom: 3px; }
.turn .txt { font-size: 13px; line-height: 1.55; }

.empty { color: var(--text-dim); font-size: 13px; text-align: center; padding: 28px 12px; line-height: 1.7; }

/* ---------------- 设置抽屉 ---------------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--text-dim); }
.field input, .field select {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
  font-family: inherit; font-size: 13.5px; width: 100%;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }

.row { display: flex; gap: 9px; }
.row button { flex: 1 1 0; }
.sep { border: none; border-top: 1px solid var(--line); margin: 2px 0; }

/* 高级设置折叠区 */
.adv { margin-top: 10px; border: 1px solid var(--line); border-radius: 9px; }
.adv > summary {
  cursor: pointer; padding: 9px 12px; font-size: 12px; color: var(--text-dim);
  list-style: none; user-select: none;
}
.adv > summary::-webkit-details-marker { display: none; }
.adv > summary::before { content: "▸ "; }
.adv[open] > summary::before { content: "▾ "; }
.adv > summary:hover { color: var(--text); }
.adv-body {
  display: flex; flex-direction: column; gap: 10px;
  padding: 4px 12px 12px; border-top: 1px solid var(--line);
}
.adv-body .field input[readonly] {
  color: var(--text-dim); background: var(--bg-2, var(--bg));
  cursor: default;
}

.status.cfg-ok  { color: var(--accent-2); }
.status.cfg-err { color: var(--danger); }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
}

/* 顶栏挤不下时，先让「统计信息」让位给按钮 ——
   统计是锦上添花，按钮够不着是功能缺失。 */
@media (max-width: 900px) {
  .topbar .meta { display: none; }
  .topbar { padding: 8px 12px; }
}

/* ================================================================
   以下为本轮新增：流式状态 / 关键数字 / 资料库 / 热键 / 演讲者模式
   ================================================================ */

.dot.err { background: var(--danger); box-shadow: 0 0 0 3px rgba(255,107,107,.15); }

/* 停止按钮 */
#btnStop[disabled] { opacity: .4; cursor: not-allowed; }

/* 回答里的关键数字：会上必须扫一眼的东西 */
.key-fields {
  display: flex; flex-wrap: wrap; gap: 7px;
  margin-top: 12px;
}
.key-fields .chip {
  background: rgba(88,230,169,.12);
  border: 1px solid rgba(88,230,169,.4);
  color: var(--accent-2);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.card-hit {
  margin-top: 10px;
  font-size: 13px;
  color: var(--accent);
}

/* 资料库抽屉 */
.drawer.wide { width: 560px; }
.kb-list { flex: 1 1 auto; overflow-y: auto; }
.kb-list h3 {
  font-size: 13px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .08em;
  margin: 14px 0 8px;
}
.kb-list h3:first-child { margin-top: 0; }
.kb-list ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.kb-list li {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 11px;
}
.kb-list li b { font-size: 14px; font-weight: 600; }
.kb-list li span { font-size: 12px; color: var(--text-dim); }
.kb-skipped li { border-color: rgba(255,180,84,.35); background: rgba(255,180,84,.06); }
.kb-skipped li span { color: var(--warn); }

.warn { color: var(--warn); }
.tip.warn { color: var(--warn); }

/* 热键列表 */
.hotkey-list { display: flex; flex-direction: column; gap: 9px; }
.hotkey-list h3 { font-size: 14px; margin-bottom: 2px; }
.hk-status { font-size: 13px; }
.hk-status.ok { color: var(--accent-2); }
.hk-status.warn { color: var(--warn); }
.hk-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.hk-list li { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.hk-list kbd {
  background: var(--bg-3); border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px; padding: 2px 8px;
  font-family: inherit; font-size: 12px; min-width: 78px; text-align: center;
}
.hk-list span { color: var(--text-dim); }

/* 历史里的三种角色 */
.turn.them .who { color: var(--accent); }
.turn.me .who   { color: var(--text-dim); }
.turn.said .who  { color: var(--accent-2); }
.turn.said { border-left: 2px solid rgba(88,230,169,.5); }

/* toast
   位置很要紧：原来放在视口底部正中 —— 那正好是「照着念」正文的位置，
   一旦弹出错误提示，恰好把最重要的答案文字盖住了。
   挪到顶栏中间的空位：那里只有静态统计信息，被盖 3 秒无所谓。 */
.toast {
  position: fixed; top: 10px; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 20px;
  font-size: 14px; z-index: 90;
  max-width: min(560px, 92vw);
  box-shadow: 0 10px 34px rgba(0,0,0,.5);
}

/* ---------------------------------------------------------------
   演讲者模式：只留下「照着念」，窗口再小也能读
   --------------------------------------------------------------- */

body.speaker .pane-in { display: none; }
body.speaker .layout { grid-template-columns: 1fr !important; }
body.speaker .detail-block { display: none; }
body.speaker .reply-block { flex: 1 1 auto; justify-content: center; }
body.speaker .pane-out { padding: 8vh 6vw; align-items: center; }
body.speaker .reply-en {
  font-size: calc(var(--reply-size) * 1.55);
  line-height: 1.4;
  text-align: center;
  max-width: 1200px;
}
body.speaker .key-fields { justify-content: center; }
body.speaker .card-hit { text-align: center; }
body.speaker #btnCards,
body.speaker #btnHistory,
body.speaker #btnKnowledge,
body.speaker #btnReset { display: none; }
body.speaker .detail-block { display: none; }

/* 生成中：让「正在写」这件事一眼可见 */
.reply-en.streaming { color: var(--text); }

/* ================================================================
   实时字幕（音频采集 + 流式转写）
   ================================================================ */

.listen-bar {
  flex: 0 0 auto;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  margin-bottom: 12px;
  flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 9px;
  max-height: 40vh;
}
.listen-bar.active { border-color: rgba(76,154,255,.45); }

/* 窗口窄的时候这一行要能换行，而不是把「开始听」挤成竖排三个字。
   开会时按钮挤没了是很糟心的。 */
.listen-head { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.listen-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 15px; border-radius: 9px; cursor: pointer;
  background: rgba(76,154,255,.14);
  border: 1px solid rgba(76,154,255,.45);
  color: var(--accent); font-size: 14px; font-weight: 600;
  font-family: inherit;
  white-space: nowrap; flex: 0 0 auto;
}
.listen-btn:hover { background: rgba(76,154,255,.22); }
.listen-btn.on {
  background: rgba(255,107,107,.15);
  border-color: rgba(255,107,107,.5);
  color: #ff9d9d;
}

.mic-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--text-dim);
}
.listen-btn.on .mic-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255,107,107,.16);
  animation: pulse 1.5s ease-in-out infinite;
}
/* 检测到对方正在说话 —— 麦克风点变绿并快闪 */
.mic-dot.talking {
  background: #58e6a9;
  box-shadow: 0 0 0 4px rgba(88,230,169,.18);
  animation: pulse .5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.chk.tiny { font-size: 12.5px; color: var(--text-dim); }

/* 工具条里所有「宽度会变」的元素，都要占一个**固定**的槽位。
   否则内容一变，工具条可能从一行折成两行，下面全部跟着上下移 ——
   听写时界面一直在抖，就是这么来的。 */
.lat {
  font-size: 12px; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  flex: 0 0 140px;
  text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 输入来源指示：开会时必须一眼看出「客户的话现在从哪来」 */
.src-chip {
  font-size: 12px; color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 10px; white-space: nowrap;
  /* 开始听 / 停止时这句话会变（「剪贴板」↔「实时听写」），
     宽度必须锁死，否则那一瞬间工具条会折行。 */
  flex: 0 0 auto;
  min-width: 232px;
  text-align: center;
}
.src-chip.live { color: var(--accent); border-color: var(--accent); }

/* 音频电平条：区分「没收到声音」和「收到了但没识别出来」 */
.level-bar {
  display: inline-block; width: 72px; height: 6px;
  border-radius: 3px; background: var(--bg);
  border: 1px solid var(--line); overflow: hidden;
  vertical-align: middle;
}
.level-fill {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #58e6a9 0%, #ffb454 78%, #ff7a7a 100%);
  transition: width .12s linear;
}
/* 警告位：**永远占着一个固定槽位**，有文字没文字都一样宽。
   以前是 display:none / 一大串文字 —— 提示一出现，工具条就被撑成两行，
   下面整体下移；提示一消失又移回来。听写时界面就一直上下抖。
   现在只有四个字（「没有声音」），完整说明放进 title（鼠标悬停可见）。 */
.level-warn {
  font-size: 12px; color: var(--warn);
  flex: 0 0 64px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.transcript {
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
}
.t-empty { font-size: 12.5px; color: var(--text-dim); line-height: 1.65; }
.t-empty b { color: var(--accent); }

/* 字幕历史：识别过的每一句都留在这儿，方便回看。
   它吃掉本轮原话之外的剩余空间 —— 空间有限时先牺牲它，不会牺牲主角。
   overflow:hidden 很关键：栏矮的时候这块会被压扁，
   不裁掉的话里面的文字会直接盖到下面的按钮行上（看着像界面坏了）。 */
.history-block {
  margin-top: 12px;
  flex: 1 1 auto;
  min-height: 56px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.history-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex: 0 0 auto; }

.t-line {
  /* 字幕历史：听写时也会瞄一眼，字号跟着本轮原话一起放大 */
  font-size: 15px; line-height: 1.55;
  padding: 7px 11px; border-radius: 8px;
  background: rgba(255,255,255,.035);
  border-left: 2px solid var(--line);
  color: var(--text-dim);
  animation: fadein .18s ease;
}
.t-line:last-child { color: var(--text); border-left-color: var(--accent); }
.t-line.partial {
  color: var(--text-dim); font-style: italic;
  border-left-color: var(--warn);
  background: rgba(255,180,84,.07);
}
.t-line .t-meta {
  display: block; font-size: 11px; color: var(--text-dim);
  margin-top: 3px; font-style: normal;
}
@keyframes fadein { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; } }

/* 演讲者模式下隐藏输入区，实时字幕也随之收起 */
body.speaker .listen-bar { display: none; }

.kb-sum {
  font-size: 13px; line-height: 1.7; color: var(--text-dim);
  background: rgba(76,154,255,.07);
  border: 1px solid rgba(76,154,255,.22);
  border-radius: 9px; padding: 10px 13px; margin-bottom: 14px;
}
.kb-sum b { color: var(--accent); }

/* ==========================================================================
   登录界面（SaaS 模式）
   ==========================================================================
   本地单机版永远看不到这一屏（服务器没配 MC_DB_URL）。
   所以它可以做得「独立」一点 —— 不依赖面板的任何状态。
   ========================================================================== */

/* 需要登录时，把工作台内容彻底藏起来。
   登录屏是 position:fixed 盖在工作台上的 —— 但工作台的内容仍然在
   渲染、仍然可能透过遮罩被看到，于是用户会看到「闪一下会议工作台」
   才出现登录框（实测反馈）。

   .mc-maybe-login 是「可能需要登录」：服务端在 SaaS 模式下加的标记。
   首屏先挡住工作台（不闪），前端拿到令牌后立刻撤掉这个类。
   .mc-need-login 是「确定需要登录」：前端确认没有令牌后加的，
   这时登录屏直接显示、不用等网络往返。 */
body.mc-maybe-login > *:not(.login-screen),
body.mc-need-login > *:not(.login-screen) { display: none !important; }

/* 首屏就在 HTML 里，不必等 JS —— 但要避免「无 JS 时页面空白」。
   登录屏默认 hidden，靠 JS 显示；这里给它一个由 JS 控制的显示态。 */
body.mc-need-login .login-screen { display: flex !important; }

.login-screen {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1100px 520px at 50% -8%, rgba(76, 154, 255, .16), transparent 62%),
    radial-gradient(760px 420px at 88% 108%, rgba(88, 230, 169, .08), transparent 60%),
    var(--bg);
  padding: 24px;
  overflow: auto;
}

/* 两栏：左边讲清楚这是什么，右边是表单。
   单栏的登录框容易让人以为是随便哪个后台 —— 左边那几句才是关键：
   让用户一眼知道「我登录的是会议同传应答助手」。 */
.login-wrap {
  width: 100%; max-width: 860px;
  display: grid; grid-template-columns: 1fr 380px;
  gap: 44px; align-items: center;
}

.login-intro { min-width: 0; }
.login-intro .kicker {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px; margin-bottom: 18px;
  border-radius: 999px;
  background: rgba(76, 154, 255, .12);
  color: var(--accent);
  font-size: 12.5px; font-weight: 600;
}
.login-intro .kicker .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
}
.login-intro h1 {
  font-size: 30px; line-height: 1.3; font-weight: 700;
  letter-spacing: -.3px; margin-bottom: 12px;
}
.login-intro h1 em { font-style: normal; color: var(--accent); }
.login-intro .lead {
  color: var(--text-dim); font-size: 14.5px; line-height: 1.75;
  margin-bottom: 22px; max-width: 42ch;
}
.login-intro .feat { display: flex; flex-direction: column; gap: 11px; }
.login-intro .feat div {
  display: flex; align-items: flex-start; gap: 10px;
  color: var(--text-dim); font-size: 13.5px; line-height: 1.6;
}
.login-intro .feat i {
  flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px;
  border-radius: 50%; background: rgba(88, 230, 169, .14);
  color: var(--accent-2);
  font-style: normal; font-size: 11px; line-height: 18px;
  text-align: center; font-weight: 700;
}
.login-intro .feat b { color: var(--text); font-weight: 600; }

.login-card {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 26px 24px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .45);
}

.login-brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 16px; margin-bottom: 4px;
}
.login-brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

.login-sub {
  color: var(--text-dim); font-size: 13px; margin-bottom: 18px;
}

.login-msg {
  min-height: 18px; font-size: 13px; color: var(--text-dim);
  margin-bottom: 10px;
}
.login-msg.err { color: var(--danger); }

.login-form { display: flex; flex-direction: column; gap: 12px; }

.login-form .field { display: flex; flex-direction: column; gap: 5px; }
.login-form .field > span { font-size: 12px; color: var(--text-dim); }

.login-form input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.login-form input::placeholder { color: var(--text-dim); opacity: .65; }
.login-form input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76, 154, 255, .16);
}

.login-form .primary {
  margin-top: 6px; width: 100%;
  padding: 11px 16px;
  border-radius: 9px;
  font-size: 14.5px; font-weight: 600;
  transition: filter .15s ease, opacity .15s ease;
}
.login-form .primary:disabled { opacity: .6; cursor: default; }
.login-form .primary:not(:disabled):hover { filter: brightness(1.08); }

.login-alt {
  font-size: 12.5px; color: var(--text-dim); text-align: center; margin-top: 4px;
}
.login-alt a { color: var(--accent); text-decoration: none; }
.login-alt a:hover { text-decoration: underline; }

/* 登录页底部：给「这是给谁用的」一点说明 */
.login-foot {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--text-dim); line-height: 1.7;
}
.login-foot a { color: var(--accent); text-decoration: none; }
.login-foot a:hover { text-decoration: underline; }

/* 窄屏：左边那栏藏起来，只留表单 */
@media (max-width: 760px) {
  .login-wrap { grid-template-columns: 1fr; max-width: 400px; gap: 0; }
  .login-intro { display: none; }
}

/* ==========================================================================
 * 亮色模式的修正
 * --------------------------------------------------------------------------
 * 主题变量在 theme.css 里（:root = 黑夜，html[data-theme="light"] = 白天）。
 * 这里只处理**历史上直接写死、变量覆盖不到**的少数几处。
 *
 * 原则：能用变量的用变量；写死的必须在这里逐个补 —— 否则切到白天
 * 会出现「白底白字」「深色 hover 块」这类问题。
 * ========================================================================== */
html[data-theme="light"] button:hover {
  background: var(--bg-3);
  border-color: var(--line);
}
html[data-theme="light"] button.primary {
  /* 亮色下 accent 是深蓝（#1f6feb），字得是白的才看得清 */
  color: #fff;
}
html[data-theme="light"] button.primary:hover {
  background: #1a5fd0;
  border-color: #1a5fd0;
}
html[data-theme="light"] kbd {
  background: var(--bg-3);
}
html[data-theme="light"] .warn-detail .detail-body {
  /* #ffd7a1 是给深色背景用的浅橙 —— 白底上几乎看不见 */
  color: #7a4a00;
}
html[data-theme="light"] .reply-en.idle { color: var(--text-dim); }
html[data-theme="light"] .src-badge.from-local {
  color: #0b7a4b; border-color: rgba(11, 122, 75, .4);
}
html[data-theme="light"] .src-badge.from-general {
  color: #b45309; border-color: rgba(180, 83, 9, .4);
}
html[data-theme="light"] .error-text,
html[data-theme="light"] .err { color: var(--danger); }

/* --------------------------------------------------------------------------
 * 密码显示/隐藏
 * -------------------------------------------------------------------------- */
.mc-pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  /* 32×32：触屏上 30 偏小，手指点不准 */
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 7px; background: transparent;
  color: var(--dim); cursor: pointer;
}
.mc-pw-toggle:hover { background: var(--bg-3); color: var(--text); }
.mc-pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input.mc-has-pw-toggle { padding-right: 42px !important; }

/* --------------------------------------------------------------------------
 * 注册时的协议勾选
 * -------------------------------------------------------------------------- */
.agree-box {
  margin: 4px 0 14px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-2);
}
.agree-box.need-attention {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220,80,80,.12);
}
.agree-head {
  font-size: 12.5px; color: var(--dim); margin-bottom: 9px;
}
.agree-list { display: flex; flex-direction: column; gap: 7px; }
.agree-item {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 13.5px; color: var(--text);
  cursor: pointer;
}
.agree-item input { width: 15px; height: 15px; accent-color: var(--accent); }
.agree-link { color: var(--accent); text-decoration: none; }
.agree-link:hover { text-decoration: underline; }
.agree-note { font-size: 13px; color: var(--dim); }
.agree-loading { font-size: 13px; color: var(--dim); }
.mc-ver {
  font-size: 11px; color: var(--dim);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
  margin-left: 5px;
}

/* 协议全文弹窗里的正文排版 */
.mc-doc { font-size: 14.5px; line-height: 1.85; color: var(--text); }
.mc-doc h2, .mc-doc h3, .mc-doc h4, .mc-doc h5 { margin: 18px 0 8px; line-height: 1.4; }
.mc-doc h2 { font-size: 19px; }
.mc-doc h3 { font-size: 17px; }
.mc-doc h4 { font-size: 15.5px; }
.mc-doc h5 { font-size: 14.5px; }
.mc-doc p { margin: 0 0 12px; }
.mc-doc ul { margin: 0 0 12px; padding-left: 22px; }
.mc-doc li { margin-bottom: 4px; }
.mc-doc code {
  background: var(--bg-3); padding: 1px 5px; border-radius: 4px;
  font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* --------------------------------------------------------------------------
 * 账户中心
 *
 * 之前这些样式放在 admin.css 里，但账户中心（account-center.js）跑在
 * **用户面板**（/app）里 —— 而 /app 只加载 style.css，不加载 admin.css。
 * 结果：用户侧账户中心是**完全没样式**的（靠浏览器默认样式硬撑）。
 * 搬到这里 —— 谁在用谁有样式。
 * -------------------------------------------------------------------------- */
.mc-ac-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line);
}
.mc-ac-row:last-child { border-bottom: none; }
.mc-ac-k { flex: 0 0 88px; font-size: 12.5px; color: var(--text-dim); }
.mc-ac-v { flex: 1 1 auto; font-size: 13.5px; word-break: break-all; }
.mc-ac-role {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  border-radius: 999px; background: var(--bg); border: 1px solid var(--line);
  font-size: 11px; color: var(--text-dim);
}
.mc-ac-cur {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  border-radius: 999px; background: var(--accent); color: var(--accent-fg);
  font-size: 11px;
}
.mc-ac-hint {
  font-size: 12px; color: var(--text-dim); line-height: 1.6;
  margin: 2px 0 10px;
}
.mc-ac-label {
  display: block; margin-bottom: 10px; font-size: 12.5px; color: var(--text-dim);
}
.mc-ac-label input {
  display: block; width: 100%; margin-top: 5px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px;
  font-family: inherit; font-size: 13.5px;
}
.mc-ac-label input:focus { outline: none; border-color: var(--accent); }
.mc-ac-actions { margin-top: 4px; }
.mc-ac-msg { min-height: 18px; margin: 10px 0 0; font-size: 12.5px; color: var(--ok); }
.mc-ac-msg.err { color: var(--err); }
.mc-ac-danger { border-color: var(--err); }
/* 账户抽屉最后一个卡片（退出登录）离底边太近，看着很挤 */
#mcAccountDrawer .mc-body { padding-bottom: 10px; }
/* 「退出登录」四个字排成两行（退出登 / 录）很难看 —— 按钮给足宽度 */
.mc-ac-danger .mc-ac-row button,
.mc-ac-btnrow button { white-space: nowrap; }
.mc-ac-danger .mc-ac-row { border-bottom: none; }

@media (max-width: 640px) {
  .mc-drawer, .mc-drawer.wide { width: 100%; max-width: 100%; }
  .mc-price-row input { flex: 1 1 100%; }
  .mc-ac-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .mc-ac-k { flex: none; }
}

.mc-ac-list { margin: 6px 0 12px; }
.mc-ac-btnrow { display: flex; gap: 6px; flex-wrap: wrap; }
.mc-ac-bind { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.mc-ac-verify { margin-top: 10px; padding: 10px 12px; border-radius: 9px; background: var(--bg-3); }
.mc-ac-verify.hidden { display: none; }
.mc-ac-verify .mc-ac-hint { margin-bottom: 8px; }
