/* 主题变量 */
:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --input-bg: #f1f5f9;
  --msg-self: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --msg-other: #f1f5f9;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --input-bg: #1e293b;
  --msg-self: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --msg-other: #1e293b;
}

/* 通用样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: all 0.3s;
}

.container { 
  max-width: 800px; 
  margin: 0 auto; 
  min-height: 100vh; 
  display: flex; 
  flex-direction: column; 
}

.form-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--input-bg);
  border: 2px solid transparent;
  border-radius: 14px;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 14px;
  outline: none;
  transition: all 0.3s;
}

.form-input:focus { 
  border-color: var(--primary); 
  background: var(--card); 
}

.btn-primary, .btn-secondary, .btn {
  width: 100%;
  padding: 16px;
  background: var(--gradient);
  border: none;
  border-radius: 14px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
  transition: all 0.3s;
}

.btn-primary:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4); 
}

.btn-secondary {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease; }

/* 移动端适配 */
@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .form-input { padding: 12px 14px; font-size: 14px; }
  .btn-primary, .btn-secondary, .btn { padding: 14px; font-size: 15px; }
}
/* 登录页 */
#loginUI { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  min-height: 100vh; 
  padding: 20px; 
  position: relative; 
}

.btn-theme {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.login-card {
  background: var(--card);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}

.login-header { text-align: center; margin-bottom: 32px; }

.login-logo {
  width: 64px;
  height: 64px;
  background: var(--gradient);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
}

.login-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.login-subtitle { color: var(--text-muted); font-size: 14px; }

/* 登录 Tab */
.login-tabs {
  display: flex;
  margin-bottom: 24px;
  background: var(--input-bg);
  border-radius: 14px;
  padding: 4px;
}

.login-tab {
  flex: 1;
  text-align: center;
  padding: 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s;
}

.login-tab.active {
  background: var(--card);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.2);
}

/* 记住我 */
.input-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.remember-me input { display: none; }

.remember-me .checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.remember-me input:checked + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.remember-me input:checked + .checkmark::after {
  content: '✓';
  color: white;
  font-size: 12px;
}

.show-password {
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.show-password:hover { opacity: 1; }

/* 错误提示 */
.auth-error {
  color: #ef4444;
  font-size: 13px;
  margin-bottom: 12px;
  display: none;
}

/* 登录切换 */
.auth-switch {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
}

.auth-switch:hover { color: var(--primary); }

/* 管理员登录按钮 */
.admin-login-link {
  display: block;
  text-align: center;
  padding: 16px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  text-decoration: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 16px;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
  transition: all 0.3s;
}

.admin-login-link:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4); 
}

/* 下载区域 */
.download-section { margin-top: 24px; }

.download-divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
}

.download-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--border);
}

.download-divider span {
  background: var(--card);
  padding: 0 16px;
  color: var(--text-muted);
  font-size: 13px;
  position: relative;
}

.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  text-decoration: none;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.download-btn:hover { 
  transform: translateY(-3px); 
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4); 
}

.qr-wrapper {
  text-align: center;
  margin-top: 20px;
  padding: 16px;
  background: var(--input-bg);
  border-radius: 16px;
}

.qr-wrapper img { width: 110px; height: 110px; border-radius: 12px; }
.qr-wrapper p { font-size: 13px; color: var(--text-muted); margin-top: 10px; }

/* 聊天页 */
#chatUI { display: none; }

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

.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.user-avatar {
  width: 48px;
  height: 48px;
  background: var(--gradient);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  flex-shrink: 0;
}

.user-name { font-size: 16px; font-weight: 600; white-space: nowrap; }

.btn-new {
  padding: 10px 18px;
  background: var(--gradient);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
  transition: all 0.3s;
}

.btn-new:hover { 
  transform: translateY(-1px); 
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4); 
}

.btn-logout {
  padding: 10px 18px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.3);
  transition: all 0.3s;
}

.btn-logout:hover { 
  transform: translateY(-1px); 
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4); 
}

/* 悬浮按钮 */
.floating-theme {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 48px;
  height: 48px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  touch-action: none;
  user-select: none;
}

.floating-theme:active { transform: scale(1.1); }

/* 对话标签 */
.chat-tabs {
  display: flex;
  gap: 10px;
  padding: 14px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.chat-tabs::-webkit-scrollbar { display: none; }

.chat-tab {
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-tab.active {
  background: var(--gradient);
  color: white;
  border-color: transparent;
}

.chat-tab .close {
  margin-left: 6px;
  opacity: 0.7;
}

.chat-tab .close:hover { opacity: 1; }

/* 消息区域 */
.chat-main {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.messages { display: flex; flex-direction: column; gap: 16px; }

.message {
  display: flex;
  gap: 12px;
  max-width: 85%;
}

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

.msg-avatar {
  width: 36px;
  height: 36px;
  background: var(--gradient);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}

.msg-content {
  padding: 12px 16px;
  background: var(--msg-other);
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}

.message.self .msg-content {
  background: var(--msg-self);
  color: white;
}

/* 输入区域 */
.input-area {
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.quick-btns {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.quick-btn {
  padding: 8px 14px;
  background: var(--input-bg);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-btn:hover { background: var(--border); }

.input-box {
  display: flex;
  gap: 10px;
  background: var(--input-bg);
  border-radius: 14px;
  padding: 4px;
}

.input-box input {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.btn-send {
  width: 46px;
  height: 46px;
  background: var(--gradient);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-send:hover { transform: scale(1.05); }

/* 等待动画 */
.msg-content.thinking {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}

.msg-content.thinking .dot {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.msg-content.thinking .dot:nth-child(1) { animation-delay: -0.32s; }
.msg-content.thinking .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* 管理员页 */
#adminUI { display: none; }

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.admin-header h2 { 
  font-size: 20px; 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  color: white;
}

.admin-header .btn-logout {
  background: rgba(255,255,255,0.2);
  color: white;
}

.user-table { 
  background: var(--card); 
  border-radius: 20px; 
  overflow: hidden; 
  box-shadow: var(--shadow); 
}

.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  transition: all 0.3s;
}

.user-row:hover { 
  background: var(--input-bg); 
  transform: translateX(4px);
}

.user-row:last-child { border-bottom: none; }
.user-info { flex: 1; }

.user-name { 
  font-weight: 600; 
  font-size: 16px; 
  display: flex; 
  align-items: center; 
  gap: 10px; 
}

.user-name::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.admin-badge {
  font-size: 11px;
  padding: 3px 10px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border-radius: 12px;
  font-weight: 500;
}

.user-meta { font-size: 13px; color: var(--text-muted); margin-top: 8px; display: flex; gap: 16px; }
.user-pwd, .user-time { display: flex; align-items: center; gap: 6px; }

.user-status {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  margin-right: 12px;
}

.user-status.enabled { 
  background: linear-gradient(135deg, #10b981 0%, #059669 100%); 
  color: white; 
}

.user-status.disabled { 
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); 
  color: white; 
}

.user-actions { display: flex; gap: 8px; }

.user-actions button {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-enable { background: #10b981; color: white; }
.btn-enable:hover { background: #059669; transform: translateY(-1px); }

.btn-disable { background: #f59e0b; color: white; }
.btn-disable:hover { background: #d97706; transform: translateY(-1px); }

.btn-delete { background: #ef4444; color: white; }
.btn-delete:hover { background: #dc2626; transform: translateY(-1px); }

.loading, .empty { 
  text-align: center; 
  padding: 40px; 
  color: var(--text-muted); 
}

/* 移动端适配 */
@media (max-width: 480px) {
  .login-card { padding: 24px 20px; }
  .login-logo { width: 56px; height: 56px; font-size: 24px; }
  .login-title { font-size: 20px; }
  
  .chat-header { padding: 12px 0; }
  .header-left { gap: 6px; }
  .header-right { gap: 6px; }
  .user-avatar { width: 36px; height: 36px; font-size: 14px; }
  .user-name { font-size: 13px; }
  .btn-new, .btn-logout { padding: 6px 10px; font-size: 12px; }
  .btn-theme { width: 32px; height: 32px; font-size: 14px; }
  
  .chat-tabs { gap: 6px; padding: 10px 0; }
  .chat-tab { padding: 6px 10px; font-size: 12px; }
  
  .message { max-width: 90%; gap: 8px; }
  .msg-avatar { width: 32px; height: 32px; font-size: 14px; }
  .msg-content { padding: 10px 14px; font-size: 14px; border-radius: 14px; }
  
  .input-area { padding: 12px 0; }
  .quick-btns { gap: 8px; margin-bottom: 10px; }
  .quick-btn { padding: 6px 10px; font-size: 12px; }
  .input-box { padding: 3px; }
  .input-box input { padding: 10px 12px; font-size: 14px; }
  .btn-send { width: 40px; height: 40px; font-size: 16px; }
  
  .form-input { padding: 12px 14px; font-size: 14px; }
  .btn-primary, .btn-secondary { padding: 16px; font-size: 14px; }
  
  .admin-header { padding: 16px; }
  .admin-header h2 { font-size: 16px; }
  .user-row { padding: 14px; }
  .user-name { font-size: 14px; }
  .user-meta { font-size: 12px; gap: 10px; }
  .user-actions button { padding: 6px 10px; font-size: 11px; }
}

/* 修复panel显示 */
/* 主题切换按钮 */
.btn-theme {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card);
  border: none;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 100;
}

/* 模式选择栏 */
.rag-mode-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin: 8px 0;
  background: #f8fafc;
  border-radius: 12px;
}

.rag-label {
  font-size: 14px;
  color: #64748b;
  white-space: nowrap;
}

.rag-mode-bar select {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  font-size: 14px;
  cursor: pointer;
}

.btn-upload {
  padding: 8px 14px;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

/* 输入框区域 */
.input-area {
  padding: 16px 20px;
  background: var(--card);
  border-top: 1px solid var(--border);
}

/* 聊天页面固定高度，内容滚动 */
#chatUI {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#chatUI .chat-main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 登录页不应用 */
#loginUI {
  height: auto;
  overflow: auto;
}

/* 统一管理员登录按钮高度 */
.admin-login-link {
  padding: 16px;
  font-size: 16px;
  margin-top: 0;
  margin-bottom: 12px;
}

/* ==================== 管理后台美化 ==================== */

/* 头部 */
.admin-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.admin-header h2 {
  font-size: 20px;
}


/* 标签页 */
.admin-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  padding: 0;
  background: transparent;
  border-bottom: none;
}

.admin-tab {
  padding: 12px 24px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 50px;
  font-size: 14px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.3s;
}

.admin-tab:hover {
  border-color: #667eea;
  color: #667eea;
}

.admin-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.35);
}

/* 内容区域 */
.admin-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

/* 面板 */
.kb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.kb-header h3 {
  font-size: 18px;
  color: #1e293b;
}

/* 表格 */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
}

table th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
}

table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #475569;
}

table tr:hover {
  background: #f8fafc;
}

table tr:last-child td {
  border-bottom: none;
}

/* 预览区域 */
.kb-preview {
  margin-top: 24px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
}

.kb-preview h3 {
  margin-bottom: 16px;
  color: #1e293b;
}

.kb-preview select {
  width: 100%;
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 16px;
  background: white;
}

.kb-preview select:focus {
  outline: none;
  border-color: #667eea;
}

/* 面板显示控制 */
.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block !important;
}

/* Modal 弹窗样式 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9998;
  padding: 20px;
  box-sizing: border-box;
}

.modal.show {
  display: flex !important;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 10000;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  font-size: 16px;
  margin: 0;
}

.modal-body {
  padding: 20px;
}

.modal-body label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}

.modal-body .form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.modal-body textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.modal-body input[type="file"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px dashed #ddd;
  border-radius: 8px;
  background: var(--input-bg);
  font-size: 14px;
}

.modal-body .tip {
  font-size: 12px;
  color: #888;
  margin-top: -12px;
  margin-bottom: 16px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
  width: auto;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 0;
  box-shadow: none;
}

.modal-footer .btn-primary {
  background: var(--gradient);
  color: white;
  border: none;
}

.modal-footer .btn-secondary {
  background: #f5f5f5;
  color: #666;
  border: 1px solid #ddd;
}

.error {
  color: #ef4444;
  font-size: 13px;
  margin: 8px 0;
}

/* 管理后台样式 */
.admin-tabs {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-bottom: 1px solid #eee;
  overflow-x: auto;
}

.admin-tab {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: #f5f5f5;
  color: #666;
  transition: all 0.2s;
  white-space: nowrap;
}

.admin-tab.active {
  background: #6366f1;
  color: white;
}

.admin-content {
  padding: 20px;
}

.admin-panel {
  display: none;
}

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

.kb-header, .vector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.kb-header h3, .vector-header h3 {
  font-size: 16px;
  margin: 0;
  flex-shrink: 0;
}

.user-table, .kb-table, .vector-table {
  background: white;
  border-radius: 8px;
  overflow: hidden;
}

.loading {
  text-align: center;
  padding: 20px;
  color: #888;
}

/* 管理后台按钮优化 */
.admin-panel .btn-primary {
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
  margin-bottom: 0;
  box-shadow: none;
}

.admin-panel .btn-primary:hover {
  transform: none;
}

.kb-header .btn-primary,
.vector-header .btn-primary {
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
  margin-bottom: 0;
  box-shadow: none;
}

.kb-header .btn-primary:hover,
.vector-header .btn-primary:hover {
  transform: none;
}

/* 弹窗内按钮 */
.modal-footer .btn-primary,
.modal-footer .btn-secondary {
  width: auto;
  padding: 8px 20px;
  font-size: 14px;
  margin-bottom: 0;
  box-shadow: none;
}

/* 强制覆盖按钮宽度 */
.kb-header .btn-primary,
.vector-header .btn-primary,
.admin-panel .btn-primary {
  width: auto !important;
  padding: 8px 16px !important;
  font-size: 13px !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
  width: auto !important;
  padding: 8px 20px !important;
  font-size: 14px !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
}

/* 管理后台compact按钮 */
.kb-header .btn-primary,
.vector-header .btn-primary {
  display: inline-block !important;
  width: auto !important;
  min-width: unset !important;
  max-width: none !important;
  padding: 6px 12px !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
  white-space: nowrap !important;
  margin: 0 !important;
  box-shadow: none !important;
  border-radius: 6px !important;
  text-align: center !important;
  flex: unset !important;
}

.kb-header .btn-primary:hover,
.vector-header .btn-primary:hover {
  transform: none !important;
}

/* 弹窗底部按钮 */
.modal-footer {
  display: flex !important;
  flex-direction: row !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 12px 16px !important;
  border-top: 1px solid #eee !important;
  background: #fafafa !important;
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
  display: inline-block !important;
  width: auto !important;
  min-width: unset !important;
  max-width: none !important;
  padding: 6px 16px !important;
  font-size: 13px !important;
  line-height: 1.4 !important;
  white-space: nowrap !important;
  margin: 0 !important;
  box-shadow: none !important;
  border-radius: 6px !important;
  text-align: center !important;
  flex: unset !important;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 10000;
}

.modal-header h3 {
  font-size: 15px !important;
  font-weight: 600 !important;
  margin: 0 !important;
}

.modal-body {
  padding: 16px !important;
}

.modal-body label {
  display: block !important;
  font-size: 12px !important;
  color: #666 !important;
  margin-bottom: 6px !important;
  font-weight: 500 !important;
}
