*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--c-bg); color: var(--c-text);
  font: 14px/22px var(--font-sans);
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: var(--c-primary); text-decoration: none; border-radius: 3px; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); outline: 2px solid transparent; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.muted { color: var(--c-text-secondary); }
.small { font-size: 12px; line-height: 18px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 壳 ---------- */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 30;
  background: var(--c-bg-subtle); border-right: 1px solid var(--c-border);
  display: flex; flex-direction: column;
}
.product {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 10px;
  padding: 0 16px; border-bottom: 1px solid var(--c-border);
}
.product-mark {
  width: 28px; height: 28px; border-radius: 6px; background: var(--c-primary); color: var(--c-surface);
  display: grid; place-items: center; flex: none;
}
.product-name { font-size: 15px; font-weight: 600; line-height: 20px; white-space: nowrap; }
.product-sub { font-size: 12px; line-height: 16px; color: var(--c-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { padding: 8px 10px 16px; overflow-y: auto; flex: 1; }
.nav-group { font-size: 12px; line-height: 18px; color: var(--c-text-tertiary); margin: 14px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 13px;
  color: var(--c-text-secondary); border-radius: var(--r-md); font-weight: 500; position: relative;
}
.nav a:hover { background: var(--c-hover); color: var(--c-text); text-decoration: none; }
.nav a svg { flex: none; }
.nav a.on { background: var(--c-selected); color: var(--c-primary-active); box-shadow: inset 3px 0 0 var(--c-primary); }
.nav a .soon { margin-left: auto; font-size: 11px; font-weight: 400; color: var(--c-text-tertiary); }
.side-foot { flex: none; border-top: 1px solid var(--c-border); padding: 12px 16px; font-size: 12px; line-height: 18px; color: var(--c-text-secondary); }

.work { margin-left: var(--sidebar-w); min-width: 0; }
.top {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: var(--c-surface); border-bottom: 1px solid var(--c-border);
}
.btn.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--c-text-secondary); white-space: nowrap; overflow: hidden; }
.crumbs b { color: var(--c-text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: var(--c-border-strong); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--c-text-secondary); font-size: 13px; white-space: nowrap; }
.scope { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-bg); color: var(--c-text); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--c-selected); color: var(--c-primary-active); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
main { max-width: 1600px; padding: 20px 24px 40px; display: grid; gap: 24px; }
.scrim { display: none; }

/* ---------- 页面头 ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; line-height: 30px; font-weight: 600; }
.page-head .sub { color: var(--c-text-secondary); margin-top: 2px; }
.head-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; color: var(--c-text-secondary); align-items: center; }
.head-meta b { color: var(--c-text); font-weight: 500; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border: 1px solid var(--c-border-strong); border-radius: var(--r-md);
  background: var(--c-surface); color: var(--c-text); font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--c-hover); text-decoration: none; }
.btn:active { background: var(--c-divider); }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-surface); }
.btn-primary:hover { background: var(--c-primary-hover); border-color: var(--c-primary-hover); }
.btn-primary:active { background: var(--c-primary-active); }
.btn-danger { color: var(--c-err); border-color: var(--c-err-border); }
.btn-danger:hover { background: var(--c-err-bg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-link { border: 0; background: none; padding: 0 2px; height: auto; color: var(--c-primary); font-weight: 500; cursor: pointer; border-radius: 3px; }
.btn-link:hover { text-decoration: underline; background: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 34px; padding: 0; }

/* ---------- 卡片 ---------- */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--c-divider); }
.card-head h2 { font-size: 15px; line-height: 22px; font-weight: 600; }
.card-head .hint { color: var(--c-text-secondary); font-size: 13px; font-weight: 400; margin-left: 8px; }
.card-body { padding: 16px; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--c-divider); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--c-text-secondary); font-size: 13px; }
.section-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--c-selected); color: var(--c-primary-active); font-size: 12px; font-weight: 600; margin-right: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2.align-start, .grid-side, .grid-wide { align-items: start; }
.grid-2.grid-side { grid-template-columns: minmax(160px, 220px) minmax(0, 1fr); }
.grid-2.grid-wide { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.stack { display: grid; gap: 16px; }
.stack > * { min-width: 0; }
.row { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.between { justify-content: space-between; }

/* ---------- 状态标签（都带文字） ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-sm);
  font-size: 12px; line-height: 18px; font-weight: 500; white-space: nowrap;
  background: var(--c-info-bg); color: var(--c-info); border: 1px solid var(--c-info-border);
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.plain::before { display: none; }
.tag.ok { background: var(--c-ok-bg); color: var(--c-ok); border-color: var(--c-ok-border); }
.tag.warn { background: var(--c-warn-bg); color: var(--c-warn); border-color: var(--c-warn-border); }
.tag.err { background: var(--c-err-bg); color: var(--c-err); border-color: var(--c-err-border); }
.tag.teal { background: var(--c-selected); color: var(--c-primary-active); border-color: var(--c-primary-border); }

/* ---------- 数字卡 ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: 14px 16px; min-width: 0; }
.kpi-label { color: var(--c-text-secondary); font-size: 13px; line-height: 20px; }
.kpi-value { font-size: 30px; line-height: 38px; font-weight: 600; margin-top: 2px; white-space: nowrap; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--c-text-secondary); margin-left: 4px; }
.kpi-note { color: var(--c-text-secondary); font-size: 12px; line-height: 18px; margin-top: 4px; }
.caliber { color: var(--c-text-secondary); font-size: 12px; line-height: 18px; }

/* ---------- 待办 ---------- */
.todo li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--c-divider); }
.todo li:first-child { border-top: 0; }
.todo-count { flex: none; min-width: 44px; font-size: 22px; line-height: 28px; font-weight: 600; text-align: right; }
.todo-count small { font-size: 12px; font-weight: 500; color: var(--c-text-secondary); margin-left: 2px; }
.todo-main { flex: 1; min-width: 0; }
.todo-main strong { font-weight: 600; display: block; }
.todo-main span { color: var(--c-text-secondary); font-size: 13px; }
.todo li.done { opacity: .6; }

/* ---------- 筛选 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 12px 16px; border-bottom: 1px solid var(--c-divider); }
.field { display: grid; gap: 4px; min-width: 0; }
.field > span, .label { font-size: 12px; line-height: 18px; color: var(--c-text-secondary); font-weight: 500; }
.input, select.input, textarea.input {
  height: 34px; padding: 0 10px; border: 1px solid var(--c-border-strong); border-radius: var(--r-md);
  background: var(--c-surface); min-width: 0; max-width: 100%;
}
textarea.input { height: auto; padding: 8px 10px; line-height: 22px; resize: vertical; width: 100%; }
.input:hover { border-color: var(--c-text-tertiary); }
.input:focus-visible { border-color: var(--c-primary); }
.filters .input { width: 148px; }
.filters .grow { flex: 1; min-width: 160px; }
.filters .grow .input { width: 100%; }
.check { display: inline-flex; align-items: center; gap: 6px; height: 34px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--c-primary); }
.help { font-size: 12px; line-height: 18px; color: var(--c-text-secondary); }

/* ---------- 表格（窄屏变卡片） ---------- */
.table-wrap { overflow-x: auto; }
table.rt { width: 100%; border-collapse: collapse; }
.rt th { text-align: left; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--c-text-secondary); padding: 8px 16px; border-bottom: 1px solid var(--c-border); background: var(--c-bg); white-space: nowrap; }
.rt td { padding: 9px 16px; border-bottom: 1px solid var(--c-divider); vertical-align: middle; }
.rt tbody tr:last-child td { border-bottom: 0; }
.rt tbody tr:hover { background: var(--c-hover); }
.rt th.right, .rt td.right { text-align: right; }
.rt .ops { white-space: nowrap; text-align: right; }
.rt .ops > * + * { margin-left: 10px; }
.rt td strong { font-weight: 600; }

.pager { display: flex; align-items: center; gap: 6px; }
.pager .btn { min-width: 28px; }
.pager .cur { background: var(--c-selected); border-color: var(--c-primary-border); color: var(--c-primary-active); }

.empty { text-align: center; padding: 28px 16px; color: var(--c-text-secondary); }
.empty svg { color: var(--c-border-strong); }
.empty strong { display: block; color: var(--c-text); font-weight: 600; margin: 6px 0 2px; }
.empty .actions { justify-content: center; margin-top: 12px; }

/* ---------- 键值 ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 24px; }
.kv dt { font-size: 12px; line-height: 18px; color: var(--c-text-secondary); }
.kv dd { font-weight: 500; overflow-wrap: anywhere; }
.kv.tight { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--c-border); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; color: var(--c-text-secondary); font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; border-radius: var(--r-md) var(--r-md) 0 0; }
.tabs button:hover { background: var(--c-hover); color: var(--c-text); }
.tabs button[aria-selected="true"] { color: var(--c-primary-active); border-bottom-color: var(--c-primary); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--c-border-strong); border-radius: var(--r-md); overflow: hidden; background: var(--c-surface); flex-wrap: wrap; }
.seg button { border: 0; background: none; height: 32px; padding: 0 12px; cursor: pointer; font-weight: 500; color: var(--c-text-secondary); border-right: 1px solid var(--c-border); }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--c-hover); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--c-selected); color: var(--c-primary-active); }

/* ---------- 步骤 ---------- */
.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; counter-reset: s; }
.steps li { position: relative; padding: 0 12px 0 0; counter-increment: s; }
.steps li::before {
  content: counter(s); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--c-border-strong); background: var(--c-surface); color: var(--c-text-secondary); font-size: 13px; font-weight: 600; position: relative; z-index: 1;
}
.steps li::after { content: ""; position: absolute; top: 13px; left: 26px; right: 0; height: 1.5px; background: var(--c-border); }
.steps li:last-child::after { display: none; }
.steps li.done::before { content: "✓"; background: var(--c-primary); border-color: var(--c-primary); color: var(--c-surface); }
.steps li.done::after { background: var(--c-primary); }
.steps li.now::before { border-color: var(--c-primary); color: var(--c-primary-active); background: var(--c-selected); }
.steps strong { display: block; margin-top: 8px; font-weight: 600; }
.steps span { display: block; color: var(--c-text-secondary); font-size: 13px; line-height: 20px; }
.steps li.now strong { color: var(--c-primary-active); }

/* ---------- 清单 ---------- */
.checklist li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--c-divider); }
.checklist li:first-child { border-top: 0; }
.checklist .what { flex: 1; min-width: 0; }
.checklist .what span { display: block; color: var(--c-text-secondary); font-size: 13px; }

/* ---------- 列表项（当前对象） ---------- */
.pick { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 16px; border-bottom: 1px solid var(--c-divider); cursor: pointer; color: inherit; }
.pick:hover { background: var(--c-hover); }
.pick[aria-current="true"] { background: var(--c-selected); box-shadow: inset 3px 0 0 var(--c-primary); }
.pick .l1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pick .l1 .time { font-weight: 600; }
.pick .l1 .dur { margin-left: auto; color: var(--c-text-secondary); font-size: 13px; }
.pick .l2 { color: var(--c-text-secondary); font-size: 13px; line-height: 20px; margin-top: 2px; }
.pick .l3 { margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pick .l4 { color: var(--c-text-tertiary); font-size: 12px; line-height: 18px; margin-top: 2px; }

.split { display: grid; grid-template-columns: minmax(360px, 5fr) minmax(0, 6fr); gap: 16px; align-items: start; }
.split .detail { position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - var(--topbar-h) - 32px); overflow-y: auto; }
.sect { padding: 14px 16px; border-top: 1px solid var(--c-divider); }
.sect > h3 { font-size: 13px; line-height: 20px; font-weight: 600; color: var(--c-text-secondary); margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* 录音条 */
.player { display: flex; align-items: center; gap: 10px; background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 8px 10px; }
.player .track { flex: 1; height: 6px; border-radius: 3px; background: var(--c-divider); position: relative; min-width: 40px; }
.player .track i { position: absolute; inset: 0 auto 0 0; background: var(--c-primary); border-radius: 3px; width: 0; }
.play-btn { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--c-primary); color: var(--c-surface); display: grid; place-items: center; cursor: pointer; flex: none; }
.play-btn:hover { background: var(--c-primary-hover); }

/* 逐句对话 */
.talk { display: grid; gap: 4px; }
.talk button { display: grid; grid-template-columns: 44px 40px minmax(0, 1fr); gap: 8px; text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: var(--r-md); cursor: pointer; font-size: 15px; line-height: 24px; }
.talk button:hover { background: var(--c-hover); }
.talk button.at { background: var(--c-selected); }
.talk .t { color: var(--c-text-tertiary); font-size: 12px; }
.talk .who { font-size: 12px; font-weight: 600; color: var(--c-text-secondary); }
.talk .who.bot { color: var(--c-primary); }

/* 折叠 */
details.fold { border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); }
details.fold > summary { cursor: pointer; padding: 10px 14px; font-weight: 500; border-radius: var(--r-md); }
details.fold > summary:hover { background: var(--c-hover); }
details.fold > .fold-body { padding: 4px 14px 14px; }
.sect details.fold { border: 0; background: none; }
.sect details.fold > summary { padding: 0; font-size: 13px; font-weight: 600; color: var(--c-text-secondary); }
.sect details.fold > summary:hover { background: none; color: var(--c-text); }
.sect details.fold > .fold-body { padding: 10px 0 0; }

/* 表单 */
.form { display: grid; gap: 16px; max-width: 760px; }
.form .field .input { width: 100%; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.switch { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 36px; height: 20px; margin: 0; cursor: pointer; }
.switch i { flex: none; width: 36px; height: 20px; border-radius: 10px; background: var(--c-border-strong); position: relative; transition: background .12s; margin-top: 1px; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--c-surface); transition: left .12s; }
.switch input:checked + i { background: var(--c-primary); }
.switch input:checked + i::after { left: 18px; }
.switch input:focus-visible + i { box-shadow: var(--focus); }
.switch b { font-weight: 500; display: block; }
.switch small { display: block; color: var(--c-text-secondary); font-size: 12px; line-height: 18px; }
.radio-list { display: grid; gap: 8px; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: var(--r-md); cursor: pointer; }
.radio:hover { background: var(--c-hover); }
.radio input { margin-top: 4px; accent-color: var(--c-primary); }
.radio:has(input:checked) { background: var(--c-selected); border-color: var(--c-primary-border); }
.radio b { font-weight: 500; display: block; }
.radio small { color: var(--c-text-secondary); font-size: 12px; line-height: 18px; }
.subhead { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.olist { display: grid; gap: 6px; counter-reset: o; }
.olist li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); counter-increment: o; }
.olist li::before { content: counter(o); color: var(--c-text-tertiary); font-size: 12px; width: 14px; }
.olist li > span { flex: 1; min-width: 0; }
.olist.plain li::before { display: none; }
.olist.plain li > span { flex: none; min-width: 96px; }

/* 话术助手 */
.chat { display: grid; gap: 10px; }
.bubble { max-width: 640px; padding: 10px 12px; border-radius: var(--r-lg); border: 1px solid var(--c-border); background: var(--c-surface); font-size: 15px; line-height: 24px; }
.bubble.me { justify-self: end; background: var(--c-selected); border-color: var(--c-primary-border); }
.bubble .who { font-size: 12px; line-height: 18px; color: var(--c-text-secondary); font-weight: 600; display: block; }
.change { margin-top: 8px; border: 1px solid var(--c-divider); border-radius: var(--r-md); overflow: hidden; font-size: 14px; line-height: 22px; }
.change div { padding: 6px 10px; }
.change .was { background: var(--c-err-bg); color: var(--c-err); text-decoration: line-through; }
.change .now { background: var(--c-ok-bg); color: var(--c-ok); }
.change .cap { background: var(--c-bg); color: var(--c-text-secondary); font-size: 12px; }

/* 线路卡片 */
.line-card .kv { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.note { border-radius: var(--r-md); padding: 8px 12px; font-size: 13px; line-height: 20px; background: var(--c-info-bg); color: var(--c-info); border: 1px solid var(--c-info-border); }
.note.warn { background: var(--c-warn-bg); color: var(--c-warn); border-color: var(--c-warn-border); }
.note.ok { background: var(--c-ok-bg); color: var(--c-ok); border-color: var(--c-ok-border); }
.note.err { background: var(--c-err-bg); color: var(--c-err); border-color: var(--c-err-border); }

/* 提示条 */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--c-text); color: var(--c-surface); padding: 8px 16px; border-radius: var(--r-md); box-shadow: var(--shadow-pop); max-width: calc(100vw - 32px); font-size: 14px; }

/* 下拉（显示项） */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: 38px; z-index: 10; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 8px 12px; min-width: 150px; display: grid; }

/* ---------- 自适应 ---------- */
@media (max-width: 1279px) {
  .grid-2.grid-wide { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split .detail { position: static; max-height: none; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1099px) {
  .side { transform: translateX(-100%); box-shadow: none; }
  .nav-open .side { transform: none; box-shadow: var(--shadow-pop); }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(37, 36, 31, .32); }
  .work { margin-left: 0; }
  .btn.menu-btn { display: inline-flex; }
  .top { padding: 0 16px; }
}
@media (max-width: 760px) {
  main { padding: 16px 16px 40px; gap: 16px; }
  .grid-2, .grid-3, .grid-2.grid-side, .grid-2.grid-wide { grid-template-columns: minmax(0, 1fr); }
  .top-right .hide-s { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 24px; line-height: 32px; white-space: normal; }
  .filters .field, .filters .input { width: 100%; }
  .btn, .input, .seg button { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .tabs { gap: 0; }
  .tabs button { padding: 10px 8px; }
  .steps { grid-template-columns: 1fr; gap: 12px; }
  .steps li { padding: 0 0 0 38px; min-height: 30px; }
  .steps li::before { position: absolute; left: 0; top: 0; }
  .steps li::after { top: 26px; bottom: -12px; left: 12px; right: auto; width: 1.5px; height: auto; }
  .steps strong { margin-top: 0; }
  .todo li, .checklist li { flex-wrap: wrap; }
  .todo-count { min-width: 0; text-align: left; }
  .todo-main { flex: 1 1 calc(100% - 64px); }
  .todo li > .tag { margin-left: auto; }
  .fix-list li { grid-template-columns: 1fr; gap: 2px; }
  .talk button { grid-template-columns: 36px 34px minmax(0, 1fr); gap: 6px; padding: 6px 2px; }
  /* 列表变卡片 */
  .table-wrap { overflow: visible; }
  .rt thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rt, .rt tbody, .rt tr, .rt td { display: block; width: 100%; }
  .rt tr { padding: 10px 16px; border-bottom: 1px solid var(--c-divider); }
  .rt tbody tr:last-child { border-bottom: 0; }
  .rt td { padding: 3px 0; border: 0; display: flex; gap: 12px; justify-content: space-between; align-items: baseline; text-align: right; }
  .rt td::before { content: attr(data-label); color: var(--c-text-secondary); font-size: 12px; flex: none; text-align: left; }
  .rt td.right, .rt .ops { text-align: right; }
  .rt td.ops { justify-content: flex-end; padding-top: 8px; flex-wrap: wrap; }
  .rt td.ops::before { display: none; }
  .rt td:first-child { font-weight: 600; }
}

/* ================= 第二批新增的共用组件 ================= */

/* 标签串（多个权限、多个 Bot 时换行，不撑宽表格） */
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.top-right a.quit { color: var(--c-text-secondary); }

/* ---------- 弹层与抽屉 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(37, 36, 31, .42); }
.modal-box { background: var(--c-surface); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; min-width: 0; }
dialog.number-confirmation {
  inset: 0;
  margin: auto;
  width: min(480px, calc(100% - 32px));
  height: fit-content;
  max-height: calc(100dvh - 32px);
  border: 0;
  border-radius: var(--r-xl);
  background: var(--c-surface);
  box-shadow: var(--shadow-pop);
}
.modal-box.wide { width: min(760px, 100%); }
.modal-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--c-divider); }
.modal-head h2 { font-size: 18px; line-height: 26px; font-weight: 600; overflow-wrap: anywhere; }
.modal-head .x { flex: none; width: 30px; height: 30px; border: 0; background: none; border-radius: var(--r-md); cursor: pointer; color: var(--c-text-secondary); font-size: 20px; line-height: 1; }
.modal-head .x:hover { background: var(--c-hover); color: var(--c-text); }
.modal-body { padding: 16px 20px; overflow-y: auto; display: grid; gap: 12px; align-content: start; flex: 1; min-height: 0; }
.modal-body .field .input { width: 100%; }
.modal-foot { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--c-divider); }
.modal-foot .help { margin-right: auto; }
.modal.drawer { place-items: stretch end; padding: 0; }
.modal.drawer .modal-box { width: min(560px, 100%); height: 100%; max-height: none; border-radius: 0; }
body.modal-open { overflow: hidden; }
/* 确认弹层里的「会影响什么」 */
.impact { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-bg); }
.impact li { position: relative; padding-left: 14px; }
.impact li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 5px; height: 5px; border-radius: 50%; background: var(--c-text-tertiary); }
.radio small b, .switch small b, .checklist .what span b { display: inline; font-weight: 600; }
/* 只显示一次的密钥 */
.secret { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--c-warn-border); background: var(--c-warn-bg); border-radius: var(--r-md); }
.secret code { font-family: var(--font-mono); font-size: 14px; overflow-wrap: anywhere; flex: 1; min-width: 0; color: var(--c-text); }

/* ---------- 上传区 ---------- */
.drop { display: grid; justify-items: center; gap: 4px; padding: 20px 16px; border: 1.5px dashed var(--c-border-strong); border-radius: var(--r-lg); background: var(--c-bg); text-align: center; color: var(--c-text-secondary); cursor: pointer; }
.drop:hover { border-color: var(--c-primary); background: var(--c-selected); }
.drop strong { color: var(--c-text); font-weight: 600; }
.drop.has-file { border-style: solid; border-color: var(--c-primary-border); background: var(--c-selected); }

/* ---------- 用量条 ---------- */
.meter { height: 8px; border-radius: 4px; background: var(--c-divider); overflow: hidden; min-width: 80px; }
.meter i { display: block; height: 100%; background: var(--c-primary); border-radius: 4px; }
.meter.warn i { background: var(--c-warn); }
.meter.err i { background: var(--c-err); }

/* ---------- 状态行（系统状态等：名称、状态、数值） ---------- */
.health li { display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1.6fr); gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--c-divider); }
.health li:first-child { border-top: 0; }
.health b { font-weight: 500; display: block; }
.health .what span, .health .val { color: var(--c-text-secondary); font-size: 13px; }
.health .val { text-align: right; }

/* ---------- 改前改后 ---------- */
.ba { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ba > div { border: 1px solid var(--c-divider); border-radius: var(--r-md); padding: 8px 10px; background: var(--c-bg); overflow-wrap: anywhere; }
.ba > div > span { display: block; font-size: 12px; line-height: 18px; color: var(--c-text-secondary); }
.ba .after { background: var(--c-ok-bg); border-color: var(--c-ok-border); }

/* ---------- 登录页（两个后台同一套） ---------- */
body.auth { min-height: 100vh; display: grid; grid-template-rows: 1fr auto; }
.auth-wrap { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(400px, 100%); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-xl); padding: 28px 28px 24px; display: grid; gap: 16px; }
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand .product-mark { width: 36px; height: 36px; border-radius: 8px; }
.auth-brand .product-name { font-size: 17px; line-height: 24px; }
.auth-card h1 { font-size: 22px; line-height: 30px; font-weight: 600; }
.auth-card .field .input { width: 100%; height: 40px; font-size: 15px; }
.auth-card .btn { height: 40px; }
.otp { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.otp .btn { min-width: 112px; }
.field-err { color: var(--c-err); font-size: 12px; line-height: 18px; }
.input.bad { border-color: var(--c-err); }
.auth-foot { text-align: center; padding: 16px; color: var(--c-text-secondary); font-size: 12px; }
.auth-main { display: grid; gap: 16px; justify-items: center; width: 100%; }
.auth-main > .spec-bar { width: min(760px, 100%); }

/* ---------- 网页通话页与扫码试打页（固定暖白深青，不跟随系统深色） ---------- */
body.callpage { color-scheme: light; background: var(--c-bg); min-height: 100vh; }
.phone { width: min(420px, 100%); margin: 0 auto; padding: 20px 16px 32px; display: grid; gap: 16px; }
.phone-brand { display: flex; align-items: center; gap: 8px; color: var(--c-text-secondary); font-size: 13px; }
.phone-brand .product-mark { width: 24px; height: 24px; }
.phone h1 { font-size: 24px; line-height: 32px; font-weight: 600; }
.phone .lead { color: var(--c-text-secondary); font-size: 15px; line-height: 24px; }
.call-zone { display: grid; justify-items: center; gap: 10px; padding: 28px 16px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-xl); text-align: center; }
.call-btn { width: 88px; height: 88px; border-radius: 50%; border: 0; background: var(--c-primary); color: var(--c-surface); display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 16px rgba(40, 100, 94, .28); }
.call-btn:hover { background: var(--c-primary-hover); }
.call-btn.hangup { background: var(--c-err); box-shadow: 0 6px 16px rgba(151, 66, 56, .28); }
.call-btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.call-label { font-size: 16px; font-weight: 600; }
.call-timer { font-size: 34px; line-height: 40px; font-weight: 600; font-variant-numeric: tabular-nums; }
.call-state { color: var(--c-text-secondary); font-size: 14px; min-height: 22px; }
.call-state.err { color: var(--c-err); }
.wave { display: flex; align-items: center; gap: 4px; height: 28px; color: var(--c-primary); }
.wave i { width: 4px; border-radius: 2px; background: currentColor; height: 8px; animation: wave 1s ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: .12s; } .wave i:nth-child(3) { animation-delay: .24s; } .wave i:nth-child(4) { animation-delay: .36s; } .wave i:nth-child(5) { animation-delay: .48s; }
.wave.idle i { animation: none; height: 4px; color: var(--c-border-strong); }
@keyframes wave { 0%, 100% { height: 6px; } 50% { height: 24px; } }
@media (prefers-reduced-motion: reduce) { .wave i { animation: none; height: 14px; } }
.phone-tips li { display: flex; gap: 8px; padding: 4px 0; color: var(--c-text-secondary); font-size: 14px; }
.phone-tips li::before { content: "·"; color: var(--c-text-tertiary); }

body:has(> .work) {display:block}
body > aside.side {padding:0; gap:0; height:100dvh; width:var(--sidebar-w); position:fixed}
.side .nav {display:block}
.compact {--sidebar-w:60px}
.compact .product > div,.compact .nav-group,.compact .nav a span,.compact .side-foot {display:none}
.compact .side nav a {justify-content:center;padding:0}
main,main > *, .work > *, pre {min-width:0}
pre {white-space:pre-wrap;overflow-wrap:anywhere}
body > .work > main {width:100%; margin:0 auto}
.top .btn {display:inline-flex}
@media(max-width:760px) {
  .side .nav a {height:42px}
  .top button {position:static}
  .rt td {white-space:normal; overflow-wrap:anywhere}
}

body.auth {grid-template-columns:minmax(0, 1fr)}
body.auth .workspace {margin:0; display:grid; min-height:100vh}
body.auth .side, body.auth .top, body.auth .scrim {display:none}

.scope:empty { display: none; }
#callDetail > h2 { padding: 12px 16px 4px; }

#callDetail { scroll-margin-top: calc(var(--topbar-h) + 12px); }
#callDetail > h1 { padding: 16px 16px 0; }
