/* ==========================================================
   CloudCall · 智能外呼中心  —  Design System
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --line: #e8ecf3;
  --line-2: #f0f3f8;

  --ink: #111827;
  --ink-2: #59637a;
  --ink-3: #8b95a7;

  --primary: #3557f6;
  --primary-700: #2643d4;
  --primary-soft: #eef2ff;

  --violet: #7a4dff;
  --violet-soft: #f2edff;

  --green: #0eab6d;
  --green-soft: #e9f9f2;
  --amber: #e08c05;
  --amber-soft: #fff6e6;
  --red: #f04438;
  --red-soft: #feeceb;

  --sidebar: #0d1424;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 30px -22px rgba(16, 24, 40, .35);
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d5dceb; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #c2cadd; }
::-webkit-scrollbar-track { background: transparent; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 238px; flex: 0 0 238px; background: var(--sidebar);
  display: flex; flex-direction: column; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 0; }

.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 20px; }
.brand-mark {
  width: 31px; height: 31px; border-radius: 9px; flex: 0 0 31px;
  background: linear-gradient(135deg, #4f7bff, #8a5bff);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 6px 16px -4px rgba(79, 123, 255, .6);
}
.brand-mark svg { width: 17px; height: 17px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; }
.brand-name { color: #fff; font-size: 14.5px; font-weight: 650; letter-spacing: .2px; }
.brand-sub { font-size: 10.5px; color: #78849e; margin-top: 2px; letter-spacing: .06em; }

.nav { padding: 0 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 10px; color: #5b6781; letter-spacing: .14em;
  padding: 14px 10px 7px; text-transform: uppercase; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 9px; color: #a7b2c8; font-size: 13px; cursor: pointer;
  transition: background .16s, color .16s; border: none; background: none;
  width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255, 255, 255, .055); color: #e7edf9; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(79, 123, 255, .24), rgba(79, 123, 255, .05));
  color: #fff; box-shadow: inset 0 0 0 1px rgba(120, 150, 255, .16);
}
.nav-item svg {
  width: 17px; height: 17px; flex: 0 0 17px; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .92;
}
.nav-badge {
  margin-left: auto; font-size: 10px; background: rgba(255, 255, 255, .1);
  color: #dbe4f5; padding: 1px 6px; border-radius: 20px; font-variant-numeric: tabular-nums;
}

.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .07); }
.agent-card {
  display: flex; gap: 9px; align-items: center; padding: 8px 9px;
  border-radius: 10px; background: rgba(255, 255, 255, .05);
}
.avatar {
  width: 31px; height: 31px; border-radius: 50%; flex: 0 0 31px;
  background: linear-gradient(135deg, #5b8cff, #8a5bff);
  display: grid; place-items: center; color: #fff; font-size: 11.5px; font-weight: 600;
}
.agent-meta-name { color: #eef3fd; font-size: 12.5px; font-weight: 550; }
.agent-meta-sub { color: #7d89a3; font-size: 10.5px; display: flex; align-items: center; gap: 4px; margin-top: 1px; }

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

.topbar {
  height: 62px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }
.topbar-crumb { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pill b { color: var(--ink); font-weight: 650; }
.pill-ok { background: var(--green-soft); border-color: #cdeee0; color: #0a7d51; }
.pill-ok b { color: #0a7d51; }

.live-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 rgba(14, 171, 109, .55); animation: pulse 2s infinite;
  flex: 0 0 6px;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(14, 171, 109, .5); }
  70% { box-shadow: 0 0 0 6px rgba(14, 171, 109, 0); }
  100% { box-shadow: 0 0 0 0 rgba(14, 171, 109, 0); }
}

.content { padding: 22px 24px 44px; flex: 1; min-width: 0; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font-size: 20px; letter-spacing: -.02em; font-weight: 680; }
.page-desc { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 33px; padding: 0 13px;
  border-radius: 9px; border: 1px solid var(--line); background: #fff;
  color: var(--ink-2); font-size: 12.5px; font-weight: 500; cursor: pointer;
  transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #d3dbeb; color: var(--ink); background: #fcfdff; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary {
  background: linear-gradient(180deg, #4568ff, var(--primary)); border-color: var(--primary-700);
  color: #fff; box-shadow: 0 6px 16px -8px rgba(53, 87, 246, .9);
}
.btn-primary:hover { background: linear-gradient(180deg, #3b5efb, var(--primary-700)); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-primary:disabled { background: #9aabf4; border-color: #9aabf4; color: #fff; }
.btn-primary:disabled:hover { background: #9aabf4; color: #fff; }
.btn-sm { height: 27px; padding: 0 9px; font-size: 11.5px; border-radius: 7px; }

/* ---------- Card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-hd { display: flex; align-items: center; gap: 10px; padding: 15px 18px 0; }
.card-title { font-size: 13.5px; font-weight: 620; letter-spacing: -.005em; }
.card-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; font-weight: 400; }
.card-hd .spacer { margin-left: auto; }
.card-bd { padding: 15px 18px 18px; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.kpi { position: relative; overflow: hidden; padding: 16px 17px 14px; }
.kpi-label { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kpi-value {
  font-size: 27px; font-weight: 700; letter-spacing: -.03em; margin-top: 7px;
  font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 5px;
}
.kpi-unit { font-size: 12px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11.5px; color: var(--ink-3); }
.trend { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-variant-numeric: tabular-nums; }
.trend-up { color: var(--green); }
.trend-down { color: var(--red); }
.kpi-spark { position: absolute; right: 0; bottom: 0; width: 108px; height: 46px; opacity: .55; }

/* ---------- Grid helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; margin-bottom: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Badges / chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px;
  border-radius: 6px; font-size: 11px; font-weight: 550; white-space: nowrap;
}
.chip svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; }
.chip-flow { background: var(--primary-soft); color: #2946d9; }
.chip-agent { background: var(--violet-soft); color: #6534e8; }
.chip-ok { background: var(--green-soft); color: #0a7d51; }
.chip-warn { background: var(--amber-soft); color: #a86604; }
.chip-gray { background: #f0f3f9; color: var(--ink-2); }
.chip-red { background: var(--red-soft); color: #c0362b; }

.tag-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.table th {
  text-align: left; font-weight: 550; color: var(--ink-3); font-size: 11.5px;
  padding: 9px 16px; background: var(--surface-2); border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.table th:first-child { padding-left: 18px; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table td:first-child { padding-left: 18px; }
.table tbody tr:hover { background: #fafbff; }
.table tbody tr:last-child td { border-bottom: none; }
.num { font-variant-numeric: tabular-nums; }
.t-strong { font-weight: 560; color: var(--ink); }
.t-muted { color: var(--ink-3); }
.link { color: var(--primary); font-weight: 500; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* progress */
.bar { height: 5px; border-radius: 4px; background: #eef1f7; overflow: hidden; width: 100%; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #4f7bff, #7a4dff); }
.bar.flow > i { background: linear-gradient(90deg, #5b8cff, #3557f6); }
.bar.agent > i { background: linear-gradient(90deg, #9a6bff, #7a4dff); }
.bar-cell { display: flex; align-items: center; gap: 9px; min-width: 128px; }
.bar-cell span { font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 32px; }

/* ---------- Segmented ---------- */
.segmented {
  display: inline-flex; padding: 3px; background: #f1f4fa; border-radius: 9px; gap: 2px;
}
.segmented button {
  border: none; background: none; padding: 5px 11px; border-radius: 7px;
  font-size: 12px; color: var(--ink-2); cursor: pointer; transition: .15s; font-weight: 500;
}
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); font-weight: 600; }

.seg-engine { display: inline-flex; padding: 3px; background: #f1f4fa; border-radius: 10px; gap: 2px; }
.seg-engine button {
  border: none; background: none; padding: 6px 12px; border-radius: 8px; font-size: 12px;
  color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  font-weight: 550; transition: .18s;
}
.seg-engine button svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.seg-engine button.active { background: #fff; box-shadow: 0 1px 4px rgba(16, 24, 40, .14); }
.seg-engine button.active.flow { color: #2946d9; }
.seg-engine button.active.agent { color: #6534e8; }

/* ---------- Views ---------- */
.view { display: none; }
.view.active { display: block; animation: fadeUp .28s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ==========================================================
   Workspace
   ========================================================== */
.ws-grid {
  display: grid; grid-template-columns: 306px minmax(0, 1fr) 340px; gap: 14px;
  height: calc(100vh - 128px); min-height: 620px;
}
.ws-col { display: flex; flex-direction: column; gap: 12px; min-height: 0; }

.call-card { padding: 16px; background: linear-gradient(160deg, #101a30, #1b2643 62%, #22305a); border: none; color: #fff; overflow: hidden; position: relative; }
.call-card::after {
  content: ""; position: absolute; width: 190px; height: 190px; right: -70px; top: -90px;
  background: radial-gradient(circle, rgba(110, 140, 255, .35), transparent 68%); border-radius: 50%;
}
.call-status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #9fb0d4; }
.call-name { font-size: 17px; font-weight: 650; margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.call-phone { font-family: var(--mono); font-size: 12px; color: #9fb0d4; margin-top: 3px; letter-spacing: .02em; }
.call-timer {
  font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: .02em;
  margin-top: 14px; font-variant-numeric: tabular-nums;
}
.call-actions { display: flex; gap: 8px; margin-top: 14px; position: relative; z-index: 1; }
.call-actions button {
  flex: 1; height: 32px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08); color: #e6edff; font-size: 11.5px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; transition: .15s;
}
.call-actions button:hover { background: rgba(255, 255, 255, .16); }
.call-actions button.danger { background: rgba(240, 68, 56, .9); border-color: transparent; color: #fff; }
.call-actions button.danger:hover { background: #e33d31; }
.call-actions svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; }

.info-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 12px; border-bottom: 1px dashed var(--line-2); }
.info-row:last-child { border-bottom: none; }
.info-row dt { color: var(--ink-3); }
.info-row dd { margin: 0; font-weight: 550; color: var(--ink); font-variant-numeric: tabular-nums; }

/* chat */
.chat-card { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-hd { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; scroll-behavior: smooth; }
.chat-scroll::-webkit-scrollbar { width: 6px; }

.msg { display: flex; gap: 9px; max-width: 88%; animation: msgIn .3s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg.right { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
  width: 27px; height: 27px; border-radius: 8px; flex: 0 0 27px; display: grid; place-items: center;
  font-size: 10px; font-weight: 650; color: #fff;
}
.msg.agent .msg-avatar { background: linear-gradient(135deg, #6f5bff, #9a5bff); }
.msg.customer .msg-avatar { background: #d9dfec; color: #56617a; }
.msg-body { min-width: 0; }
.msg-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 10.5px; color: var(--ink-3); }
.msg.right .msg-meta { justify-content: flex-end; }
.msg-name { font-weight: 600; color: var(--ink-2); font-size: 11px; }
.bubble {
  padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.62;
  background: #f3f6fb; color: #22314d; word-break: break-word;
}
.msg.agent .bubble { background: #fff; border: 1px solid var(--line); border-top-left-radius: 4px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.msg.customer .bubble { background: #eef2ff; border-top-right-radius: 4px; color: #1b2a46; }

.latency-tag {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; font-size: 10px;
  color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.latency-tag b { font-weight: 600; color: #4a5c86; }
.latency-tag svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 2; }
.msg.right .latency-tag { justify-content: flex-end; }

.asr-line {
  display: inline-flex; align-items: center; gap: 6px; font-size: 10px; color: #0a7d51;
  background: var(--green-soft); border-radius: 5px; padding: 1px 6px; margin-left: 6px; font-weight: 600;
}
.asr-line.low { color: #a86604; background: var(--amber-soft); }

.sys-note {
  align-self: center; font-size: 11px; color: var(--ink-3); background: #f4f6fa;
  border: 1px solid var(--line); padding: 5px 12px; border-radius: 20px; display: inline-flex;
  align-items: center; gap: 6px; max-width: 92%; text-align: center;
}
.sys-note svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.engine-badge { margin-left: 4px; padding: 1px 7px; border-radius: 10px; background: var(--green-soft); color: #0a7d51; font-size: 10px; font-weight: 600; white-space: nowrap; }

.typing { display: inline-flex; gap: 3px; align-items: center; height: 14px; }
.typing i { width: 5px; height: 5px; background: #a9b4cb; border-radius: 50%; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

.chat-ft { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 8px; align-items: center; }
.chat-input {
  flex: 1; height: 34px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px;
  font-size: 12.5px; font-family: inherit; color: var(--ink); background: var(--surface-2); outline: none;
}
.chat-input:focus { border-color: #b9c6ff; background: #fff; box-shadow: 0 0 0 3px rgba(53, 87, 246, .1); }

/* pipeline */
.pipe-list { display: flex; flex-direction: column; }
.pipe-node {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; transition: .25s; position: relative;
}
.pipe-node.on { border-color: #c9d4ff; background: linear-gradient(180deg, #fbfcff, #f3f6ff); box-shadow: 0 2px 10px -6px rgba(53, 87, 246, .7); }
.pipe-node.on.agent-on { border-color: #d8c9ff; background: linear-gradient(180deg, #fdfbff, #f7f2ff); box-shadow: 0 2px 10px -6px rgba(122, 77, 255, .7); }
.pipe-ico {
  width: 26px; height: 26px; border-radius: 7px; flex: 0 0 26px; display: grid; place-items: center;
  background: #f1f4fb; color: #5b6b8c;
}
.pipe-node.on .pipe-ico { background: #e6ecff; color: #3557f6; }
.pipe-node.on.agent-on .pipe-ico { background: #efe6ff; color: #7a4dff; }
.pipe-ico svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pipe-name { font-size: 12px; font-weight: 550; color: var(--ink); }
.pipe-desc { font-size: 10px; color: var(--ink-3); font-family: var(--mono); margin-top: 1px; }
.pipe-ms { margin-left: auto; font-size: 10.5px; font-family: var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pipe-node.on .pipe-ms { color: #3557f6; font-weight: 600; }
.pipe-node.on.agent-on .pipe-ms { color: #7a4dff; }
.pipe-link {
  height: 22px; margin-left: 24px; border-left: 1.5px dashed #d6ddec; position: relative;
  display: flex; align-items: center;
}
.pipe-link span {
  font-size: 9.5px; color: var(--ink-3); font-family: var(--mono); background: var(--bg);
  padding: 0 4px; margin-left: 6px; position: relative; top: 0;
}

.metric-mini { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.mm { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 10px; }
.mm-k { font-size: 10.5px; color: var(--ink-3); }
.mm-v { font-size: 15px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.mm-v small { font-size: 10px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }

.hint-list { display: flex; flex-direction: column; gap: 7px; }
.hint {
  display: flex; gap: 8px; padding: 9px 10px; border-radius: 9px; background: var(--surface-2);
  border: 1px solid var(--line-2); font-size: 11.5px; color: var(--ink-2); line-height: 1.5; cursor: pointer;
  transition: .15s;
}
.hint:hover { border-color: #c9d4ff; background: #f8faff; }
.hint-idx {
  font-size: 9.5px; font-weight: 700; color: #3557f6; background: #e9eeff; border-radius: 4px;
  padding: 1px 5px; height: 16px; flex: 0 0 auto; margin-top: 1px;
}
.kb-hit { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--ink-3); margin-top: 5px; }
.kb-hit b { color: #6534e8; font-weight: 600; }

/* waveform */
.wave { display: flex; align-items: center; gap: 2px; height: 28px; }
.wave i { width: 2px; border-radius: 2px; background: #c7d2e8; }
.wave.live i { background: #7a8cff; animation: waveMove 1.1s ease-in-out infinite; }
@keyframes waveMove { 0%, 100% { transform: scaleY(.55); } 50% { transform: scaleY(1); } }

/* ==========================================================
   Flow builder
   ========================================================== */
.flow-shell {
  display: grid; grid-template-columns: 196px minmax(0, 1fr) 268px; gap: 0;
  height: calc(100vh - 128px); min-height: 620px;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  overflow: hidden; box-shadow: var(--shadow);
}
.flow-side { border-right: 1px solid var(--line); padding: 14px 12px; overflow-y: auto; background: var(--surface-2); }
.flow-side.right { border-right: none; border-left: 1px solid var(--line); background: #fff; }
.side-title { font-size: 11px; font-weight: 650; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; padding: 0 4px 9px; }
.node-lib { display: flex; flex-direction: column; gap: 6px; }
.lib-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 9px; border-radius: 8px;
  background: #fff; border: 1px solid var(--line); font-size: 12px; color: var(--ink-2);
  cursor: grab; transition: .15s;
}
.lib-item:hover { border-color: #b9c6ff; box-shadow: 0 2px 8px -6px rgba(53, 87, 246, .8); transform: translateY(-1px); }
.lib-item svg { width: 14px; height: 14px; stroke: #63718c; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.canvas {
  position: relative; overflow: auto; background-color: #fafbfe;
  background-image: radial-gradient(#dfe5f0 1px, transparent 1px);
  background-size: 18px 18px; background-position: 0 0;
}
.canvas-inner { position: relative; width: 900px; height: 480px; margin: 26px auto 40px; }
.flow-svg { position: absolute; inset: 0; pointer-events: none; }

.fnode {
  position: absolute; width: 156px; background: #fff; border: 1px solid #e2e8f4; border-radius: 10px;
  padding: 9px 11px; box-shadow: 0 1px 3px rgba(16, 24, 40, .06); cursor: pointer; transition: .15s;
}
.fnode:hover { border-color: #b9c6ff; box-shadow: 0 4px 14px -8px rgba(53, 87, 246, .8); }
.fnode.sel { border-color: #3557f6; box-shadow: 0 0 0 3px rgba(53, 87, 246, .13); }
.fnode-kind { font-size: 9.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.fnode-title { font-size: 12.5px; font-weight: 550; margin-top: 2px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fnode.k-start { border-left: 3px solid #0eab6d; }
.fnode.k-tts { border-left: 3px solid #3557f6; }
.fnode.k-asr { border-left: 3px solid #0ea5e9; }
.fnode.k-branch { border-left: 3px solid #e08c05; background: linear-gradient(180deg, #fffdf7, #fff); }
.fnode.k-agent { border-left: 3px solid #7a4dff; background: linear-gradient(180deg, #fdfbff, #fff); }

.flow-toolbar {
  position: absolute; left: 14px; top: 12px; display: flex; gap: 4px; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 3px; box-shadow: 0 2px 8px -4px rgba(16, 24, 40, .3); z-index: 3;
}
.flow-toolbar button { width: 26px; height: 26px; border: none; background: none; border-radius: 6px; cursor: pointer; display: grid; place-items: center; color: var(--ink-2); }
.flow-toolbar button:hover { background: var(--surface-2); }
.flow-toolbar svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }

.flow-legend {
  position: absolute; right: 14px; bottom: 12px; display: flex; gap: 12px; background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 11px; font-size: 10.5px; color: var(--ink-3); z-index: 3;
  backdrop-filter: blur(6px);
}
.flow-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg-dot { width: 7px; height: 7px; border-radius: 2px; }

/* inspector */
.insp-field { margin-bottom: 12px; }
.insp-label { font-size: 11px; color: var(--ink-3); margin-bottom: 5px; display: block; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px;
  font-size: 12px; font-family: inherit; color: var(--ink); background: #fff; outline: none;
  transition: .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: #b9c6ff; box-shadow: 0 0 0 3px rgba(53, 87, 246, .1); }
.textarea { resize: vertical; min-height: 74px; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b95a7' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; padding-right: 26px; }

/* ==========================================================
   Agent config
   ========================================================== */
.agent-grid { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 14px; align-items: start; }
.model-card {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer; transition: .15s; background: #fff;
}
.model-card:hover { border-color: #c9d4ff; }
.model-card.on { border-color: #7a4dff; background: linear-gradient(180deg, #fdfbff, #f8f3ff); box-shadow: 0 0 0 3px rgba(122, 77, 255, .1); }
.model-radio { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid #cfd6e4; flex: 0 0 15px; margin-top: 2px; display: grid; place-items: center; }
.model-card.on .model-radio { border-color: #7a4dff; }
.model-card.on .model-radio::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #7a4dff; }
.model-name { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.model-desc { font-size: 11px; color: var(--ink-3); margin-top: 3px; line-height: 1.5; }

.switch { position: relative; width: 34px; height: 19px; flex: 0 0 34px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute; inset: 0; background: #dfe4ee; border-radius: 20px; cursor: pointer; transition: .2s;
}
.switch span::after {
  content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%; background: #fff;
  top: 2px; left: 2px; transition: .2s; box-shadow: 0 1px 3px rgba(16, 24, 40, .25);
}
.switch input:checked + span { background: linear-gradient(90deg, #7a4dff, #9a6bff); }
.switch input:checked + span::after { transform: translateX(15px); }

.switch-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line-2); }
.switch-row:last-child { border-bottom: none; }
.switch-row .txt { flex: 1; }
.switch-row .txt b { font-size: 12.5px; font-weight: 550; display: block; }
.switch-row .txt small { font-size: 11px; color: var(--ink-3); display: block; margin-top: 2px; line-height: 1.45; }

input[type="range"] { -webkit-appearance: none; width: 100%; height: 4px; border-radius: 4px; background: #e6ebf4; outline: none; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff;
  border: 2px solid var(--violet); box-shadow: 0 1px 4px rgba(16, 24, 40, .2); cursor: pointer;
}
.range-row { display: flex; align-items: center; gap: 10px; }
.range-val { font-size: 11.5px; font-family: var(--mono); color: var(--ink-2); min-width: 42px; text-align: right; }

.voice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.voice {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; cursor: pointer;
  display: flex; align-items: center; gap: 8px; transition: .15s; background: #fff;
}
.voice:hover { border-color: #d8c9ff; }
.voice.on { border-color: #7a4dff; background: #faf6ff; }
.voice-name { font-size: 12px; font-weight: 550; }
.voice-tag { font-size: 10px; color: var(--ink-3); }
.play-btn {
  width: 21px; height: 21px; border-radius: 50%; border: none; background: #f1ecff; color: #7a4dff;
  display: grid; place-items: center; cursor: pointer; margin-left: auto; flex: 0 0 21px;
}
.play-btn svg { width: 10px; height: 10px; fill: currentColor; stroke: none; }

.try-panel { position: sticky; top: 78px; }
.try-chat {
  background: #0f172a; border-radius: 12px; padding: 14px; min-height: 268px;
  display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto;
}
.try-chat::-webkit-scrollbar-thumb { background: #2b3852; }
.try-msg { font-size: 11.5px; line-height: 1.6; padding: 8px 11px; border-radius: 10px; max-width: 86%; }
.try-msg.bot { background: rgba(255, 255, 255, .08); color: #dfe6f5; border-top-left-radius: 3px; align-self: flex-start; }
.try-msg.me { background: linear-gradient(135deg, #7a4dff, #5b8cff); color: #fff; border-top-right-radius: 3px; align-self: flex-end; }
.try-meta { font-size: 9.5px; color: #64748b; font-family: var(--mono); }

/* ==========================================================
   Records
   ========================================================== */
.rec-row { cursor: pointer; }
.rec-row:hover { background: #fafbff; }
.rec-detail { display: none; }
.rec-detail.open { display: table-row; }
.rec-detail td { padding: 0 !important; background: #fbfcfe; }
.rec-detail-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; padding: 16px 18px 18px; border-bottom: 1px solid var(--line-2); }
.transcript { display: flex; flex-direction: column; gap: 8px; max-height: 190px; overflow-y: auto; padding-right: 6px; }
.tr-line { display: flex; gap: 8px; font-size: 11.5px; line-height: 1.55; }
.tr-t { font-family: var(--mono); font-size: 10px; color: var(--ink-3); flex: 0 0 34px; padding-top: 1px; }
.tr-who { font-weight: 600; flex: 0 0 34px; }
.tr-who.a { color: #3557f6; }
.tr-who.c { color: #0a7d51; }
.tr-txt { color: var(--ink-2); }

.qc-list { display: flex; flex-direction: column; gap: 7px; }
.qc-item { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.qc-item .bar { flex: 1; }
.qc-score { font-variant-numeric: tabular-nums; font-weight: 600; width: 30px; text-align: right; font-size: 11px; }

/* ---------- misc ---------- */
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: #c3cbdb; display: inline-block; }
.mono { font-family: var(--mono); }
.hr { height: 1px; background: var(--line-2); margin: 12px 0; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-6 { gap: 6px; }
.gap-10 { gap: 10px; }
.mt-10 { margin-top: 10px; }
.mt-14 { margin-top: 14px; }
.mb-10 { margin-bottom: 10px; }
.text-xs { font-size: 11px; }
.muted { color: var(--ink-3); }
.spacer { margin-left: auto; }

.engine-health { display: flex; flex-direction: column; gap: 10px; }
.eh-row { display: flex; align-items: center; gap: 10px; font-size: 11.5px; }
.eh-name { width: 96px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.eh-bar { flex: 1; height: 6px; border-radius: 4px; background: #f0f3f9; overflow: hidden; }
.eh-bar i { display: block; height: 100%; border-radius: 4px; }
.eh-val { width: 44px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-family: var(--mono); font-size: 10.5px; }

/* responsive */
@media (max-width: 1400px) {
  .ws-grid { grid-template-columns: 280px minmax(0, 1fr) 310px; }
}
@media (max-width: 1240px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .agent-grid { grid-template-columns: 1fr; }
  .ws-grid { grid-template-columns: 260px minmax(0, 1fr); }
  .ws-grid > .ws-col:last-child { display: none; }
  .flow-shell { grid-template-columns: 170px minmax(0, 1fr); }
  .flow-shell > .flow-side.right { display: none; }
}
@media (max-width: 980px) {
  .sidebar { width: 62px; flex: 0 0 62px; }
  .brand-name, .brand-sub, .nav-label, .nav-item span, .nav-badge, .side-foot .agent-meta { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .brand { justify-content: center; padding: 16px 0; }
  .ws-grid { grid-template-columns: 1fr; height: auto; }
  .ws-grid > .ws-col:first-child { display: none; }
  .chat-card { height: 560px; }
  .flow-shell { grid-template-columns: 1fr; height: auto; }
  .flow-shell > .flow-side { display: none; }
  .canvas { height: 520px; }
}

/* ==========================================================
   v2 · 业务组件（线路/模型/智能体/分支/任务向导）
   ========================================================== */
.no-scroll { overflow: hidden; }

/* icon button */
.icon-btn {
  width: 26px; height: 26px; border: none; background: none; border-radius: 6px;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-3);
  transition: .15s; padding: 0; vertical-align: middle;
}
.icon-btn:hover { background: #f1f4fa; color: var(--ink); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }
.icon-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* toast */
.toast-wrap { position: fixed; right: 22px; bottom: 22px; z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 8px; background: #101828; color: #fff;
  padding: 10px 14px; border-radius: 10px; font-size: 12.5px; max-width: 380px;
  box-shadow: 0 12px 30px -10px rgba(16,24,40,.5); opacity: 0; transform: translateY(10px);
  transition: .24s; line-height: 1.45;
}
.toast.in { opacity: 1; transform: none; }
.toast-err { background: #b42318; }
.toast-ico { display: inline-grid; place-items: center; flex: 0 0 14px; }
.toast-ico svg { width: 14px; height: 14px; stroke: #fff; fill: none; stroke-width: 2.6; stroke-linecap: round; }

/* overlay + sheet */
.overlay { position: fixed; inset: 0; background: rgba(13,20,36,.45); backdrop-filter: blur(2px); z-index: 100; opacity: 0; transition: .24s; }
.overlay.show { opacity: 1; }
.sheet { position: fixed; background: #fff; z-index: 110; display: flex; flex-direction: column; box-shadow: 0 24px 60px -20px rgba(16,24,40,.4); }
.drawer { right: 0; top: 0; height: 100vh; width: 520px; max-width: 94vw; transform: translateX(100%); transition: transform .26s cubic-bezier(.22,.8,.3,1); }
.drawer.show { transform: none; }
.modal { left: 50%; top: 50%; width: 560px; max-width: 94vw; max-height: 86vh; border-radius: 16px; transform: translate(-50%,-46%); opacity: 0; transition: .24s; }
.modal.show { transform: translate(-50%,-50%); opacity: 1; }
.sheet-hd { display: flex; align-items: flex-start; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sheet-title { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.sheet-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.sheet-hd .icon-btn { margin-left: auto; flex: 0 0 26px; }
.sheet-bd { flex: 1; overflow-y: auto; padding: 18px 20px; }
.sheet-ft { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.btn-danger { background: var(--red); border-color: #c0362b; color: #fff; }
.btn-danger:hover { background: #d93a2e; color: #fff; border-color: #c0362b; }

/* form */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { min-width: 0; }
.field.span-2, .switch-row.span-2, .form-divider.span-2, .form-note.span-2 { grid-column: 1 / -1; }
.field-label { display: block; font-size: 11.5px; font-weight: 550; color: var(--ink-2); margin-bottom: 5px; }
.req { color: var(--red); font-style: normal; }
.field-hint { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.5; }
.field-hint.hint-fix { color: var(--green, #1a9d63); font-weight: 550; }
.field-hint.hint-err { color: var(--red); font-weight: 550; }
.form-divider { font-size: 11px; font-weight: 650; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; padding: 10px 0 2px; border-top: 1px solid var(--line-2); margin-top: 4px; display: flex; align-items: baseline; gap: 6px; }
.form-note { font-size: 11px; color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; line-height: 1.55; }
.field.invalid .input, .field.invalid .select, .field.invalid .textarea { border-color: var(--red); box-shadow: 0 0 0 3px rgba(240,68,56,.1); }
.static-val { font-size: 12.5px; color: var(--ink); padding: 7px 0; font-weight: 550; }
.confirm-body { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; color: var(--ink-2); line-height: 1.65; }
.confirm-body svg { width: 18px; height: 18px; flex: 0 0 18px; stroke: var(--amber); fill: none; stroke-width: 2; margin-top: 2px; }

.upload-box { border: 1.5px dashed #d3dbeb; border-radius: 10px; padding: 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; background: var(--surface-2); transition: .15s; }
.upload-box:hover { border-color: #b9c6ff; background: #f8faff; }
.upload-box.has-file { border-style: solid; border-color: #cdeee0; background: var(--green-soft); }
.upload-box svg { width: 20px; height: 20px; stroke: #8b95a7; fill: none; stroke-width: 1.7; flex: 0 0 20px; }
.upload-box b { font-size: 12px; display: block; color: var(--ink); }
.upload-box small { font-size: 10.5px; color: var(--ink-3); display: block; margin-top: 2px; }

/* stats */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.mini-kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; box-shadow: var(--shadow); }
.mk-label { font-size: 11.5px; color: var(--ink-3); }
.mk-value { font-size: 21px; font-weight: 680; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mk-value small { font-size: 11px; font-weight: 500; color: var(--ink-3); margin-left: 3px; }
.mk-bar { height: 4px; border-radius: 3px; background: #f0f3f9; margin-top: 9px; overflow: hidden; }
.mk-bar i { display: block; height: 100%; background: linear-gradient(90deg,#5b8cff,#7a4dff); border-radius: 3px; }

/* tabs */
.tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--line); align-items: center; }
.tab { border: none; background: none; padding: 12px 12px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.tab:hover { color: var(--ink); }
.tab em { font-style: normal; font-size: 10px; background: #f0f3f9; color: var(--ink-3); padding: 1px 5px; border-radius: 20px; }
.tab.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab.on em { background: var(--primary-soft); color: var(--primary); }

/* tiles */
.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tile-grid-4 { grid-template-columns: repeat(4, 1fr); }
.model-tile { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; transition: .15s; display: flex; flex-direction: column; }
.model-tile:hover { border-color: #c9d4ff; box-shadow: 0 8px 24px -18px rgba(53,87,246,.8); }
.mt-hd { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.mt-name { font-size: 13px; font-weight: 600; line-height: 1.35; }
.mt-id { font-size: 10.5px; color: var(--ink-3); margin-top: 3px; word-break: break-all; }
.mt-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 12px 0; }
.mt-meta div { display: flex; justify-content: space-between; gap: 6px; font-size: 10.5px; color: var(--ink-3); }
.mt-meta b { color: var(--ink-2); font-weight: 550; text-align: right; }
.mt-ft { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line-2); display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--ink-3); }

.voice-tile { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; text-align: center; transition: .15s; }
.voice-tile:hover { border-color: #d8c9ff; }
.voice-tile.training { opacity: .72; }
.vt-avatar { width: 42px; height: 42px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; background: linear-gradient(135deg,#e9eeff,#f2edff); color: #5b6bff; font-weight: 650; font-size: 15px; }
.vt-name { font-size: 12.5px; font-weight: 600; }
.vt-tags { display: flex; gap: 4px; justify-content: center; margin-top: 6px; }
.vt-src { font-size: 10px; color: var(--ink-3); margin-top: 6px; }
.vt-wave { display: flex; gap: 2px; justify-content: center; align-items: center; height: 24px; margin: 10px 0 6px; }
.vt-wave i { width: 2px; height: 6px; border-radius: 2px; background: #dbe2f0; }
.vt-wave i:nth-child(2n) { height: 12px; }
.vt-wave i:nth-child(3n) { height: 18px; }
.vt-wave i:nth-child(5n) { height: 9px; }
.voice-tile.playing .vt-wave i { background: #7a4dff; animation: waveMove .7s ease-in-out infinite; }
.voice-tile.playing .vt-wave i:nth-child(2n) { animation-delay: .1s; }
.voice-tile.playing .vt-wave i:nth-child(3n) { animation-delay: .2s; }
.vt-ft { display: flex; align-items: center; gap: 4px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line-2); }

/* agent layout */
.agent-layout { display: grid; grid-template-columns: 350px minmax(0,1fr); gap: 14px; height: calc(100vh - 132px); min-height: 560px; }
.agent-list { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.agent-list-hd { font-size: 11.5px; color: var(--ink-3); padding: 4px 6px 2px; display: flex; align-items: center; gap: 6px; }
.agent-list-hd em { font-style: normal; background: #f0f3f9; padding: 0 6px; border-radius: 20px; font-size: 10px; }
.agent-item { border: 1px solid var(--line); border-radius: 10px; padding: 11px; cursor: pointer; transition: .15s; }
.agent-item:hover { border-color: #c9d4ff; }
.agent-item.on { border-color: #7a4dff; background: linear-gradient(180deg,#fdfbff,#f8f3ff); box-shadow: 0 0 0 3px rgba(122,77,255,.1); }
.ai-top { display: flex; align-items: center; gap: 6px; }
.ai-name { font-size: 12.5px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-model { font-size: 10px; color: var(--ink-3); margin-top: 4px; }
.ai-bottom { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.ai-bottom .chip { height: 18px; font-size: 9.5px; padding: 0 6px; }

.test-panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; min-height: 0; box-shadow: var(--shadow); overflow: hidden; }
.test-hd { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.test-name { font-size: 13px; font-weight: 600; }
.test-sub { font-size: 10.5px; color: var(--ink-3); font-family: var(--mono); margin-top: 2px; }
.test-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; background: var(--surface-2); min-height: 0; }
.test-ft { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.test-empty { margin: auto; text-align: center; color: var(--ink-3); font-size: 12px; line-height: 1.8; max-width: 340px; }
.te-icon { width: 48px; height: 48px; border-radius: 14px; background: #f2edff; color: #7a4dff; display: grid; place-items: center; margin: 0 auto 12px; }
.te-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; }

/* branch */
.branch-card { margin-bottom: 14px; overflow: hidden; }
.bc-hd { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.bc-title { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.bc-sub { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--ink-3); flex-wrap: wrap; }
.bc-arrow { color: #c3cbdb; }
.bc-flow { padding: 12px 18px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 10px; }
.bf-node { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; position: relative; background: #fff; }
.bf-node.fallback { background: #fbfcfe; border-style: dashed; }
.bf-idx { position: absolute; right: 10px; top: 10px; width: 16px; height: 16px; border-radius: 50%; background: #eef2ff; color: #3557f6; font-size: 9.5px; display: grid; place-items: center; font-weight: 700; }
.bf-node.fallback .bf-idx { background: #fff6e6; color: #a86604; }
.bf-cond { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; padding-right: 20px; }
.bf-type { font-size: 9px; font-weight: 600; color: var(--ink-3); background: #f2f5fa; padding: 1px 4px; border-radius: 4px; }
.bf-reply { font-size: 11px; color: var(--ink-2); margin-top: 5px; line-height: 1.55; }
.bf-target { font-size: 10.5px; color: #3557f6; margin-top: 6px; font-family: var(--mono); }
.bf-node.fallback .bf-target { color: var(--ink-3); }

.brow { display: grid; grid-template-columns: 1.2fr 96px 1.8fr 110px 26px; gap: 6px; align-items: center; margin-bottom: 6px; }
.brow-head { display: grid; grid-template-columns: 1.2fr 96px 1.8fr 110px 26px; gap: 6px; font-size: 10.5px; color: var(--ink-3); margin-bottom: 5px; padding: 0 1px; white-space: nowrap; }

/* wizard */
.steps { display: flex; gap: 8px; margin-bottom: 16px; }
.step { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); padding: 7px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); flex: 1; }
.step-no { width: 18px; height: 18px; border-radius: 50%; background: #e8ecf3; color: var(--ink-3); font-size: 10px; display: grid; place-items: center; font-weight: 700; flex: 0 0 18px; }
.step.on { background: var(--primary-soft); border-color: #c9d4ff; color: #2946d9; font-weight: 600; }
.step.on .step-no { background: var(--primary); color: #fff; }
.step.done { color: #0a7d51; border-color: #cdeee0; background: var(--green-soft); }
.step.done .step-no { background: var(--green); color: #fff; }
.wiz-body { min-height: 344px; }

.pick-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick-card { border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; cursor: pointer; transition: .15s; }
.pick-card:hover { border-color: #c9d4ff; }
.pick-card.on { border-color: #3557f6; background: linear-gradient(180deg,#fbfcff,#f3f6ff); box-shadow: 0 0 0 3px rgba(53,87,246,.1); }
.pc-title { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.pc-title svg { width: 14px; height: 14px; stroke: #3557f6; fill: none; stroke-width: 1.8; }
.pc-desc { font-size: 11px; color: var(--ink-3); margin-top: 5px; line-height: 1.5; }
.pc-meta { font-size: 10.5px; color: var(--ink-2); margin-top: 7px; font-family: var(--mono); }

.win-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.win-row .input { width: 128px; }
.win-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.win-chip { font-size: 10.5px; font-family: var(--mono); background: #eef2ff; color: #2946d9; padding: 1px 6px; border-radius: 5px; }
.day-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.day-chip { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; color: var(--ink-2); transition: .15s; }
.day-chip:hover { border-color: #c9d4ff; }
.day-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.confirm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cf-item { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 13px; display: flex; flex-direction: column; gap: 3px; }
.cf-item span { font-size: 10.5px; color: var(--ink-3); }
.cf-item b { font-size: 12.5px; font-weight: 600; }
.cf-item small { font-size: 10.5px; color: var(--ink-3); font-family: var(--mono); }
.cf-check { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; background: var(--green-soft); border: 1px solid #cdeee0; border-radius: 10px; padding: 11px 13px; font-size: 12px; color: #0a7d51; }
.cf-check svg { width: 15px; height: 15px; stroke: #0a7d51; fill: none; stroke-width: 2.4; }
.cf-force { grid-column: 1 / -1; background: var(--amber-soft); border: 1px solid #f2ddaf; border-radius: 10px; padding: 11px 13px; }
.cf-force-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #8a5a04; cursor: pointer; }
.cf-force-row input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.cf-force .field-hint { margin: 6px 0 0 23px; color: #a0701a; }

.empty { text-align: center; padding: 52px 0; color: var(--ink-3); font-size: 12.5px; line-height: 1.7; }
.empty svg { width: 30px; height: 30px; stroke: #c3cbdb; fill: none; stroke-width: 1.5; display: block; margin: 0 auto 10px; }

@media (max-width: 1400px) {
  .tile-grid-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1240px) {
  .tile-grid, .tile-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .agent-layout { grid-template-columns: 300px minmax(0,1fr); }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
  .tile-grid, .tile-grid-4 { grid-template-columns: 1fr; }
  .agent-layout { grid-template-columns: 1fr; height: auto; }
  .agent-list { max-height: 300px; }
  .test-panel { height: 520px; }
  .form-grid { grid-template-columns: 1fr; }
  .brow, .brow-head { grid-template-columns: 1fr; }
}

/* ==========================================================
   v3 · 后端连接状态 / 流式光标 / 进度条
   ========================================================== */
#svc-pill { cursor: pointer; font-family: var(--mono); font-size: 11px; gap: 7px; }
#svc-pill:hover { border-color: #c9d4ff; }
.svc-dot { width: 6px; height: 6px; border-radius: 50%; background: #c3cbdb; flex: 0 0 6px; }
#svc-pill.svc-on { background: var(--green-soft); border-color: #cdeee0; color: #0a7d51; }
#svc-pill.svc-on .svc-dot { background: var(--green); box-shadow: 0 0 0 0 rgba(14,171,109,.55); animation: pulse 2s infinite; }
#svc-pill.svc-off { background: var(--red-soft); border-color: #fbd7d4; color: #b42318; }
#svc-pill.svc-off .svc-dot { background: var(--red); }
#svc-pill.svc-wait .svc-dot { background: var(--amber); animation: pulseAmber 1.2s infinite; }
@keyframes pulseAmber {
  0% { box-shadow: 0 0 0 0 rgba(247,144,9,.5); }
  70% { box-shadow: 0 0 0 5px rgba(247,144,9,0); }
  100% { box-shadow: 0 0 0 0 rgba(247,144,9,0); }
}

/* 流式输出光标 */
.caret {
  display: inline-block; width: 2px; height: 12px; margin-left: 2px;
  background: var(--primary); vertical-align: -2px; animation: caretBlink .9s steps(2) infinite;
}
@keyframes caretBlink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* 音色克隆进度 */
.vt-prog { height: 3px; border-radius: 2px; background: #eef1f7; margin: 8px 0 2px; overflow: hidden; }
.vt-prog i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg,#b28cff,#7a4dff); transition: width .5s ease; }
.vt-prog-txt { font-size: 9.5px; color: #7a4dff; font-family: var(--mono); }


/* ==========================================================
   v4 · 总览空态 / 清空数据
   ========================================================== */
#view-dashboard.is-empty > *:not(.page-head):not(#dash-empty) { display: none; }
#view-dashboard.is-empty #dash-empty { display: block; }
#dash-empty[hidden] { display: none !important; }
.dash-empty-card {
  background: #fff; border: 1px dashed #d3dbeb; border-radius: 16px;
  padding: 46px 30px; text-align: center; box-shadow: var(--shadow);
}
.de-icon {
  width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 14px;
  display: grid; place-items: center; background: linear-gradient(135deg,#eef2ff,#f5f0ff); color: #5b6bff;
}
.de-icon svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
.de-title { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.de-desc { font-size: 12.5px; color: var(--ink-3); margin: 8px auto 0; max-width: 520px; line-height: 1.85; }
.de-desc b { color: var(--ink-2); font-weight: 600; }
.de-actions { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }


/* 通话记录空态 */
#view-records.recs-empty .card:not(:first-of-type) { display: none; }
#view-records.recs-empty .recs-empty-note { margin-top: 14px; }

/* ==========================================================
   v5 · 模型接入配置 / 连接测试 / 变量插入编辑器
   ========================================================== */
/* 模型卡片上的接入信息行 */
.mt-conn {
  display: flex; align-items: center; gap: 6px; margin-top: 7px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 7px; padding: 5px 8px; overflow: hidden;
}
.mt-conn.no-ep { color: var(--ink-3); font-size: 10.5px; background: #fdf6f5; border-color: #f6d9d5; }
.mt-conn .mc-host { font-size: 10.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.mt-conn .mc-key { font-size: 10px; color: var(--ink-3); flex: 0 0 auto; }
.conn-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px; background: #c3cbdb; }
.conn-dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(14,171,109,.12); }
.conn-dot.warn { background: var(--amber); box-shadow: 0 0 0 3px rgba(247,144,9,.14); }
.conn-dot.bad { background: var(--red); box-shadow: 0 0 0 3px rgba(240,68,56,.12); }
.conn-dot.idle { background: #b9c3d6; }

/* 抽屉里的连接测试结果 */
.conn-box {
  margin-top: 14px; display: flex; align-items: flex-start; gap: 9px;
  border-radius: 10px; padding: 11px 13px; font-size: 12px; line-height: 1.5;
  animation: connIn .2s ease;
}
@keyframes connIn { from { opacity: 0; transform: translateY(4px); } }
.conn-box svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 1px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.conn-box b { display: block; font-size: 12.5px; }
.conn-box span { display: block; font-size: 11px; margin-top: 2px; word-break: break-all; }
.conn-box.ok { background: var(--green-soft); border: 1px solid #cdeee0; color: #0a7d51; }
.conn-box.warn { background: #fff8e8; border: 1px solid #f6e3b4; color: #9a5b00; }
.conn-box.err { background: var(--red-soft); border: 1px solid #fbd7d4; color: #b42318; }
.conn-box.wait { background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }

/* 旋转 spinner */
.spin {
  display: inline-block; width: 12px; height: 12px; vertical-align: -2px;
  border: 2px solid rgba(120,130,160,.25); border-top-color: #5b6bff;
  border-radius: 50%; animation: rot .7s linear infinite;
}
.conn-box.wait .spin { border-top-color: var(--ink-3); }
@keyframes rot { to { transform: rotate(360deg); } }

/* 带行号 + 插入变量的大文本编辑器 */
.prompt-box {
  display: flex; border: 1px solid #d3dbeb; border-radius: 10px;
  background: #fff; overflow: hidden; transition: border-color .15s, box-shadow .15s;
}
.prompt-box:focus-within { border-color: #8aa2ff; box-shadow: 0 0 0 3px rgba(53,87,246,.1); }
.pb-gutter {
  flex: 0 0 34px; padding: 9px 6px 9px 0; text-align: right;
  font-family: var(--mono); font-size: 11px; line-height: 19px;
  color: #b6bfd0; background: var(--surface-2); border-right: 1px solid var(--line-2);
  overflow: hidden; user-select: none; white-space: pre;
}
.pb-area {
  flex: 1; border: none !important; box-shadow: none !important; border-radius: 0 !important;
  font-family: var(--mono); font-size: 12px; line-height: 19px; padding: 9px 11px;
  resize: vertical; min-width: 0; background: #fff; color: var(--ink);
}
.pb-area:focus { outline: none; }
.pb-toolbar {
  display: flex; align-items: center; gap: 8px; margin-top: 5px;
  position: relative;
}
.pb-var {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--line); background: #fff; border-radius: 7px;
  padding: 3px 9px; font-size: 11px; color: var(--ink-2); cursor: pointer; transition: .15s;
  position: relative;
}
.pb-var:hover { border-color: #8aa2ff; color: #3557f6; background: #f5f8ff; }
.pb-var svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; }
.pb-count { margin-left: auto; font-size: 10.5px; color: var(--ink-3); font-family: var(--mono); }
.pb-pop {
  position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 14px 34px -14px rgba(16,24,40,.4); padding: 8px; width: 240px;
  animation: connIn .16s ease;
}
.pb-pop-hd { font-size: 10.5px; color: var(--ink-3); padding: 2px 4px 6px; }
.pb-pop-list { display: flex; flex-wrap: wrap; gap: 5px; }
.pb-pop-item {
  border: 1px solid #dfe6f3; background: #f6f8ff; color: #3557f6;
  font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 6px;
  cursor: pointer; transition: .12s;
}
.pb-pop-item:hover { background: #eef2ff; border-color: #8aa2ff; }
.pb-pop-custom { display: flex; gap: 5px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-2); }
.pb-pop-custom .input { height: 26px; font-size: 11px; flex: 1; font-family: var(--mono); }
.var-chip {
  display: inline-block; font-family: var(--mono); font-size: 11px;
  background: #eef2ff; color: #2946d9; border-radius: 4px; padding: 0 4px; margin: 0 1px;
}

/* ==========================================================
   音色创建：二选一弹窗 / 模型音色拉取列表
   ========================================================== */
.vc-choices { display: grid; gap: 12px; }
.vc-card {
  display: flex; align-items: center; gap: 13px; text-align: left;
  width: 100%; padding: 16px 16px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2); cursor: pointer; transition: .16s; font: inherit; color: var(--ink);
}
.vc-card:hover { border-color: #a9baff; background: #f7f9ff; box-shadow: 0 8px 20px -14px rgba(53,87,246,.55); transform: translateY(-1px); }
.vc-num {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: 8px;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 700;
}
.vc-ico {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; background: var(--violet-soft); color: var(--violet);
}
.vc-ico svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vc-txt { flex: 1; min-width: 0; }
.vc-txt b { display: block; font-size: 13.5px; font-weight: 650; }
.vc-txt small { display: block; font-size: 11px; color: var(--ink-3); line-height: 1.6; margin-top: 3px; }
.vc-go { font-size: 22px; color: var(--ink-3); line-height: 1; }

.mv-bar { display: flex; align-items: center; gap: 9px; }
#mv-model { flex: 1; min-width: 0; width: auto; }
.mv-bar .btn { flex: 0 0 auto; white-space: nowrap; }
.mv-note {
  font-size: 11px; color: var(--ink-3); line-height: 1.6;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 8px 10px; margin: 12px 0;
}
.mv-src {
  display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 7px;
  border-radius: 5px; background: var(--amber-soft); color: #a86604; margin-right: 6px;
}
.mv-src.live { background: var(--green-soft); color: #0a7d51; }
.mv-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.mv-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-bottom: 1px solid var(--line-2); cursor: pointer; transition: .12s;
}
.mv-row:last-child { border-bottom: 0; }
.mv-row:hover:not(.done) { background: #f8faff; }
.mv-row.done { opacity: .62; cursor: default; }
.mv-check { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; flex: 0 0 auto; }
.mv-avatar {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #e9eeff, #f2edff); color: #5b6bff; font-size: 12px; font-weight: 650;
}
.mv-main { flex: 1; min-width: 0; }
.mv-main .mv-name { width: 100%; height: 27px; padding: 3px 7px; font-size: 12px; font-weight: 600; }
.mv-main small { display: block; font-size: 10.5px; color: var(--ink-3); margin: 3px 0 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-code { flex: 0 0 auto; font-size: 10.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 5px; padding: 2px 6px; }
.mv-count { font-size: 11.5px; margin-right: 4px; }

/* ==========================================================
   智能体模板编辑：左「参数 + 开场白」/ 右「人设大编辑框」
   ========================================================== */
.ae-modal { max-height: 88vh; }
.ae-modal .sheet-bd { overflow: hidden; display: flex; flex-direction: column; padding: 10px 20px 18px; }
.ae-wrap {
  display: grid; grid-template-columns: minmax(0, .94fr) minmax(0, 1.06fr);
  gap: 16px; flex: 1; min-height: 0;
}
.ae-col { min-width: 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding-right: 4px; }
.ae-col-r { border-left: 1px solid var(--line); padding-left: 16px; }
.ae-col-hd { display: flex; align-items: baseline; gap: 8px; flex: 0 0 auto; padding: 2px 0 10px; }
.ae-col-hd b { font-size: 12.5px; font-weight: 650; }
.ae-col-hd small { font-size: 10.5px; color: var(--ink-3); }
.ae-col .form-grid { align-content: start; }
.ae-col-l .field[data-field="opening"] { border-left: 3px solid var(--violet); padding-left: 10px; }

/* 右栏：人设编辑器撑满可用高度，行号与输入区同步滚动 */
.ae-col-r .form-grid { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 0; }
.ae-col-r .form-grid .form-divider { margin-top: 0; padding-top: 0; border-top: 0; }
.ae-col-r .field[data-field="prompt"] { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ae-col-r .prompt-box { flex: 1; min-height: 360px; }
.ae-col-r .pb-area { resize: none; }
.ae-col-r .pb-toolbar, .ae-col-r .field-hint { flex: 0 0 auto; }
.ae-col-r .field-label { flex: 0 0 auto; }

.ae-tips {
  flex: 0 0 auto; margin-top: 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); padding: 10px 12px;
}
.ae-tips-hd { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--ink-2); }
.ae-tips-hd svg { width: 13px; height: 13px; stroke: var(--primary); fill: none; stroke-width: 1.8; }
.ae-tips-body { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.ae-tips p { margin: 0; font-size: 10.5px; color: var(--ink-3); line-height: 1.6; }
.ae-tips code { font-family: var(--mono); }

@media (max-width: 1150px) {
  .ae-modal .sheet-bd { overflow-y: auto; display: block; }
  .ae-wrap { display: block; }
  .ae-col { overflow: visible; }
  .ae-col-r { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
  .ae-col-r .prompt-box { min-height: 320px; }
}

/* ---------- 重新注册：真实 SIP REGISTER 结果 ---------- */
.reg-btn { margin-right: 5px; }
.reg-btn svg { width: 12px; height: 12px; }
.reg-grid {
  display: grid; grid-template-columns: 108px 1fr; gap: 9px 14px;
  margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface-2); font-size: 12px;
}
.reg-k { color: var(--ink-3); }
.reg-v { color: var(--ink); font-family: var(--mono); word-break: break-all; }
.reg-seen {
  margin-top: 14px; padding: 13px 16px; border-radius: 10px;
  background: var(--primary-soft); border: 1px solid #dbe3ff;
}
.reg-seen.muted { background: var(--surface-2); border-color: var(--line); }
.reg-seen-k { font-size: 11px; color: var(--ink-2); }
.reg-seen-v { font-family: var(--mono); font-size: 18px; font-weight: 500; color: var(--primary-700); margin: 5px 0; }
.reg-seen-tip { font-size: 11px; color: var(--ink-2); line-height: 1.6; }
.reg-sec-t { font-size: 12px; font-weight: 500; color: var(--ink-2); margin: 18px 0 8px; }
.reg-steps { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.reg-steps li {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  font-size: 11.5px; color: var(--ink-2); border-top: 1px solid var(--line-2);
}
.reg-steps li:first-child { border-top: 0; }
.reg-steps li > span:last-child { flex: 1; }
.reg-step-tr {
  flex: 0 0 auto; font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  background: #f0f3f9; border-radius: 4px; padding: 2px 5px;
}
.reg-step-code { flex: 0 0 62px; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }

/* ---------- 任务实时运行面板（调度引擎） ---------- */
.rt-card { margin-top: 14px; }
.rt-card .card-hd { flex-wrap: wrap; gap: 6px; }
.rt-note { font-size: 10.5px; line-height: 1.4; margin-top: 4px; color: #a86604; max-width: 200px; }
.rt-note.ok { color: var(--green); }
.rt-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.rt-kpi { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); padding: 10px 12px; }
.rt-kpi span { display: block; font-size: 11px; color: var(--ink-3); }
.rt-kpi b { display: block; font-size: 19px; font-weight: 600; color: var(--ink); margin-top: 4px; font-family: var(--mono); }
.rt-kpi small { font-size: 10.5px; color: var(--ink-3); margin-left: 3px; font-weight: 400; }
.rt-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: 14px; }
.rt-sub { font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin: 0 0 8px; }
.rt-table { font-size: 11.5px; }
.rt-table th, .rt-table td { padding: 8px 10px; }
.rt-table td { vertical-align: middle; }
.rt-feed { border: 1px solid var(--line); border-radius: 10px; max-height: 330px; overflow-y: auto; background: var(--surface-2); }
.rt-ev { display: flex; gap: 9px; align-items: baseline; padding: 7px 11px; border-top: 1px solid var(--line-2); font-size: 11px; color: var(--ink-2); line-height: 1.5; }
.rt-ev:first-child { border-top: 0; }
.rt-ev > span:first-child { flex: 0 0 auto; font-size: 10.5px; color: var(--ink-3); }
.rt-ev.warn > span:last-child { color: #a86604; }
.rt-empty { text-align: center; padding: 26px 12px; color: var(--ink-3); font-size: 11.5px; }
.rt-notice { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding: 9px 12px; border-radius: 9px; background: var(--amber-soft); color: #8a5a04; font-size: 11.5px; }
.rt-notice svg { width: 13px; height: 13px; flex: 0 0 auto; }
.trend-empty {
  height: 232px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; border: 1px dashed var(--line); border-radius: 10px;
  color: var(--ink-2); font-size: 12.5px; text-align: center; line-height: 1.6;
}
.trend-empty span { font-size: 11px; color: var(--ink-3); }

/* ---------- 号码回收弹窗 ---------- */
.rc-types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.rc-type {
  display: flex; gap: 9px; align-items: flex-start; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px; cursor: pointer; background: var(--surface);
}
.rc-type:hover { border-color: #b9c6ff; background: var(--primary-soft); }
.rc-type input { margin-top: 2px; flex: 0 0 auto; accent-color: var(--primary); }
.rc-type > span:nth-child(2) { flex: 1; min-width: 0; }
.rc-type b { font-size: 12px; font-weight: 600; color: var(--ink); }
.rc-type small { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.4; }
.rc-num {
  margin-left: auto; flex: 0 0 auto; font-family: var(--mono); font-size: 11px;
  color: var(--primary-700); background: var(--primary-soft); border-radius: 5px; padding: 2px 6px;
}
.rc-modes { display: flex; gap: 10px; }
.rc-mode {
  flex: 1; display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
}
.rc-mode input { margin-top: 2px; flex: 0 0 auto; accent-color: var(--primary); }
.rc-mode b { font-size: 12px; color: var(--ink); }
.rc-mode small { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 3px; line-height: 1.5; }
.rc-empty {
  padding: 16px; margin-top: 10px; text-align: center; color: var(--ink-3); font-size: 12px;
  background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px; line-height: 1.6;
}
@media (max-width: 700px) { .rc-types, .rc-modes { grid-template-columns: 1fr; display: block; } .rc-type, .rc-mode { margin-bottom: 8px; } }

@media (max-width: 1150px) {
  .rt-grid { display: block; }
  .rt-grid > div:last-child { margin-top: 14px; }
  .rt-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- 真实试呼：AI 对话状态 ---------- */
.call-live { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--surface-2); min-height: 48px; font-size: 12px; line-height: 1.6; }
.call-live-row { margin: 4px 0; }
.call-live-row b { color: var(--ink-1); }
.call-live-user { color: var(--green-600, #0a7d51); }
.call-live-ai { color: var(--blue-600, #3f63f0); }
.call-live.muted { color: var(--ink-3); }

/* ---------- 任务行「更多」下拉菜单 ---------- */
.task-more { position: relative; display: inline-block; }
.task-more-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 50;
  min-width: 150px; background: var(--surface, #fff);
  border: 1px solid var(--line, #e5e8ef); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20, 30, 60, 0.12);
  padding: 5px; display: none;
}
.task-more-menu.open { display: block; }
.task-more-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 0; background: none; cursor: pointer;
  font-size: 12px; color: var(--ink, #202636); border-radius: 7px; text-align: left;
}
.task-more-menu button:hover { background: var(--surface-2, #f1f4fa); }
.task-more-menu button.danger { color: var(--red, #d8434e); }
.task-more-menu button.danger:hover { background: var(--red-soft, #fdeaea); }
.task-more-menu svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 号码列表弹窗工具栏 ---------- */
.rost-toolbar { display: flex; align-items: center; gap: 8px; }
.rost-toolbar .input { width: 100%; }

/* ---------- 登录遮罩 ---------- */
.login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f1b3d 0%, #1a2a5e 50%, #0f1b3d 100%);
}
.login-box {
  width: 380px; background: #fff; border-radius: 16px; padding: 34px 34px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand .brand-mark { background: linear-gradient(135deg, #3557f6, #7a4dff); color: #fff; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.login-brand .brand-mark svg { width: 24px; height: 24px; stroke: #fff; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.login-brand .brand-name { font-size: 18px; font-weight: 700; color: #1a2236; }
.login-brand .brand-sub { font-size: 12px; color: #8b95a7; }
.login-title { font-size: 20px; font-weight: 700; color: #1a2236; margin-bottom: 4px; }
.login-sub { font-size: 12.5px; color: #8b95a7; margin-bottom: 22px; }
.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 12px; color: #5b6478; margin-bottom: 6px; font-weight: 550; }
.login-field .input { width: 100%; height: 40px; }
.login-btn { width: 100%; height: 42px; font-size: 14px; margin-top: 6px; }
.login-err { background: #fdeaea; color: #c0362b; border-radius: 8px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 12px; }
.login-foot { text-align: center; font-size: 11.5px; color: #a5adbd; margin-top: 16px; }

/* ---------- 权限树 ---------- */
.perm-tree { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.perm-menu { border: 1px solid var(--line, #e5e8ef); border-radius: 10px; padding: 10px 12px; }
.perm-menu-hd { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; margin-bottom: 8px; }
.perm-menu-hd input { accent-color: #3557f6; }
.perm-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-btns input { accent-color: #3557f6; }
