:root {
  --bg: #14120f;
  --panel: #1c1916;
  --ink: #f3eadc;
  --muted: #b7a48a;
  --line: #3a3229;
  --accent: #d9772c;
  --ok: #7cb342;
  --bad: #c4473a;
  --mono: "IBM Plex Mono", "SFMono-Regular", ui-monospace, monospace;
  --sans: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); }
body {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  min-width: 0;
}
aside {
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #100e0c;
  height: 100vh;
  position: sticky;
  top: 0;
  min-height: 0;
  overflow: hidden;
  z-index: 3;
}
.brand { margin: 0; font-size: 22px; letter-spacing: 0.1em; }
.brand-sub { margin: 4px 0 0; color: var(--muted); font-size: 11px; letter-spacing: 0.04em; }
nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
nav button, button {
  font: inherit;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}
nav button { width: 100%; flex: none; white-space: nowrap; }
nav button.active, button:hover { background: var(--accent); color: #1a1208; border-color: var(--accent); }
button.ghost { color: var(--muted); }
button.danger { color: #ff6b6b; border-color: rgba(255, 107, 107, 0.45); }
button.danger:hover { background: #ff6b6b; color: #1a1208; border-color: #ff6b6b; }
button[disabled] { opacity: 0.4; cursor: not-allowed; }
.aside-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  flex: none;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); display: inline-block; flex: none; }
.dot.on { background: var(--ok); }
main { padding: 24px 28px; overflow: auto; min-width: 0; }
header h1 { margin: 0; font-size: 28px; font-weight: 600; }
header p { color: var(--muted); margin: 8px 0 20px; }
.hidden { display: none !important; }

/* 代客跳转横幅：始终悬在页面顶部，明确告诉操作者"现在不是你自己的账号"。
   只读代看用冷色、代操作用暖色，颜色本身就是一道提醒。 */
.imp-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 8px 14px;
  margin: 0 0 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid;
}
.imp-banner.view { background: #eef4ff; border-color: #b9cdf5; color: #23407a; }
.imp-banner.act { background: #fff4e5; border-color: #f0c383; color: #7a4a11; }
/* 剩余不足 2 分钟：把边框加粗并换成警示色，让"要到期了"在余光里也能看见 */
.imp-banner.expiring { border-width: 2px; border-color: #d9822b; font-weight: 600; }
.imp-banner.view.expiring { border-color: #4a6fc0; }

/* 小标签：用来标注"这个价格是谈定的，不是档位价" */
.tag {
  display: inline-block;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 18px;
  background: #fdf0d5;
  border: 1px solid #e8c88a;
  color: #7a4a11;
  white-space: nowrap;
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.talk { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-bottom: 16px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea {
  font: inherit;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 10px 12px;
  width: 100%;
  min-width: 0;
}
.live-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px 12px;
  margin-bottom: 12px;
  align-items: end;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}
.field select { width: 100%; min-width: 0; }
.lab-tts-params {
  margin-top: 4px;
}
.lab-tts-params .field input {
  width: 100%;
  box-sizing: border-box;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.2;
}
.check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}
.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; min-height: 420px; }
.log, .transcript {
  background: #0c0b0a;
  border: 1px solid var(--line);
  padding: 14px;
  overflow: auto;
  min-height: 380px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
}
.transcript { list-style: none; margin: 0; }
.transcript li { margin: 0 0 10px; }
.transcript .role { color: var(--accent); margin-right: 8px; }
.transcript .clk { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 8px; font-size: 12px; }
.transcript .lat { color: var(--muted); margin-left: 8px; font-size: 12px; }
.transcript .partial { color: var(--muted); font-style: italic; }
.transcript .barge-mark { color: var(--accent); font-style: normal; }
.transcript .barge-mark .role { color: var(--accent); }
.badge { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.badge.tone-ok, .tone-ok { color: var(--ok); }
.badge.tone-warn, .tone-warn { color: #e0b35a; }
.badge.tone-bad, .tone-bad { color: var(--bad); }
.badge.tone-muted, .tone-muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 10px 8px; font-size: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--panel); border: 1px solid var(--line); padding: 16px; }
.kpi b { display: block; font-size: 28px; margin-top: 6px; }
.kpi .kpi-sub { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.kpi.tone-ok b { color: var(--ok); }
.kpi.tone-warn b { color: #d4a017; }
.kpi.tone-bad b { color: var(--bad); }
.prompt-list { padding: 0; list-style: none; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.subhead { font-size: 15px; margin: 16px 0 8px; font-weight: 600; }
.alert-list { list-style: none; margin: 0 0 16px; padding: 0; }
.alert-list .alert {
  border: 1px solid var(--line);
  padding: 10px 12px;
  margin: 0 0 8px;
  font-size: 13px;
  background: #12100e;
}
.alert-list .alert .sev {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  margin-right: 8px;
  color: var(--muted);
}
.alert-list .alert .aid { font-family: var(--mono); color: var(--accent); margin-right: 8px; }
.alert-list .alert.critical { border-color: #a33; background: #1a0c0c; }
.alert-list .alert.warning { border-color: #a75; background: #1a140c; }
.alert-list .alert.ok { color: var(--muted); }
canvas.wave {
  display: block;
  width: 100%;
  max-width: 640px;
  height: 72px;
  margin: 12px 0 4px;
  border: 1px solid var(--line);
  background: #0f1a14;
}
canvas.live-wave { height: 56px; margin: 0 0 4px; max-width: none; }
.live-wave-wrap { margin: 0 0 12px; }
#reviewPlayer audio, #callDetail audio, #boardTranscript audio { display: block; margin: 8px 0 12px; }
.sip-status {
  background: #0c0b0a;
  border: 1px solid var(--line);
  padding: 10px 12px;
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 110px;
  overflow: auto;
}
.sip-status.sip-bad {
  border-color: var(--bad);
  background: #1a0c0c;
  color: #f0c0b8;
}
.subhead { margin: 24px 0 10px; font-size: 16px; color: var(--muted); font-weight: 500; }
.detail-log { min-height: 160px; margin-top: 12px; }
select {
  font: inherit;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 10px 12px;
  min-width: 0;
  max-width: 100%;
}
.lab-switch button.active { background: var(--accent); color: #1a1208; border-color: var(--accent); }
.lab-bench {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.lab-card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px 14px;
  min-height: 180px;
}
.lab-card .lab-card-h {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}
.lab-card .lab-card-h b { font-size: 14px; }
.lab-card .lab-meta { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.lab-card .lab-body {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.45;
  min-height: 72px;
}
.lab-card .lab-err { color: var(--bad); font-size: 12px; margin-top: 8px; }
.lab-chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 6px 10px;
  font-size: 13px;
}
.lab-chip.on { border-color: var(--accent); color: var(--accent); }
.lab-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 8px 0 16px;
  align-items: stretch;
}
.lab-col {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 10px 12px 12px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}
.lab-col-h {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.lab-col-h select { flex: 1; min-width: 0; }
.lab-thread {
  flex: 1;
  overflow: auto;
  min-height: 280px;
  max-height: 520px;
  background: #0c0b0a;
  border: 1px solid var(--line);
  padding: 10px;
}
.lab-msg { margin: 0 0 10px; max-width: 92%; }
.lab-msg.user { margin-left: auto; }
.lab-msg .lab-bubble {
  padding: 8px 10px;
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.lab-msg.user .lab-bubble { background: #2a2118; border-color: var(--accent); }
.lab-msg.agent .lab-bubble { background: #161310; }
.lab-msg .lab-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  margin-top: 4px;
}
#btnLabStart { background: var(--accent); color: #111; }
.pb-layout {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.pb-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pb-list { display: flex; flex-direction: column; gap: 6px; }
.pb-list button { width: 100%; }
.pb-list button.active { background: var(--accent); color: #1a1208; border-color: var(--accent); }
.pb-editor { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pb-editor textarea { min-height: 72px; font-family: var(--mono); font-size: 13px; line-height: 1.45; }
#pbBody { min-height: 320px; }
@media (max-width: 720px) {
  .pb-layout { grid-template-columns: 1fr; }
}
.lab-composer { margin-top: 8px; }
.lab-col-copy { font-size: 12px; color: var(--muted); }
@media (max-width: 720px) {
  .split, .kpis, .live-toolbar { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  body { grid-template-columns: 1fr; }
  aside {
    height: auto;
    position: sticky;
    top: 0;
    flex-direction: column;
    overflow: visible;
  }
  nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
  }
  nav button { width: auto; }
  .split, .kpis { grid-template-columns: 1fr; }
}

.lab-audio {
  display: block;
  width: min(480px, 100%);
  margin: 0.6rem 0;
}
.lexicon-box {
  margin-top: 18px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.lexicon-box table { margin: 0 0 12px; }
.lexicon-box td input {
  width: 100%;
  padding: 8px 10px;
}
#lexiconHint { margin: 0; }

/* ---- 多级管理：身份卡 / 登录浮层 / 分组导航 ---- */
.identity {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.identity-name { margin: 0; font-weight: 600; }
.identity-role { margin: 0; font-size: 12px; opacity: 0.75; }
.identity-scope { font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.identity-scope select { width: 100%; }
.identity-actions { display: flex; gap: 6px; }
button.tiny { padding: 4px 8px; font-size: 12px; }
nav button.nav-group {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
/* 导航分组标题：空组随组内按钮一起隐藏（见 app.js applyIdentityUI）。 */
.nav-section {
  margin: 14px 0 4px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
  opacity: 0.75;
}
.nav-section:first-child { margin-top: 0; }
/* 额度用量条：平台经营台里一眼看出谁快超额。 */
.meter { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; margin-bottom: 3px; }
.meter i { display: block; height: 100%; background: var(--ok); }
.meter.tone-warn i { background: #e0b35a; }
.meter.tone-bad i { background: var(--bad); }
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 16, 24, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
}
.login-card {
  background: var(--panel, #161b24);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px;
  width: min(360px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.login-card h2 { margin: 0; font-size: 18px; }
.login-card .brand { margin: 0; }
/* 登录设备弹层要放下一张表，比登录卡片宽；窄屏仍收回到视口内 */
.sess-card { width: min(1080px, 96vw); max-height: 88vh; overflow: auto; }
.sess-card .hint { margin: 0; }
.login-err { margin: 0; min-height: 18px; color: #ff8080; font-size: 13px; }
.lock-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 128, 128, 0.16);
  color: #ff9a9a;
  font-size: 11px;
  margin-left: 6px;
}
