/* AI 智能呼叫平台 · 控制台样式 v3 */
:root {
  --brand: #2563eb;
  --brand-2: #7c3aed;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f5f7fb;
  --card: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -12px rgba(15, 23, 42, .12);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 滚动条：细、跟随主题、深色侧栏独立配色 ---------- */
html, body, .table-wrap, pre.json, .modal .body { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #cbd5e1; border-radius: 99px;
  border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

/* 侧栏导航：隐藏滚动条，但保留滚轮/触控板滚动 */
#nav { padding-right: 4px; scrollbar-width: none; -ms-overflow-style: none; }
#nav::-webkit-scrollbar { width: 0; height: 0; display: none; }
a { color: var(--brand); text-decoration: none; }
button { font: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
.hidden, [hidden] { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.gap { gap: 8px; }
.row { display: flex; align-items: center; }

/* ---------- 通用按钮 ---------- */
button, .btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 8px 14px; border-radius: 10px; transition: .16s ease;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
button:hover, .btn:hover { border-color: #cbd5e1; background: #f8fafc; transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .8); }
button.primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: #eef2f7; color: var(--ink); }
button.danger { color: var(--bad); border-color: #fecaca; background: #fff5f5; }
button.danger:hover { background: #fee2e2; }
button.sm, .btn.sm { padding: 5px 10px; border-radius: 8px; font-size: 12.5px; }

/* ---------- 登录页 ---------- */
#login-view { min-height: 100vh; display: flex; align-items: stretch; }
.login-wrap { display: grid; grid-template-columns: 1.05fr .95fr; width: 100%; }
.login-hero {
  position: relative; overflow: hidden; padding: 56px 60px; color: #eaf1ff;
  background: radial-gradient(1000px 600px at 10% -10%, #3b82f6 0, transparent 55%),
              radial-gradient(800px 500px at 110% 110%, #7c3aed 0, transparent 50%),
              linear-gradient(160deg, #0b1224 0%, #111a33 60%, #0b1224 100%);
  display: flex; flex-direction: column; justify-content: space-between;
}
.login-hero .logo-line { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 17px; letter-spacing: .01em; }
.login-hero .logo-line img { width: 34px; height: 34px; border-radius: 0; background: transparent; padding: 0; }
.login-hero h1 { font-size: 40px; line-height: 1.25; margin: 46px 0 14px; font-weight: 750; letter-spacing: -.02em; }
.login-hero h1 span { background: linear-gradient(90deg, #93c5fd, #c4b5fd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-hero p.sub { color: #b6c2e2; font-size: 15px; max-width: 520px; }
.login-hero .features { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; margin-top: 40px; max-width: 560px; }
.login-hero .feature { display: flex; gap: 10px; align-items: flex-start; color: #d8e2fb; font-size: 13.5px; }
.login-hero .feature b { display: block; color: #fff; font-weight: 600; }
.login-hero .feature i { font-style: normal; width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 9px; background: #ffffff14; border: 1px solid #ffffff1f; }
.login-hero .foot { color: #8192bb; font-size: 12px; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.login-card {
  width: min(400px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 34px 32px; box-shadow: 0 24px 60px -30px rgba(15, 23, 42, .35);
}
.login-card h2 { font-size: 22px; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 10px 12px; border-radius: 10px; font: inherit; outline: none; transition: .15s;
}
textarea { min-height: 88px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: color-mix(in srgb, var(--brand) 70%, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.login-card button[type=submit] { width: 100%; margin-top: 8px; padding: 11px; background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.hint { min-height: 20px; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
.hint.err { color: var(--bad); }
.demo-hint { margin-top: 16px; padding: 10px 12px; border-radius: 10px; background: #f1f5ff; color: #3b4a6b; font-size: 12px; line-height: 1.7; }

/* ---------- 主框架 ---------- */
#shell-view { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0b1224, #131c33 60%, #0d1526);
  color: #c7d2e8; display: flex; flex-direction: column; padding: 18px 14px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 16px; color: #fff; font-weight: 700; font-size: 15.5px; letter-spacing: .01em; }
.brand img { width: 32px; height: 32px; border-radius: 0; background: transparent; padding: 0; }
.quick-start {
  display: flex; align-items: center; gap: 8px; margin: 2px 2px 14px; padding: 10px 12px;
  border-radius: 10px; background: linear-gradient(90deg, #2563eb33, #7c3aed2e);
  border: 1px solid #ffffff1a; color: #eaf1ff; font-size: 13px; cursor: pointer;
}
.quick-start:hover { background: linear-gradient(90deg, #2563eb55, #7c3aed44); }
#nav { flex: 1; overflow-y: auto; padding-right: 2px; }
#nav .group { margin: 11px 8px 5px; font-size: 11px; letter-spacing: .08em; color: #6f7f9f; text-transform: uppercase; }
#nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px; margin: 2px 4px;
  color: #b9c6e2; border-radius: 9px; font-size: 13.5px; transition: .16s;
}
#nav a i { font-style: normal; width: 20px; text-align: center; opacity: .9; }
#nav a i svg { display: block; width: 18px; height: 18px; margin: 0 auto; }
#nav a:hover { background: #ffffff0f; color: #fff; }
#nav a.active { background: linear-gradient(90deg, #2563eb, #3b82f6); color: #fff; box-shadow: 0 8px 18px -10px #2563eb; }
.user-box { border-top: 1px solid #ffffff14; padding: 12px 8px 4px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: #9fb0d0; }
.user-box .avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #2563eb; color: #fff; font-weight: 700; }
.user-box button { background: #ffffff10; border-color: #ffffff21; color: #dbe5fb; padding: 6px 10px; }
main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 18px 12px; background: #f5f7fbd9; backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 21px; }
.crumb { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.content { padding: 6px 18px 32px; width: 100%; }

/* ---------- 面板 ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); font-weight: 650; }
.panel > header .sub { font-weight: 400; }
.panel > .body { padding: 16px 18px; }
.panel.tight > .body { padding: 0; }

/* ---------- 指标卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.card .k { color: var(--muted); font-size: 12.5px; }
.card .v { font-size: 23px; font-weight: 720; margin-top: 6px; letter-spacing: -.01em; }
.card .d { color: var(--muted); font-size: 12px; margin-top: 4px; }
.card.accent::after { content: ""; position: absolute; right: -20px; top: -20px; width: 90px; height: 90px; border-radius: 50%; background: color-mix(in srgb, var(--brand) 12%, transparent); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .02em; padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
tbody tr:hover { background: #fafcff; }
tbody tr.row-disabled td { background: #fef2f2 !important; color: #b91c1c; }
tbody tr.row-disabled td .link, tbody tr.row-disabled td a { color: #b91c1c; }
tbody tr:last-child td { border-bottom: none; }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty .icon { font-size: 26px; display: block; margin-bottom: 8px; }
.empty .cta { margin-top: 12px; }

/* ---------- 表单 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 14px; align-items: start; }
.grid .full { grid-column: 1 / -1; }
.form-section-title { grid-column: 1 / -1; margin-top: 6px; padding-top: 12px; border-top: 1px solid #eef2f7; font-size: 13px; font-weight: 600; color: var(--ink); }
.form-section-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.grid label .help { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.form-actions.inline { grid-column: auto; margin: 0; align-self: end; }
/* 价格设置：字段尽量一排显示 */
#sp-form { grid-template-columns: repeat(4, minmax(150px, 1fr)) auto; }
#tp-form { grid-template-columns: repeat(7, minmax(110px, 1fr)) auto; }
#sp-form .form-actions.inline, #tp-form .form-actions.inline { align-self: end; }
/* 云服务凭证：厂商/能力/名称 + 动态字段 + 保存按钮一排显示 */
#cred-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.modal:has(#cred-form) { width: min(860px, 94vw); }
.modal:has(#trunk-form) { width: min(780px, 94vw); }
.modal #trunk-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal #cred-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#cred-fields { display: contents; }
#cred-form .form-actions.inline { grid-column: 1 / -1; align-self: end; justify-content: flex-start; }
#camp-form { grid-template-columns: repeat(4, minmax(120px, 1fr)) minmax(220px, 1.5fr) minmax(200px, 1.2fr) auto; align-items: start; }
#camp-form textarea { min-height: 64px; }
#camp-form .form-actions.inline { align-self: start; margin-top: 22px; }
#trunk-form { grid-template-columns: repeat(9, minmax(0, 1fr)) auto; align-items: start; }
#trunk-form .form-actions.inline { align-self: start; margin-top: 22px; }
@media (max-width: 1500px) {
  #camp-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #camp-form .form-actions.inline { grid-column: 1 / -1; }
  #trunk-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #trunk-form .form-actions.inline { grid-column: 1 / -1; }
}
@media (max-width: 1500px) {
  #sp-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #tp-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #sp-form .form-actions.inline, #tp-form .form-actions.inline { grid-column: 1 / -1; }
  #cred-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #cred-form .form-actions.inline { grid-column: 1 / -1; }
}

/* ---------- 徽标 / 药丸 ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f7; color: var(--ink-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.pill.A { background: #e7f8ee; color: #15803d; }
.pill.B { background: #e8f1ff; color: #1d4ed8; }
.pill.C { background: #fff7e6; color: #b45309; }
.pill.D { background: #f1f5f9; color: #475569; }
.pill.E { background: #fef2f2; color: #b91c1c; }
.pill.F { background: #fde8e8; color: #991b1b; }
.pill.sent, .pill.active, .pill.approved, .pill.completed { background: #e7f8ee; color: #15803d; }
.pill.failed, .pill.rejected, .pill.disabled { background: #fef2f2; color: #b91c1c; }
.pill.pending, .pill.ringing, .pill.draft { background: #fff7e6; color: #b45309; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 7px; font-size: 11.5px; background: #eef2f7; color: var(--muted); }

/* ---------- 引导 / 新手 ---------- */
.onboard { display: grid; grid-template-columns: 300px 1fr; gap: 0; }
.onboard .side { padding: 20px; background: linear-gradient(160deg, #0b1224, #162040); color: #e8eefc; border-radius: var(--radius) 0 0 var(--radius); }
.onboard .side h3 { font-size: 17px; margin-bottom: 6px; }
.onboard .side p { color: #a8b7d8; font-size: 12.5px; margin: 0 0 16px; }
.onboard .progress { height: 8px; border-radius: 99px; background: #ffffff1f; overflow: hidden; }
.onboard .progress > i { display: block; height: 100%; background: linear-gradient(90deg, #60a5fa, #a78bfa); width: 0; transition: width .4s; }
.onboard .steps { padding: 16px 20px; display: grid; gap: 8px; }
.step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; transition: .16s; }
.step:hover { border-color: #c7d6f5; background: #f8faff; }
.step .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #eef2f7; color: var(--muted); font-size: 12.5px; font-weight: 700; flex: 0 0 26px; }
.step.done .n { background: #dcfce7; color: #15803d; }
.step.done { border-color: #bbf7d0; background: #f6fdf9; }
.step .t { flex: 1; font-weight: 600; font-size: 13px; }
.step .s { font-size: 12px; color: var(--muted); font-weight: 400; }
.step .go { color: var(--brand); font-size: 12.5px; }

/* ---------- 快捷入口 ---------- */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.quick a { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); transition: .16s; }
.quick a:hover { border-color: #bfd3f7; transform: translateY(-2px); box-shadow: var(--shadow); }
.quick a i { font-style: normal; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; display: grid; place-items: center; background: #eef4ff; font-size: 18px; }
.quick a b { display: block; font-size: 13.5px; }
.quick a span { display: block; font-size: 12px; color: var(--muted); }

/* ---------- 详情 KV / JSON ---------- */
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; font-size: 13px; }
.kv .k { color: var(--muted); }
pre.json { background: #0b1224; color: #dbe5ff; padding: 14px; border-radius: 10px; overflow: auto; font-size: 12px; line-height: 1.6; }

/* ---------- Toast / 弹窗 ---------- */
.toast {
  position: fixed; left: 50%; top: 22px; transform: translateX(-50%) translateY(-8px);
  background: #0f172a; color: #fff; padding: 11px 18px; border-radius: 11px;
  box-shadow: 0 18px 40px -18px rgba(2, 6, 23, .6); z-index: 1000; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .2s; max-width: min(680px, 90vw);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #7f1d1d; }
.toast.ok { background: #14532d; }

#modal-root { position: fixed; inset: 0; z-index: 900; display: none; }
#modal-root.open { display: block; }
.modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); }
.modal {
  position: relative; margin: 8vh auto 0; width: min(560px, 92vw); background: #fff;
  border-radius: 16px; box-shadow: 0 32px 80px -30px rgba(2, 6, 23, .55); overflow: hidden;
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(8px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal header { padding: 18px 20px; border-bottom: 1px solid var(--line); font-weight: 650; display: flex; justify-content: space-between; align-items: center; }
.modal .body { padding: 18px 20px; max-height: 64vh; overflow: auto; }
.modal footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: #fbfcfe; }

/* ---------- 右侧抽屉（通话详情等，占宽 30%） ---------- */
#modal-root.drawer #modal-box { position: relative; width: 100%; height: 100%; display: flex; justify-content: flex-end; }
.modal.drawer {
  margin: 0; width: 30vw; min-width: 420px; max-width: 820px; height: 100vh; max-height: 100vh;
  border-radius: 0; display: flex; flex-direction: column; animation: slideIn .22s ease-out;
  box-shadow: -24px 0 60px -30px rgba(2, 6, 23, .5);
}
.modal.drawer .body { max-height: none; flex: 1; overflow: auto; }
.modal.drawer .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@keyframes slideIn { from { transform: translateX(36px); opacity: .5; } to { transform: none; opacity: 1; } }
@media (max-width: 900px) { .modal.drawer { width: 100vw; min-width: 0; max-width: none; } }

/* ---------- 提示条 ---------- */
.tip { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 11px; background: #f1f6ff; border: 1px solid #dbe7ff; color: #31456e; font-size: 12.5px; line-height: 1.65; margin-bottom: 14px; }
.tip b { color: #1d4ed8; }
.tip.warn { background: #fff9ed; border-color: #fde9c3; color: #7c5314; }

/* ---------- 骨架屏 ---------- */
.skeleton { padding: 4px 0; }
.skeleton i { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, #eef2f7, #f8fafc, #eef2f7); background-size: 200% 100%; animation: sk 1.2s infinite; margin: 10px 0; }
.skeleton i:nth-child(2) { width: 72%; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1020px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  #shell-view { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  #nav { display: flex; flex-wrap: wrap; gap: 4px; }
  #nav .group { display: none; }
  #nav a { margin: 0; }
  .onboard { grid-template-columns: 1fr; }
  .onboard .side { border-radius: var(--radius) var(--radius) 0 0; }
  .content { padding: 4px 14px 30px; }
  .topbar { padding: 14px; }
}

/* ---------- 小窗口（笔记本/低分辨率）：压缩侧栏，避免出现大滚动条 ---------- */
@media (max-height: 900px) {
  .quick-start { display: none !important; }
}
@media (max-height: 780px) {
  .quick-start { display: none !important; }
  .sidebar { padding-top: 10px; padding-bottom: 8px; }
  #nav .group { margin: 6px 8px 2px; font-size: 10px; }
  #nav a { padding: 5px 9px; margin: 1px 4px; font-size: 12.5px; gap: 8px; }
  #nav a .icon { font-size: 14px; }
  .user-box { padding-top: 6px; padding-bottom: 2px; }
}

/* ---------- 通话详情：录音播放器 / 技术明细折叠 ---------- */
#call-audio { height: 38px; flex: 1; min-width: 260px; }
details.tech { margin-top: 14px; }
details.tech > summary {
  cursor: pointer; color: #64748b; font-size: 13px; user-select: none; padding: 6px 2px;
}
details.tech > summary:hover { color: var(--brand); }
details.tech > pre.json { margin-top: 8px; max-height: 280px; overflow: auto; }
.pill.U { background: #f1f5f9; color: #64748b; }

/* 通话记录筛选条：下拉保持自然宽度，不铺满整行 */
.filters select { width: auto; min-width: 170px; flex: 0 0 auto; }
.filters button { flex: 0 0 auto; }
.filters select, .filters input, .filters button { height: 36px; font-size: 13px; }
.filters select, .filters input { padding-top: 0; padding-bottom: 0; }
.filters button.sm { padding: 0 12px; }
.filters select, .filters button { width: 170px; min-width: 170px; }
.filters #call-time-btn { min-width: 170px; justify-content: flex-start; }

/* 表格行内文字链接（如密码“显示”） */
a.link { color: var(--brand); text-decoration: none; font-size: 13px; }
a.link:hover { text-decoration: underline; }
a.link.danger { color: #dc2626; }
.ok-text { color: #15803d; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; }
.err-text { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; }
.doc-thumb { width: 48px; height: 32px; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); vertical-align: middle; margin-right: 4px; }

/* 品牌 LOGO 上传 */
.logo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.brand-logo-preview {
  height: 52px; width: 52px; object-fit: contain; padding: 0;
  border: none; border-radius: 0; background: transparent;
}

.fin-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fin-bar input { width: auto; min-width: 150px; padding: 8px 10px; }
.fin-bar .muted { margin-left: 4px; }

#seat-form { grid-template-columns: repeat(5, minmax(0, 1fr)) auto; align-items: start; }
#seat-form .form-actions.inline { align-self: start; margin-top: 22px; }

.call-stat-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 12px; padding: 10px 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; }
.call-stat-bar .k { color: var(--muted); font-size: 12px; }
.call-stat-bar b { font-size: 17px; }
.call-stat-bar .lv-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: 12px; text-decoration: none; }
.call-stat-bar .lv-chip:hover { background: #e0e7ff; }
.call-stat-bar .lv-chip.on { background: #f1f5f9; box-shadow: inset 0 0 0 1px #e2e8f0; }
.call-stat-bar .lv-chip.on b { background: transparent; color: #0f172a; }
.call-stat-bar .lv-chip.on .pill { box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(15, 23, 42, .18); }
.call-stat-bar .lv-chip b { font-size: 12px; }

label.check { display: flex; flex-direction: row; align-items: center; gap: 6px; }
label.check input { width: auto; }

.top-right { display: flex; align-items: center; gap: 10px; }
.clock { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.top-user { font-size: 13px; color: #334155; background: #eef2f7; border: 1px solid #e2e8f0; padding: 6px 10px; border-radius: 99px; white-space: nowrap; }
@media (max-width: 1100px) { .clock { display: none; } }

/* 通话记录统计条：等级 chip 与外呼任务列表完全一致的徽标样式 */
.call-stat-bar .lv-chip { border: none; background: transparent; padding: 0; margin-right: 10px; color: var(--text); display: inline-flex; align-items: center; gap: 5px; text-decoration: none; }
.call-stat-bar .lv-chip .pill { font-size: 11.5px; padding: 1px 7px; }
.call-stat-bar .lv-chip b { font-weight: 600; color: #334155; }
.call-stat-bar .lv-chip.on b { color: #0f172a; text-decoration: underline; text-underline-offset: 3px; }
.call-stat-bar .lv-chip.on .pill { font-weight: 700; }
.call-stat-bar .lv-chip:hover .pill { filter: brightness(.96); }

#fin-tenant { width: 280px; }

.doc-view { white-space: pre-wrap; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; max-height: 60vh; overflow: auto; font-size: 13.5px; line-height: 1.75; }

.sms-config { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; align-items: start; padding-top: 4px; border-top: 1px dashed var(--line); }
.sms-config > label { min-width: 0; }
.sms-config > label:nth-child(5) { grid-column: 1 / -1; }
.lv-checks { display: inline-flex; gap: 5px; margin: 4px 0; flex-wrap: nowrap; }
.lv-checks .chk { padding: 3px 6px; min-width: 32px; justify-content: center; }
.chk { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; cursor: pointer; font-size: 13px; }
.chk input { width: auto; }
.chk.A { border-color: #86efac; } .chk.B { border-color: #93c5fd; } .chk.C { border-color: #fcd34d; }
.chk.D { border-color: #cbd5e1; } .chk.E { border-color: #fca5a5; } .chk.F { border-color: #f87171; } .chk.U { border-color: #cbd5e1; }

#camp-form select[multiple], #camp-sms-form select[multiple] { height: auto; min-height: 76px; padding: 6px; }

.ms { position: relative; }
.ms-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff; border: 1px solid #d9e1ec; border-radius: 10px; padding: 8px 10px; height: 40px; font-size: 13.5px; color: #1e293b; cursor: pointer; }
.ms-btn:hover { border-color: var(--brand); }
.ms.disabled .ms-btn { opacity: .55; cursor: not-allowed; background: #f1f5f9; }
.ms-arrow { color: #94a3b8; }
.ms-menu { position: absolute; right: 0; left: auto; min-width: 280px; top: 44px; z-index: 50; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 12px 32px rgba(15,23,42,.12); padding: 6px; max-height: 220px; overflow: auto; }
.ms-item { display: flex; flex-direction: row; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.ms-item:hover { background: #f1f6ff; }
.ms-item input { width: auto; }
.ms-empty { color: #94a3b8; font-size: 12.5px; padding: 8px; }

.panel:has(.ms) { overflow: visible; }

.modal:has(#camp-form) { width: min(940px, 94vw); }

.modal #camp-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.modal #camp-form .sms-config { flex-wrap: wrap; }
.modal #camp-form .sms-config > label { flex: 1 1 200px; }
.modal #camp-form .form-actions.inline { grid-column: 1 / -1; justify-content: flex-end; align-self: stretch; margin-top: 4px; }

.modal:has(#camp-sms-form) { width: min(820px, 94vw); }
.modal:has(#tenant-edit-form) { width: min(760px, 94vw); }
.modal:has(#camp-sms-form) .body { max-height: 76vh; }
.modal #camp-sms-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal #camp-sms-form label { min-width: 0; }

.pill.on { background: #dcfce7; color: #15803d; }
.pill.off { background: #f1f5f9; color: #64748b; }

.row-actions { display: grid; grid-template-columns: repeat(4, auto); gap: 6px; justify-content: end; align-items: center; margin-left: auto; }
.row-actions .btn, .row-actions button { white-space: nowrap; }

.chat { display: flex; flex-direction: column; gap: 10px; }
.chat-row { display: flex; gap: 10px; align-items: flex-start; }
.chat-row.user { flex-direction: row-reverse; }
.chat-who { font-size: 12px; color: #64748b; min-width: 54px; text-align: right; padding-top: 5px; }
.chat-row.user .chat-who { text-align: left; }
.chat-bubble { max-width: 78%; padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.55; background: #eef5ff; color: #0f172a; }
.chat-row.user .chat-bubble { background: #ecfdf5; color: #064e3b; }

.camp-main td { border-bottom: none !important; }
.camp-actions-cell { padding: 2px 12px 10px !important; border-top: none !important; }
.camp-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-start; }
.camp-actions .btn, .camp-actions button { white-space: nowrap; }

/* 话术修改弹窗：加宽、提示词区域加大 */
.modal:has(#script-edit-form) { width: min(1080px, 94vw); }
.modal:has(#script-edit-form) .body { max-height: 78vh; }
.modal:has(#script-edit-form) textarea[name="opening"] { min-height: 110px; line-height: 1.65; }
.modal:has(#script-edit-form) textarea[name="system_prompt"] { min-height: 340px; line-height: 1.65; }
/* ---- 外呼任务 × 通话记录 合并页 ---- */
.task-merge { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 16px; align-items: start; }
.task-merge .task-col { position: sticky; top: 12px; max-height: calc(100vh - 90px); overflow-y: auto; padding-right: 2px; }
.task-merge .calls-col { min-width: 0; }
.task-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 2px 10px; }
.task-toolbar .tc-title { font-weight: 650; font-size: 14px; }
.camp-card { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 13px; margin-bottom: 10px; cursor: pointer; transition: box-shadow .15s, border-color .15s, background .15s; }
.camp-card:hover { box-shadow: 0 3px 12px rgba(15,23,42,.07); }
.camp-card.on { border-color: #6366f1; background: #f8faff; box-shadow: 0 0 0 2px rgba(99,102,241,.14); }
.camp-card .cc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.camp-card .cc-name { font-weight: 650; font-size: 14px; line-height: 1.35; word-break: break-all; }
.camp-card .cc-meta { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); align-items: center; }
.camp-card .cc-kpis { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); }
.camp-card .cc-kpis b { color: var(--ink); font-size: 13px; margin-left: 2px; }
.camp-card .cc-lv { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px 9px; font-size: 12px; color: var(--muted); align-items: center; }
.camp-card .cc-lv .pill { font-size: 11px; padding: 1px 7px; }
.camp-card .cc-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.camp-card .cc-actions button { padding: 3px 9px; font-size: 12px; }
.camp-card-all { border-style: dashed; }
.camp-card-all .cc-meta { margin-top: 5px; }
@media (max-width: 1180px) {
  .task-merge { grid-template-columns: minmax(0, 1fr); }
  .task-merge .task-col { position: static; max-height: none; overflow: visible; }
}
/* 合并页：右侧通话记录更紧凑 */
.task-merge .calls-col .table-wrap table { font-size: 12px; }
.task-merge .calls-col .table-wrap th, .task-merge .calls-col .table-wrap td { white-space: nowrap; padding: 9px 10px; vertical-align: middle; }
.task-merge .calls-col .table-wrap td .pill { white-space: nowrap; }
.task-merge .calls-col .panel { margin-bottom: 0; }
.task-merge .calls-col .panel > .body { padding: 14px; }
.task-merge .calls-col .table-wrap th:last-child,
.task-merge .calls-col .table-wrap td:last-child { position: sticky; right: 0; background: #fff; box-shadow: -10px 0 12px -10px rgba(15,23,42,.28); }
.task-merge .calls-col .table-wrap tbody tr:hover td:last-child { background: #fafcff; }
/* 背景音：自定义上传列表 */
.amb-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.amb-list .chip { display: inline-flex; gap: 8px; align-items: center; padding: 5px 10px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: 12.5px; border: 1px solid #dbe4ff; }
.amb-list .chip a { color: #2563eb; text-decoration: none; }
.amb-list .chip a.danger { color: #dc2626; }
.amb-uploader { border: 1px dashed #cbd5e1; border-radius: 12px; padding: 10px 12px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.amb-uploader .help { flex-basis: 100%; }
.amb-upload-status { min-height: 18px; }

.turn-play { flex: none; width: 26px; height: 26px; margin-top: 3px; padding: 0; border-radius: 50%;
  border: 1px solid #dbe3ee; background: #fff; color: #0f172a; cursor: pointer; font-size: 10px;
  line-height: 1; display: inline-flex; align-items: center; justify-content: center; transition: background .15s, border-color .15s; }
.turn-play:hover { background: #eef5ff; border-color: #93b4e6; }
.chat-row.user .turn-play { margin-right: 2px; }


/* 知识库文档列表：内容分行完整显示 */
.kb-doc-content {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 720px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #334155;
}

/* 通话记录时间范围下拉 */
.time-pop { position: fixed; z-index: 1200; display: flex; width: 660px; max-width: calc(100vw - 16px); background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; box-shadow: 0 16px 40px rgba(15, 23, 42, .18); overflow: hidden; font-size: 13px; }
.time-side { width: 120px; flex: none; padding: 6px 0; background: #fbfdff; border-right: 1px solid #eef2f7; }
.time-side button { display: block; width: 100%; padding: 8px 14px; border: 0; background: transparent; color: #334155; text-align: left; font-size: 13px; cursor: pointer; }
.time-side button:hover { background: #eff6ff; color: var(--brand); }
.time-main { flex: 1; min-width: 0; padding: 10px 12px 8px; }
.time-inputs { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.time-inputs input[type=date] { width: 132px; }
.time-inputs input[type=time] { width: 104px; }
.time-sep { color: #94a3b8; }
.time-cals { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.time-cal-head { display: flex; align-items: center; justify-content: center; gap: 2px; margin: 4px 0 6px; color: #1e293b; }
.time-cal-head button { padding: 2px 4px; border: 0; background: transparent; color: #64748b; font-size: 14px; cursor: pointer; }
.time-cal-head button:hover { color: var(--brand); }
.time-cal-head b { margin: 0 6px; font-size: 13px; font-weight: 600; }
.time-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.time-week span { padding: 4px 0; color: #94a3b8; font-size: 12px; }
.time-day { width: 28px; height: 28px; margin: auto; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #334155; font-size: 13px; cursor: pointer; }
.time-day:hover { background: #eff6ff; color: var(--brand); }
.time-day.sel { background: var(--brand); color: #fff; }
.time-day.inrange { border-radius: 0; background: #dbeafe; color: #1d4ed8; }
.time-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid #eef2f7; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 12px; }
.pager select { width: 90px; height: 32px; padding: 0 8px; }
