/* ============================================================
   在线客服聊天 · 共用样式
   ============================================================ */

:root {
  --canvas: #efece7;
  --surface: #ffffff;
  --surface-soft: #f7f5f2;
  --ink: #16181d;
  --ink-2: #4b525b;
  --muted: #8b929c;
  --line: #e7e3dc;
  --line-strong: #d8d3ca;
  --accent: #ef532b;
  --accent-deep: #d43f18;
  --accent-soft: #fdece6;
  --ok: #1f9d63;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(22, 24, 29, 0.05);
  --shadow-md: 0 8px 28px rgba(22, 24, 29, 0.1);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
textarea {
  font-family: inherit;
  font-size: 16px;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: rgba(22, 24, 29, 0.15);
  border-radius: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ============================ 访客端 ============================ */

.page-visitor {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 80% at 50% 0%, #f8f6f3 0%, #ece8e2 70%, #e7e2db 100%);
  padding: 0;
}

.visitor-shell {
  width: 100%;
  max-width: 460px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface-soft);
  overflow: hidden;
}

@media (min-width: 720px) {
  .page-visitor {
    padding: 24px;
  }
  .visitor-shell {
    height: min(820px, calc(100dvh - 48px));
    border-radius: var(--radius);
    box-shadow: 0 24px 60px rgba(22, 24, 29, 0.14), 0 2px 8px rgba(22, 24, 29, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.8);
  }
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  z-index: 2;
}

.brand-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 4px 10px rgba(239, 83, 43, 0.28);
}

.brand-avatar svg {
  width: 20px;
  height: 20px;
}

.chat-head-titles {
  min-width: 0;
  flex: 1;
}

.chat-head-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-head-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(31, 157, 99, 0.14);
}

/* 聊天容器（消息列表 + 输入区） */
.chat-host {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

[hidden] {
  display: none !important;
}

/* ============================ 消息区 ============================ */

.chat-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 8px;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
}

.chat-list {
  min-height: 100%;
  width: 100%;
  max-width: 940px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  padding: 24px;
  max-width: 300px;
}

.chat-empty svg {
  width: 46px;
  height: 46px;
  margin: 0 auto 10px;
  opacity: 0.35;
}

.chat-empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
}

.day-sep {
  align-self: center;
  margin: 12px 0 8px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.75);
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}

.sys-line {
  align-self: center;
  margin: 6px 0;
  font-size: 12px;
  color: var(--muted);
  background: rgba(22, 24, 29, 0.045);
  padding: 4px 12px;
  border-radius: 999px;
}

.msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 6px 0;
  position: relative;
}

.msg.me {
  flex-direction: row-reverse;
}

.msg .avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.msg.me .avatar-sm {
  background: var(--accent-soft);
  border-color: #f7d3c7;
  color: var(--accent-deep);
}

.msg-main {
  max-width: min(74%, 320px);
  min-width: 0;
  position: relative;
}

.msg.me .msg-main {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.bubble {
  position: relative;
  padding: 9px 13px;
  border-radius: 14px 14px 14px 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 14.5px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: var(--shadow-sm);
}

.msg.me .bubble {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 4px 14px rgba(239, 83, 43, 0.22);
}

.bubble.img-bubble {
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  line-height: 0;
}

.msg.me .bubble.img-bubble {
  background: rgba(239, 83, 43, 0.1);
  border-color: rgba(239, 83, 43, 0.18);
}

.bubble img {
  max-width: 210px;
  max-height: 260px;
  width: auto;
  height: auto;
  border-radius: 10px;
  cursor: zoom-in;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin: 3px 2px 0;
  min-height: 20px;
  align-items: center;
}

.msg.me .msg-meta {
  justify-content: flex-end;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.state-pill.unread {
  color: var(--muted);
}
.state-pill.read {
  color: var(--ok);
}
.state-pill.read svg {
  width: 12px;
  height: 12px;
}

/* 消息操作按钮：放在时间行里，手机端也不会被屏幕边缘裁掉 */
.msg-actions {
  display: inline-flex;
  align-items: center;
  opacity: 0.55;
  transition: opacity 0.15s;
  z-index: 3;
}

.msg:hover .msg-actions,
.msg:focus-within .msg-actions {
  opacity: 1;
}

.btn-dots {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
}
.btn-dots:hover {
  background: rgba(22, 24, 29, 0.06);
  color: var(--ink-2);
}
.btn-dots svg {
  width: 13px;
  height: 13px;
}

.pop-menu {
  position: absolute;
  top: 100%;
  margin-top: 4px;
  min-width: 118px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 4px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pop-menu.up {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 4px;
}

.msg.me .pop-menu {
  right: 0;
}
.msg.other .pop-menu {
  left: 0;
}

.pop-menu button {
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
}
.pop-menu button:hover {
  background: var(--surface-soft);
}
.pop-menu button.danger {
  color: var(--accent-deep);
}

/* ============================ 输入区 ============================ */

.composer {
  flex: 0 0 auto;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  z-index: 4;
}

.composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 940px;
  margin-inline: auto;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  flex: 0 0 auto;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover {
  background: var(--surface-soft);
  color: var(--accent);
}
.icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.icon-btn svg {
  width: 20px;
  height: 20px;
}

.composer-field {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer-field:focus-within {
  border-color: rgba(239, 83, 43, 0.5);
  box-shadow: 0 0 0 3px rgba(239, 83, 43, 0.1);
  background: var(--surface);
}

.composer-field textarea {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  font-size: 16px;
  line-height: 1.5;
  padding: 6px 0;
  max-height: 120px;
  min-height: 24px;
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  transition: transform 0.12s, background 0.15s, opacity 0.15s;
  box-shadow: 0 4px 12px rgba(239, 83, 43, 0.28);
}
.send-btn:hover {
  background: var(--accent-deep);
}
.send-btn:active {
  transform: scale(0.94);
}
.send-btn:disabled {
  background: var(--line-strong);
  box-shadow: none;
  cursor: not-allowed;
}
.send-btn svg {
  width: 18px;
  height: 18px;
}

.hint-bar {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 6px 0 0;
}

/* ============================ 客服端 ============================ */

.page-agent {
  background: #12151a;
}

.agent-app {
  display: grid;
  grid-template-columns: 296px 1fr;
  height: 100dvh;
  background: var(--surface-soft);
  overflow: hidden;
}

.sidebar {
  background: #181b21;
  color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-head {
  padding: 18px 18px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-head .mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  display: grid;
  place-items: center;
}

.sidebar-head .mark svg {
  width: 17px;
  height: 17px;
}

.sidebar-head-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.sidebar-head-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

.sidebar-tools {
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  padding: 6px 10px;
}

.search-box svg {
  width: 15px;
  height: 15px;
  color: rgba(255, 255, 255, 0.45);
  flex: 0 0 auto;
}

.search-box input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 16px;
  padding: 0;
}
.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.conv-list {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}

.conv-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  transition: background 0.15s;
}

.conv-item:hover {
  background: rgba(255, 255, 255, 0.045);
}

.conv-item.active {
  background: rgba(255, 255, 255, 0.08);
}
.conv-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.conv-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.conv-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  overflow: hidden;
}

.conv-body {
  min-width: 0;
}

.conv-name {
  font-size: 13.5px;
  font-weight: 500;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.conv-preview {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.42);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.conv-side {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.conv-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  white-space: nowrap;
}

.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
  line-height: 1;
}

.sidebar-foot {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.text-link {
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  font-size: 11px;
}
.text-link:hover {
  color: #fff;
}

/* 右侧聊天区 */
.agent-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface-soft);
}

.agent-pane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.back-btn {
  display: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  place-items: center;
  color: var(--ink-2);
}
.back-btn svg {
  width: 18px;
  height: 18px;
}

.rename-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: var(--ink-2);
  flex: 0 0 auto;
}
.rename-btn:hover {
  background: var(--line);
  color: var(--ink);
}
.rename-btn svg {
  width: 18px;
  height: 18px;
}

.pane-titles {
  flex: 1;
  min-width: 0;
}
.pane-name {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pane-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

.pane-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  text-align: center;
  padding: 32px;
}
.pane-empty svg {
  width: 64px;
  height: 64px;
  opacity: 0.22;
}
.pane-empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
}

#agent-chat-host {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 客服端登录页 */
.login-wrap {
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% 0%, #262a32 0%, #12151a 62%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 18px;
  padding: 28px 26px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
}

.login-card .mark-lg {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  box-shadow: 0 8px 20px rgba(239, 83, 43, 0.3);
}
.login-card .mark-lg svg {
  width: 23px;
  height: 23px;
}

.login-card h1 {
  font-size: 20px;
  margin: 0 0 6px;
  letter-spacing: 0.3px;
}
.login-card .lead {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 20px;
  line-height: 1.6;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 500;
}

.field-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field-input:focus {
  border-color: rgba(239, 83, 43, 0.55);
  box-shadow: 0 0 0 3px rgba(239, 83, 43, 0.12);
}

.btn-primary {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s, transform 0.12s;
}
.btn-primary:hover {
  background: var(--accent-deep);
}
.btn-primary:active {
  transform: scale(0.99);
}

.login-error {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 8px 10px;
  display: none;
}

/* ============================ 通用浮层 ============================ */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 15, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 24px;
  cursor: zoom-out;
}
.lightbox.open {
  display: flex;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 10px);
  background: rgba(22, 24, 29, 0.9);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 9px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 80;
  max-width: 80vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 窄屏：客服端列表与聊天切换 */
@media (max-width: 760px) {
  .agent-app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
  }

  .agent-pane {
    position: fixed;
    inset: 0;
    z-index: 30;
    transform: translateX(100%);
    transition: transform 0.22s ease;
  }

  .agent-app.mobile-open .agent-pane {
    transform: translateX(0);
  }

  .back-btn {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   2025 修复版新增：表情面板 / 弹窗 / 备注 / 在线状态
   ============================================================ */

.sidebar-head-titles {
  min-width: 0;
  flex: 1;
}

/* 表情面板 */
.emoji-panel {
  max-width: 940px;
  margin: 0 auto 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  box-shadow: var(--shadow-md);
  max-height: 208px;
  overflow-y: auto;
}

.emoji-item {
  font-size: 20px;
  line-height: 1;
  padding: 6px 0;
  border-radius: 8px;
  transition: background 0.12s, transform 0.12s;
}
.emoji-item:hover {
  background: var(--accent-soft);
}
.emoji-item:active {
  transform: scale(0.9);
}

@media (max-width: 480px) {
  .emoji-panel {
    grid-template-columns: repeat(8, 1fr);
  }
}

/* 纯表情消息显示大一点 */
.bubble.emoji-bubble {
  font-size: 30px;
  line-height: 1.25;
  padding: 6px 12px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.msg.me .bubble.emoji-bubble {
  background: transparent;
  box-shadow: none;
}

.img-cap {
  font-size: 13px;
  padding: 5px 6px 2px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 备注标签 / 在线小绿点 */
.remark-tag {
  font-size: 10px;
  font-weight: 400;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 1px 4px;
  flex: 0 0 auto;
}

.online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.2);
}

.conv-empty {
  padding: 28px 16px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 12.5px;
  text-align: center;
  line-height: 1.8;
}

/* 侧栏文字按钮（原来只有 a 标签样式，这里补 button） */
.text-link {
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
}

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 15, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 70;
  overflow-y: auto;
}
.modal-mask[hidden] {
  display: none;
}

.modal {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 40px);
  overflow: hidden;
}
.modal-sm {
  max-width: 380px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px;
}
.modal-head h2 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
  display: grid;
  place-items: center;
}
.modal-close:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.modal-body {
  padding: 4px 18px 6px;
  overflow-y: auto;
}

.modal-tip {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 12px;
}

.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px 16px;
}

.btn-ghost {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink-2);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.btn-ghost:hover {
  background: var(--line);
}
.btn-ghost.danger {
  color: var(--accent-deep);
  border-color: #f7d3c7;
  background: var(--accent-soft);
}

.modal-save {
  width: auto;
  margin-top: 0;
  padding: 10px 18px;
  font-size: 14px;
}

.field-textarea {
  resize: vertical;
  min-height: 74px;
  line-height: 1.55;
  font-size: 15px;
}

/* 开关 */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0 4px;
  border-top: 1px solid var(--line);
}
.switch-title {
  font-size: 13.5px;
  font-weight: 500;
}
.switch-desc {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.5;
}

.switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-track {
  width: 44px;
  height: 25px;
  border-radius: 999px;
  background: var(--line-strong);
  display: inline-flex;
  align-items: center;
  padding: 2px;
  transition: background 0.18s;
}
.switch-thumb {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s;
}
.switch input:checked + .switch-track {
  background: var(--accent);
}
.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(19px);
}

/* 存储用量面板 */
.usage-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.usage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}
.usage-bar {
  height: 8px;
  border-radius: 6px;
  background: var(--line);
  overflow: hidden;
}
.usage-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
  transition: width 0.3s ease;
}
.usage-line {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}
.usage-sub {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}
.usage-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.usage-row .field-input {
  flex: 1;
  min-width: 0;
  text-align: center;
}
.usage-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* 消息名称标签 */
.msg-name {
  font-size: 11px;
  color: var(--muted);
  margin: 0 2px 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg.me .msg-name {
  text-align: right;
}

/* 头像图片 */
.avatar-sm img.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  display: block;
}

/* 设置里的头像预览 */
.avatar-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 14px;
}
.avatar-preview {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--line, #e5e9f0);
  display: grid;
  place-items: center;
  font-size: 16px;
  color: var(--accent-deep);
  overflow: hidden;
  flex: 0 0 auto;
}
.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.avatar-hint {
  font-size: 12px;
  color: var(--muted);
}

/* 自动回复标记 */
.msg-tag {
  font-size: 11px;
  color: var(--muted);
  margin: 4px 2px 0;
  border: 1px solid var(--line, #e5e9f0);
  border-radius: 6px;
  padding: 0 5px;
  display: inline-block;
}
.msg.me .msg-tag {
  align-self: flex-end;
}

/* 会话列表里的 IP / 归属地 */
.conv-geo {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.85;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 会话详情顶部的访客信息条 */
.pane-geo {
  padding: 8px 16px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line, #eef1f6);
  word-break: break-all;
}

/* 导出按钮 */
.pane-export {
  font-size: 13px;
  margin-right: 8px;
  flex: 0 0 auto;
}

/* 在线 / 离线切换 */
.text-link.is-offline {
  color: var(--accent-deep);
  font-weight: 600;
}

/* 关键词自动回复块 */
.kw-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line, #eef1f6);
}
.kw-tip {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin: 6px 0 8px;
}
.kw-input {
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 10px;
}
.kw-switch {
  margin-top: 6px;
}

/* 访客端：留联系方式 */
.head-link {
  margin-left: auto;
  flex: 0 0 auto;
  border: 1px solid var(--line, #e5e9f0);
  background: #fff;
  color: var(--accent-deep);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}
.contact-panel {
  margin: 10px 12px 0;
  padding: 12px;
  border: 1px solid var(--line, #eef1f6);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}
.contact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.contact-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
}
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.contact-grid .field-input {
  font-size: 13px;
  padding: 9px 10px;
}
.contact-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.contact-save {
  width: auto !important;
  padding: 8px 18px;
  font-size: 13px;
}
.contact-note {
  font-size: 11px;
  color: var(--muted);
}
.contact-toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: 999px;
  z-index: 100;
}

/* 提示音设置行 */
.sound-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
  flex-wrap: wrap;
}
.sound-count {
  width: 72px !important;
  flex: 0 0 auto;
  padding: 8px 10px;
  font-size: 13px;
}
.sound-row .btn-ghost {
  font-size: 13px;
  padding: 8px 12px;
}

/* 拉黑 */
.remark-tag.is-blocked {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}
.pane-block {
  margin-left: 8px;
}
.pane-block.is-off {
  color: #b45309;
}
.blocked-banner {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: #b91c1c;
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
}
.blocked-banner.show {
  display: flex;
}

/* 会话顶部：导出 / 拉黑文字按钮（白底上要看得见） */
.agent-pane-head .text-link {
  color: #c2410c;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 8px;
  background: #fff4ec;
  margin-right: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.agent-pane-head .text-link:hover {
  color: #ffffff;
  background: #e8552b;
}
.agent-pane-head .text-link.is-off {
  color: #b91c1c;
  background: #fef2f2;
}
