/* ============================================================
   MeiStudio Web Demo — Design System
   Dark Glassmorphism + Purple/Blue Accent
   ============================================================ */

:root {
  /* Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a28;
  --bg-glass: rgba(255,255,255,0.03);
  --bg-glass-hover: rgba(255,255,255,0.06);
  --border-color: rgba(255,255,255,0.06);
  --border-active: rgba(139,92,246,0.4);
  --text-primary: #e8e8f0;
  --text-secondary: #8b8b9e;
  --text-muted: #55556a;
  --accent: #8b5cf6;
  --accent-light: #a78bfa;
  --accent-glow: rgba(139,92,246,0.15);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  /* Typography */
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  /* Sizing */
  --sidebar-width: 260px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

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

html, body { height:100%; overflow:hidden; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

/* ============================================================
   Layout
   ============================================================ */
#app {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

#page-container {
  min-height: 100%;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  border-radius: var(--radius-sm);
  padding: 4px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.logo-title { font-weight: 700; font-size: 17px; display: block; }
.logo-subtitle { font-size: 11px; color: var(--text-muted); display: block; letter-spacing: 0.5px; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent-light);
  border: 1px solid var(--border-active);
}

.nav-icon { 
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px; 
  height: 24px;
  color: inherit;
}

.lucide-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.nav-badge {
  margin-left: auto;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.nav-item.active .nav-badge {
  background: rgba(139,92,246,0.2);
  color: var(--accent-light);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-indicator { display: flex; align-items: center; gap: 8px; font-size: 12px; }

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse 2s infinite;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--danger); animation: none; }

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

.status-text { color: var(--text-muted); }
.version { color: var(--text-muted); font-size: 11px; font-family: var(--font-mono); }

/* ============================================================
   Page Header
   ============================================================ */
.page-header {
  padding: 32px 40px 24px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, rgba(139,92,246,0.03) 0%, transparent 100%);
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-desc {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.3s;
}

.card:hover {
  border-color: rgba(255,255,255,0.1);
  background: var(--bg-glass-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff;
  box-shadow: 0 4px 15px rgba(139,92,246,0.25);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(139,92,246,0.4);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-ghost:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.12);
}

.btn-danger {
  background: rgba(239,68,68,0.1);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
}

.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============================================================
   Inputs
   ============================================================ */
.input-group { margin-bottom: 16px; }
.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  transition: border-color 0.2s;
  outline: none;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.1);
}

.input::placeholder { color: var(--text-muted); }

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

/* ============================================================
   Status Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: rgba(16,185,129,0.1); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.1); color: var(--danger); }
.badge-info { background: rgba(59,130,246,0.1); color: var(--info); }
.badge-accent { background: var(--accent-glow); color: var(--accent-light); }

/* ============================================================
   Landing Page
   ============================================================ */
.landing-hero {
  padding: 60px 40px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(139,92,246,0.08) 0%, transparent 60%);
}

.hero-logo {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
}

.hero-logo img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--accent-glow);
  border: 1px solid var(--border-active);
  border-radius: 20px;
  font-size: 12px;
  color: var(--accent-light);
  font-weight: 500;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #e8e8f0 30%, var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.hero-actions { display: flex; gap: 12px; justify-content: center; }

.landing-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 0 40px 40px;
}

.stat-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: all 0.3s;
}

.stat-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

.landing-section {
  padding: 40px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

.arch-diagram-img {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s;
}

.arch-diagram-img:hover {
  border-color: var(--border-active);
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.arch-diagram-img img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-tag {
  padding: 6px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.tech-tag:hover {
  border-color: var(--border-active);
  color: var(--accent-light);
  background: var(--accent-glow);
}

/* ============================================================
   Chat Page
   ============================================================ */
.chat-layout {
  display: flex;
  height: 100vh;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-sidebar {
  width: 280px;
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
}

.chat-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  font-weight: 600;
}

.chat-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.file-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s;
  font-size: 13px;
}

.file-check-item:hover { background: var(--bg-glass-hover); }

.file-check-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px; height: 16px;
}

.file-check-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.file-check-item input:checked ~ .file-check-name {
  color: var(--text-primary);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message {
  max-width: 80%;
  animation: fadeSlideIn 0.3s ease;
}

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

.message.user { align-self: flex-end; }
.message.assistant { align-self: flex-start; }

.message-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.7;
}

.message.user .message-bubble {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.message-bubble p { margin-bottom: 8px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble pre {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  margin: 8px 0;
}

.message-bubble code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: rgba(139,92,246,0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ============================================================
   MCP Rich Content
   ============================================================ */
.mcp-rich-block {
  margin: 12px 0;
  max-width: 100%;
  animation: fadeSlideIn 0.3s ease;
}

.mcp-image img {
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  object-fit: contain;
  background: var(--bg-primary);
}

.mcp-video video, .mcp-audio audio {
  width: 100%;
  border-radius: var(--radius-md);
  background: #000;
  outline: none;
}

.mcp-audio audio {
  height: 44px;
  filter: invert(1) hue-rotate(180deg);
  opacity: 0.9;
}

.mcp-file-card, .mcp-link-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
}

.mcp-file-card:hover, .mcp-link-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-active);
}

.mcp-file-icon, .mcp-link-icon {
  width: 48px; height: 48px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}

.mcp-file-info, .mcp-link-content {
  flex: 1;
  min-width: 0;
}

.mcp-file-name, .mcp-link-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mcp-file-meta, .mcp-link-url {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mcp-file-btn {
  padding: 6px 16px;
  background: var(--accent);
  color: #fff !important;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

/* ============================================================
   Chat Input Area
   ============================================================ */
.chat-input-area {
  padding: 20px 40px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.chat-input-wrap {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-input-wrap textarea {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  resize: none;
  outline: none;
  max-height: 120px;
  transition: border-color 0.2s;
}

.chat-input-wrap textarea:focus { border-color: var(--accent); }

.send-btn {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.send-btn:hover { box-shadow: 0 4px 15px rgba(139,92,246,0.4); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 8px 4px;
}

.typing-indicator span {
  width: 6px; height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  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(-6px); opacity: 1; }
}

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

.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state-text { font-size: 14px; margin-bottom: 8px; }

/* ============================================================
   Knowledge Page
   ============================================================ */
.knowledge-layout {
  padding: 0 40px 40px;
}

.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 32px;
  position: relative;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.upload-zone-icon { font-size: 40px; margin-bottom: 12px; }

.upload-zone-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.upload-zone-desc { font-size: 13px; color: var(--text-muted); }

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.doc-list { display: flex; flex-direction: column; gap: 8px; }

.doc-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.doc-item:hover { border-color: rgba(255,255,255,0.1); }

.doc-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.doc-icon.pdf { background: rgba(239,68,68,0.1); }
.doc-icon.txt { background: rgba(59,130,246,0.1); }
.doc-icon.md { background: rgba(16,185,129,0.1); }
.doc-icon.doc { background: rgba(59,130,246,0.1); }

.doc-info { flex: 1; }

.doc-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}

.doc-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.doc-actions { display: flex; gap: 8px; align-items: center; }

/* ============================================================
   MCP Page
   ============================================================ */
.mcp-layout { padding: 0 40px 40px; }

.mcp-add-form {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.server-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: all 0.2s;
}

.server-item:hover { border-color: rgba(255,255,255,0.1); }

.server-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

.server-info { flex: 1; }

.server-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.server-url {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.server-meta {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

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

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

/* ============================================================
   Toast
   ============================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  animation: toastIn 0.3s ease;
  max-width: 360px;
  border: 1px solid;
}

.toast-success {
  background: rgba(16,185,129,0.1);
  color: var(--success);
  border-color: rgba(16,185,129,0.2);
}

.toast-error {
  background: rgba(239,68,68,0.1);
  color: var(--danger);
  border-color: rgba(239,68,68,0.2);
}

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

/* ============================================================
   Loading Spinner
   ============================================================ */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Feature Cards (Landing)
   ============================================================ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.feature-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all 0.3s;
}

.feature-card:hover {
  border-color: var(--border-active);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(139,92,246,0.1);
}

.feature-icon {
  font-size: 28px;
  margin-bottom: 14px;
}

.feature-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================================
   Auth Card (Login & Register)
   ============================================================ */
.login-card {
  max-width: 460px;
  margin: 0 auto;
}

.login-card-inner {
  background: var(--bg-glass);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-xl);
  padding: 36px;
  text-align: left;
  box-shadow: 0 8px 40px rgba(139,92,246,0.12);
}

.auth-tabs {
  display: flex;
  gap: 24px;
  margin-bottom: 28px;
  border-bottom: 1px solid rgba(139,92,246,0.1);
}

.auth-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 600;
  padding: 8px 4px;
  cursor: pointer;
  position: relative;
  transition: color 0.3s;
}

.auth-tab.active {
  color: var(--primary-color);
}

.auth-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary-gradient);
}

.auth-header {
  margin-bottom: 24px;
}

#auth-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
}

#auth-desc {
  font-size: 14px;
  color: var(--text-secondary);
}

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

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

.auth-footer a:hover {
  text-decoration: underline;
}

.input-group {
  margin-bottom: 16px;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.login-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form .input {
  padding: 14px 16px;
  font-size: 15px;
}

.login-form .btn-primary {
  justify-content: center;
  padding: 14px;
  font-size: 15px;
}

.login-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 16px;
}

/* Settings Page */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.settings-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.settings-card .card-header h3 {
  margin-bottom: 20px;
  font-size: 18px;
  color: var(--primary-color);
}

.settings-card .form-group {
  margin-bottom: 24px;
}

.settings-card .form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.settings-card .input-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  margin: 15px 0;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-gradient);
  cursor: pointer;
  box-shadow: 0 0 10px var(--primary-color);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.settings-actions {
  display: flex;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Modal & Onboarding */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.onboarding-card {
  max-width: 500px;
  width: 100%;
  padding: 40px;
  text-align: center;
}

.onboarding-header {
  margin-bottom: 32px;
}

.onboarding-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.onboarding-header h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
  color: #fff;
}

.onboarding-header p {
  color: var(--text-secondary);
  font-size: 16px;
}

.onboarding-body {
  text-align: left;
  margin-bottom: 32px;
}

.onboarding-step {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.onboarding-step.highlight {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.step-num {
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: var(--primary-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.step-text h4 {
  font-size: 15px;
  margin-bottom: 4px;
  color: #fff;
}

.step-text p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.onboarding-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 14px;
}

.animate-pop {
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
