

:root {
  --bg-primary: #0a0e14;
  --bg-secondary: #0f1419;
  --bg-tertiary: #151a21;
  --bg-elevated: #1a1f26;
  --bg-hover: rgba(255, 255, 255, 0.03);
  
  --text-primary: #e8edf3;
  --text-secondary: #8b92a0;
  --text-tertiary: #5f6673;
  --text-muted: #404552;
  
  --border-default: #1e2329;
  --border-muted: #181c22;
  --border-subtle: #14181d;
  
  --accent-primary: #3b82f6;
  --accent-hover: #5393f7;
  --accent-active: #2970e5;
  --accent-subtle: rgba(59, 130, 246, 0.1);
  
  --success: #3fb950;
  --success-hover: #4cc65a;
  --success-subtle: rgba(63, 185, 80, 0.12);
  
  --danger: #f85149;
  --danger-hover: #ff6159;
  --danger-subtle: rgba(248, 81, 73, 0.12);
  
  --warning: #f59e0b;
  --warning-hover: #f6a819;
  --warning-subtle: rgba(245, 158, 11, 0.12);
  
  --info: #06b6d4;
  --info-hover: #14c5e0;
  --info-subtle: rgba(6, 182, 212, 0.12);
  
  /* 📐 Spacing */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* 🔲 Border Radius */
  --radius-xs: 0.25rem;
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  
  /* 🎭 Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.18);
  --shadow-2xl: 0 24px 48px rgba(0, 0, 0, 0.22);
  
  /* ⚡ Transitions */
  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
  
  /* 🎯 Typography */
  --font-xs: 0.75rem;
  --font-sm: 0.875rem;
  --font-base: 1rem;
  --font-lg: 1.125rem;
  --font-xl: 1.25rem;
  --font-2xl: 1.5rem;
  --font-3xl: 1.875rem;
  
  /* 📏 Layout */
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --max-content-width: 1400px;
  
  /* 🖼️ Logo */
  --logo-filter: brightness(0) invert(1);
  
  /* 🎨 Special Colors */
  --bg-topbar: rgba(15, 20, 25, 0.6);
  --border-topbar: rgba(255, 255, 255, 0.1);
  --bg-menu: rgba(26, 31, 38, 0.95);
  --border-menu: rgba(255, 255, 255, 0.08);
  --shadow-menu: 0 20px 40px rgba(0, 0, 0, 0.3), 0 8px 16px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #fafbfc;
  --bg-tertiary: #f5f6f8;
  --bg-elevated: #ffffff;
  --bg-hover: rgba(0, 0, 0, 0.04);
  --text-primary: #0d1117;
  --text-secondary: #59636e;
  --text-tertiary: #8c959f;
  --text-muted: #b1b8c0;
  --border-default: #e1e4e8;
  --border-muted: #eaeef2;
  --border-subtle: #f3f5f7;
  --accent-primary: #0969da;
  --accent-hover: #0860ca;
  --accent-active: #0757b9;
  --accent-subtle: rgba(9, 105, 218, 0.1);
  --logo-filter: brightness(0) invert(0);
  --bg-topbar: rgba(255, 255, 255, 0.6);
  --border-topbar: rgba(0, 0, 0, 0.08);
  --bg-menu: rgba(255, 255, 255, 0.98);
  --border-menu: rgba(0, 0, 0, 0.1);
  --shadow-menu: 0 20px 40px rgba(0, 0, 0, 0.08), 0 8px 16px rgba(0, 0, 0, 0.04);
}

/* ===== RESET & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Wix Madefor Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-weight: 400;
  line-height: 1.5;
}

input, button, select, textarea {
  font-family: inherit;
}

/* ===== LAYOUT ===== */
.app { display: flex; flex-direction: column; min-height: 100vh; background: var(--bg-primary); }
.topbar {
  height: var(--topbar-height);
  background: var(--bg-topbar);
  border: 1px solid var(--border-topbar);
  border-radius: var(--radius-2xl);
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 12px;
  left: 16px;
  right: 16px;
  z-index: 1000;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-smooth);
}

.topbar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent);
  opacity: 0.5;
  pointer-events: none;
  border-radius: var(--radius-2xl);
  z-index: -1;
}

.topbar .left, .topbar .right { display: flex; align-items: center; gap: var(--space-3); position: relative; z-index: 1; }

.mobile-menu-toggle {
  display: none;
  background: transparent; border: none; color: var(--text-primary);
  font-size: 20px; cursor: pointer; padding: var(--space-2);
  border-radius: var(--radius-md);
  width: 40px; height: 40px;
  display: none; align-items: center; justify-content: center;
}

@media (max-width: 768px) {
  .mobile-menu-toggle { display: flex; }
  .topbar {
    top: 8px;
    left: 8px;
    right: 8px;
    padding: 0 var(--space-2);
    height: 56px;
    border-radius: var(--radius-xl);
  }
  .user-name { display: none; }
  .brand-sub { display: none; }
  .logo-img { height: 20px; }
  .topbar .left, .topbar .right { gap: var(--space-1); }
  .brand-block { padding: var(--space-1) var(--space-2); gap: var(--space-2); }
  .profile-btn { padding: var(--space-1); gap: var(--space-2); }
  .profile-arrow { display: none; }
}

@media (max-width: 480px) {
  .topbar .left { flex: 1; overflow: hidden; }
  .brand-block { overflow: hidden; }
}

.brand-block {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  cursor: pointer;
}
.brand-block:hover { background: var(--bg-hover); transform: translateY(-1px); }
.logo-img { height: 24px; filter: var(--logo-filter); transition: all 0.3s ease; }
.brand-sub { font-size: var(--font-xs); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }

.profile-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}
.profile-btn:hover { background: var(--bg-hover); transform: translateY(-1px); }
.avatar-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.avatar {
  width: 100%; height: 100%; border-radius: var(--radius-lg);
  background: var(--accent-primary);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 14px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  overflow: hidden;
}

@media (max-width: 480px) {
  .brand-block .logo-img { height: 18px; }
  .topbar { margin: 0; top: 0; left: 0; right: 0; border-radius: 0; border-top: none; border-left: none; border-right: none; padding: 0 var(--space-1); }
  .layout { margin-top: 56px; }
  .brand-block { padding: var(--space-1); }
  .profile-btn { padding: var(--space-1); }
  .avatar-wrap { width: 32px; height: 32px; }
}

.profile { position: relative; }
.profile-menu {
  position: absolute;
  top: calc(100% + var(--space-3));
  right: 0;
  background: var(--bg-menu);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-menu);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-menu);
  min-width: 240px;
  padding: var(--space-3);
  z-index: 1000;
  transition: all var(--transition-smooth);
}
.profile-menu.hidden { display: none; opacity: 0; transform: translateY(-12px) scale(0.95); }

.menu-item {
  width: 100%; display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: transparent; border: none; border-radius: var(--radius-lg);
  color: var(--text-primary); font-size: var(--font-sm); font-weight: 500;
  text-align: left; cursor: pointer; transition: all var(--transition-base);
}
.menu-item:hover { background: var(--bg-hover); transform: translateX(2px); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-subtle); }

.theme-toggle-container {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-muted);
  margin-bottom: var(--space-2);
  display: flex; align-items: center; justify-content: space-between;
}
.theme-label { font-size: var(--font-sm); color: var(--text-secondary); }
.theme-switch { position: relative; width: 50px; height: 26px; }
.theme-switch input { opacity: 0; width: 0; height: 0; }
.theme-switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--bg-tertiary); border: 1px solid var(--border-default);
  border-radius: 34px; transition: .4s;
}
.theme-switch .slider:before {
  position: absolute; content: ""; height: 18px; width: 18px;
  left: 4px; bottom: 3px; background: var(--accent-primary);
  transition: .4s; border-radius: 50%;
}
.theme-switch input:checked + .slider:before { transform: translateX(24px); background: var(--warning); }

.layout { 
  display: flex; 
  flex: 1; 
  margin-top: calc(var(--topbar-height) + 24px); 
}
@media (max-width: 768px) {
  .layout { margin-top: 72px; }
}
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform var(--transition-smooth);
}

/* Mobile Sidebar */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 2000;
    background: var(--bg-primary);
    padding-top: 80px;
    transform: translateX(-105%); /* Полностью скрываем за экраном */
    box-shadow: none;
    transition: transform var(--transition-smooth);
  }
  .sidebar.mobile-open { 
    transform: translateX(0); 
    box-shadow: var(--shadow-2xl);
  }
  .mobile-overlay.active { 
    display: block; 
    position: fixed; 
    inset: 0; 
    background: rgba(0,0,0,0.5); 
    backdrop-filter: blur(4px);
    z-index: 1500; 
  }
  .nav { padding: var(--space-4) var(--space-4); } /* Больше отступов на мобилках */
}

/* 🧭 Navigation - 2025 Refined Pill Design */
.nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-6) var(--space-3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  font-size: var(--font-sm);
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: inherit;
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Vertical active indicator */
.nav-item::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 0;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
  transition: height var(--transition-base);
  z-index: 2;
}

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

.nav-item:hover i {
  color: var(--text-primary);
  transform: scale(1.1);
}

.nav-item.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
}

[data-theme="light"] .nav-item.active {
  background: var(--bg-tertiary);
}

.nav-item.active::before {
  height: 16px;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 18px;
  color: var(--text-tertiary);
  transition: all var(--transition-base);
  margin-left: 12px;
}

.nav-item.active i {
  color: var(--accent-primary);
}

.nav-item span {
  transition: all var(--transition-base);
}

.content { 
  flex: 1; 
  padding: var(--space-8); 
  max-width: var(--max-content-width); 
  margin: 0; 
  min-width: 0;
  background: var(--bg-primary);
}
.content-view { display: none; min-height: 400px; width: 100%; position: relative; z-index: 10; background: inherit; }
.content-view.visible { display: block !important; visibility: visible !important; opacity: 1 !important; }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: var(--space-8); }
.page-title { font-size: var(--font-3xl); font-weight: 700; color: var(--text-primary); margin-bottom: var(--space-2); letter-spacing: -0.02em; line-height: 1.2; }
.page-sub { font-size: var(--font-base); color: var(--text-secondary); line-height: 1.6; margin-bottom: var(--space-8); }

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

/* ===== CARDS ===== */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
.card-header h3 { font-size: var(--font-lg); font-weight: 700; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  font-weight: 600; cursor: pointer; border: none; transition: all var(--transition-base);
  font-family: inherit; font-size: var(--font-sm);
}
.btn-primary, .btn.primary { background: var(--accent-primary); color: white; }
.btn-primary:hover, .btn.primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-secondary, .btn.secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border-default); }
.btn-secondary:hover, .btn.secondary:hover { background: var(--bg-hover); }

/* ===== SYSTEM STATS ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-6);
}

.system-stats-enhanced { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-6); }
.server-stat-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-4);
}
.stat-main { display: flex; align-items: center; gap: var(--space-4); }
.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.stat-icon--cpu { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.stat-icon--memory { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.stat-icon--uptime { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

.stat-content { flex: 1; }
.stat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.stat-label { font-size: var(--font-sm); color: var(--text-secondary); font-weight: 600; }
.stat-meta { font-size: var(--font-xs); color: var(--text-tertiary); }
.stat-value-row { display: flex; justify-content: space-between; align-items: flex-end; }
.stat-value {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.stat-unit { font-size: 14px; color: var(--text-tertiary); margin-left: 2px; }

.stat-progress { height: 6px; background: var(--bg-primary); border-radius: 10px; overflow: hidden; position: relative; border: 1px solid var(--border-subtle); }
.stat-progress-bar { height: 100%; position: absolute; left: 0; top: 0; border-radius: 10px; transition: width 0.5s ease; }
.stat-progress-bar--system { background: var(--border-default); z-index: 1; opacity: 0.5; }
.stat-progress-bar--process { background: var(--accent-primary); z-index: 2; box-shadow: 0 0 10px rgba(59, 130, 246, 0.3); }

.stat-details-toggle {
  width: 100%; padding: 8px; background: transparent; border: 1px dashed var(--border-default);
  border-radius: var(--radius-md); color: var(--text-tertiary); font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s ease;
}
.stat-details-toggle:hover { border-color: var(--border-muted); color: var(--text-secondary); background: var(--bg-hover); }
.stat-details-toggle i { transition: transform 0.3s ease; }
.stat-details { display: none; padding-top: 12px; border-top: 1px solid var(--border-subtle); margin-top: 8px; }
.server-stat-card.expanded .stat-details { display: block; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail-item { display: flex; justify-content: space-between; padding: 6px 10px; background: var(--bg-primary); border-radius: 6px; font-size: var(--font-xs); }
.detail-item.full { grid-column: 1 / -1; }

/* ===== LOGIN & AUTH ===== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-container::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(59, 130, 246, 0.03) 0%,
    transparent 50%
  );
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 392px;
  background: var(--bg-menu);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-menu);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--shadow-menu);
  transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.auth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
  border-radius: 20px;
  pointer-events: none;
}

.auth-card:hover {
  box-shadow: var(--shadow-2xl);
  transform: translateY(-2px);
}

.auth-card .brand-block {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding: 8px 12px;
  border-radius: 12px;
  transition: all 0.3s ease;
  width: fit-content;
  text-decoration: none;
}

.auth-card .brand-block:hover {
  background: var(--bg-hover);
}

.auth-card .brand-block .logo-img {
  height: 24px !important;
  width: auto !important;
  max-width: 150px;
  filter: var(--logo-filter);
  opacity: 0.95;
}

.auth-card .brand-block .brand-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.auth-card .title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 32px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  text-align: left;
}

.auth-card .form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  margin: 0;
}

.auth-card .field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.auth-card .field span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.auth-card input {
  padding: 12px 16px;
  border: 1px solid var(--border-muted);
  border-radius: 12px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  width: 100%;
}

.auth-card input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-subtle);
  transform: translateY(-1px);
}

.auth-card .btn.primary {
  width: 100% !important;
  max-width: 100%;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg, #3b82f6, #5393f7);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
  margin-top: 8px;
}

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

.auth-card .message {
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
  min-height: 20px;
  text-align: left;
}

.auth-card .message.error { color: #f85149; }
.auth-card .message.success { color: #3fb950; }

/* ===== MODALS ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal.hidden { display: none; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 450px;
  padding: var(--space-8);
  box-shadow: var(--shadow-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  will-change: transform, opacity;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 { font-size: var(--font-xl); font-weight: 700; }

.modal-body { display: flex; flex-direction: column; gap: var(--space-5); }

.modal .field { display: flex; flex-direction: column; gap: var(--space-2); }
.modal .field span { font-size: var(--font-sm); font-weight: 600; color: var(--text-secondary); }
.modal input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  font-family: inherit;
  width: 100%;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.2s;
}
.close-btn:hover { color: var(--text-primary); }

/* ===== MODULE CARDS ===== */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--space-6);
}

.module-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5); /* Увеличил отступ между блоками внутри */
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.module-card:hover {
  border-color: var(--border-elevated);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.module-card.disabled {
  opacity: 0.7;
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.module-info-main {
  display: flex;
  gap: var(--space-4);
  align-items: center;
}

.module-icon {
  width: 48px;
  height: 48px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--accent-primary);
  border: 1px solid var(--border-muted);
}

.module-title-wrap {
  display: flex;
  flex-direction: column;
}

.module-name {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.module-version {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  font-weight: 600;
}

.module-description {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.module-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.module-author {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

/* ===== SWITCH COMPONENT ===== */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

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

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--bg-tertiary);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 22px;
  border: 1px solid var(--border-muted);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: #fff;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.switch input:checked + .switch-slider {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

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

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-success {
  background: var(--success-subtle);
  color: var(--success);
}

.badge-muted {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  border: 1px solid var(--border-muted);
}

.module-actions {
  display: flex;
  gap: var(--space-2);
}

.module-action-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-muted);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
}

.module-action-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.module-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
}

.modules-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  background: var(--bg-secondary);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-default);
}

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

.modules-search-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

.modules-search-wrap input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-sm);
  transition: all var(--transition-base);
}

.modules-search-wrap input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.module-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.module-tag {
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-weight: 700;
}

.sidebar-bottom { 
  margin-top: auto; 
  padding: var(--space-6) var(--space-4); 
  border-top: 1px solid var(--border-subtle); 
}
.footer-info { font-size: var(--font-xs); color: var(--text-tertiary); line-height: 1.4; }
.bug-report a { color: var(--accent-primary); text-decoration: none; font-weight: 600; }
.copyright { margin-top: 4px; opacity: 0.6; }

/* ===== NOTIFICATIONS ===== */
.notification-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.notification {
  pointer-events: auto;
  min-width: 280px;
  max-width: 400px;
  background: var(--bg-menu);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-menu);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-weight: 500;
  animation: notificationIn 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
  transition: all 0.3s ease;
}

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

.notification.fade-out {
  opacity: 0;
  transform: translateY(-10px);
}

.notification i {
  font-size: 18px;
  flex-shrink: 0;
}

.notification-success i { color: var(--success); }
.notification-error i { color: var(--danger); }
.notification-info i { color: var(--accent-primary); }
.notification-warning i { color: var(--warning); }

.notification-success { border-left: 4px solid var(--success); }
.notification-error { border-left: 4px solid var(--danger); }
.notification-info { border-left: 4px solid var(--accent-primary); }
.notification-warning { border-left: 4px solid var(--warning); }

/* ===== FONTS MODULE MODAL ===== */
#font-upload-modal .modal-content {
  max-width: 450px;
}

#font-upload-modal .modal-header h3 {
  font-size: var(--font-xl);
  font-weight: 700;
}

#font-upload-modal .modal-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

#font-upload-modal .field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

#font-upload-modal .field span {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

#font-upload-modal input,
#font-upload-modal select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  font-family: inherit;
  width: 100%;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-tertiary); }

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-muted);
}

.admin-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: var(--bg-hover);
}

.admin-table code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-family: monospace;
  font-size: 12px;
  color: var(--accent-primary);
}

.page-actions {
  display: flex;
  gap: var(--space-3);
}

/* ===== RESPONSIVE UTILITIES & MODULE FIXES ===== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

.grid-responsive {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
}

@media (max-width: 768px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  .content {
    padding: var(--space-4);
  }
  
  .page-header {
    flex-direction: column;
    gap: var(--space-4);
    align-items: flex-start;
  }
  
  .page-actions {
    width: 100%;
  }
  
  .page-actions .btn {
    flex: 1;
    justify-content: center;
  }
  
  .card {
    padding: var(--space-4);
  }

  .modules-header {
    flex-direction: column;
    gap: var(--space-4);
    align-items: stretch;
    padding: var(--space-4);
  }

  .modules-search-wrap {
    max-width: none;
  }
}

/* Module Editor Improvements */
.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.field-group label {
  font-weight: 600;
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.input-styled {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-muted);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--font-sm);
  transition: all var(--transition-base);
}

.input-styled:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

