/* ===== VARIABLES - Deep Ocean Theme ===== */
:root {
  --bg-primary: #0a0f1c;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2332;
  --bg-card: rgba(26, 35, 50, 0.6);
  
  --primary: #3b82f6;
  --primary-light: #60a5fa;
  --primary-dark: #2563eb;
  
  --accent: #8b5cf6;
  --accent-light: #a78bfa;
  --accent-dark: #7c3aed;
  
  --cyan: #06b6d4;
  --cyan-light: #22d3ee;
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border: rgba(148, 163, 184, 0.1);
  --border-hover: rgba(148, 163, 184, 0.2);
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.3);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;
  
  --sidebar-width: 280px;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

/* ===== AUTH SCREEN ===== */
.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  background: var(--bg-primary);
}

.auth-screen.hidden {
  display: none;
}

.auth-bg {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.05) 0%, transparent 70%);
  animation: authBgPulse 8s ease-in-out infinite;
}

@keyframes authBgPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.auth-container {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px;
}

.auth-logo {
  margin-bottom: 48px;
}

.auth-logo .logo-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 60px rgba(59, 130, 246, 0.5);
}

.auth-logo .logo-icon.pulse {
  animation: logoPulse 2s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 60px rgba(59, 130, 246, 0.5); }
  50% { transform: scale(1.05); box-shadow: 0 0 80px rgba(59, 130, 246, 0.7); }
}

.auth-logo h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-logo p {
  color: var(--text-secondary);
  font-size: 1.125rem;
}

.auth-box {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  max-width: 420px;
  margin: 0 auto;
  animation: authBoxIn 0.6s ease;
}

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

.auth-box h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.auth-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 28px;
}

.telegram-login-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  background: linear-gradient(135deg, #0088cc, #00a8e8);
  border-radius: var(--radius-md);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 4px 20px rgba(0, 136, 204, 0.4);
}

.telegram-login-placeholder:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 136, 204, 0.5);
}

.telegram-login-placeholder svg {
  width: 24px;
  height: 24px;
}

.auth-note {
  margin-top: 20px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ===== APP ===== */
.app {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.app.hidden {
  display: none;
}

/* ===== BACKGROUND MESH ===== */
.bg-mesh {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: orbFloat 20s ease-in-out infinite;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  animation-delay: 0s;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  bottom: -150px;
  left: -150px;
  animation-delay: -7s;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--cyan) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -30px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(-30px, -20px) scale(1.02); }
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
  transition: all var(--transition-base);
}

.logo:hover .logo-icon {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.6);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-label {
  display: block;
  padding: 12px 16px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 2px 4px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.nav-item:hover::before {
  opacity: 1;
}

.nav-item.active {
  color: var(--primary-light);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.1));
}

.nav-item.active::before {
  opacity: 1;
}

.nav-item svg {
  flex-shrink: 0;
  transition: transform var(--transition-base);
}

.nav-item:hover svg {
  transform: scale(1.1);
}

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
}

.nav-badge.alert {
  background: var(--danger);
  animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.status-pulse {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  margin-left: auto;
  box-shadow: 0 0 8px var(--success);
  animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.user-avatar-img,
.user-avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.user-avatar-img.hidden {
  display: none;
}

.user-avatar-fallback {
  color: white;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 0.875rem;
}

.user-tier {
  font-size: 0.75rem;
  color: var(--accent-light);
}

.lang-switcher-sidebar {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.lang-btn {
  flex: 1;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

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

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: translateY(-1px);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.page {
  display: none;
  flex-direction: column;
  min-height: 100%;
  animation: pageIn 0.4s ease;
}

.page.active {
  display: flex;
}

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

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 15, 28, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.page-subtitle {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--success);
}

.pulse-ring {
  width: 8px;
  height: 8px;
  border: 2px solid var(--success);
  border-radius: 50%;
  animation: pulseRing 1.5s infinite;
}

@keyframes pulseRing {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}

.queue-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--warning);
}

.queue-count {
  background: var(--warning);
  color: var(--bg-primary);
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  border: none;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.btn:hover::before {
  transform: translateX(100%);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-hover);
}

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

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

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

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

.btn-sm {
  padding: 8px 14px;
  font-size: 0.8125rem;
}

.refresh-icon {
  transition: transform 0.5s ease;
}

.btn-ghost:hover .refresh-icon {
  transform: rotate(180deg);
}

/* ===== PAGE CONTENT ===== */
.page-content {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
}

/* ===== METRICS GRID ===== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.metric-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
}

.metric-glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.metric-card:hover .metric-glow {
  opacity: 1;
}

.metric-card.primary .metric-glow {
  background: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.15), transparent 70%);
}

.metric-card.secondary .metric-glow {
  background: radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.15), transparent 70%);
}

.metric-card.accent .metric-glow {
  background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.15), transparent 70%);
}

.metric-card.success .metric-glow {
  background: radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.15), transparent 70%);
}

.metric-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
  flex-shrink: 0;
}

.metric-card.primary .metric-icon {
  color: var(--primary-light);
}

.metric-card.secondary .metric-icon {
  color: var(--cyan-light);
}

.metric-card.accent .metric-icon {
  color: var(--accent-light);
}

.metric-card.success .metric-icon {
  color: var(--success);
}

.metric-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.metric-value.model-name {
  font-size: 1.125rem;
  font-family: 'JetBrains Mono', monospace;
}

.metric-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.metric-change.positive {
  color: var(--success);
}

.metric-change.negative {
  color: var(--danger);
}

.metric-change.neutral {
  color: var(--text-muted);
}

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
  margin-bottom: 24px;
}

/* ===== PANEL ===== */
.panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-base);
}

.panel:hover {
  border-color: var(--border-hover);
}

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

.panel-title {
  font-size: 1.0625rem;
  font-weight: 600;
}

.panel-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.panel-status {
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
}

.panel-status.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

/* Memory Panel */
.memory-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.memory-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.memory-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.memory-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.memory-icon.blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-light);
}

.memory-icon.cyan {
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan-light);
}

.memory-icon.purple {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-light);
}

.memory-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.memory-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.memory-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.memory-bar {
  width: 80px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.memory-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width var(--transition-slow);
}

/* Config Panel */
.config-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-row.three {
  grid-template-columns: repeat(3, 1fr);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-select {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: all var(--transition-base);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 36px;
}

.form-select.mini {
  padding: 6px 28px 6px 10px;
  font-size: 0.8125rem;
}

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

.form-slider {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  appearance: none;
  cursor: pointer;
}

.form-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--transition-base);
}

.form-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-light);
  min-width: 40px;
  text-align: right;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle-switch.large {
  width: 56px;
  height: 30px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 26px;
  transition: all var(--transition-base);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all var(--transition-base);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.toggle-switch.large .toggle-slider::before {
  height: 24px;
  width: 24px;
}

.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.toggle-switch.large input:checked + .toggle-slider::before {
  transform: translateX(26px);
}

/* Smart Tools Info */
.smart-tools-info {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.smart-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.smart-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.smart-value {
  font-weight: 600;
}

.smart-value.status-ok {
  color: var(--success);
}

/* Telegram Config */
.connection-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.connection-badge.connected {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

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

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.telegram-config {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.config-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.toggle-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-hover);
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toggle-title {
  font-weight: 500;
  font-size: 0.875rem;
}

.toggle-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.toggle-checkbox {
  display: none;
}

.debounce-group {
  max-width: 300px;
}

/* Search Box */
.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: all var(--transition-base);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.9375rem;
  outline: none;
  width: 250px;
}

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

/* ===== CAPABILITIES PAGE ===== */
.capabilities-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 9999px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

.filter-chip.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: transparent;
  color: white;
}

.chip-count {
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  font-size: 0.6875rem;
}

.capabilities-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.capability-item {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

.capability-item:hover {
  border-color: var(--border-hover);
}

.capability-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
}

.capability-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.capability-chevron {
  color: var(--text-muted);
  transition: transform var(--transition-base);
}

.capability-item.expanded .capability-chevron {
  transform: rotate(90deg);
}

.capability-name {
  font-weight: 600;
}

.capability-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 9999px;
}

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

.capability-mode {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all var(--transition-base);
}

.capability-mode:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

/* ===== EXTENSIONS PAGE ===== */
.extensions-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  width: fit-content;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
}

.tab-count {
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  font-size: 0.6875rem;
}

.tab-count.new {
  background: var(--success);
}

.tab-count.alert {
  background: var(--warning);
  color: var(--bg-primary);
}

.extension-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  transition: all var(--transition-base);
}

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

.extension-card.installed {
  border-color: rgba(16, 185, 129, 0.3);
}

.extension-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.extension-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.extension-name {
  font-size: 1.125rem;
  font-weight: 600;
}

.extension-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

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

.extension-tag {
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 9999px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

.extension-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.extension-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.extension-main > div:first-child {
  flex: 1;
}

/* ===== ACTIVITY STREAM ===== */
.activity-stream {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  min-height: 500px;
  max-height: 600px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  transition: background var(--transition-fast);
}

.activity-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.activity-type {
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.activity-time {
  color: var(--text-muted);
  white-space: nowrap;
}

.activity-message {
  color: var(--text-primary);
}

.activity-item.success .activity-message {
  color: var(--success);
}

.activity-item.error .activity-message {
  color: var(--danger);
}

.activity-item.warning .activity-message {
  color: var(--warning);
}

/* ===== OPERATIONS ===== */
.operations-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.op-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
}

.op-filter:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

.op-filter.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: transparent;
  color: white;
}

.filter-badge {
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  font-size: 0.6875rem;
}

.operations-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.operation-item {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition-base);
}

.operation-item:hover {
  border-color: var(--border-hover);
}

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

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

.operation-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.operation-name {
  font-weight: 600;
}

.operation-status {
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.operation-status.queued {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.operation-status.running {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-light);
}

.operation-status.completed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.operation-status.failed {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.operation-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.operation-meta {
  display: flex;
  gap: 16px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.operation-progress {
  margin-top: 16px;
}

.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width var(--transition-slow);
  animation: progressShine 2s infinite;
}

@keyframes progressShine {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ===== SETTINGS ===== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

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

.settings-section .section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.settings-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.credential-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.credential-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.credential-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.credential-name {
  font-weight: 500;
}

.credential-status {
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
}

.credential-status.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group .form-input {
  flex: 1;
}

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

.setting-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.setting-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setting-name {
  font-weight: 500;
}

.setting-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 80px 40px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.empty-icon {
  margin-bottom: 24px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.empty-state code {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  color: var(--primary-light);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1280px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .toggle-grid {
    grid-template-columns: 1fr;
  }
  
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .form-row,
  .form-row.three {
    grid-template-columns: 1fr;
  }
  
  .config-row {
    grid-template-columns: 1fr;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .smart-tools-info {
    flex-direction: column;
    gap: 12px;
  }
  
  .extension-main {
    flex-direction: column;
  }
  
  .capabilities-filters,
  .operations-filters {
    flex-wrap: wrap;
  }
}

/* ===== AGENT CARDS (real agents from API) ===== */
.agents-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.agent-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.2s;
}
.agent-card:hover { border-color: var(--primary); }
.agent-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  min-width: 80px;
}
.agent-status.active { color: var(--success); }
.agent-status.paused { color: var(--text-muted); }
.agent-status .status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.agent-status.active .status-dot {
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.agent-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.agent-info strong { font-size: 0.9rem; color: var(--text); }
.agent-desc { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-trigger { font-size: 0.72rem; color: var(--text-muted); }
.agent-actions { display: flex; gap: 8px; }
.btn-success { background: rgba(16,185,129,0.15); color: var(--success); border-color: var(--success); }
.btn-success:hover { background: rgba(16,185,129,0.25); }
.btn-warning { background: rgba(245,158,11,0.15); color: var(--warning); border-color: var(--warning); }
.btn-warning:hover { background: rgba(245,158,11,0.25); }
.loading-placeholder { color: var(--text-muted); font-size: 0.85rem; padding: 20px 0; text-align: center; }
.empty-state { text-align: center; padding: 30px 20px; color: var(--text-muted); }
.empty-state p { margin-bottom: 12px; }
