/* ================= 基础 ================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #1f2329;
  --text-2: #5b6472;
  --text-3: #68707c;
  --primary: #2563eb;
  --primary-soft: #eef4ff;
  --success: #0f9d76;
  --success-soft: #e8f7f2;
  --warn: #b7791f;
  --warn-soft: #fdf5e6;
  --danger: #d64545;
  --danger-soft: #fdeded;
  --sidebar: #151a21;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { font-weight: 500; }
h1 { font-size: 16px; }
h2 { font-size: 14px; }
h3 { font-size: 13px; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ================= 布局 ================= */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 210px; flex: 0 0 210px;
  background: var(--sidebar); color: #cbd2dc;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-title { color: #fff; font-size: 14px; font-weight: 500; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: #7d8794; margin-top: 2px; }

.nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin-bottom: 2px; border-radius: 8px;
  color: #aab3c0; cursor: pointer; font-size: 13px;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .ico {
  width: 16px; height: 15px; flex: 0 0 16px;
  display: flex; align-items: center; justify-content: center;
  opacity: .9; font-size: 13px;
}
.nav-item .ico svg { display: block; }
.nav-badge {
  margin-left: auto; background: rgba(255,255,255,.14);
  border-radius: 20px; padding: 0 7px; font-size: 11px;
}
.nav-item.active .nav-badge { background: rgba(255,255,255,.25); }

.sidebar-foot { padding: 12px 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.user-row { display: flex; align-items: center; gap: 8px; }
/* 名字过长时省略，别把右侧两个图标挤出去 */
.user-info { flex: 1 1 auto; min-width: 0; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; flex: 0 0 26px;
}
.user-name {
  color: #e7ebf0; font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-role { color: #7d8794; font-size: 11px; }
/* 侧栏底部「改密 / 退出」由文字改为图标（2026-11-13），hover 出文字提示。
   基础样式只给尺寸与排布，颜色按所在区域（深色侧栏 / 浅色顶栏）各自覆盖。 */
.icon-btn {
  width: 26px; height: 26px; flex: 0 0 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent;
  color: inherit; cursor: pointer; transition: all .12s;
}
.icon-btn svg { display: block; }
.icon-btn:active { transform: translateY(1px); }
.icon-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.sidebar .icon-btn { color: #8d96a3; }
.sidebar .icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
/* 退出图标 hover 偏红，跟「改密」区分开，避免两个相近的小图标点错 */
.sidebar .icon-btn.danger:hover { color: #ff8f8f; background: rgba(255, 90, 90, .14); }
/* 浅色顶栏（坐席工作台）：顶栏底色浅，图标用 --text-2 才看得清 */
.topbar .icon-btn { color: var(--text-2); }
.topbar .icon-btn:hover { color: var(--text); background: var(--bg); }

/* ================= 侧栏收起/展开（PC 手动收起，样式复用 H5 窄栏） ================= */
.user-ops { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.sidebar-toggle {
  width: 28px; height: 28px; flex: 0 0 28px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-3);
  cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-toggle:hover { color: var(--text); background: var(--surface-2); }
.sidebar-toggle svg { display: block; }
.layout.nav-collapsed .sidebar-toggle svg { transform: scaleX(-1); }

.layout.nav-collapsed .sidebar { width: 62px; flex: 0 0 62px; }
.layout.nav-collapsed .brand-sub,
.layout.nav-collapsed .nav-item span:not(.ico),
.layout.nav-collapsed .nav-badge,
.layout.nav-collapsed .user-info,
.layout.nav-collapsed .user-name,
.layout.nav-collapsed .user-role { display: none; }
/* 图标模式放不下子项文案，与 H5 一致直接隐藏，避免出现几条空行 */
.layout.nav-collapsed .nav-child,
.layout.nav-collapsed .nav-parent .nav-caret { display: none; }
.layout.nav-collapsed .brand { padding: 16px 0; text-align: center; }
.layout.nav-collapsed .brand-title { font-size: 0; }
.layout.nav-collapsed .brand-title::after { content: "AI"; font-size: 13px; }
.layout.nav-collapsed .nav-item { justify-content: center; padding: 10px 0; }
.layout.nav-collapsed .sidebar-foot { padding: 12px 4px 16px; }
.layout.nav-collapsed .user-row { flex-wrap: wrap; justify-content: center; row-gap: 8px; }
/* 改密/退出竖排居中，62px 宽度刚好放得下 */
.layout.nav-collapsed .user-ops {
  margin-left: 0; flex-direction: column; align-items: center;
  gap: 6px; width: 100%;
}


.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 54px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.view { padding: 20px; flex: 1; max-width: 1440px; width: 100%; }
/* 话术画布这类要铺开的页面不受 1440 限宽（大屏两侧不留大片空白） */
.view.view-wide { max-width: none; }

/* ================= 卡片 ================= */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.card-head h2 { flex: 1; }
.card-body { padding: 16px; }
.card + .card { margin-top: 16px; }
/* 栅格里并排的卡片不能带上间距：margin-top 会让第二列整体下沉 16px，
   顶边和左列错位（概览「分时外呼量 / 结果分布」踩过）。间距由 grid gap 负责。 */
.grid > .card + .card { margin-top: 0; }
/* 卡片跟在统计卡栅格 / 子页切换条后面时也要留间距（原来只处理了 card+card） */
.grid + .card, .stat + .card { margin-top: 16px; }
.card + .grid, .card + .subtabs { margin-top: 16px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* 开放接口文档：左侧目录 */
.doc-toc {
  display: block; padding: 5px 10px; margin-left: -2px;
  font-size: 12px; color: var(--text-2); text-decoration: none;
  border-left: 2px solid transparent; border-radius: 0 6px 6px 0;
  transition: color .12s, background .12s;
}
.doc-toc:hover { color: var(--primary); background: var(--surface-2); }
.doc-toc.active { color: var(--primary); border-left-color: var(--primary); font-weight: 500; }
.doc-toc.sub { padding-left: 26px; font-size: 11.5px; color: var(--text-3); }
.doc-toc.sub:hover, .doc-toc.sub.active { color: var(--primary); }

/* 开放接口文档：每个接口一张编号卡片，标题吸顶——长页面滚动时不会「串接口」 */
.doc-ep {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 0 14px 12px; background: var(--surface);
}
.doc-ep-head {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; margin: 0 -14px;
  border-bottom: 1px dashed var(--border);
  position: sticky; top: 56px; z-index: 2;
  background: var(--surface);
  border-radius: 10px 10px 0 0;
}
.doc-no {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 13px; font-weight: 600; color: var(--primary);
  min-width: 30px; flex: 0 0 auto;
}
.mchip {
  flex: 0 0 auto; font-size: 11px; font-weight: 600; letter-spacing: .5px;
  padding: 2px 8px; border-radius: 6px; font-family: inherit;
}
.m-get  { background: var(--primary-soft); color: var(--primary); }
.m-post { background: var(--success-soft); color: var(--success); }
.m-put  { background: var(--warn-soft); color: var(--warn); }
.doc-path { font-size: 12.5px; font-weight: 600; color: var(--text); }
.doc-sec-title { display: flex; align-items: baseline; gap: 8px; margin: 0; font-size: 14px; }
.doc-sec-no {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 13px; font-weight: 700; color: var(--primary);
}
.grid-main { grid-template-columns: minmax(0, 1fr) 320px; }

/* ================= 统计卡 ================= */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 24px; font-weight: 500; margin-top: 6px; letter-spacing: -.5px; }
.stat-value small { font-size: 12px; color: var(--text-3); font-weight: 400; margin-left: 3px; }
.stat-foot { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* ================= 按钮 ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 7px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 13.5px; font-family: inherit;
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.btn:hover { border-color: var(--text-3); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-danger { color: var(--danger); border-color: #f0c4c4; background: var(--danger-soft); }
.btn-danger:hover { background: #fbe0e0; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }

/* 一体式按钮组（如话术管理的「平台模板库 / 全部客户话术」切换） */
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 7px 0 0 7px; }
.btn-group .btn:last-child { border-radius: 0 7px 7px 0; }
.btn-group .btn + .btn { margin-left: -1px; }

/* 音色卡片网格（新建话术的播报音色选择：全部展开 + 卡片内试听） */
.voice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.voice-card {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px;
  background: var(--surface); cursor: pointer; transition: all .12s; min-width: 0;
}
.voice-card:hover { border-color: var(--text-3); background: var(--surface-2); }
.voice-card.sel { border-color: var(--primary); background: var(--primary-soft); }
.voice-card .vc-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.voice-card .vc-main b { font-size: 12.5px; }
.voice-card .vc-main span { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-card .vc-play { flex: 0 0 auto; }
.voice-card.sel .vc-play { border-color: var(--primary); color: var(--primary); }

/* 页内子页切换条（如费用账单的话费明细 / 充值记录） */
.subtabs { display: flex; gap: 8px; margin-bottom: 14px; }
.subtabs .subtab {
  height: 32px; padding: 0 16px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); font-size: 13px; font-family: inherit;
  transition: all .12s; white-space: nowrap;
}
.subtabs .subtab:hover { color: var(--text); background: var(--surface-2); }
.subtabs .subtab.active {
  color: #fff; background: var(--primary); border-color: var(--primary); font-weight: 500;
}
/* 坐席工作台的子页切换条直接挂在 body 下（不在 .view 里），
   必须自带与 .view 一致的左右内边距和上间距，否则按钮贴窗口左边、紧贴顶栏；
   margin-bottom 归零，和下方内容的间距交给 .view 的 padding-top，避免双份留白。
   admin 里的 .subtabs 都在 .view 内，不受这条规则影响。 */
body > .subtabs { padding: 0 20px; margin: 20px 0 0; }
@media (max-width: 860px) { body > .subtabs { padding: 0 14px; margin-top: 14px; } }

/* 系统设置的页签条吸顶：语音与 AI 这类长分组要往下滑，页签跟着滚走就切不回去了。
   贴住顶栏底部（topbar 高 54px）再留 8px 呼吸位，那 8px 用伪元素铺底色，
   否则滑动中的卡片会从那道缝里露出来。
   z-index 要低于 topbar(20)，免得盖住顶栏；背景用页面底色，滚动时卡片从下面穿过。 */
#setTabs { position: sticky; top: 62px; z-index: 15; background: var(--bg); }
#setTabs::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%;
  height: 8px; background: var(--bg);
}

/* 子页标题上的待办计数徽标（坐席工作台：工单 / 回拨） */
.tab-badge {
  display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 6px;
  border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 11px; line-height: 16px; text-align: center; font-weight: 600;
}
/* 回拨队列里已到期未处理的行 */
tr.cb-overdue td { background: var(--danger-soft); }

/* ================= 表单 ================= */
.input, .select, .textarea {
  height: 32px; padding: 0 10px; border: 1px solid var(--border-strong);
  border-radius: 7px; font-size: 13.5px; font-family: inherit;
  background: var(--surface); color: var(--text); width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.textarea { height: auto; padding: 10px; resize: vertical; line-height: 1.5; }
/* 密码框右侧的「显示明文」按钮：特殊符号多时靠它核对 */
.pwd-wrap { position: relative; }
.pwd-wrap .input { padding-right: 34px; }
.pwd-eye {
  position: absolute; top: 0; right: 0; height: 32px; width: 32px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text-muted, #64748b);
  cursor: pointer; border-radius: 0 7px 7px 0;
}
.pwd-eye:hover { color: var(--text); background: rgba(15,23,42,.05); }
.pwd-eye.on { color: var(--primary); }
/* 登录被锁定时的提示条 */
.lock-tip {
  margin-top: 10px; padding: 8px 10px; border-radius: 7px;
  background: var(--danger-soft); color: var(--danger);
  font-size: 12px; line-height: 1.6;
}
/* 倒计时中的登录按钮：禁用态也要看清剩余时间（默认 .5 透明度太淡） */
#btnLogin:disabled {
  opacity: 1; background: var(--primary-soft); color: var(--primary);
  cursor: not-allowed; box-shadow: none;
}
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .input, .toolbar .select { width: auto; min-width: 150px; }

/* ================= 表格 ================= */
/* 页面级表格：给 wrap 限高，长列表在容器内滚动——表头吸顶、工具栏和分页始终可见。
   （弹窗里的 .table-wrap 不在 .view 内，保持随弹窗整体滚动的老行为） */
.view .table-wrap { overflow-x: auto; overflow-y: auto; max-height: calc(100vh - 230px); }
/* ↑ 这个 230px 只是兜底：admin 页会按「顶部条+卡头+筛选行」实际占用
   用 JS 现算覆盖（fitTables），放得下就精确适配一屏，放不下才用这条。 */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--text-2);
  padding: 9px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
/* 表头吸顶：只在限高滚动的 wrap 里生效；separate 边框模型让表头的
   下边框跟着一起钉住（collapse 下滚动时边框会被吃掉） */
.table-wrap thead th { position: sticky; top: 0; z-index: 2; }
td { padding: 10px 14px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
td.mono { white-space: nowrap; }   /* 时间/号码/ID 不折行（带年份后更长） */

/* 文件选择框：替代浏览器原生「选择文件 未选择任何文件」，与站内控件统一 */
.file-pick {
  display: flex; align-items: center; gap: 10px;
  margin-top: 6px; padding: 9px 12px;
  border: 1px dashed var(--border-strong); border-radius: 8px;
  background: var(--surface-2);
  transition: border-color .12s, background .12s;
}
.file-pick:hover { border-color: var(--primary); background: var(--primary-soft); }
.file-pick .fname {
  flex: 1; min-width: 0; font-size: 13px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-pick .fname.picked { color: var(--text); }
tbody tr:hover { background: #fafbfd; }
tbody tr.selected { background: var(--primary-soft); }
tbody tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; }
/* 可排序数字列：表头整格可点，箭头用伪元素占位（不改变列宽跳动） */
th.num.sortable { cursor: pointer; user-select: none; }
th.num.sortable:hover { color: var(--text); }
th.num.sortable::after {
  content: "↕"; margin-left: 4px; font-size: 10px; opacity: .3; display: inline-block;
}
th.num.sortable:hover::after { opacity: .6; }
th.num.sortable.sort-asc::after { content: "▲"; opacity: 1; color: var(--primary); }
th.num.sortable.sort-desc::after { content: "▼"; opacity: 1; color: var(--primary); }
.empty { padding: 36px 16px; text-align: center; color: var(--text-3); font-size: 12px; }

/* ================= 徽标 ================= */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 8px; border-radius: 20px;
  font-size: 11px; background: var(--bg); color: var(--text-2);
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-plain::before { display: none; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-gray { background: #f2f3f5; color: var(--text-2); }

/* 报表维度勾选：整块可点，选中态用主色浅底 */
.dim-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px;
  padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 15px;
  background: var(--surface); color: var(--text-2);
  font-size: 12.5px; cursor: pointer; user-select: none; transition: all .12s;
}
.dim-chip input { margin: 0; accent-color: var(--primary); cursor: pointer; }
.dim-chip:hover { border-color: var(--text-3); color: var(--text); }
.dim-chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 500; }

.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-on { background: var(--success); box-shadow: 0 0 0 3px rgba(15,157,118,.15); }
.dot-off { background: var(--text-3); }

/* ================= 图表（CSS 柱状） ================= */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; max-width: 26px; background: var(--primary); opacity: .85;
  border-radius: 3px 3px 0 0; min-height: 2px; transition: height .3s;
}
.bar-label { font-size: 10px; color: var(--text-3); }
.bar-val { font-size: 10px; color: var(--text-2); }

.dist-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.dist-name { width: 96px; flex: 0 0 96px; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-track { flex: 1; height: 7px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.dist-fill { height: 100%; background: var(--primary); border-radius: 4px; }
.dist-num { width: 34px; text-align: right; font-size: 12px; color: var(--text-2); }

/* 监控页：指标键值行 */
.kv-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.kv-row:last-of-type { border-bottom: 0; }
.kv-k { color: var(--text-2); flex: 0 0 auto; }
.kv-v { text-align: right; font-variant-numeric: tabular-nums; }

/* ================= 对话气泡 ================= */
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding: 2px; }
.bubble { display: flex; gap: 8px; max-width: 88%; }
.bubble-bot { align-self: flex-start; }
.bubble-user { align-self: flex-end; flex-direction: row-reverse; }
.bubble-who {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; background: var(--primary-soft); color: var(--primary);
}
.bubble-user .bubble-who { background: var(--success-soft); color: var(--success); }
.bubble-text {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 8px 11px; border-radius: 10px; font-size: 12.5px; line-height: 1.55;
}
.bubble-user .bubble-text { background: var(--primary); border-color: var(--primary); color: #fff; }
.bubble-meta { font-size: 10px; color: var(--text-3); margin-top: 4px; }

/* ================= 拨号盘 ================= */
.dialpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dial-key {
  height: 46px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); font-size: 17px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: all .1s; font-family: inherit; color: var(--text);
}
.dial-key:hover { background: var(--primary-soft); border-color: #c7d8f7; }
.dial-key:active { transform: scale(.97); }
.dial-key small { font-size: 9px; color: var(--text-3); line-height: 1; margin-top: 1px; }
.dial-number {
  height: 46px; border: 1px solid var(--border); border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; letter-spacing: 1.5px; margin-bottom: 10px;
  background: var(--surface-2); font-family: "SFMono-Regular", Consolas, monospace;
}

/* ================= 通话中 ================= */
.live-card { border: 1px solid #c7d8f7; background: linear-gradient(180deg, #f7faff, #fff 60%); }
.live-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid #e3ecfb; }
.live-phone { font-size: 18px; font-weight: 500; letter-spacing: .5px; }
.live-timer { font-size: 15px; color: var(--primary); font-variant-numeric: tabular-nums; margin-left: auto; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
@media (prefers-reduced-motion: no-preference) {
  .pulse { animation: pulse 1.6s ease-in-out infinite; }
  @keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.85); } }
}

/* ================= 弹窗 / Toast ================= */
.mask {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .38);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: 12px; width: 100%; max-width: 640px;
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(16,24,40,.18);
}
.modal-head { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h2 { flex: 1; }
.modal-close { cursor: pointer; color: var(--text-3); font-size: 18px; line-height: 1; padding: 2px 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* 确认弹窗：比业务弹窗小一号，图标 + 标题 + 说明，危险操作用红色主按钮 */
.mask-dialog { z-index: 300; }
.dialog {
  background: var(--surface); border-radius: 14px; width: 100%;
  max-width: min(430px, calc(100vw - 36px));
  padding: 20px 20px 16px; box-shadow: 0 24px 60px rgba(16,24,40,.24);
  display: flex; flex-direction: column; gap: 14px;
  animation: dialogIn .15s ease-out;
}
@keyframes dialogIn { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dialog { animation: none; } }
.dialog-head { display: flex; gap: 12px; align-items: flex-start; }
.dialog-icon {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.dialog-danger .dialog-icon { background: var(--danger-soft); color: var(--danger); }
.dialog-copy { flex: 1; min-width: 0; padding-top: 1px; }
.dialog-title { font-size: 14.5px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.dialog-text { color: var(--text-2); font-size: 12.5px; line-height: 1.7; white-space: pre-line; }
.dialog-detail {
  padding: 9px 11px; background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong); border-radius: 7px;
  color: var(--text-2); font-size: 12px; line-height: 1.65; white-space: pre-line;
}
.dialog-danger .dialog-detail { border-left-color: var(--danger); background: var(--danger-soft); color: #7a3f3f; }
.dialog-input { width: 100%; }
.dialog-error { color: var(--danger); font-size: 12px; margin-top: -6px; }
.dialog-input.is-invalid {
  border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft);
  animation: dialogShake .26s ease-in-out;
}
@keyframes dialogShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.dialog-foot { display: flex; gap: 9px; justify-content: flex-end; margin-top: 2px; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #bf3a3a; border-color: #bf3a3a; color: #fff; }

#toastRoot { position: fixed; top: 16px; right: 16px; z-index: 400; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1f2937; color: #fff; padding: 9px 14px; border-radius: 8px;
  font-size: 12.5px; box-shadow: 0 4px 14px rgba(16,24,40,.2);
  max-width: 320px; animation: slideIn .18s ease-out;
}
.toast-ok { background: #0f766e; }
.toast-err { background: #b91c1c; }
.toast-warn { background: #b45309; }
@keyframes slideIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* ================= 登录页 ================= */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #eef1f5; padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; padding: 30px 28px;
  box-shadow: 0 8px 28px rgba(16,24,40,.08);
}
.login-logo {
  width: 38px; height: 38px; border-radius: 10px; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 17px; margin-bottom: 16px;
}
.login-title { font-size: 17px; font-weight: 500; margin-bottom: 22px; }
.demo-tip { margin-top: 16px; padding: 10px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 8px; font-size: 11.5px; color: var(--text-2); line-height: 1.7; }

/* ================= 坐席工作台 ================= */
.console-grid {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: 290px minmax(0, 1fr) 330px;
}
@media (max-width: 1240px) {
  .console-grid { grid-template-columns: 270px minmax(0, 1fr); }
  .console-grid > div:nth-child(3) { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .console-grid { grid-template-columns: minmax(0, 1fr); }
  .console-grid > div:nth-child(3) { grid-column: auto; }
}

/* ================= 响应式 ================= */
@media (max-width: 1180px) {
  .grid-4, .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { width: 62px; flex: 0 0 62px; }
  .brand-sub, .nav-item span:not(.ico), .nav-badge, .user-name, .user-role { display: none; }
  /* 图标模式没地方放子项文案，直接不显示，避免出现几条空行 */
  .nav-child, .nav-parent .nav-caret { display: none; }
  .brand { padding: 16px 0; text-align: center; }
  .brand-title { font-size: 0; }
  .brand-title::after { content: "AI"; font-size: 13px; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: minmax(0, 1fr); }
  .view { padding: 14px; }
}

/* ================= 话术画布 ================= */
.cv-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cv-toolbar .cv-sep { width: 1px; height: 20px; background: var(--border); }
.cv-zoom { display: flex; align-items: center; gap: 4px; }
.cv-zoom span { min-width: 42px; text-align: center; }

.cv-body { display: flex; gap: 14px; align-items: stretch; }

/* 画布高度跟着窗口走：1080p 下比固定 620 高不少，小屏仍保底 620 */
.cv-wrap {
  position: relative; flex: 1; min-width: 0;
  height: max(620px, calc(100vh - 300px));
  overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius);
  background-color: #f8fafc;
  background-image: radial-gradient(#d5dbe4 1px, transparent 1px);
  background-size: 16px 16px;
  cursor: grab; touch-action: none;
}
.cv-wrap.panning { cursor: grabbing; }
.cv-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cv-links { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }

.cv-node {
  position: absolute; width: 264px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: var(--shadow); overflow: hidden;
}
.cv-node.sel { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow); }
.cv-node-head {
  display: flex; align-items: center; gap: 7px; padding: 9px 12px;
  border-bottom: 1px solid var(--border); background: var(--surface-2); cursor: move;
}
.cv-node.start .cv-node-head { background: var(--primary-soft); }
.cv-node.end .cv-node-head { background: var(--success-soft); }
.cv-node-id {
  font-size: 13px; font-weight: 600; color: var(--text); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cv-node-badge {
  margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: rgba(0, 0, 0, .06); color: var(--text-2); white-space: nowrap; flex: 0 0 auto;
}
.cv-node.start .cv-node-badge { background: rgba(37, 99, 235, .12); color: var(--primary); }
.cv-node.end .cv-node-badge { background: rgba(15, 157, 118, .14); color: var(--success); }
.cv-node-text {
  padding: 10px 12px; font-size: 13px; line-height: 1.65; color: var(--text-2);
  max-height: 98px; overflow: hidden; word-break: break-all;
}
.cv-node-text.empty { color: var(--text-3); font-style: italic; }
.cv-brs { border-top: 1px dashed var(--border); padding: 5px 0; }
.cv-br {
  display: flex; align-items: center; gap: 6px; padding: 2px 12px;
  font-size: 12px; color: var(--text-3);
}
.cv-br i { font-style: normal; color: var(--text-2); }
.cv-br .cv-br-next {
  color: var(--primary); font-family: "SFMono-Regular", Consolas, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.cv-hint {
  position: absolute; left: 10px; bottom: 8px; font-size: 12px; color: var(--text-3);
  background: rgba(255, 255, 255, .88); padding: 3px 9px; border-radius: 6px;
  pointer-events: none; box-shadow: var(--shadow);
}

.cv-side {
  flex: 0 0 380px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); display: flex; flex-direction: column;
  height: max(620px, calc(100vh - 300px)); overflow: hidden;
}
.cv-side-head {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  font-size: 13px;
}
.cv-side-body { padding: 14px; overflow-y: auto; flex: 1; }
.cv-side-body .field { margin-bottom: 12px; }
.cv-side-body .field label { font-size: 13px; }
.cv-side-body .input, .cv-side-body .select, .cv-side-body .textarea { font-size: 13.5px; }

@media (max-width: 1180px) {
  .cv-body { flex-direction: column; }
  .cv-side { flex: 1 1 auto; width: 100%; height: auto; max-height: 460px; }
  .cv-wrap { height: 520px; }
}

/* ================= 多标签页 ================= */
.tabbar {
  display: flex; align-items: flex-end; gap: 4px; padding: 6px 14px 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 54px; z-index: 19;
  overflow-x: auto; overflow-y: hidden;
}
.tab {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  height: 30px; padding: 0 6px 0 10px; margin-bottom: -1px;
  border: 1px solid var(--border); border-bottom-color: transparent;
  border-radius: 8px 8px 0 0; background: var(--surface-2);
  color: var(--text-2); font-size: 12.5px; cursor: pointer;
  user-select: none; max-width: 220px;
}
.tab .tab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab:hover { background: #eef2f8; color: var(--text); }
.tab.active {
  background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: inset 0 2px 0 var(--primary);
}
.tab .tab-x {
  width: 16px; height: 16px; line-height: 14px; text-align: center;
  border-radius: 50%; color: var(--text-3); font-size: 14px; flex: 0 0 16px;
}
.tab .tab-x:hover { background: #e3e7ee; color: var(--text); }
.tab.active .tab-x { color: var(--text-2); }

/* 「⋯」标签操作：靠右；标签多到要横向滚动时 sticky 住，始终点得到 */
.tabbar .tab-more {
  margin-left: auto; flex: 0 0 auto; align-self: flex-end;
  position: sticky; right: 0; margin-bottom: 4px;
  width: 30px; height: 26px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); font-size: 15px; color: var(--text-3); cursor: pointer;
  white-space: nowrap; user-select: none;
}
.tabbar .tab-more:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong, #cfd6e2); }
.tabbar .tab-more.open { background: var(--surface-2); color: var(--text); }
/* 「⋯」不写字形、用三个圆点画：字符 ⋯ 的基线随字体浮动，靠 translateY 硬掰
   在不同系统上会偏上或偏下，圆点由 flex 居中，永远正中 */
.tabbar .tab-more span {
  width: 3px; height: 3px; border-radius: 50%;
  background: currentColor; font-size: 0; letter-spacing: 0;
  box-shadow: -5px 0 0 currentColor, 5px 0 0 currentColor;
}

/* 菜单浮层：挂在 body 上（fixed），避免被标签栏的横向滚动裁掉 */
.tab-pop {
  position: fixed; z-index: 200; min-width: 132px; padding: 5px 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
  font-size: 13px; color: var(--text);
}
.tab-pop-item { padding: 8px 16px; cursor: pointer; white-space: nowrap; }
.tab-pop-item:hover { background: var(--surface-2); }
.tab-pop-item.is-off { color: var(--text-3); cursor: default; }
.tab-pop-item.is-off:hover { background: transparent; }

/* 标签面板的宿主：本身不加内边距（内边距/限宽在 .view 面板上） */
.view-host { flex: 1; min-width: 0; }

/* ================= 2026-11-10 新增 ================= */
/* 名单批量选择复选框 */
.row-check {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  accent-color: var(--primary);
  cursor: pointer;
}

/* 意图调试输出 */
.dbg-intent { font-family: var(--mono, monospace); }

/* 结果标签选择弹层（原生 datalist 会按已输入内容过滤，只弹一条，故自绘） */
.tag-pick { display: flex; gap: 6px; align-items: stretch; cursor: pointer; position: relative; }
.tag-pick .input { flex: 1; min-width: 0; cursor: pointer; padding-right: 26px; }
.tag-pick:hover .input { border-color: var(--text-3); }
/* 纯装饰的下拉箭头：整行可点，箭头只做视觉提示（pointer-events:none 不挡点击） */
.tag-pick::after {
  content: "▾"; position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%); color: var(--text-3);
  font-size: 12px; line-height: 1; pointer-events: none;
}
.tag-pop-item { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tag-pop-item.is-cur { background: var(--primary-soft); }
.tag-pop-item .badge { font-weight: 500; }
.tag-pop-item .tag-pop-off { color: var(--text-3); font-size: 12px; margin-left: auto; }
.tag-pop-empty { padding: 9px 16px; color: var(--text-3); font-size: 13px; }

/* —— 纯通知：分段文案编辑器 —— */
.ann-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 18px; align-items: start; }
.ann-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.ann-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ann-seg { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--surface); }
.ann-seg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.ann-seg-no { font-size: 12px; font-weight: 500; color: var(--text-2); }
.ann-seg-text { width: 100%; resize: vertical; line-height: 1.7; font-size: 13px; box-sizing: border-box; }
.ann-side { display: flex; flex-direction: column; gap: 10px; }
.ann-tips { line-height: 1.8; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; }
@media (max-width: 960px) { .ann-wrap { grid-template-columns: 1fr; } }

/* ---- 权限配置弹窗（用户管理 → 权限）---- */
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
.perm-item { display: flex; align-items: center; gap: 8px; padding: 6px 9px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px; cursor: pointer;
  transition: background .12s; }
.perm-item:hover { background: var(--primary-soft); }
.perm-item input { margin: 0; flex: none; }
.perm-item span:last-child { margin-left: auto; }
.perm-item.is-locked { opacity: .5; cursor: not-allowed; background: transparent; }
.perm-item.is-locked:hover { background: transparent; }
@media (max-width: 720px) { .perm-grid { grid-template-columns: 1fr; } }

/* ---- 通话详情弹窗：左信息 / 右对话，对话区接近全屏高，长对话不用一直滚 ---- */
.rec-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 22px; align-items: start; }
.chat-lg { gap: 12px; }
.chat-lg .bubble { max-width: 82%; }
.chat-lg .bubble-who { width: 26px; height: 26px; flex-basis: 26px; font-size: 11px; }
.chat-lg .bubble-text { font-size: 13.5px; line-height: 1.6; padding: 9px 13px; }
.chat-lg .bubble-meta { font-size: 11px; }
@media (max-width: 900px) {
  .rec-grid { grid-template-columns: minmax(0, 1fr); }
  .chat-lg { max-height: 60vh !important; }
}

/* ---- 侧边栏子菜单（话术管理：对话式/纯通知）---- */
.nav-parent .nav-caret {
  margin-left: auto; font-size: 11px; color: #9aa4b2;
}
.nav-parent:hover .nav-caret { color: #fff; }
.nav-child {
  padding-left: 38px !important;
  font-size: 12.5px;
  border-left: 2px solid rgba(255,255,255,.08);
  margin-left: 17px; border-radius: 0 8px 8px 0;
}
.nav-child.active { border-left-color: rgba(255,255,255,.6); }
.nav-hidden { display: none; }
