* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4f7cff;
  --primary-dark: #3a66e8;
  --primary-light: #e8f0ff;
  --bg: #f5f7fa;
  --white: #ffffff;
  --text: #333333;
  --text-light: #888888;
  --border: #e5e7eb;
  --user-msg: #4f7cff;
  --admin-msg: #f0f2f5;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ==================== 用户端样式 ==================== */
.chat-container {
  max-width: 420px;
  width: 100%;
  height: 100vh;
  margin: 0 auto;
  background: var(--white);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 768px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
  }
  .chat-container {
    height: 90vh;
    max-height: 800px;
    border-radius: 16px;
    overflow: hidden;
  }
}

.chat-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header .avatar {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-header .avatar svg {
  width: 24px;
  height: 24px;
}

.header-info {
  flex: 1;
}

.agent-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.9;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  display: inline-block;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* 欢迎界面 */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px 20px;
}

.welcome-logo {
  width: 80px;
  height: 80px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 24px;
}

.welcome-logo svg {
  width: 40px;
  height: 40px;
}

.welcome-screen h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.welcome-screen p {
  color: var(--text-light);
  margin-bottom: 28px;
}

.name-input {
  width: 100%;
  max-width: 280px;
  display: flex;
  gap: 10px;
}

.name-input input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.name-input input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.15);
}

.name-input button {
  padding: 12px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.name-input button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.name-input button:active {
  transform: translateY(0);
}

/* 消息气泡 */
.message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 85%;
  animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.admin {
  align-self: flex-start;
}

.message.system {
  align-self: center;
  max-width: 90%;
  width: 100%;
  justify-content: center;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 500;
}

.message.user .message-avatar {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.message.admin .message-avatar {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
  position: relative;
}

.message.user .message-bubble {
  background: var(--user-msg);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.admin .message-bubble {
  background: var(--admin-msg);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.message.system .message-bubble {
  background: transparent;
  color: var(--text-light);
  font-size: 12px;
  text-align: center;
  padding: 4px 0;
}

.message-time {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
  padding: 0 4px;
}

.message.user .message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* 本地删除单条消息按钮（悬停显示） */
.local-delete-btn {
  align-self: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s;
  margin-left: 4px;
}
.message.user .local-delete-btn {
  margin-left: 0;
  margin-right: 4px;
}
.local-delete-btn:hover {
  background: #ef4444;
  color: white;
  transform: scale(1.1);
}
.message.system .local-delete-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}
.message.system {
  position: relative;
}

.message.admin .message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* 输入区域 */
.chat-input-area {
  border-top: 1px solid var(--border);
  background: var(--white);
  padding: 12px 16px;
  position: relative;
}

/* 表情按钮 */
.emoji-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.emoji-btn:hover {
  background: #f3f4f6;
  color: var(--primary);
  border-color: var(--primary);
}
.emoji-btn svg {
  width: 22px;
  height: 22px;
}

/* 群公告栏 */
.room-announcement {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin: 0 14px 8px;
  background: #fff8e1;
  border: 1px solid #ffe9a8;
  border-radius: 10px;
  font-size: 13px;
  color: #7a5c00;
  cursor: pointer;
  flex-shrink: 0;
  min-height: 36px;
  box-sizing: border-box;
}
.room-announcement-img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.08);
}

/* 群聊图片发送按钮 */
.chat-img-btn {
  margin-left: 8px;
}

/* 群聊图片预览（粘贴/选择后待发送） */
.chat-img-preview {
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 8px;
  padding: 6px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.chat-img-preview img {
  max-width: 160px;
  max-height: 100px;
  border-radius: 6px;
  display: block;
  object-fit: contain;
}
.chat-img-preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.chat-img-preview-remove:hover {
  background: #dc2626;
}

/* 图片消息附带文字 */
.msg-image-caption {
  margin-top: 4px;
}

/* 表情面板 */
.emoji-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 16px;
  right: 16px;
  max-width: 360px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
  padding: 10px;
  z-index: 100;
}
.emoji-categories {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.emoji-cat {
  flex: 1;
  min-width: 40px;
  padding: 4px 6px;
  border: none;
  border-radius: 6px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.emoji-cat:hover {
  background: #e5e7eb;
}
.emoji-cat.active {
  background: var(--primary);
  color: #fff;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 160px;
  overflow-y: auto;
  padding: 4px;
}
.emoji-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 20px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.12s;
  user-select: none;
}
.emoji-item:hover {
  background: #f3f4f6;
  transform: scale(1.25);
}

/* B端表情面板位置修正 */
.session-chat-input .emoji-panel {
  left: 24px;
  right: 24px;
}

.typing-indicator {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-light);
  padding-bottom: 8px;
}

.typing-indicator.active {
  display: flex;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--text-light);
  border-radius: 50%;
  display: inline-block;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.input-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

#messageInput {
  flex: 1;
  resize: none;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.5;
}

#messageInput:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.15);
}

#messageInput::-webkit-scrollbar {
  width: 4px;
}

#sendBtn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

#sendBtn:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

#sendBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#sendBtn svg {
  width: 20px;
  height: 20px;
}

/* ==================== 客服端样式 ==================== */
.admin-container {
  display: flex;
  height: 100vh;
  background: var(--bg);
}

.sidebar {
  width: 300px;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 0;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-header .logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.sidebar-header .logo svg {
  width: 22px;
  height: 22px;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 600;
}

.session-count {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}

.session-count .count {
  background: var(--primary);
  color: white;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

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

.sessions-list::-webkit-scrollbar {
  width: 6px;
}

.sessions-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-light);
  text-align: center;
}

.empty-state svg {
  width: 60px;
  height: 60px;
  margin-bottom: 16px;
  opacity: 0.5;
}

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

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

.session-item {
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.15s;
  position: relative;
}

.session-item:hover {
  background: var(--bg);
}

.session-item.active {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  padding-left: 17px;
}

.session-item.has-unread {
  background: linear-gradient(90deg, rgba(239,68,68,0.06) 0%, transparent 60%);
  border-left: 3px solid #ef4444;
}

.session-item.has-unread:hover {
  background: linear-gradient(90deg, rgba(239,68,68,0.1) 0%, rgba(239,68,68,0.02) 100%);
}

.session-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.session-info {
  flex: 1;
  min-width: 0;
}

.session-name {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.session-name .time {
  font-size: 11px;
  color: var(--text-light);
  font-weight: normal;
}

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

.unread-badge {
  background: var(--danger);
  color: white;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--white);
  min-height: 0;
}

.no-session {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  padding: 40px;
  text-align: center;
}

.no-session svg {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  opacity: 0.4;
}

.no-session h2 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.no-session p {
  font-size: 13px;
}

.session-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.session-chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
  flex-shrink: 0;
}

.session-chat-header .info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-chat-header .name {
  font-size: 16px;
  font-weight: 600;
}

.session-chat-header .user-id {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

.session-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.session-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.session-chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.user-typing {
  align-self: flex-start;
  font-size: 12px;
  color: var(--text-light);
  padding-left: 40px;
  display: none;
  align-items: center;
  gap: 4px;
}

.user-typing.active {
  display: flex;
}

.user-typing span {
  width: 5px;
  height: 5px;
  background: var(--text-light);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.user-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.user-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

.session-chat-input {
  border-top: 1px solid var(--border);
  background: var(--white);
  padding: 16px 24px;
  position: relative;
  flex-shrink: 0;
}

.quick-replies {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.quick-reply {
  padding: 6px 14px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border: none;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.quick-reply:hover {
  background: var(--primary);
  color: white;
}

/* ==================== 新增：首页（创建链接） ==================== */
.hero-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  padding: 40px 36px;
  max-width: 520px;
  width: 100%;
}
.create-card {
  text-align: center;
}
.hero-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-logo svg { width: 36px; height: 36px; }
.hero-logo.small { width: 54px; height: 54px; border-radius: 16px; }
.hero-logo.small svg { width: 26px; height: 26px; }
.create-card h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #1a1a1a;
}
.create-card .sub,
.login-card .sub {
  color: var(--text-light);
  font-size: 13px;
  margin-bottom: 28px;
  line-height: 1.8;
}
.form-row {
  text-align: left;
  margin-bottom: 20px;
}
.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}
.form-row label span {
  font-weight: normal;
  color: var(--text-light);
  font-size: 12px;
  margin-left: 6px;
}
.form-row input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  background: #fafbfc;
}
.form-row input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.15);
}
.inline-label {
  display: block;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin: 8px 0 8px;
}
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  gap: 6px;
}
.primary-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(79, 124, 255, 0.35);
}
.primary-btn:active:not(:disabled) { transform: translateY(0); }
.primary-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.primary-btn.big { width: 100%; padding: 13px 24px; font-size: 15px; border-radius: 12px; }
.primary-btn.full { width: 100%; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  background: transparent;
  color: #4b5563;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.ghost-btn:hover { background: #f3f4f6; border-color: #d1d5db; }
.ghost-btn.full { width: 100%; margin-top: 16px; }

.copy-btn {
  padding: 10px 16px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.copy-btn:hover { background: var(--primary); color: #fff; }

.result-box {
  margin-top: 32px;
  padding: 24px;
  background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 100%);
  border-radius: 14px;
  border: 1px solid #dbeafe;
  text-align: left;
}
.success-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #d1fae5;
  color: #065f46;
  font-size: 12px;
  font-weight: 700;
  border-radius: 20px;
  margin-bottom: 20px;
}
.success-tag svg { width: 14px; height: 14px; }

.link-section + .link-section { margin-top: 20px; }
.link-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  margin-bottom: 8px;
}
.link-label svg { width: 14px; height: 14px; }
.link-row {
  display: flex;
  gap: 8px;
}
.link-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12.5px;
  background: #fff;
  color: #374151;
  font-family: ui-monospace, Consolas, monospace;
  outline: none;
}
.tip {
  font-size: 11.5px;
  color: #6b7280;
  margin-top: 8px;
  line-height: 1.6;
}
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: #9ca3af;
  margin: 22px 0 14px;
}
.divider::before, .divider::after {
  content: ""; flex: 1;
  border-top: 1px dashed #e5e7eb;
}

/* ==================== 新增：Toast 轻提示 ==================== */
.toast {
  position: fixed;
  left: 50%;
  top: 32px;
  transform: translate(-50%, -20px);
  background: #1f2937;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 99999;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  max-width: 90vw;
  visibility: hidden;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  visibility: visible;
}
.toast.ok { background: #065f46; }
.toast.err { background: #991b1b; }
.toast.info { background: #1f2937; }

/* ==================== 新增：Chat.html 欢迎/登录屏 ==================== */
#chatContainer {
  position: relative;
}
.greet-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 20px;
  background: var(--bg);
}
@media (min-width: 768px) {
  .greet-screen { background: #fff; }
}
.greet-card {
  max-width: 340px;
  width: 100%;
  text-align: center;
  padding: 32px 24px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.08);
}
.error-ico {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: #ef4444;
  background: #fee2e2;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.error-ico svg { width: 32px; height: 32px; }
.greet-card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #111827;
}
.host-info-block { margin-bottom: 24px; }
.big-avatar {
  width: 80px; height: 80px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}
.online-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
}

.back-home {
  margin-left: auto;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.back-home:hover { background: rgba(255,255,255,0.25); }
.back-home svg { width: 18px; height: 18px; }

.host-avatar {
  color: #fff;
  font-weight: 600;
  background: linear-gradient(135deg, #667eea, #3a66e8);
}

/* ==================== 新增：Host 后台登录遮罩 ==================== */
.login-mask {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  width: 100%;
  max-width: 400px;
  padding: 36px 32px;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.25);
  text-align: center;
}
.login-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #111827;
}
.link-code-line {
  text-align: left;
  font-size: 12px;
  color: #6b7280;
  padding: 10px 14px;
  background: #f3f4f6;
  border-radius: 8px;
  margin: 4px 0 18px;
}
.link-code-line b {
  color: #111827;
  letter-spacing: 2px;
  font-size: 14px;
  margin-left: 6px;
  font-family: ui-monospace, Consolas, monospace;
}
#pwdInput {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbfc;
  outline: none;
  font-size: 14px;
  margin-bottom: 16px;
  transition: all 0.2s;
}
#pwdInput:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.15);
}
.warn-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  background: #fffbeb;
  color: #92400e;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 16px;
  text-align: left;
}
.warn-box svg {
  flex-shrink: 0;
  width: 20px; height: 20px;
  margin-top: 1px;
  color: #d97706;
}

/* Host 后台新增元素 */
.me-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}
.link-code {
  background: #f3f4f6;
  color: #374151;
  padding: 1px 7px;
  border-radius: 5px;
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 600;
  letter-spacing: 1px;
}
.tool-row {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tool-row .session-count {
  padding: 0;
  border: none;
}
.copy-link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border: none;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-link-btn:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 124, 255, 0.3);
}
.copy-link-btn svg { width: 14px; height: 14px; }

.online-small-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 2px;
}

.session-name > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* admin 后台的输入框颜色修正（沿用已有 input-wrapper） */
.session-chat-input .input-wrapper textarea {
  flex: 1;
  resize: none;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.5;
}
.session-chat-input .input-wrapper textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.15);
}

/* ==================== 举报弹窗样式 ==================== */
.header-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.action-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.action-btn:hover { background: rgba(255,255,255,0.25); }
.action-btn svg { width: 18px; height: 18px; }
.report-btn:hover { background: rgba(239, 68, 68, 0.3); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalPop 0.2s ease;
}
@keyframes modalPop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  margin: 0;
  font-size: 17px;
  color: #333;
}
.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #999;
  line-height: 1;
}
.modal-close:hover { color: #666; }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
}
.modal-desc {
  font-size: 13px;
  color: #666;
  margin: 0 0 16px;
}

.report-reasons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.report-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f8f9fa;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
}
.report-option:hover { background: #e9ecef; }
.report-option input { display: none; }
.report-option.selected,
.report-option input:checked + span {
  color: var(--primary);
  font-weight: 500;
}
.report-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}
.report-option span {
  position: relative;
  padding-left: 24px;
}
.report-option span::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border: 2px solid #ccc;
  border-radius: 50%;
}
.report-option input:checked + span::before {
  border-color: var(--primary);
  background: var(--primary);
}
.report-option input:checked + span::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
}

#reportDesc {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
#reportDesc:focus { border-color: var(--primary); }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.btn-secondary {
  padding: 10px 20px;
  background: #f5f7fa;
  color: #666;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { background: #e8eaed; }

/* ==================== 协议勾选框 ==================== */
.agreement-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px 0;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
}
.agreement-line input {
  margin-top: 2px;
  flex-shrink: 0;
}
.agreement-line label {
  cursor: pointer;
  text-align: left;
}
.agreement-line a {
  color: var(--primary);
  text-decoration: none;
}
.agreement-line a:hover { text-decoration: underline; }

/* ==================== 底部链接 ==================== */
.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #9ca3af;
  padding: 8px 0 0;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--primary);
  text-decoration: none;
}
.footer-links a:hover { text-decoration: underline; }
.footer-links span {
  color: #d1d5db;
}
.encryption-note {
  color: #9ca3af;
}

/* Toast 扩展样式 */
.toast.warn { background: #f59e0b; }
.toast.err { background: #ef4444; }

/* ==================== 会话恢复界面 ==================== */
.restore-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.btn-text {
  background: none;
  border: none;
  color: var(--primary, #4f7cff);
  font-size: 13px;
  cursor: pointer;
  padding: 8px;
  text-decoration: underline;
}
.btn-text:hover { opacity: 0.8; }

.clear-chat-btn:hover { background: rgba(239, 68, 68, 0.3); }

/* ==================== Host 设置按钮 ==================== */
.settings-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  transition: all 0.2s;
  white-space: nowrap;
}
.settings-btn:hover { background: var(--hover); border-color: var(--primary); color: var(--primary); }
.settings-btn svg { width: 14px; height: 14px; }

/* ==================== 设置弹窗 ==================== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-box {
  background: #fff;
  border-radius: 16px;
  width: 90%; max-width: 560px; max-height: 85vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; font-weight: 600; margin: 0; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-light);
  display: flex; align-items: center;
}
.modal-close svg { width: 20px; height: 20px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); text-align: right; }

/* 设置区块 */
.settings-section { margin-bottom: 24px; }
.settings-section-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 600; margin-bottom: 10px;
}

/* 快捷回复编辑器 */
.qr-editor-list { display: flex; flex-direction: column; gap: 8px; }
.qr-edit-item { display: flex; gap: 8px; align-items: center; }
.qr-input {
  flex: 1; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px;
}
.qr-input:focus { outline: none; border-color: var(--primary); }
.qr-del-btn {
  background: none; border: none; cursor: pointer;
  color: #ef4444; padding: 6px;
  display: flex; align-items: center;
}
.qr-del-btn svg { width: 16px; height: 16px; }
.qr-add-btn {
  background: none; border: 1px dashed var(--primary);
  color: var(--primary); padding: 4px 12px;
  border-radius: 6px; cursor: pointer; font-size: 12px;
}
.qr-add-btn:hover { background: var(--hover); }

/* 开关 */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #ccc; border-radius: 22px; transition: 0.3s;
}
.slider:before {
  content: ""; position: absolute;
  height: 16px; width: 16px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: 0.3s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(18px); }

/* 类型选择器 */
.type-selector { display: flex; gap: 8px; margin-bottom: 10px; }
.type-btn {
  padding: 6px 16px; border: 1px solid var(--border);
  background: #fff; border-radius: 8px; cursor: pointer;
  font-size: 13px; color: var(--text);
}
.type-btn.active { border-color: var(--primary); background: var(--primary); color: #fff; }

.settings-row textarea {
  width: 100%; padding: 10px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; resize: vertical;
}
.settings-row textarea:focus { outline: none; border-color: var(--primary); }
.settings-row input[type="file"] { width: 100%; }
.image-preview {
  max-width: 200px; max-height: 200px;
  margin-top: 8px; border-radius: 8px;
  border: 1px solid var(--border);
}

/* 备注标签 */
.alias-tag {
  display: inline-block;
  font-size: 11px; color: var(--text-light);
  background: var(--hover); padding: 1px 6px;
  border-radius: 4px; margin-left: 4px;
  text-decoration: line-through;
}

/* 备注按钮 */
.rename-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px; background: transparent;
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: 12px; color: var(--text);
}
.rename-btn:hover { background: var(--hover); border-color: var(--primary); color: var(--primary); }
.rename-btn svg { width: 14px; height: 14px; }

/* 自动回复标签 */
.auto-reply-tag {
  display: inline-block;
  font-size: 10px; color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
  padding: 1px 5px; border-radius: 3px;
  margin-left: 4px;
}

/* 消息中的图片 */
.msg-image {
  max-width: 220px; max-height: 220px;
  border-radius: 8px; margin-bottom: 4px;
  cursor: pointer; display: block;
  transition: transform 0.2s;
}
.msg-image:hover { transform: scale(1.02); }

/* ==================== 图片预览 ==================== */
.image-preview-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s;
  cursor: zoom-out;
}
.image-preview-overlay.show { opacity: 1; }
.image-preview-inner {
  position: relative;
  max-width: 90vw; max-height: 90vh;
  display: flex; align-items: center; justify-content: center;
}
.image-preview-img {
  max-width: 90vw; max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  transform: scale(0.8);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  user-select: none;
  pointer-events: none;
}
.image-preview-overlay.show .image-preview-img { transform: scale(1); }
.image-preview-close {
  position: absolute; top: -40px; right: 0;
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.15);
  color: #fff; border: none;
  border-radius: 50%;
  font-size: 22px; font-weight: 700;
  cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.image-preview-close:hover { background: rgba(255,255,255,0.3); }

/* ==================== 创建链接页：验证设置 ==================== */
.verify-section { padding: 12px 16px; background: var(--hover); border-radius: 12px; }
.verify-toggle-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 500; cursor: pointer;
}
.verify-toggle-label .sub-label { font-size: 12px; color: var(--text-light); font-weight: 400; }
.verify-config { margin-top: 12px; }
.verify-type-row { display: flex; gap: 8px; margin-bottom: 10px; }
.verify-field { margin-bottom: 8px; }
.verify-field label { display: block; font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.verify-field input {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px;
}
.verify-field input:focus { outline: none; border-color: var(--primary); }

/* ==================== 访客验证界面 ==================== */
.verify-box {
  width: 100%;
  padding: 24px 20px;
  background: var(--hover);
  border-radius: 16px;
  text-align: center;
}
.verify-icon {
  width: 48px; height: 48px;
  margin: 0 auto 12px;
  color: var(--primary);
}
.verify-icon svg { width: 100%; height: 100%; }
.verify-prompt {
  font-size: 16px; font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  word-break: break-word;
}
.verify-box input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  text-align: center;
  margin-bottom: 12px;
}
.verify-box input:focus { outline: none; border-color: var(--primary); }
.verify-hint {
  font-size: 12px; color: var(--text-light);
  margin-top: 8px;
}

/* ==================== 极简验证界面 ==================== */
.verify-minimal {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px;
  gap: 22px;
  overflow: hidden;
  isolation: isolate;
}
.verify-minimal::before {
  /* 顶部/底部装饰马赛克背景 */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(135deg, rgba(102,126,234,0.08) 0%, rgba(118,75,162,0.08) 100%);
  filter: blur(4px);
  pointer-events: none;
}
.verify-lock {
  width: 64px; height: 64px;
  color: #667eea;
  display: flex; align-items: center; justify-content: center;
  filter: blur(0);
  position: relative;
  z-index: 2;
}
.verify-lock svg { width: 100%; height: 100%; }

/* 马赛克装饰层 —— 模拟"其他信息已马赛克"的视觉 */
.verify-mosaic {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  opacity: 0.75;
  background-image:
    linear-gradient(90deg, #d1d5db 25%, transparent 25%, transparent 50%, #d1d5db 50%, #d1d5db 75%, transparent 75%),
    linear-gradient(0deg, rgba(209,213,219,0.4) 25%, transparent 25%, transparent 50%, rgba(209,213,219,0.4) 50%, rgba(209,213,219,0.4) 75%, transparent 75%);
  background-size: 12px 12px, 12px 12px;
}
.verify-mosaic::before,
.verify-mosaic::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 18px;
  background: repeating-linear-gradient(
    90deg,
    #d1d5db 0 8px, #e5e7eb 8px 16px, #cbd5e1 16px 24px, #e5e7eb 24px 32px
  );
  border-radius: 6px;
  opacity: 0.85;
  filter: blur(0.5px);
}
.verify-mosaic::before { top: 10px; }
.verify-mosaic::after  { bottom: 10px; }

/* 让文本和输入框浮在马赛克之上 */
.verify-lock,
.verify-hint-text,
.verify-minimal input,
.verify-minimal .primary-btn {
  position: relative;
  z-index: 2;
}

.verify-hint-text {
  font-size: 15px;
  color: #6b7280;
  margin: 0;
  text-align: center;
  line-height: 1.8;
}
.verify-prompt-inline {
  display: inline-block;
  padding: 1px 10px;
  margin: 0 2px;
  color: #fff;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(102,126,234,0.35);
}
.verify-minimal input {
  width: 100%;
  max-width: 320px;
  padding: 14px 18px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  text-align: center;
  background: #f9fafb;
  transition: all 0.2s;
}
.verify-minimal input:focus {
  outline: none;
  border-color: #667eea;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(102,126,234,0.1);
}
.verify-minimal .primary-btn {
  width: 100%;
  max-width: 320px;
}
.verify-error {
  display: none;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  margin: 8px 0;
  text-align: center;
  animation: shake 0.35s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.session-chat-input .input-wrapper button {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.session-chat-input .input-wrapper button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}
.session-chat-input .input-wrapper button svg {
  width: 20px; height: 20px;
}

/* 手机端适配：后台横向滚动条隐藏 */
@media (max-width: 768px) {
  .admin-container { flex-direction: column; height: auto; min-height: 100vh; }
  .sidebar { width: 100%; max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
  .card { padding: 28px 22px; }
}

/* ==================== 首页账号系统样式 ==================== */
.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  color: #fff;
  margin-bottom: 16px;
}
.account-info { display: flex; align-items: center; gap: 10px; }
.account-avatar {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.account-name { font-weight: 600; font-size: 15px; }
.account-sub { font-size: 11px; opacity: 0.85; }
.account-actions { display: flex; gap: 6px; }
.ghost-btn.small { padding: 6px 12px; font-size: 12px; background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.3); color: #fff; }
.ghost-btn.small:hover { background: rgba(255,255,255,0.35); }
.ghost-btn.small.danger { background: rgba(239,68,68,0.3); border-color: rgba(239,68,68,0.5); }
.ghost-btn.small.danger:hover { background: rgba(239,68,68,0.5); }

.auth-section { text-align: center; }
.auth-tabs {
  display: flex;
  gap: 0;
  background: #f3f4f6;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  padding: 8px 16px;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
  transition: all 0.2s;
}
.auth-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.auth-form { text-align: left; }
.auth-hint {
  font-size: 12px;
  color: #6b7280;
  margin-top: 16px;
  line-height: 1.6;
}
.compact-sub { margin-bottom: 16px; }

.form-row.compact { margin-bottom: 12px; }
.form-row.compact input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  background: #fafbfc;
}
.form-row.compact input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.15);
}

.compact-verify { padding: 10px 14px; margin-bottom: 14px; }
.verify-field input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  width: 100%;
}
.verify-field { margin-bottom: 6px; }

.create-form { text-align: left; }

.my-links-box { margin-top: 16px; }
.my-links-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.my-links-header h3 { font-size: 16px; font-weight: 600; color: #111827; margin: 0; }
.my-links-list { display: flex; flex-direction: column; gap: 8px; }
.my-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid #f3f4f6;
}
.my-link-info { flex: 1; min-width: 0; }
.my-link-name {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
  margin-bottom: 2px;
}
.my-link-code {
  font-size: 11px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 1px 7px;
  border-radius: 4px;
  font-family: ui-monospace, Consolas, monospace;
  margin-left: 4px;
}
.my-link-meta {
  font-size: 11px;
  color: #6b7280;
}
.my-link-actions { display: flex; gap: 6px; flex-shrink: 0; }
.my-link-actions button {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
}
.my-link-actions button:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.my-link-actions .edit-btn {
  color: #6b7280;
}
.my-link-actions .enter-btn {
  color: #059669;
  border-color: #a7f3d0;
  background: #ecfdf5;
}
.my-link-actions .enter-btn:hover {
  background: #d1fae5;
  border-color: #059669;
}

/* 编辑弹窗 */
.edit-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.edit-modal-inner {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}
.edit-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
}
.edit-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.edit-close {
  border: none;
  background: transparent;
  font-size: 24px;
  color: #9ca3af;
  cursor: pointer;
  line-height: 1;
}
.edit-close:hover { color: #374151; }
.edit-modal-body {
  padding: 20px;
}
.edit-link-code {
  text-align: center;
  padding: 8px 12px;
  background: linear-gradient(135deg, #667eea20, #764ba220);
  border-radius: 8px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 16px;
}
.edit-modal-body .form-row label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
  font-weight: 500;
}
.edit-verify-section {
  margin-top: 16px;
  padding: 14px;
  background: #f9fafb;
  border-radius: 10px;
}
.edit-verify-section .verify-toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 500;
}
.edit-verify-config {
  margin-top: 12px;
}
.edit-verify-config .verify-type-row {
  margin-bottom: 10px;
}
.edit-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid #f3f4f6;
}
.edit-modal-footer .primary-btn {
  padding: 8px 20px;
  font-size: 14px;
}
.empty-hint {
  text-align: center;
  color: #9ca3af;
  padding: 20px;
  font-size: 13px;
}

/* host.html 侧边栏增加历史会话入口 */
.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.sidebar-footer-btn {
  width: 100%;
  padding: 8px 12px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sidebar-footer-btn:hover { background: var(--primary); color: #fff; }
.sidebar-footer-btn svg { width: 16px; height: 16px; }

/* 历史会话面板 */
.history-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.history-panel.show { display: flex; }
.history-panel-inner {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.history-panel-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.history-panel-header h3 { margin: 0; font-size: 18px; font-weight: 600; }
.history-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}
.history-session-item {
  padding: 12px 14px;
  background: #f9fafb;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.history-session-item:hover { background: var(--primary-light); }
.history-session-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.history-session-name { font-weight: 600; font-size: 14px; }
.history-session-time { font-size: 11px; color: #6b7280; }
.history-session-meta { font-size: 12px; color: #6b7280; }
.history-session-meta span { margin-right: 10px; }
.history-ip {
  font-family: ui-monospace, Consolas, monospace;
  color: #ef4444;
  font-size: 11px;
}

/* 验证码 */
.captcha-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.captcha-row input {
  flex: 1;
}
.captcha-img {
  flex-shrink: 0;
  width: 130px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  background: #f0f4f8;
  display: flex;
  align-items: center;
  justify-content: center;
}
.captcha-img svg { width: 100%; height: 100%; }
.captcha-img:hover { opacity: 0.85; }

/* 会话项：拉黑相关 */
.session-item-blocked {
  opacity: 0.55;
  background: #fef2f2 !important;
  border-left: 3px solid #ef4444 !important;
}
/* 批量选择 */
.session-check {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}
.session-item.batch-selected {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
}
.batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--primary-light);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
  position: relative;
  z-index: 10;
}
.batch-bar-info b { color: var(--primary); }
.batch-actions { display: flex; gap: 6px; }
.batch-btn {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
}
.batch-btn:hover { background: var(--bg); }
.batch-btn.batch-delete { background: #ef4444; border-color: #ef4444; color: #fff; }
.batch-btn.batch-delete:hover { background: #dc2626; }
.batch-btn.batch-delete:disabled { opacity: 0.5; cursor: not-allowed; background: #fca5a5; border-color: #fca5a5; }
.settings-btn.active {
  background: var(--primary-light);
  color: var(--primary);
}
.block-action-btn {
  font-size: 11px;
  padding: 3px 8px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  background: none;
}
.block-action-btn.block { color: #ef4444; }
.block-action-btn.block:hover { background: #fef2f2; }
.block-action-btn.unblock { color: #10b981; }
.block-action-btn.unblock:hover { background: #ecfdf5; }

