/* ===== 金牌销冠 · 控制台样式（美化版）=====
   设计目标：专业、真实、人性化的销售对话体验，贴近真实的即时通讯工具。 */
:root {
  --bg: #eef1f6;
  --bg-grad: radial-gradient(1200px 500px at 20% -10%, #e8f0fe 0%, #eef1f6 45%, #f3f5f9 100%);
  --panel: #ffffff;
  --border: #e5e8ef;
  --border-soft: #eef1f6;
  --text: #1f2937;
  --text-deep: #111827;
  --muted: #7a8497;
  --primary: #4f7dff;
  --primary-dark: #345ee8;
  --primary-grad: linear-gradient(135deg, #4f7dff 0%, #6a9bff 100%);
  --green: #22b56d;
  --green-soft: #e6f7ef;
  --amber: #f5a623;
  --amber-soft: #fdf3e2;
  --red: #e5484d;
  --red-soft: #fdecec;
  --purple: #7c6cf0;
  --purple-soft: #efecff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .12);
  --chip-height: 40px;
  --font: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-grad);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 精致滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #ccd3e0; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #adb6c8; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- 顶栏 ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset;
  position: relative;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.brand .logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-grad);
  color: #fff;
  font-size: 21px;
  box-shadow: 0 6px 16px rgba(79, 125, 255, .35);
}
.brand .title { font-size: 18px; font-weight: 800; color: var(--text-deep); letter-spacing: .3px; }
.brand .sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.brand .stack { display: flex; flex-direction: column; line-height: 1.2; }

/* ---- 三栏 ---- */
.layout {
  flex: 1;
  display: flex;
  gap: 16px;
  padding: 16px;
  min-height: 0;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 14px 16px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--border-soft);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.panel-title .title-count {
  color: var(--primary);
  background: var(--purple-soft);
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 8px;
  letter-spacing: 0;
}

/* 左栏固定宽 */
.panel-customers { width: 248px; flex-shrink: 0; }
/* 中栏自适应 */
.panel-chat { flex: 1; }
/* 右栏固定宽 */
.panel-signals { width: 308px; flex-shrink: 0; }

/* ---- 客户列表 ---- */
.customer-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.customer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin-bottom: 3px;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: background .15s ease, transform .1s ease;
  border: 1px solid transparent;
}
.customer-item:hover { background: #f4f7ff; }
.customer-item:active { transform: scale(.985); }
.customer-item.active {
  background: linear-gradient(90deg, #eef3ff, #f6f9ff);
  border-color: #d7e1ff;
  box-shadow: inset 3px 0 0 var(--primary);
}
.customer-item .avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(135deg, #7f9cf5, #5d7bed);
  box-shadow: 0 3px 8px rgba(93, 123, 237, .25);
}
.customer-item.active .avatar { box-shadow: 0 4px 12px rgba(79, 125, 255, .4); }
.customer-item .info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.customer-item .customer-name {
  font-weight: 600;
  color: var(--text-deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.customer-item .customer-role {
  color: var(--muted);
  font-size: 11px;
}
.customer-item .dot {
  margin-left: 8px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
  flex-shrink: 0;
}
.customer-item:not(.active) .dot { opacity: .0; }
.customer-item .actions {
  margin-left: auto;
  display: flex;
  gap: 5px;
  flex-shrink: 0;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity .15s ease, transform .15s ease;
}
.customer-item:hover .actions { opacity: 1; transform: translateX(0); }
.customer-item .act {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--border-soft);
  box-shadow: 0 1px 3px rgba(30,41,59,.06);
  opacity: .85;
  transition: opacity .12s ease, background .12s ease, transform .08s ease;
}
.customer-item .act:hover { opacity: 1; background: #f0f3ff; transform: translateY(-1px); }
.customer-item .act-del:hover { background: #fff1f1; border-color: #ffd6d6; color: #d64545; }
/* 置顶客户高亮：金色小标 + 名称微金 */
.customer-item .act-pin.on {
  background: #fff7e0;
  border-color: #ffd977;
  opacity: 1;
}
.customer-item.pinned .avatar,
.customer-item.pinned .customer-name {
  background: linear-gradient(135deg, #f7b733, #ffd25e);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.customer-item.pinned .avatar {
  -webkit-text-fill-color: #fff;
  box-shadow: 0 3px 8px rgba(247,183,51,.35);
}
.customer-item .empty { color: var(--muted); padding: 18px; text-align: center; }

/* ---- 对话头部 ---- */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #fbfcfe, #fff);
}
.chat-header .ch-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary-grad);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 4px 10px rgba(79,125,255,.3);
  flex-shrink: 0;
}
.chat-header .ch-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chat-header #chat-customer-name {
  font-weight: 800;
  font-size: 15px;
  color: var(--text-deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header .ch-presence {
  font-size: 11px;
  color: var(--green);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}
.chat-header .ch-presence::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--green);
  animation: pulse 1.8s ease infinite;
}
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(34,181,109,.4);} 50% { box-shadow: 0 0 0 5px rgba(34,181,109,0);} }
.chat-header .spacer { flex: 1; }
.status {
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f0f2f7;
  color: var(--muted);
  font-weight: 600;
}
.status.ready { background: #e6f7ef; color: var(--green); }
.status.hot { background: #fdf3e2; color: var(--amber); }

/* ---- 消息区 ---- */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background:
    radial-gradient(900px 320px at 0% 0%, rgba(79,125,255,.05), transparent 60%),
    #fff;
}

/* 消息行 */
.msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 82%;
  animation: msgIn .28s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg-row .m-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.msg-row .m-bubble-col { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.msg-row .m-sender {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  padding: 0 4px;
}

/* AI（销冠）消息 —— 左对齐 */
.msg-row.ai { align-self: flex-start; }
.msg-row.ai .m-avatar { background: var(--primary-grad); box-shadow: 0 3px 8px rgba(79,125,255,.3); }
.msg {
  padding: 10px 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.msg-row.ai .msg {
  background: #f2f4fb;
  color: var(--text);
  border-radius: 4px 14px 14px 14px;
  border: 1px solid #edf0f8;
}
.msg-row.ai .msg .badge-tag { display:inline-block; margin-right:6px; }

/* 客户消息 —— 右对齐 */
.msg-row.customer { align-self: flex-end; flex-direction: row-reverse; }
.msg-row.customer .m-avatar { background: linear-gradient(135deg, #ff9966, #ff7e5f); box-shadow: 0 3px 8px rgba(255,126,95,.3); }
.msg-row.customer .m-bubble-col { align-items: flex-end; }
.msg-row.customer .msg {
  background: var(--primary-grad);
  color: #fff;
  border-radius: 14px 4px 14px 14px;
  box-shadow: 0 6px 16px rgba(79,125,255,.28);
}

.msg .meta { display: block; font-size: 10.5px; color: var(--muted); margin-top: 6px; opacity: .85; }
.msg-row.customer .msg .meta { color: rgba(255,255,255,.8); text-align: right; }

/* 打字指示器 */
.msg-row.ai .msg.typing {
  font-style: normal;
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 14px 16px;
}
.msg.typing .tdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa5bf;
  animation: tb 1.2s infinite ease-in-out;
}
.msg.typing .tdot:nth-child(2) { animation-delay: .15s; }
.msg.typing .tdot:nth-child(3) { animation-delay: .3s; }
@keyframes tb { 0%,60%,100%{ transform: translateY(0); opacity:.5;} 30%{ transform: translateY(-4px); opacity:1;} }

/* ---- 输入区 ---- */
.input-bar {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border-soft);
  background: #fff;
}
.input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: #f2f4f9;
  border: 1.5px solid transparent;
  border-radius: 999px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.input-wrap:focus-within {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(79,125,255,.12);
}
.input-wrap .input-icon { color: var(--muted); padding-left: 14px; font-size: 15px; }
.input-wrap input {
  flex: 1;
  padding: 11px 14px;
  border: none;
  background: transparent;
  font-size: 14px;
  outline: none;
  color: var(--text);
}
.input-bar #btn-send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: var(--primary-grad);
  box-shadow: 0 6px 14px rgba(79,125,255,.32);
  transition: transform .12s, filter .15s, box-shadow .15s;
}
.input-bar #btn-send:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.input-bar #btn-send:active:not(:disabled) { transform: scale(.97); }
.input-bar #btn-send:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ---- 按钮 ---- */
.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s, background .15s, transform .1s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost {
  background: #f2f4f9;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); background: #edf0f6; }
.btn-ghost:active { transform: scale(.97); }

/* ---- 决策面板 ---- */
.signals { padding: 14px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.signals .placeholder {
  color: var(--muted);
  text-align: center;
  padding: 44px 0;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.signals .placeholder::before {
  content: "💬";
  font-size: 34px;
  opacity: .5;
}
.sig-card {
  background: #f7f9fd;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px 14px;
}
.sig-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 13px; }
.sig-row + .sig-row { border-top: 1px dashed var(--border-soft); }
.sig-row .k { color: var(--muted); }
.sig-row .v { font-weight: 700; color: var(--text-deep); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge.ready { background: #e6f7ef; color: var(--green); }
.badge.hot { background: #fdf3e2; color: var(--amber); }
.badge.warm { background: #efecff; color: var(--purple); }
.badge.cold { background: #eef1f6; color: var(--muted); }
.badge.positive { background: #e6f7ef; color: var(--green); }
.badge.neutral { background: #eef1f6; color: var(--muted); }
.badge.negative { background: #fdecec; color: var(--red); }
.score-meter {
  height: 9px;
  background: #eef1f6;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.score-meter > div {
  height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--green));
  border-radius: 999px;
  transition: width .4s cubic-bezier(.4,0,.2,1);
}
.sig-note { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.sig-note strong { color: var(--text-deep); }
.block-title {
  font-weight: 700;
  margin: 14px 0 6px;
  font-size: 12.5px;
  color: var(--text-deep);
  display: flex;
  align-items: center;
  gap: 6px;
}
.block-title::before { content: ""; width: 4px; height: 12px; border-radius: 2px; background: var(--primary-grad); }

/* ---- 弹窗 ---- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(3px);
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--panel);
  border-radius: 16px;
  padding: 26px;
  width: 340px;
  box-shadow: var(--shadow-lg);
  animation: msgIn .2s ease;
}
.modal-box h3 { margin: 0 0 16px; font-size: 16px; }
.modal-box input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  outline: none;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.modal-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79,125,255,.12); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
