/* 企业微信侧边栏样式 - PC 端固定宽度约 300px */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #0082ef;
  --primary-light: #e8f3ff;
  --text: #1f2329;
  --text-sub: #8a919f;
  --border: #e8eaef;
  --bg: #f5f6f8;
  --card: #ffffff;
  --danger: #e24b4a;
  --success: #1d9e75;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  width: 100%;
  max-width: 320px;
  min-width: 260px;
}

/* ---------- 头部 ---------- */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.customer-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 500;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.customer-meta {
  flex: 1;
  min-width: 0;
}

.customer-name {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-sub {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  flex-shrink: 0;
}

.status-dot.ok {
  background: var(--success);
}

.status-dot.err {
  background: var(--danger);
}

/* ---------- Tab ---------- */
.tab-bar {
  display: flex;
  border-top: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 9px 0;
  background: none;
  border: none;
  font-size: 13px;
  color: var(--text-sub);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}

/* ---------- 鉴权横幅 ---------- */
.banner {
  padding: 8px 14px;
  font-size: 12px;
  background: #fff7e6;
  color: #ad6800;
  border-bottom: 1px solid #ffe7ba;
  display: none;
}

.banner.show {
  display: block;
}

.banner.ok {
  background: #e8fbf3;
  color: #0f6e56;
  border-bottom-color: #c3ecd9;
}

.banner.err {
  background: #fdecec;
  color: #a32d2d;
  border-bottom-color: #f7c1c1;
}

/* ---------- 内容区 ---------- */
.content {
  padding: 12px 14px 20px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.card {
  background: var(--card);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.card-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 10px;
  color: var(--text);
}

/* ---------- 客户画像 ---------- */
.profile-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.profile-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
  line-height: 1.5;
}

.profile-row:last-child {
  border-bottom: none;
}

.profile-label {
  width: 76px;
  flex-shrink: 0;
  color: var(--text-sub);
}

.profile-value {
  flex: 1;
  word-break: break-all;
}

.value-green { color: var(--success); font-weight: 500; }
.value-red { color: var(--danger); font-weight: 500; }
.value-blue { color: var(--primary); font-weight: 500; }
.value-geekblue { color: #185fa5; font-weight: 500; }

/* ---------- 按钮 ---------- */
.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 0;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:active {
  opacity: 0.7;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-block {
  width: 100%;
}

.btn-primary[disabled] {
  background: #b3d8fb;
  cursor: not-allowed;
}

/* ---------- 快捷回复 ---------- */
.reply-item {
  padding: 10px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}

.reply-item:hover {
  border-color: var(--primary);
}

.reply-text {
  font-size: 13px;
  line-height: 1.5;
}

.reply-item:last-child {
  margin-bottom: 0;
}

.textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 10px;
  outline: none;
}

.textarea:focus {
  border-color: var(--primary);
}

/* ---------- 会话记录 ---------- */
.session-list {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.8;
}

.session-empty {
  text-align: center;
  padding: 18px 0;
}

/* 单个会话提示（当前展示的是「客户 + 某员工」这个会话） */
.session-summary {
  font-size: 11.5px;
  color: #8c6d1f;
  background: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: 4px;
  padding: 4px 8px;
  margin-bottom: 8px;
  line-height: 1.5;
}

/* 最近有聊天的客户列表（演示模式） */
.session-list-title {
  font-size: 12px;
  color: var(--text-sub);
  padding: 4px 0 8px;
}

.recent-chat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.recent-chat-item:hover {
  background: var(--primary-light);
}

.rc-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 15px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rc-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rc-meta {
  flex: 1;
  min-width: 0;
}

.rc-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rc-sub {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.back-btn {
  font-size: 12px;
  color: var(--primary);
  padding: 6px 0 8px;
  cursor: pointer;
  user-select: none;
}

.back-btn:active {
  opacity: 0.7;
}

/* 「客户 + 员工」会话列表（各自独立，点击查看该会话聊天记录） */
.conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border, #f0f0f0);
}

.conv-item:last-child { border-bottom: none; }

.conv-item:hover {
  background: var(--primary-light);
}

.conv-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 15px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.conv-meta {
  flex: 1;
  min-width: 0;
}

.conv-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-dep {
  font-size: 11px;
  color: var(--text-sub);
  margin-left: 6px;
  font-weight: 400;
}

.conv-sub {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.conv-right {
  flex-shrink: 0;
  text-align: right;
}

.conv-time {
  font-size: 11px;
  color: var(--text-sub);
}

.conv-count {
  font-size: 11px;
  color: var(--primary);
  margin-top: 2px;
}

/* 聊天气泡 */
.msg-row {
  display: flex;
  margin-bottom: 10px;
}

.msg-customer {
  justify-content: flex-start;
}

.msg-staff {
  justify-content: flex-end;
}

.msg-bubble {
  max-width: 82%;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.msg-customer .msg-bubble {
  background: #fff;
  border-top-left-radius: 2px;
}

.msg-staff .msg-bubble {
  background: var(--primary-light);
  border-top-right-radius: 2px;
}

.msg-sender {
  font-size: 11px;
  color: var(--text-sub);
  margin-bottom: 3px;
}

.msg-staff .msg-sender {
  text-align: right;
}

.msg-content {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-all;
}

/* 聊天图片 / 文件 */
.msg-image {
  display: block;
  max-width: 200px;
  max-height: 200px;
  border-radius: 6px;
  cursor: zoom-in;
}

.msg-file {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid var(--primary);
}

.msg-time {
  font-size: 10px;
  color: #b6bcc8;
  margin-top: 3px;
}

.msg-customer .msg-time {
  text-align: left;
}

.msg-staff .msg-time {
  text-align: right;
}

/* 标签 chip */
.tag-chip {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid #c4e0fa;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.6;
  padding: 0 6px;
  margin: 2px 4px 2px 0;
}

.text-sub {
  color: var(--text-sub);
}

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  padding: 26px 0 20px;
  color: var(--text-sub);
}

.empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px dashed var(--border);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.empty p {
  margin-bottom: 4px;
}

.empty-sub {
  font-size: 12px;
}
