:root {
  --primary: #1a5276;
  --primary-light: #2980b9;
  --primary-dark: #154360;
  --bg: #f0f2f5;
  --chat-bg: #e5ddd5;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #657786;
  --border: #e1e8ed;
  --green: #25d366;
  --green-dark: #128c7e;
  --ai-bg: #e3f2fd;
  --ai-border: #2980b9;
  --bubble-me: #dcf8c6;
  --bubble-other: #ffffff;
  --bubble-ai: #e3f2fd;
  --online: #25d366;
  --orange: #e67e22;
  --red: #e74c3c;
}

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

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

/* ===== App Container ===== */
#app {
  display: flex;
  height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--primary-dark);
  color: white;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-header .subtitle {
  font-size: 12px;
  opacity: 0.6;
  margin-top: 2px;
}

.sidebar-stats {
  display: flex;
  gap: 12px;
  padding: 8px 16px;
  font-size: 12px;
  opacity: 0.7;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-info {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

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

.user-info .user-name { font-size: 14px; font-weight: 500; }
.user-info .user-meta { font-size: 11px; opacity: 0.6; margin-top: 1px; }

/* Sidebar action buttons */
.sidebar-actions {
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.action-btn {
  background: rgba(255,255,255,0.1);
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}

.action-btn:hover { background: rgba(255,255,255,0.2); }

.action-btn.admin-only {
  background: rgba(231,76,60,0.3);
  width: 100%;
}

.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.channel-list::-webkit-scrollbar { width: 4px; }
.channel-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.channel-category {
  padding: 12px 16px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.4;
  font-weight: 600;
}

.channel-item {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 14px;
  position: relative;
}

.channel-item:hover { background: rgba(255,255,255,0.08); }
.channel-item.active { background: rgba(255,255,255,0.15); }
.channel-item .channel-icon { font-size: 18px; width: 24px; text-align: center; }
.channel-item .channel-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Chat Area ===== */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--chat-bg);
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4cfc4' fill-opacity='0.15'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.chat-header {
  background: var(--primary);
  color: white;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  z-index: 10;
}

.chat-header .menu-btn { display: none; font-size: 20px; cursor: pointer; background: none; border: none; color: white; }
.chat-header .channel-icon { font-size: 22px; }
.chat-header .channel-title { flex: 1; }
.chat-header .channel-title h2 { font-size: 16px; font-weight: 600; }
.chat-header .channel-title .channel-desc { font-size: 12px; opacity: 0.7; }

.header-action-btn {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.8;
  padding: 4px 8px;
  border-radius: 6px;
}
.header-action-btn:hover { opacity: 1; background: rgba(255,255,255,0.1); }

.online-indicator {
  font-size: 12px;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--online);
  display: inline-block;
}

/* ===== Pinned Messages ===== */
.pinned-area {
  background: #fff9e6;
  border-bottom: 1px solid #ffe082;
  padding: 8px 16px;
  max-height: 120px;
  overflow-y: auto;
}

.pinned-item {
  font-size: 13px;
  color: #5d4037;
  margin-bottom: 4px;
}

/* ===== Messages Area ===== */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.messages-area::-webkit-scrollbar { width: 6px; }
.messages-area::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 6px; }

.message {
  display: flex;
  gap: 8px;
  max-width: 80%;
  animation: fadeIn 0.3s ease;
}

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

.message.me { align-self: flex-end; flex-direction: row-reverse; }
.message.ai { align-self: flex-start; max-width: 90%; }

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 4px;
}

.message.ai .message-avatar { background: linear-gradient(135deg, #2980b9, #8e44ad) !important; }

.message-content { display: flex; flex-direction: column; gap: 2px; }
.message.me .message-content { align-items: flex-end; }

.message-sender {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 4px;
  margin-right: 4px;
}

.message.me .message-sender { display: none; }

.message-bubble {
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}

.message.me .message-bubble { background: var(--bubble-me); border-bottom-right-radius: 4px; }
.message.other .message-bubble { background: var(--bubble-other); border-bottom-left-radius: 4px; }
.message.ai .message-bubble {
  background: var(--bubble-ai);
  border: 1px solid var(--ai-border);
  border-bottom-left-radius: 4px;
  max-width: 600px;
}

.message.ai .message-bubble::before {
  content: '🤖 AI';
  display: inline-block;
  background: var(--ai-border);
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-bottom: 6px;
  font-weight: 600;
}

.ai-source-q {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(0,0,0,0.1);
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

.message-time {
  font-size: 10px;
  color: var(--text-secondary);
  margin: 0 4px;
}

.msg-actions {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.msg-actions button {
  background: rgba(0,0,0,0.05);
  border: none;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.6;
}

.msg-actions button:hover { opacity: 1; }

/* Typing indicator */
.typing-indicator {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  display: none;
}

.typing-indicator.active {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

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

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

/* ===== Input Area ===== */
.input-area {
  padding: 10px 16px;
  background: #f0f0f0;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.input-area textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  resize: none;
  max-height: 100px;
  min-height: 40px;
  font-family: inherit;
  outline: none;
  background: white;
  line-height: 1.4;
}

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

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.send-btn:hover { background: var(--primary-light); }
.send-btn:disabled { background: #ccc; cursor: not-allowed; }

.ai-hint {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 2px 16px 4px;
  background: #f0f0f0;
}

.ai-hint code {
  background: var(--ai-bg);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--primary);
  font-size: 11px;
}

/* ===== Auth Screens ===== */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a5276, #154360);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
}

.auth-card {
  background: white;
  border-radius: 16px;
  padding: 40px 30px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  margin: auto;
}

.auth-card h1 {
  text-align: center;
  color: var(--primary);
  font-size: 24px;
  margin-bottom: 4px;
}

.auth-card .auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 30px;
}

.auth-card .logo {
  text-align: center;
  font-size: 48px;
  margin-bottom: 10px;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border 0.2s;
  font-family: inherit;
  background: white;
}

.form-group input:focus,
.form-group select:focus { border-color: var(--primary-light); }

.auth-btn {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 10px;
  font-family: inherit;
}

.auth-btn:hover { background: var(--primary-light); }
.auth-btn:disabled { background: #ccc; cursor: not-allowed; }

.auth-error {
  background: #fdedec;
  color: #c0392b;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
  display: none;
}

.auth-error.show { display: block; }

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--primary-light);
  text-decoration: none;
}

.text-btn {
  display: block;
  width: 100%;
  text-align: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  padding: 10px;
  margin-top: 8px;
  font-family: inherit;
}

/* ===== Privacy Gate ===== */
.privacy-card {
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.privacy-icon {
  text-align: center;
  font-size: 40px;
  margin-bottom: 8px;
}

.privacy-content {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 16px;
  margin: 16px 0;
  max-height: 300px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
}

.privacy-content h3 {
  color: var(--primary);
  font-size: 14px;
  margin-top: 12px;
  margin-bottom: 4px;
}

.privacy-content h3:first-child { margin-top: 0; }
.privacy-content p { color: #555; margin-bottom: 8px; }

.full-policy-link {
  display: block;
  text-align: center;
  margin-top: 8px;
  color: var(--primary-light);
  text-decoration: none;
  font-size: 13px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 14px;
  cursor: pointer;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* ===== Tutorial ===== */
.tutorial-container {
  background: white;
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.tutorial-progress {
  height: 4px;
  background: #e1e8ed;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  width: 14%;
  transition: width 0.3s ease;
  border-radius: 0 4px 4px 0;
}

.tutorial-slides {
  flex: 1;
  overflow-y: auto;
  padding: 40px 30px;
  position: relative;
  min-height: 300px;
}

.tutorial-slide {
  display: none;
  text-align: center;
  animation: slideIn 0.4s ease;
}

.tutorial-slide.active {
  display: block;
}

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

.slide-emoji {
  font-size: 56px;
  margin-bottom: 16px;
  animation: bounce 2s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.tutorial-slide h2 {
  color: var(--primary);
  font-size: 22px;
  margin-bottom: 8px;
}

.tutorial-slide p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 8px;
}

.slide-detail {
  color: #888 !important;
  font-size: 14px !important;
  line-height: 1.6;
  max-width: 400px;
  margin: 12px auto !important;
}

.slide-demo {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 16px;
  margin: 16px auto;
  max-width: 280px;
}

.demo-sidebar {
  text-align: left;
  background: var(--primary-dark);
  border-radius: 8px;
  padding: 8px;
}

.demo-channel {
  color: white;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 2px;
}

.demo-channel.active {
  background: rgba(255,255,255,0.15);
}

.demo-chat {
  text-align: left;
}

.demo-bubble {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 6px;
  max-width: 90%;
}

.demo-bubble.demo-user {
  background: var(--bubble-me);
  margin-left: auto;
  text-align: right;
}

.demo-bubble.demo-ai {
  background: var(--bubble-ai);
  border: 1px solid var(--ai-border);
}

.slide-features {
  text-align: left;
  max-width: 380px;
  margin: 16px auto;
}

.feature-item {
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  color: #555;
}

.tutorial-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.tutorial-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.tutorial-btn:hover { border-color: var(--primary-light); }

.tutorial-btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.tutorial-btn.primary:hover { background: var(--primary-light); }

.slide-dots {
  display: flex;
  gap: 6px;
}

.slide-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ddd;
  cursor: pointer;
  transition: background 0.2s;
}

.slide-dot.active { background: var(--primary); }

.skip-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== Modals ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal {
  background: white;
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-large { max-width: 650px; }

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

.modal-header h2 {
  font-size: 18px;
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 6px;
}

.modal-close:hover { background: #f0f0f0; }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Search bar */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.search-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.search-bar input:focus { border-color: var(--primary-light); }

.search-bar button {
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-result-item {
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover { background: #e8f4fd; }

.result-header {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.result-channel { color: var(--primary); font-weight: 500; }
.result-content {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

/* School match */
.match-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 8px;
}

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

.match-name { font-size: 15px; font-weight: 500; }
.match-info { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Channel request */
.request-item {
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 8px;
}

.request-name { font-size: 15px; font-weight: 600; color: var(--primary); }
.request-reason { font-size: 13px; color: #555; margin: 4px 0; }
.request-meta { font-size: 12px; color: var(--text-secondary); }

.request-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.approve-btn {
  padding: 6px 16px;
  background: var(--green-dark);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.reject-btn {
  padding: 6px 16px;
  background: var(--red);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

/* Admin panel */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.admin-tab {
  padding: 8px 16px;
  background: none;
  border: none;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
}

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

.analysis-item {
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 8px;
}

.analysis-name { font-size: 15px; font-weight: 600; color: var(--primary); }
.analysis-reason { font-size: 13px; color: #555; margin-top: 4px; }

/* Digest */
.digest-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.badge-ai {
  background: var(--green-dark);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
}

.badge-demo {
  background: var(--orange);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
}

.digest-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(0,0,0,0.85);
  color: white;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 3000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
  }

  .sidebar.open { transform: translateX(0); }
  .chat-header .menu-btn { display: block; }
  .message { max-width: 85%; }
  .message.ai { max-width: 92%; }
  .auth-card { padding: 30px 20px; }
  .tutorial-slide h2 { font-size: 20px; }
  .slide-emoji { font-size: 48px; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 6px; }

/* ===== Moderation: Flag Badge ===== */
.badge-flag {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  padding: 0 5px;
  background: #e74c3c;
  color: #fff;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
  vertical-align: middle;
}

/* ===== Moderation: Report Modal ===== */
.report-preview {
  background: #f8f9fa;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}
.report-preview-content {
  font-size: 14px;
  color: #555;
  font-style: italic;
}
.report-reasons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.report-reason {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 2px solid #e1e8ed;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.report-reason:hover { border-color: #2980b9; background: #f8f9fa; }
.report-reason input { margin: 0; }
.report-reason span { font-size: 14px; }

/* ===== Moderation: Blocked Notice ===== */
.blocked-notice {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 2px solid #e74c3c;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 480px;
  z-index: 10000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.blocked-icon { font-size: 28px; }
.blocked-title { font-weight: 700; color: #e74c3c; font-size: 15px; }
.blocked-reason { font-size: 13px; color: #555; margin-top: 2px; }
.blocked-warning { font-size: 12px; color: #e67e22; margin-top: 4px; }
.blocked-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #999;
  padding: 0;
  margin-left: auto;
}

/* ===== Moderation: Admin Panel ===== */
.mod-stats { margin-bottom: 20px; }
.mod-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.mod-stat-card {
  background: #f8f9fa;
  border: 1px solid #e1e8ed;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.mod-stat-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}
.mod-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.mod-section {
  margin-bottom: 20px;
}
.mod-section h3 {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
}
.mod-section-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Flagged message item */
.flagged-item {
  background: #fff;
  border: 1px solid #e1e8ed;
  border-left: 4px solid #e74c3c;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}
.flagged-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.flagged-user {
  font-weight: 600;
  font-size: 13px;
}
.flagged-layer {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e3f2fd;
  color: #1565c0;
}
.flagged-confidence {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #fff3e0;
  color: #e65100;
  font-weight: 600;
}
.flagged-content {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  color: #555;
  margin-bottom: 6px;
  word-break: break-word;
}
.flagged-reason {
  font-size: 12px;
  color: #e74c3c;
  margin-bottom: 4px;
}
.flagged-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.flagged-actions {
  display: flex;
  gap: 8px;
}
.flagged-actions button {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}
.flagged-actions .approve-btn {
  background: #e74c3c;
  color: #fff;
}
.flagged-actions .reject-btn {
  background: #f0f2f5;
  color: #555;
}

/* Log item */
.log-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f0f2f5;
  font-size: 12px;
}
.log-time {
  color: var(--text-secondary);
  font-size: 11px;
  min-width: 40px;
}
.log-action {
  font-weight: 600;
  color: var(--primary);
  min-width: 80px;
}
.log-detail {
  color: #555;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Responsive for moderation ===== */
@media (max-width: 768px) {
  .mod-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .blocked-notice { max-width: calc(100% - 32px); }
  .flagged-actions { flex-direction: column; }
}
