@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-glass: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.08);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #1877F2;
  --accent-glow: rgba(24,119,242,0.3);
  --cyan: #00C9B7;
  --green: #10b981;
  --red: #ef4444;
  --orange: #f59e0b;
  --pink: #ec4899;
  --purple: #7B68AE;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Layout ── */
.app { display: flex; height: 100vh; }

.sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  z-index: 10;
}

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

.sidebar-header .logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-header .logo img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.sidebar-header h2 {
  font-size: 15px; font-weight: 700;
  background: linear-gradient(135deg, #1877F2, #00C9B7);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.sidebar-header span { font-size: 11px; color: var(--text-muted); }

.nav-section { padding: 16px 12px 8px; }
.nav-section-title { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; padding: 0 8px; margin-bottom: 8px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--text-secondary); cursor: pointer;
  transition: all 0.2s; font-size: 13px; font-weight: 500;
  position: relative;
}

.nav-item:hover { background: var(--bg-glass); color: var(--text-primary); }
.nav-item.active { background: rgba(24,119,242,0.12); color: var(--accent); }
.nav-item .icon { width: 20px; text-align: center; font-size: 15px; }

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%,100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

/* ── Main Content ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-secondary);
}

.topbar-search {
  flex: 1; max-width: 400px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px 8px 36px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.topbar-search input:focus { border-color: var(--accent); }
.topbar-search .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.topbar-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  position: relative;
}

.topbar-btn:hover { background: rgba(24,119,242,0.15); color: var(--accent); }

.topbar-btn .dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.admin-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  cursor: pointer;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(10px);
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  opacity: 0;
  transition: opacity 0.3s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card:hover::before { opacity: 1; }

.stat-card .stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
}

.stat-card .stat-icon.purple { background: rgba(24,119,242,0.15); color: var(--accent); }
.stat-card .stat-icon.cyan { background: rgba(6,182,212,0.15); color: var(--cyan); }
.stat-card .stat-icon.green { background: rgba(16,185,129,0.15); color: var(--green); }
.stat-card .stat-icon.red { background: rgba(239,68,68,0.15); color: var(--red); }

.stat-card .stat-value { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-card .stat-change { font-size: 11px; margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }

/* ── Dashboard Grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

/* ── Card Panels ── */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

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

.panel-header h3 { font-size: 14px; font-weight: 600; }
.panel-header .panel-badge { font-size: 10px; padding: 3px 8px; border-radius: 6px; font-weight: 600; }
.panel-header .panel-badge.live { background: rgba(239,68,68,0.15); color: var(--red); }
.panel-header .panel-badge.ai { background: rgba(24,119,242,0.15); color: var(--accent); }

.panel-body { padding: 16px 20px; }

/* ── Problems List ── */
.problem-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
  cursor: pointer;
}

.problem-item:last-child { border-bottom: none; }
.problem-item:hover { background: var(--bg-glass); margin: 0 -20px; padding: 12px 20px; }

.problem-severity {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.problem-severity.critical { background: var(--red); box-shadow: 0 0 8px var(--red); }
.problem-severity.high { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.problem-severity.medium { background: var(--cyan); }
.problem-severity.low { background: var(--green); }

.problem-info { flex: 1; min-width: 0; }
.problem-type { font-size: 12px; font-weight: 600; margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.problem-type .tag { font-size: 9px; padding: 2px 6px; border-radius: 4px; background: var(--bg-glass); color: var(--text-muted); font-weight: 500; text-transform: uppercase; }
.problem-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.problem-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* ── Users List ── */
.user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.user-item:last-child { border-bottom: none; }
.user-item:hover { background: var(--bg-glass); margin: 0 -20px; padding: 10px 20px; }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  position: relative;
}

.user-avatar .status-dot {
  position: absolute; bottom: -2px; right: -2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.status-dot.online { background: var(--green); }
.status-dot.idle { background: var(--orange); }
.status-dot.offline { background: var(--text-muted); }

.user-info { flex: 1; }
.user-name { font-size: 13px; font-weight: 600; }
.user-meta { font-size: 11px; color: var(--text-muted); }

.user-health {
  font-size: 10px; font-weight: 700;
  padding: 4px 8px; border-radius: 6px;
}

.health-good { background: rgba(16,185,129,0.15); color: var(--green); }
.health-warn { background: rgba(245,158,11,0.15); color: var(--orange); }
.health-bad { background: rgba(239,68,68,0.15); color: var(--red); }

/* ── Chat Widget ── */
.chat-widget {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 1000;
}

.chat-toggle {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--accent-glow);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
  position: relative;
}

.chat-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 30px var(--accent-glow); }

.chat-toggle .unread-count {
  position: absolute; top: -4px; right: -4px;
  background: var(--red);
  color: #fff;
  font-size: 10px; font-weight: 700;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-primary);
}

.chat-panel {
  position: absolute;
  bottom: 70px; right: 0;
  width: 380px;
  height: 520px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  transform: scale(0.9) translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.chat-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}

.chat-header .ai-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

.chat-header h4 { font-size: 14px; font-weight: 600; flex: 1; }

.chat-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}

.chat-tab {
  flex: 1;
  padding: 6px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.chat-tab.active { background: rgba(24,119,242,0.15); color: var(--accent); }
.chat-tab:hover { background: var(--bg-glass); color: var(--text-primary); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  animation: msg-in 0.3s ease;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.sent {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg.received {
  align-self: flex-start;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-msg.ai {
  align-self: flex-start;
  background: rgba(6,182,212,0.1);
  border: 1px solid rgba(6,182,212,0.2);
  border-bottom-left-radius: 4px;
}

.chat-msg .msg-name { font-size: 10px; font-weight: 600; margin-bottom: 4px; color: var(--cyan); }
.chat-msg .msg-time { font-size: 9px; color: var(--text-muted); margin-top: 4px; text-align: right; }

.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}

.chat-input-area input {
  flex: 1;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s;
}

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

.chat-input-area button {
  background: linear-gradient(135deg, var(--accent), var(--pink));
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.chat-input-area button:hover { transform: scale(1.05); }

/* ── AI Analysis Panel ── */
.ai-panel {
  background: linear-gradient(135deg, rgba(24,119,242,0.08), rgba(6,182,212,0.08));
  border: 1px solid rgba(24,119,242,0.2);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.ai-panel h4 { font-size: 13px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.ai-panel .ai-tag { font-size: 9px; background: var(--accent); color: #fff; padding: 2px 6px; border-radius: 4px; font-weight: 700; }

.health-bar {
  width: 100%; height: 6px;
  background: var(--bg-glass);
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0;
}

.health-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
}

.health-score { font-size: 32px; font-weight: 800; margin: 8px 0; }

/* ── Session Player ── */
.session-player {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  aspect-ratio: 16/9;
}

.session-player canvas { width: 100%; height: 100%; }

.session-controls {
  display: flex; align-items: center; gap: 8px;
  padding: 12px;
  background: rgba(0,0,0,0.8);
}

.session-controls button {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.session-controls button:hover { background: rgba(24,119,242,0.2); }

.session-timeline {
  flex: 1; height: 4px;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.session-timeline-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.1s;
}

.session-timeline .event-marker {
  position: absolute; top: -4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  transform: translateX(-50%);
  cursor: pointer;
  border: 2px solid var(--bg-primary);
}

.event-marker.error { background: var(--red); }
.event-marker.rage { background: var(--orange); }
.event-marker.navigation { background: var(--cyan); }

/* ── Tabs ── */
.view-tabs {
  display: flex; gap: 4px;
  margin-bottom: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: 10px;
  width: fit-content;
}

.view-tab {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.view-tab.active { background: var(--accent); color: #fff; }
.view-tab:hover:not(.active) { background: var(--bg-glass); color: var(--text-primary); }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h4 { font-size: 14px; margin-bottom: 4px; color: var(--text-secondary); }
.empty-state p { font-size: 12px; }

/* ── Button ── */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  display: inline-flex; align-items: center; gap: 6px;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #0d5bbd; transform: translateY(-1px); }
.btn-ghost { background: var(--bg-glass); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text-primary); background: rgba(24,119,242,0.1); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--red); }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

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

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

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

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

/* ── Quick Links Bar ── */
.quick-links-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(90deg, rgba(24,119,242,0.08), rgba(6,182,212,0.05));
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.quick-links-bar::-webkit-scrollbar { display: none; }
.quick-links-label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  white-space: nowrap; margin-right: 4px;
}
.quick-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px;
  background: var(--bg-glass); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 12px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
  transition: all 0.2s;
}
.quick-link:hover {
  background: rgba(24,119,242,0.15); color: var(--accent);
  border-color: var(--accent); transform: translateY(-1px);
}

/* ── Workflow Grid ── */
.workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.workflow-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
  position: relative;
}
.workflow-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
.workflow-card .wf-step {
  position: absolute; top: 12px; left: 12px;
  width: 24px; height: 24px;
  background: var(--accent); color: #fff;
  border-radius: 50%; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.workflow-card .wf-icon {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin: 0 auto 14px;
}
.workflow-card h4 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.workflow-card p { font-size: 11px; color: var(--text-muted); line-height: 1.5; }

/* ── Tools Grid ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.3s;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-primary);
  display: block;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
.tool-card .tool-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 12px;
}
.tool-card h4 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.tool-card p { font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.tool-card .tool-link { font-size: 11px; color: var(--accent); margin-top: 10px; display: inline-flex; align-items: center; gap: 4px; }

/* ── API Key Item ── */
.api-key-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.api-key-item:last-child { border-bottom: none; }
.api-key-item .key-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(24,119,242,0.15); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.api-key-item .key-info { flex: 1; }
.api-key-item .key-label { font-size: 13px; font-weight: 600; }
.api-key-item .key-value { font-size: 11px; color: var(--text-muted); font-family: monospace; }
.api-key-item .key-status { font-size: 10px; padding: 3px 8px; border-radius: 6px; font-weight: 600; }
.key-status.active { background: rgba(16,185,129,0.15); color: var(--green); }

/* ── Earnings Overview ── */
.earnings-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .earnings-overview { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .earnings-overview { grid-template-columns: 1fr; }
}

/* ── Earnings Table ── */
.earnings-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.earnings-row:last-child { border-bottom: none; }
.earnings-platforms { display: flex; gap: 16px; margin-left: auto; }
.earnings-platforms .ep { text-align: center; min-width: 80px; }
.ep-label { font-size: 10px; color: var(--text-muted); margin-bottom: 2px; }
.ep-value { font-size: 14px; font-weight: 700; }
.ep-total { font-size: 16px; font-weight: 800; color: var(--green); }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ── Area Buttons ── */
.area-btn.active { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }
.area-btn:hover { border-color: var(--accent); }

/* ── Health Bar ── */
.health-bar { height: 8px; border-radius: 4px; background: var(--bg-glass); overflow: hidden; }
.health-bar-fill { height: 100%; border-radius: 4px; transition: width 1s ease; }

/* ── Mobile Hamburger ── */
.mobile-menu-btn {
  display: none;
  background: none; border: none;
  color: var(--text-primary); font-size: 20px;
  padding: 8px; cursor: pointer; border-radius: 8px;
  transition: background 0.2s; z-index: 1001;
}
.mobile-menu-btn:hover { background: var(--bg-glass); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 99;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}

/* ── Tablet ── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .tools-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }

  .sidebar {
    position: fixed; left: -300px; top: 0; bottom: 0;
    width: 280px; height: 100vh; z-index: 100;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-direction: column; overflow-y: auto; box-shadow: none;
  }
  .sidebar.mobile-open { left: 0; box-shadow: 8px 0 40px rgba(0,0,0,0.5); }
  .sidebar-overlay.show { display: block; }

  .sidebar-header { padding: 16px; }
  .sidebar-header h2 { font-size: 15px; }
  .nav-section { padding: 6px 8px; flex-direction: column; }
  .nav-section-title { display: block; font-size: 10px; padding: 8px 12px 4px; }
  .nav-item { padding: 10px 14px; font-size: 13px; gap: 10px; border-radius: 8px; }
  .nav-item .icon { font-size: 15px; width: 20px; }
  .nav-badge { display: inline-flex; }

  .main { width: 100%; }

  .topbar { padding: 10px 14px; gap: 8px; }
  .topbar-search { flex: 1; min-width: 0; }
  .topbar-search input { font-size: 12px; padding: 8px 12px 8px 32px; height: 36px; }
  .topbar-right { gap: 6px; }
  .topbar-right .admin-avatar { width: 28px; height: 28px; font-size: 11px; }
  #welcome-name { display: none; }
  #header-user-card { padding: 3px 8px 3px 6px !important; }
  #header-rank-label { display: none; }

  .content { padding: 12px !important; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-card .stat-value { font-size: 20px; }
  .stat-card .stat-label { font-size: 10px; }
  .stat-card .stat-icon { width: 32px; height: 32px; font-size: 14px; }

  .tools-grid { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .tool-card { padding: 14px !important; }
  .tool-card h4 { font-size: 12px !important; }
  .tool-card p { font-size: 10px !important; }

  .panel { border-radius: 10px !important; }
  .panel-header { padding: 12px 14px !important; }
  .panel-header h3 { font-size: 14px !important; }
  .panel-body { padding: 12px !important; }

  div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
  div[style*="grid-template-columns:1fr 1fr 1fr"] { grid-template-columns: 1fr !important; }

  .chat-panel, #chat-list-panel, #dm-window {
    width: calc(100vw - 24px) !important; right: 12px !important;
    bottom: 70px !important; border-radius: 14px !important; max-height: 65vh !important;
  }
  .chat-toggle { bottom: 14px; right: 14px; width: 48px; height: 48px; }
}

/* ── Small phones ── */
@media (max-width: 420px) {
  .sidebar-header .logo { width: 28px; height: 28px; }
  .stats-grid { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: 1fr !important; }
  .topbar-search { width: 100%; }
  .topbar { flex-wrap: wrap; }
  .topbar-right { width: 100%; justify-content: flex-end; }
}

/* ── Admin Panel Tabs ── */
.admin-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: 12px; padding: 4px;
  overflow-x: auto; scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px; border: none; border-radius: 8px;
  background: transparent; color: var(--text-muted);
  font-size: 13px; font-weight: 600; font-family: 'Inter', sans-serif;
  cursor: pointer; transition: all 0.2s ease; white-space: nowrap;
}
.admin-tab:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.admin-tab.active {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 8px rgba(24,119,242,0.3);
}
.admin-tab i { font-size: 12px; }
.admin-tab-content { display: none; animation: fadeIn 0.3s ease; }
.admin-tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── Hexagonal Level Badges ── */
.level-hex {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; font-size: 15px; font-weight: 800; color: #fff;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.level-hex.lv1 { background: linear-gradient(135deg, #cd7f32, #a0522d); }
.level-hex.lv2 { background: linear-gradient(135deg, #c0c0c0, #8a8a8a); }
.level-hex.lv3 { background: linear-gradient(135deg, #ffd700, #daa520); }
.level-hex.lv4 { background: linear-gradient(135deg, #b0c4de, #778899); }
.level-hex.lv5 { background: linear-gradient(135deg, #50c878, #2e8b57); }
.level-hex.lv6 { background: linear-gradient(135deg, #b9f2ff, #4fc3f7); }

/* ── Mobile Menu ── */
.mobile-menu-btn {
  display: none; background: none; border: none;
  color: var(--text-primary); font-size: 20px; cursor: pointer;
  padding: 6px 8px; border-radius: 8px;
}
.mobile-menu-btn:hover { background: var(--bg-glass); }
.sidebar-overlay {
  display: none; position: fixed; top: 0; left: 0;
  width: 100%; height: 100%; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px); z-index: 998;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; }
  .sidebar {
    position: fixed !important; left: -280px; top: 0; height: 100vh !important; z-index: 999;
    width: 260px !important; flex-direction: column !important; transition: left 0.3s ease;
    border-right: 1px solid var(--border);
  }
  .sidebar.mobile-open { left: 0; }
  .admin-tabs { gap: 2px; padding: 3px; }
  .admin-tab { padding: 8px 10px; font-size: 11px; gap: 4px; }
  .admin-tab span { display: none; }
  .admin-tab i { font-size: 14px; }
  .admin-tab.active span { display: inline; }
  #atab-overview > div:first-child { grid-template-columns: 1fr 1fr !important; }
  #atab-users > div:first-child { grid-template-columns: 1fr !important; }
  #atab-overview > div:last-child { grid-template-columns: 1fr !important; }
}
