/* ============================================================
   智能客服（customer service）页面样式
   复用 styles.css 设计令牌与 .card/.btn；命名空间 .cs-*
   ============================================================ */

.cs-page {
  width: 100%; max-width: 1280px; min-width: 0;
  margin: 0 auto;
  display: flex; flex-direction: column; gap: 16px;
}
.cs-page > * { min-width: 0; }

/* ---- 顶部说明 + 适配器状态 ---- */
.cs-hero { padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; }
.cs-hero h2 {
  display: flex; align-items: center; gap: 9px; margin: 0;
  font-size: 17px; font-family: var(--font-display, inherit);
}
.cs-hero h2 svg { width: 19px; height: 19px; color: var(--accent, #7c8bff); }
.cs-hero p { margin: 0; font-size: 12.5px; line-height: 1.85; color: var(--text-2, #a6adc8); }
.cs-hero b { color: var(--text, #eef1f8); font-weight: 600; }
.cs-status-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cs-status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; font-size: 11.5px;
  border: 1px solid var(--border, rgba(255, 255, 255, .09));
  background: rgba(255, 255, 255, .03); color: var(--text-2, #a6adc8);
}
.cs-status-chip i {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--text-3, #6b7390);
}
.cs-status-chip.real { border-color: rgba(52, 211, 153, .35); color: var(--emerald, #34d399); background: rgba(52, 211, 153, .08); }
.cs-status-chip.real i { background: var(--emerald, #34d399); box-shadow: 0 0 7px rgba(52, 211, 153, .7); }
.cs-wall-note {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--amber, #fbbf24);
}
.cs-wall-note svg { width: 15px; height: 15px; flex: none; }

/* ---- 双栏工作台 ---- */
.cs-layout {
  display: grid; grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px; align-items: stretch;
  height: calc(100vh - 235px); min-height: 520px;
}
.cs-list-card, .cs-thread-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.cs-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--border, rgba(255, 255, 255, .08));
  flex: none;
}
.cs-card-head h3 {
  display: flex; align-items: center; gap: 8px; margin: 0;
  font-size: 14.5px; font-family: var(--font-display, inherit);
}
.cs-card-head h3 svg { width: 16px; height: 16px; color: var(--accent, #7c8bff); }
.cs-total-unread {
  font-size: 11px; font-weight: 700; color: var(--rose, #fb7185);
  background: rgba(251, 113, 133, .12); border: 1px solid rgba(251, 113, 133, .3);
  border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}

/* ---- 会话列表 ---- */
.cs-conv-list { overflow-y: auto; flex: 1; padding: 8px; }
.cs-conv {
  width: 100%; display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 11px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; cursor: pointer; text-align: left;
  color: var(--text, #eef1f8); transition: background .15s, border-color .15s;
}
.cs-conv:hover { background: rgba(255, 255, 255, .04); }
.cs-conv.active {
  background: rgba(124, 139, 255, .12);
  border-color: rgba(124, 139, 255, .45);
}
.cs-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #0b0d15;
  background: var(--accent-grad, linear-gradient(135deg, #7c8bff, #4de3ff));
}
.cs-conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cs-conv-row1 { display: flex; align-items: center; gap: 7px; min-width: 0; }
.cs-conv-row1 b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-lang-tag {
  flex: none; font-size: 10px; font-weight: 700; text-transform: uppercase;
  color: var(--cyan, #4de3ff); background: rgba(77, 227, 255, .1);
  border: 1px solid rgba(77, 227, 255, .28); border-radius: 6px; padding: 1px 6px;
}
.cs-platform-tag {
  flex: none; font-size: 10px; color: var(--text-3, #6b7390);
  border: 1px solid var(--border, rgba(255, 255, 255, .09));
  border-radius: 6px; padding: 1px 6px; white-space: nowrap;
}
.cs-unread {
  margin-left: auto; flex: none; min-width: 19px; height: 19px; padding: 0 6px;
  border-radius: 999px; background: var(--rose, #fb7185); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.cs-conv-preview {
  margin: 0; font-size: 12px; color: var(--text-2, #a6adc8); line-height: 1.55;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cs-conv-time { font-size: 10.5px; color: var(--text-3, #6b7390); flex: none; }

/* ---- 会话线程 ---- */
.cs-thread-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--text-3, #6b7390); padding: 40px 20px; text-align: center;
}
.cs-thread-empty svg { width: 42px; height: 42px; opacity: .5; }
.cs-thread-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border, rgba(255, 255, 255, .08));
  display: flex; flex-direction: column; gap: 8px; flex: none;
}
.cs-thread-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cs-thread-title b { font-size: 14.5px; }
.cs-context {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  font-size: 11.5px; color: var(--text-2, #a6adc8);
}
.cs-context span { display: inline-flex; align-items: center; gap: 5px; }
.cs-context svg { width: 13px; height: 13px; color: var(--accent-2, #4de3ff); }
.cs-context em { font-style: normal; color: var(--text, #eef1f8); }

.cs-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.cs-bubble { max-width: 72%; padding: 10px 13px; border-radius: 14px; font-size: 13px; line-height: 1.7; animation: csFadeUp .25s ease both; }
.cs-bubble.cs-buyer {
  align-self: flex-start; background: rgba(255, 255, 255, .06);
  border: 1px solid var(--border, rgba(255, 255, 255, .09));
  border-bottom-left-radius: 4px;
}
.cs-bubble.cs-seller {
  align-self: flex-end; color: #0b0d15;
  background: var(--accent-grad, linear-gradient(135deg, #7c8bff, #4de3ff));
  border-bottom-right-radius: 4px; font-weight: 500;
}
.cs-bubble-meta { font-size: 10px; opacity: .65; margin-top: 4px; }
@keyframes csFadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- 草稿与发送 ---- */
.cs-composer { border-top: 1px solid var(--border, rgba(255, 255, 255, .08)); padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 10px; flex: none; }
.cs-tpl-row { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
.cs-tpl-row::-webkit-scrollbar { height: 4px; }
.cs-tpl-chip {
  flex: none; font-size: 11px; padding: 5px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border, rgba(255, 255, 255, .1));
  background: rgba(255, 255, 255, .03); color: var(--text-2, #a6adc8);
  white-space: nowrap; transition: all .15s;
}
.cs-tpl-chip:hover { border-color: var(--accent, #7c8bff); color: var(--text, #eef1f8); }
.cs-draft-meta { font-size: 11px; color: var(--text-3, #6b7390); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.cs-draft-meta .cs-draft-mode { color: var(--cyan, #4de3ff); }
.cs-draft-meta .cs-draft-mode.offline { color: var(--amber, #fbbf24); }
.cs-composer textarea {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 76px; max-height: 200px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--border, rgba(255, 255, 255, .09));
  border-radius: 12px; padding: 11px 13px; color: var(--text, #eef1f8);
  font-size: 13px; line-height: 1.65; font-family: inherit; outline: none; transition: border-color .2s;
}
.cs-composer textarea:focus { border-color: var(--accent, #7c8bff); }
.cs-composer-actions { display: flex; align-items: center; gap: 10px; }
.cs-composer-actions .spacer { flex: 1; }
.cs-btn-send { font-weight: 700; }
.cs-btn-send:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---- 窄屏：单栏堆叠，列表限高，线程独立成块 ---- */
@media (max-width: 860px) {
  .cs-layout { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
  .cs-list-card { max-height: 340px; }
  .cs-thread-card { min-height: 560px; }
  .cs-bubble { max-width: 86%; }
}
@media (max-width: 720px) {
  .cs-hero, .cs-card-head, .cs-thread-head, .cs-composer { padding-left: 16px; padding-right: 16px; }
  .cs-messages { padding: 14px; }
}
