/* ============================================================
   HKVM Admin Panel - Professional Dual Theme
   Dark: Black & White Professional
   Light: White & Black Humanistic
   Dynamic Glass Panels • No AI Look • Pure Professional
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ============= CSS VARIABLES - DARK THEME (DEFAULT) ============= */
:root {
  /* Backgrounds - Pure Black Professional */
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-card: rgba(18, 18, 18, 0.85);
  --bg-card-hover: rgba(28, 28, 28, 0.9);
  --bg-sidebar: rgba(10, 10, 10, 0.95);
  --bg-header: rgba(0, 0, 0, 0.85);
  --bg-input: rgba(20, 20, 20, 0.8);
  --bg-modal: rgba(15, 15, 15, 0.98);
  --bg-overlay: rgba(0, 0, 0, 0.85);
  --bg-tooltip: rgba(20, 20, 20, 0.95);
  --bg-table-hover: rgba(255, 255, 255, 0.03);
  --bg-table-stripe: rgba(255, 255, 255, 0.01);
  --bg-badge: rgba(30, 30, 30, 0.9);
  --bg-elevated: rgba(25, 25, 25, 0.9);
  --bg-track: rgba(255, 255, 255, 0.1);

  /* Accents - Minimal & Professional */
  --accent-primary: #ffffff;
  --accent-secondary: #e5e5e5;
  --accent-tertiary: #cccccc;
  --accent-green: #00ff00;
  --accent-red: #ff0000;
  --accent-orange: #ff8800;
  --accent-pink: #ff00ff;
  --accent-blue: #0088ff;
  --accent-teal: #00ffff;

  /* Semantic Colors - Dark Theme */
  --color-indigo: #6366F1;
  --color-indigo-light: rgba(99, 102, 241, 0.15);
  --color-emerald: #10B981;
  --color-emerald-light: rgba(16, 185, 129, 0.15);
  --color-amber: #F59E0B;
  --color-amber-light: rgba(245, 158, 11, 0.15);
  --color-orange: #F97316;
  --color-red: #EF4444;
  --color-red-light: rgba(239, 68, 68, 0.15);
  --color-violet: #8B5CF6;
  --color-violet-light: rgba(139, 92, 246, 0.15);
  --color-cyan: #06B6D4;
  --color-cyan-light: rgba(6, 182, 212, 0.15);
  --color-gray: #9CA3AF;
  --color-gray-light: rgba(156, 163, 175, 0.15);

  /* Gradients - Subtle Glass Effects */
  --gradient-primary: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
  --gradient-green: linear-gradient(135deg, rgba(0, 255, 0, 0.2) 0%, rgba(0, 200, 0, 0.1) 100%);
  --gradient-red: linear-gradient(135deg, rgba(255, 0, 0, 0.2) 0%, rgba(200, 0, 0, 0.1) 100%);
  --gradient-orange: linear-gradient(135deg, rgba(255, 136, 0, 0.2) 0%, rgba(200, 100, 0, 0.1) 100%);
  --gradient-blue: linear-gradient(135deg, rgba(0, 136, 255, 0.2) 0%, rgba(0, 100, 200, 0.1) 100%);
  --gradient-dark: linear-gradient(135deg, rgba(20, 20, 20, 0.9) 0%, rgba(10, 10, 10, 0.95) 100%);
  --gradient-card: linear-gradient(145deg, rgba(18, 18, 18, 0.8), rgba(15, 15, 15, 0.9));
  --gradient-sidebar: linear-gradient(180deg, rgba(10, 10, 10, 0.95) 0%, rgba(5, 5, 5, 0.98) 100%);
  --gradient-glow: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
  --gradient-mesh:
    radial-gradient(at 40% 20%, rgba(255, 255, 255, 0.02) 0px, transparent 50%),
    radial-gradient(at 80% 0%, rgba(255, 255, 255, 0.015) 0px, transparent 50%),
    radial-gradient(at 0% 50%, rgba(255, 255, 255, 0.01) 0px, transparent 50%);

  /* Borders - Clean White Lines */
  --border-color: rgba(255, 255, 255, 0.12);
  --border-color-hover: rgba(255, 255, 255, 0.25);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-card: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(255, 255, 255, 0.4);

  /* Text - Pure White Scheme */
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #999999;
  --text-accent: #ffffff;
  --text-disabled: #666666;

  /* Shadows - Deep & Professional */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.8);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.9);
  --shadow-glow: 0 0 30px rgba(255, 255, 255, 0.1);
  --shadow-glow-green: 0 0 20px rgba(0, 255, 0, 0.3);
  --shadow-glow-red: 0 0 20px rgba(255, 0, 0, 0.3);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  --shadow-button: 0 4px 15px rgba(255, 255, 255, 0.15);
  --shadow-input: 0 2px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.02);
  --shadow-focus: 0 0 0 3px rgba(255, 255, 255, 0.15);

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Motion */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.22, 1.2, 0.36, 1);

  /* Glass Effect */
  --glass-bg: rgba(18, 18, 18, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: blur(20px);
}

/* ============= CSS VARIABLES - LIGHT THEME ============= */
body.light-theme {
  /* Backgrounds - Pure White Humanistic */
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(248, 248, 248, 0.95);
  --bg-sidebar: rgba(250, 250, 250, 0.95);
  --bg-header: rgba(255, 255, 255, 0.85);
  --bg-input: rgba(245, 245, 245, 0.8);
  --bg-modal: rgba(255, 255, 255, 0.98);
  --bg-overlay: rgba(0, 0, 0, 0.4);
  --bg-tooltip: rgba(245, 245, 245, 0.95);
  --bg-table-hover: rgba(0, 0, 0, 0.02);
  --bg-table-stripe: rgba(0, 0, 0, 0.01);
  --bg-badge: rgba(240, 240, 240, 0.9);
  --bg-elevated: rgba(255, 255, 255, 0.95);
  --bg-track: rgba(0, 0, 0, 0.08);

  /* Accents - Black Primary with Soft Colors */
  --accent-primary: #000000;
  --accent-secondary: #333333;
  --accent-tertiary: #666666;
  --accent-green: #00aa00;
  --accent-red: #cc0000;
  --accent-orange: #dd6600;
  --accent-pink: #cc00cc;
  --accent-blue: #0066cc;
  --accent-teal: #00aaaa;

  /* Semantic Colors - Light Theme */
  --color-indigo: #4F46E5;
  --color-indigo-light: rgba(79, 70, 229, 0.12);
  --color-emerald: #059669;
  --color-emerald-light: rgba(5, 150, 105, 0.12);
  --color-amber: #D97706;
  --color-amber-light: rgba(217, 119, 6, 0.12);
  --color-orange: #EA580C;
  --color-red: #DC2626;
  --color-red-light: rgba(220, 38, 38, 0.12);
  --color-violet: #7C3AED;
  --color-violet-light: rgba(124, 58, 237, 0.12);
  --color-cyan: #0891B2;
  --color-cyan-light: rgba(8, 145, 178, 0.12);
  --color-gray: #6B7280;
  --color-gray-light: rgba(107, 114, 128, 0.12);

  /* Gradients - Soft & Warm */
  --gradient-primary: linear-gradient(135deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.04) 100%);
  --gradient-green: linear-gradient(135deg, rgba(0, 170, 0, 0.15) 0%, rgba(0, 130, 0, 0.08) 100%);
  --gradient-red: linear-gradient(135deg, rgba(204, 0, 0, 0.15) 0%, rgba(150, 0, 0, 0.08) 100%);
  --gradient-orange: linear-gradient(135deg, rgba(221, 102, 0, 0.15) 0%, rgba(180, 80, 0, 0.08) 100%);
  --gradient-blue: linear-gradient(135deg, rgba(0, 102, 204, 0.15) 0%, rgba(0, 80, 160, 0.08) 100%);
  --gradient-dark: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 248, 248, 0.9) 100%);
  --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(252, 252, 252, 0.95));
  --gradient-sidebar: linear-gradient(180deg, rgba(250, 250, 250, 0.95) 0%, rgba(245, 245, 245, 0.98) 100%);
  --gradient-glow: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.03) 0%, transparent 70%);
  --gradient-mesh:
    radial-gradient(at 40% 20%, rgba(0, 0, 0, 0.015) 0px, transparent 50%),
    radial-gradient(at 80% 0%, rgba(0, 0, 0, 0.01) 0px, transparent 50%),
    radial-gradient(at 0% 50%, rgba(0, 0, 0, 0.008) 0px, transparent 50%);

  /* Borders - Soft Black Lines */
  --border-color: rgba(0, 0, 0, 0.1);
  --border-color-hover: rgba(0, 0, 0, 0.2);
  --border-subtle: rgba(0, 0, 0, 0.05);
  --border-card: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(0, 0, 0, 0.3);

  /* Text - Pure Black Scheme */
  --text-primary: #000000;
  --text-secondary: #333333;
  --text-muted: #666666;
  --text-accent: #000000;
  --text-disabled: #999999;

  /* Shadows - Soft & Warm */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 10px 40px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 20px rgba(0, 0, 0, 0.08);
  --shadow-glow-green: 0 0 15px rgba(0, 170, 0, 0.2);
  --shadow-glow-red: 0 0 15px rgba(204, 0, 0, 0.2);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  --shadow-button: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-input: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  --shadow-focus: 0 0 0 3px rgba(0, 0, 0, 0.1);

  /* Glass Effect */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.1);
  --glass-blur: blur(20px);
}

/* ============= REDUCED MOTION ============= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============= RESET & BASE ============= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  background-image: var(--gradient-mesh);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ============= SCROLLBAR ============= */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}
::-webkit-scrollbar-corner {
  background: transparent;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

body.light-theme ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}
body.light-theme ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}
body.light-theme * {
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* ============= SELECTION & FOCUS ============= */
::selection {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

body.light-theme ::selection {
  background: rgba(0, 0, 0, 0.15);
  color: var(--text-primary);
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============= ANIMATIONS ============= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 6px rgba(255, 255, 255, 0.15); }
  50% { box-shadow: 0 0 18px rgba(255, 255, 255, 0.35); }
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 5px rgba(0, 255, 0, 0.3); }
  50% { box-shadow: 0 0 16px rgba(0, 255, 0, 0.55); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(1.15); }
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateX(24px); }
}

@keyframes soft-bounce {
  0% { transform: scale(0.97); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes border-glow {
  0%, 100% { border-color: rgba(255, 255, 255, 0.15); }
  50% { border-color: rgba(255, 255, 255, 0.35); }
}

@keyframes ripple {
  0% { transform: scale(0); opacity: 0.45; }
  100% { transform: scale(2.5); opacity: 0; }
}

@keyframes count-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInModal {
  from { 
    opacity: 0; 
    transform: scale(0.92) translateY(24px);
  }
  to { 
    opacity: 1; 
    transform: scale(1) translateY(0);
  }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(32px) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(32px) scale(0.96); }
}

@keyframes skeleton-wave {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes progress-fill {
  from { width: 0; }
}

@keyframes stagger-fade {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Staggered entrance helpers */
.stagger-1 { animation: stagger-fade 0.4s var(--ease-out) 0.05s both; }
.stagger-2 { animation: stagger-fade 0.4s var(--ease-out) 0.1s both; }
.stagger-3 { animation: stagger-fade 0.4s var(--ease-out) 0.15s both; }
.stagger-4 { animation: stagger-fade 0.4s var(--ease-out) 0.2s both; }
.stagger-5 { animation: stagger-fade 0.4s var(--ease-out) 0.25s both; }
.stagger-6 { animation: stagger-fade 0.4s var(--ease-out) 0.3s both; }

/* ============= PARTICLES BACKGROUND ============= */
.particles-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  animation: float 7s ease-in-out infinite;
}

body.light-theme .particle {
  background: rgba(0, 0, 0, 0.1);
}

/* ============= LAYOUT ============= */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ============= GLASS PANELS ============= */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-card);
}

/* ============= SIDEBAR ============= */
.admin-sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--gradient-sidebar);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal), width var(--transition-normal);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  animation: fadeInLeft 0.35s ease-out;
  overflow: hidden;
}

.sidebar-brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  flex-shrink: 0;
  background: var(--bg-sidebar);
}

.sidebar-brand::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--gradient-primary);
  opacity: 0.45;
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: transparent;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: none;
  animation: none;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.sidebar-brand-version {
  font-size: 10px;
  color: var(--text-accent);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  min-height: 0;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

body.light-theme .sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}
body.light-theme .sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

.nav-section {
  margin-bottom: 20px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-muted);
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: color var(--transition-fast),
              background var(--transition-fast),
              border-color var(--transition-fast),
              transform var(--transition-fast);
  position: relative;
  margin-bottom: 2px;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
  transform: translateX(2px);
}

body.light-theme .nav-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.nav-item.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

body.light-theme .nav-item.active {
  color: var(--accent-primary);
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.15);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 58%;
  background: var(--text-primary);
  border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  opacity: 0.8;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  opacity: 1;
}

.nav-item:hover .nav-icon {
  transform: scale(1.08);
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent-primary);
  color: var(--bg-primary);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 600;
  flex-shrink: 0;
  animation: soft-bounce 0.4s var(--ease-spring);
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  background: var(--bg-sidebar);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: background var(--transition-fast), border-color var(--transition-fast);
  cursor: pointer;
}

.sidebar-user:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.sidebar-system-status {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 255, 0, 0.05);
  border: 1px solid rgba(0, 255, 0, 0.14);
}

body.light-theme .sidebar-system-status {
  background: rgba(0, 170, 0, 0.05);
  border-color: rgba(0, 170, 0, 0.14);
}

.system-status-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.system-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.system-stat:last-child {
  margin-bottom: 0;
}

.system-stat-label {
  font-size: 11px;
  color: var(--text-muted);
}

.system-stat-bar {
  flex: 1;
  height: 3px;
  background: var(--bg-track);
  border-radius: 2px;
  margin: 0 8px;
  overflow: hidden;
}

.system-stat-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 2px;
  transition: width 0.9s var(--ease-out);
}

.system-stat-value {
  font-size: 11px;
  color: var(--accent-green);
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ============= HEADER ============= */
.admin-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 22px;
  z-index: 50;
  gap: 14px;
  transition: left var(--transition-normal);
  animation: slideDown 0.35s var(--ease-out);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.sidebar-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-color-hover);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  min-width: 0;
}

.breadcrumb-item {
  color: var(--text-muted);
  white-space: nowrap;
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 500;
}

.breadcrumb-separator {
  color: var(--text-muted);
  font-size: 12px;
}

.header-search {
  flex: 1;
  max-width: 360px;
}

.search-input-wrapper {
  position: relative;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
  transition: color var(--transition-fast);
}

.search-input-wrapper:focus-within .search-icon {
  color: var(--accent-primary);
}

.search-input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  font-family: inherit;
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 16px;
  transition: all var(--transition-fast);
  position: relative;
  text-decoration: none;
}

.header-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-color-hover);
  transform: translateY(-1px);
}

.header-btn .notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--accent-red);
  border-radius: 50%;
  border: 1.5px solid var(--bg-primary);
  animation: status-pulse 2s ease-in-out infinite;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  background: rgba(0, 255, 0, 0.1);
  border: 1px solid rgba(0, 255, 0, 0.25);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--accent-green);
  font-weight: 500;
}

body.light-theme .header-status {
  background: rgba(0, 170, 0, 0.1);
  border-color: rgba(0, 170, 0, 0.25);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: status-pulse 2s ease-in-out infinite;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.header-user:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

.header-user-avatar {
  width: 28px;
  height: 28px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.header-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============= MAIN CONTENT ============= */
.admin-main {
  margin-left: var(--sidebar-width);
  padding-top: var(--header-height);
  min-height: 100vh;
  flex: 1;
  background: transparent;
  position: relative;
  transition: margin-left var(--transition-normal);
}

.admin-content {
  padding: 26px 28px;
  animation: fadeIn 0.4s var(--ease-out);
  max-width: 1600px;
}


/* ============= PAGE HEADER ============= */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 26px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.4px;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.25;
}

.page-title .title-icon {
  font-size: 24px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============= STAT CARDS ============= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-normal),
              border-color var(--transition-normal),
              box-shadow var(--transition-normal);
  animation: fadeIn 0.45s var(--ease-out) both;
  box-shadow: var(--shadow-card);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--card-gradient, var(--gradient-primary));
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 110px;
  height: 110px;
  background: var(--card-gradient, var(--gradient-primary));
  border-radius: 50%;
  opacity: 0.04;
  transition: opacity var(--transition-normal);
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.stat-card:hover::after {
  opacity: 0.09;
}

.stat-card:focus-within {
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.stat-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  background: transparent;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: none;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.stat-card:hover .stat-icon {
  transform: scale(1.08);
}

.stat-trend {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.stat-trend.up {
  color: var(--accent-green);
  background: rgba(0, 255, 0, 0.12);
}
.stat-trend.down {
  color: var(--accent-red);
  background: rgba(255, 0, 0, 0.12);
}
.stat-trend.neutral {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
}

body.light-theme .stat-trend.up {
  background: rgba(0, 170, 0, 0.12);
}
body.light-theme .stat-trend.down {
  background: rgba(204, 0, 0, 0.12);
}
body.light-theme .stat-trend.neutral {
  background: rgba(0, 0, 0, 0.04);
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
  animation: count-up 0.5s var(--ease-out);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============= CARDS ============= */
.card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  animation: fadeIn 0.4s var(--ease-out);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
  border-color: var(--border-color);
}

.card-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.015);
}

body.light-theme .card-header {
  background: rgba(0, 0, 0, 0.02);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  font-size: 16px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.12);
}

body.light-theme .card-footer {
  background: rgba(0, 0, 0, 0.03);
}

/* ============= BUTTONS ============= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition-fast),
              box-shadow var(--transition-fast),
              background var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  font-family: inherit;
  letter-spacing: 0.15px;
  user-select: none;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.08);
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.btn:hover::before {
  opacity: 1;
}

body.light-theme .btn::before {
  background: rgba(0, 0, 0, 0.05);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-button);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

body.light-theme .btn-primary {
  color: #ffffff;
}

body.light-theme .btn-primary:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.btn-success {
  background: var(--gradient-green);
  color: #ffffff;
  border-color: var(--accent-green);
  box-shadow: 0 4px 15px rgba(0, 255, 0, 0.25);
}

.btn-success:hover {
  box-shadow: 0 6px 24px rgba(0, 255, 0, 0.4);
  transform: translateY(-1px);
}

body.light-theme .btn-success {
  box-shadow: 0 4px 15px rgba(0, 170, 0, 0.25);
}

body.light-theme .btn-success:hover {
  box-shadow: 0 6px 24px rgba(0, 170, 0, 0.4);
}

.btn-danger {
  background: var(--gradient-red);
  color: #ffffff;
  border-color: var(--accent-red);
  box-shadow: 0 4px 15px rgba(255, 0, 0, 0.25);
}

.btn-danger:hover {
  box-shadow: 0 6px 24px rgba(255, 0, 0, 0.4);
  transform: translateY(-1px);
}

body.light-theme .btn-danger {
  box-shadow: 0 4px 15px rgba(204, 0, 0, 0.25);
}

body.light-theme .btn-danger:hover {
  box-shadow: 0 6px 24px rgba(204, 0, 0, 0.4);
}

.btn-warning {
  background: var(--gradient-orange);
  color: #ffffff;
  border-color: var(--accent-orange);
}

.btn-warning:hover {
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color-hover);
}

.btn-outline {
  background: transparent;
  color: var(--accent-primary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color-hover);
}

body.light-theme .btn-outline:hover {
  background: rgba(0, 0, 0, 0.03);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
  gap: 5px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 14px;
  border-radius: var(--radius-md);
}

.btn-icon {
  padding: 8px;
  width: 34px;
  height: 34px;
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
  padding: 6px;
}

/* Loading state */
.btn.loading {
  pointer-events: none;
  opacity: 0.85;
  color: transparent !important;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

/* ============= BADGES ============= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.badge-running {
  background: rgba(0, 255, 0, 0.14);
  color: #00ff00;
  border: 1px solid rgba(0, 255, 0, 0.25);
}
.badge-stopped {
  background: rgba(150, 150, 150, 0.14);
  color: #999999;
  border: 1px solid rgba(150, 150, 150, 0.2);
}
.badge-error {
  background: rgba(255, 0, 0, 0.14);
  color: #ff0000;
  border: 1px solid rgba(255, 0, 0, 0.25);
}
.badge-pending {
  background: rgba(255, 136, 0, 0.14);
  color: #ff8800;
  border: 1px solid rgba(255, 136, 0, 0.25);
}
.badge-info {
  background: rgba(0, 136, 255, 0.14);
  color: #0088ff;
  border: 1px solid rgba(0, 136, 255, 0.25);
}
.badge-admin {
  background: rgba(255, 0, 255, 0.14);
  color: #ff00ff;
  border: 1px solid rgba(255, 0, 255, 0.25);
}
.badge-user {
  background: rgba(0, 255, 255, 0.14);
  color: #00ffff;
  border: 1px solid rgba(0, 255, 255, 0.25);
}

body.light-theme .badge-running {
  background: rgba(0, 170, 0, 0.08);
  color: var(--accent-green);
  border-color: rgba(0, 170, 0, 0.2);
}
body.light-theme .badge-stopped {
  background: rgba(100, 100, 100, 0.08);
  color: #666666;
  border-color: rgba(100, 100, 100, 0.15);
}
body.light-theme .badge-error {
  background: rgba(204, 0, 0, 0.08);
  color: var(--accent-red);
  border-color: rgba(204, 0, 0, 0.15);
}
body.light-theme .badge-pending {
  background: rgba(221, 102, 0, 0.08);
  color: var(--accent-orange);
  border-color: rgba(221, 102, 0, 0.15);
}

.badge .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: status-pulse 2s ease-in-out infinite;
}

/* ============= TABLES ============= */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead tr {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

body.light-theme .table thead tr {
  background: rgba(0, 0, 0, 0.02);
}

.table th {
  padding: 12px 16px;
  text-align: left;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  white-space: nowrap;
}

.table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--bg-table-hover);
}

.table tbody tr:last-child {
  border-bottom: none;
}

.table td {
  padding: 13px 16px;
  color: var(--text-secondary);
  vertical-align: middle;
}

.table td.strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* ============= FORMS ============= */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-label .required {
  color: var(--accent-red);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  font-family: inherit;
  box-shadow: var(--shadow-input);
  -webkit-appearance: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus), var(--shadow-input);
  background: var(--bg-input);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.03);
}

body.light-theme .form-control:disabled {
  background: rgba(0, 0, 0, 0.03);
}

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

select.form-control option {
  background: var(--bg-card);
  color: var(--text-primary);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}

.form-error {
  font-size: 11px;
  color: var(--accent-red);
  margin-top: 5px;
  display: none;
}

.form-group.has-error .form-control {
  border-color: rgba(255, 0, 0, 0.55);
}

body.light-theme .form-group.has-error .form-control {
  border-color: rgba(204, 0, 0, 0.55);
}

.form-group.has-error .form-error {
  display: block;
}

.form-group.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.input-group {
  display: flex;
}

.input-group .form-control {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group .btn {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* Toggle Switch */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-track {
  width: 42px;
  height: 22px;
  background: var(--bg-track);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.toggle-input:checked + .toggle-track {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--bg-primary);
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

body.light-theme .toggle-thumb {
  background: #ffffff;
}

.toggle-input:checked + .toggle-track .toggle-thumb {
  transform: translateX(20px);
}

.toggle-input:focus-visible + .toggle-track {
  box-shadow: var(--shadow-focus);
}

.toggle-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Radio Cards */
.radio-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.radio-card {
  position: relative;
}

.radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-card-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 12px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  text-align: center;
}

.radio-card input:checked + .radio-card-label {
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

body.light-theme .radio-card input:checked + .radio-card-label {
  background: rgba(0, 0, 0, 0.03);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.radio-card-label:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-card);
  transform: translateY(-1px);
}

.radio-card-icon {
  font-size: 22px;
}
.radio-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.radio-card-desc {
  font-size: 10px;
  color: var(--text-muted);
}

/* ============= MODALS ============= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: calc(100vh - 40px);
  min-height: auto;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), var(--shadow-glow);
  transform: scale(0.94) translateY(20px);
  transition: transform var(--transition-bounce);
  display: flex;
  flex-direction: column;
  position: relative;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.modal-overlay.show .modal {
  transform: scale(1) translateY(0);
  animation: slideInModal 0.35s var(--ease-spring);
}

.modal-centered {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: auto;
  animation: slideInModal 0.3s ease-out;
}

.modal-lg {
  max-width: 700px;
}
.modal-xl {
  max-width: 900px;
}

.modal-header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: var(--bg-modal);
  z-index: 10;
}

.modal-overlay.show .modal-header {
  background: var(--bg-modal);
  border-bottom-color: var(--border-color);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.3;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  line-height: 1;
}

body.light-theme .modal-close {
  background: rgba(0, 0, 0, 0.03);
}

.modal-close:hover {
  background: rgba(255, 0, 0, 0.15);
  color: var(--accent-red);
  border-color: rgba(255, 0, 0, 0.3);
  transform: rotate(90deg) scale(1.05);
}

body.light-theme .modal-close:hover {
  background: rgba(204, 0, 0, 0.15);
  border-color: rgba(204, 0, 0, 0.3);
}

.modal-close:active {
  transform: rotate(90deg) scale(0.98);
}

.modal-body {
  padding: 28px 24px;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-body > div {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-body .btn {
  width: 100%;
  padding: 14px 16px;
  font-size: 14px;
  height: auto;
  min-height: 48px;
  border-radius: var(--radius-md);
  font-weight: 600;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

body.light-theme .modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}

body.light-theme .modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.01);
}

body.light-theme .modal-footer {
  background: rgba(0, 0, 0, 0.01);
}

/* ============= DROPDOWN ============= */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  overflow: hidden;
  animation: slideDown 0.15s var(--ease-out);
  display: none;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  font-family: inherit;
  text-align: left;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

body.light-theme .dropdown-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.dropdown-item.danger:hover {
  background: rgba(255, 0, 0, 0.1);
  color: var(--accent-red);
}

body.light-theme .dropdown-item.danger:hover {
  background: rgba(204, 0, 0, 0.1);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

/* ============= ALERTS ============= */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  animation: slideDown 0.3s var(--ease-out);
  border: 1px solid;
}

.alert-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}
.alert-content {
  flex: 1;
}
.alert-title {
  font-weight: 600;
  margin-bottom: 2px;
}
.alert-message {
  opacity: 0.88;
}

.alert-success {
  background: rgba(0, 255, 0, 0.08);
  color: #00ff00;
  border-color: rgba(0, 255, 0, 0.22);
}
.alert-error {
  background: rgba(255, 0, 0, 0.08);
  color: #ff0000;
  border-color: rgba(255, 0, 0, 0.22);
}
.alert-warning {
  background: rgba(255, 136, 0, 0.08);
  color: #ff8800;
  border-color: rgba(255, 136, 0, 0.22);
}
.alert-info {
  background: rgba(0, 136, 255, 0.08);
  color: #0088ff;
  border-color: rgba(0, 136, 255, 0.22);
}

body.light-theme .alert-success {
  color: var(--accent-green);
  background: rgba(0, 170, 0, 0.08);
  border-color: rgba(0, 170, 0, 0.22);
}

body.light-theme .alert-error {
  color: var(--accent-red);
  background: rgba(204, 0, 0, 0.08);
  border-color: rgba(204, 0, 0, 0.22);
}

body.light-theme .alert-warning {
  color: var(--accent-orange);
  background: rgba(221, 102, 0, 0.08);
  border-color: rgba(221, 102, 0, 0.22);
}

body.light-theme .alert-info {
  color: var(--accent-blue);
  background: rgba(0, 102, 204, 0.08);
  border-color: rgba(0, 102, 204, 0.22);
}

/* ============= PROGRESS BARS ============= */
.progress {
  height: 6px;
  background: var(--bg-track);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width 0.85s var(--ease-out);
  width: var(--progress, 0%);
}

.progress-bar.animate {
  animation: progress-fill 1.2s var(--ease-out) forwards;
}

.progress-bar.green {
  background: var(--gradient-green);
}
.progress-bar.red {
  background: var(--gradient-red);
}
.progress-bar.orange {
  background: var(--gradient-orange);
}

/* ============= TABS ============= */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: color var(--transition-fast), background var(--transition-fast);
  font-family: inherit;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover {
  color: var(--text-secondary);
}

.tab-btn.active {
  color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.03);
}

body.light-theme .tab-btn.active {
  background: rgba(0, 0, 0, 0.02);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-primary);
  border-radius: 2px 2px 0 0;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s var(--ease-out);
}
.tab-pane.active {
  display: block;
}

/* ============= CODE / TERMINAL ============= */
.code-block {
  background: #0a0a12;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: #a5f3fc;
  overflow-x: auto;
  line-height: 1.7;
}

body.light-theme .code-block {
  background: #1e1e2e;
  color: #a5f3fc;
}

.terminal-container {
  background: #050508;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

body.light-theme .terminal-container {
  background: #0a0a0f;
  border-color: rgba(0, 0, 0, 0.15);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #0c0c14;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.light-theme .terminal-bar {
  background: #0f0f18;
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-dot.red { background: #ff0000; }
.terminal-dot.yellow { background: #ff8800; }
.terminal-dot.green { background: #00ff00; }

body.light-theme .terminal-dot.red { background: #cc0000; }
body.light-theme .terminal-dot.yellow { background: #dd6600; }
body.light-theme .terminal-dot.green { background: #00aa00; }

.terminal-title {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.terminal-body {
  padding: 16px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: #e2e8f0;
  min-height: 300px;
  overflow-y: auto;
  line-height: 1.8;
}

.terminal-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: var(--accent-primary);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

/* ============= LOADER ============= */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

body.light-theme .spinner {
  border-color: rgba(0, 0, 0, 0.15);
  border-top-color: var(--accent-primary);
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  border-radius: inherit;
}

body.light-theme .loading-overlay {
  background: rgba(255, 255, 255, 0.7);
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-card) 25%,
    rgba(255, 255, 255, 0.05) 50%,
    var(--bg-card) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: var(--radius-sm);
}

body.light-theme .skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-card) 25%,
    rgba(0, 0, 0, 0.03) 50%,
    var(--bg-card) 75%
  );
  background-size: 200% 100%;
}

/* ============= TOAST NOTIFICATIONS ============= */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  min-width: 280px;
  max-width: 400px;
  animation: toast-in 0.35s var(--ease-spring);
  pointer-events: all;
  cursor: pointer;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.toast.removing {
  animation: toast-out 0.3s var(--ease-out) forwards;
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.toast-message {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}
.toast-close {
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

.toast-success {
  border-color: rgba(0, 255, 0, 0.3);
  border-left: 3px solid var(--accent-green);
}
.toast-error {
  border-color: rgba(255, 0, 0, 0.3);
  border-left: 3px solid var(--accent-red);
}
.toast-warning {
  border-color: rgba(255, 136, 0, 0.3);
  border-left: 3px solid var(--accent-orange);
}
.toast-info {
  border-color: rgba(0, 136, 255, 0.3);
  border-left: 3px solid var(--accent-blue);
}

body.light-theme .toast-success {
  border-color: rgba(0, 170, 0, 0.3);
}

body.light-theme .toast-error {
  border-color: rgba(204, 0, 0, 0.3);
}

body.light-theme .toast-warning {
  border-color: rgba(221, 102, 0, 0.3);
}

body.light-theme .toast-info {
  border-color: rgba(0, 102, 204, 0.3);
}

/* ============= VM SPECIFIC ============= */
.vm-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: transform var(--transition-normal),
              border-color var(--transition-normal),
              box-shadow var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  animation: fadeIn 0.4s var(--ease-out);
}

.vm-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.vm-card:hover {
  border-color: var(--border-color-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.vm-card:hover::before {
  opacity: 1;
}

.vm-card:focus-within {
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.vm-card.running { --status-color: var(--accent-green); }
.vm-card.stopped { --status-color: var(--text-muted); }
.vm-card.error { --status-color: var(--accent-red); }

.vm-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.vm-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vm-os {
  font-size: 11px;
  color: var(--text-muted);
}

.vm-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.vm-stat-item {
  text-align: center;
}
.vm-stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.vm-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.vm-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}
.vm-actions .btn {
  flex: 1;
}

.vm-list-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
  gap: 12px;
}

.vm-list-item:hover {
  background: var(--bg-table-hover);
}
.vm-list-item:last-child {
  border-bottom: none;
}

/* ============= RESOURCE MONITOR ============= */
.resource-ring {
  position: relative;
  width: 80px;
  height: 80px;
}

.resource-ring svg {
  transform: rotate(-90deg);
}

.resource-ring .ring-bg {
  stroke: var(--bg-track);
  fill: none;
}

.resource-ring .ring-fill {
  stroke: url(#ringGradient);
  fill: none;
  stroke-linecap: round;
  transition: stroke-dasharray 1s var(--ease-out);
}

.resource-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.resource-ring-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.resource-ring-unit {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ============= CHART AREA ============= */
.chart-container {
  position: relative;
  padding: 10px 0;
}

.mini-chart {
  height: 40px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}

.mini-chart-bar {
  flex: 1;
  background: var(--gradient-primary);
  border-radius: 2px 2px 0 0;
  opacity: 0.7;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  min-height: 2px;
  transform-origin: bottom;
}

.mini-chart-bar:hover {
  opacity: 1;
  transform: scaleY(1.05);
}

/* ============= EMPTY STATE ============= */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 52px;
  margin-bottom: 16px;
  opacity: 0.4;
  animation: float 3.5s ease-in-out infinite;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 13px;
  margin-bottom: 24px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

/* ============= LOGIN PAGE ============= */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(255, 255, 255, 0.03) 0%, transparent 60%);
}

body.light-theme .login-bg {
  background:
    radial-gradient(ellipse at 20% 20%, rgba(0, 0, 0, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(0, 0, 0, 0.02) 0%, transparent 60%);
}

.login-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.6) 0%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.6) 0%, transparent 80%);
}

body.light-theme .login-bg-grid {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 0 20px;
  position: relative;
  z-index: 1;
  animation: fadeIn 0.55s var(--ease-out);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 72px;
  height: 72px;
  background: transparent;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin: 0 auto 16px;
  animation: float 3.5s ease-in-out infinite;
}

.login-logo-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.login-logo-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-xl), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
}

.login-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
}

.login-footer a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: opacity var(--transition-fast);
}
.login-footer a:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* ============= SETTINGS ============= */
.settings-section {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}

.settings-section-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  gap: 10px;
}

body.light-theme .settings-section-header {
  background: rgba(0, 0, 0, 0.02);
}

.settings-section-icon {
  font-size: 18px;
}

.settings-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-section-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.settings-section-body {
  padding: 20px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: 20px;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-info {
  flex: 1;
}
.settings-row-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.settings-row-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.settings-row-control {
  flex-shrink: 0;
  min-width: 180px;
}

/* ============= SEARCH/FILTER BAR ============= */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
}

.filter-bar .form-control {
  min-width: 200px;
  flex: 1;
}

/* ============= PAGINATION ============= */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  margin-top: 20px;
}

.page-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.page-btn:hover,
.page-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--bg-primary);
}

body.light-theme .page-btn:hover,
body.light-theme .page-btn.active {
  color: #ffffff;
}

/* ============= MOBILE OVERLAY ============= */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
  pointer-events: none;
}

.sidebar-overlay.open {
  display: block;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ============= OS TEMPLATE CARDS ============= */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.template-card {
  position: relative;
  cursor: pointer;
}

.template-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.template-card-inner {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  background: transparent;
}

.template-card:hover .template-card-inner {
  border-color: var(--border-color-hover);
  transform: translateY(-2px);
}

.template-card input:checked + .template-card-inner {
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

body.light-theme .template-card input:checked + .template-card-inner {
  background: rgba(0, 0, 0, 0.02);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.03);
}

.template-icon {
  font-size: 28px;
  margin-bottom: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 56px;
}
.template-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.template-type {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============= NETWORK TYPE CARDS ============= */
.network-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.network-type-grid > div {
  position: relative;
}

.network-type-grid input[type="radio"] {
  display: none;
}

.network-type-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: var(--bg-card);
  border: 2px solid var(--border-card);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-align: center;
}

.network-type-grid input[type="radio"]:checked + .network-type-inner {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

body.light-theme .network-type-grid input[type="radio"]:checked + .network-type-inner {
  background: rgba(0, 0, 0, 0.03);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.03);
}

.network-type-inner:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
}

.network-type-icon {
  font-size: 24px;
  line-height: 1;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.network-type-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.network-type-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ============= WIZARD/STEPPER ============= */
.wizard-steps {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.wizard-step {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.wizard-step:last-child {
  flex: none;
}

.wizard-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  white-space: nowrap;
}

.wizard-step-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition-normal);
}

.wizard-step.active .wizard-step-num {
  background: var(--gradient-primary);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-glow);
  animation: soft-bounce 0.4s var(--ease-spring);
}

body.light-theme .wizard-step.active .wizard-step-num {
  color: #ffffff;
}

.wizard-step.completed .wizard-step-num {
  background: var(--gradient-green);
  border-color: var(--accent-green);
  color: #ffffff;
}

.wizard-step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.wizard-step.active .wizard-step-label {
  color: var(--accent-primary);
}
.wizard-step.completed .wizard-step-label {
  color: var(--accent-green);
}

.wizard-connector {
  flex: 1;
  height: 2px;
  background: var(--border-color);
  margin: 0 12px;
  position: relative;
  overflow: hidden;
  margin-bottom: 22px;
}

.wizard-connector.done {
  background: var(--accent-green);
}

/* ============= VNC CONSOLE ============= */
.vnc-container {
  background: #000;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.vnc-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  gap: 16px;
}

.vnc-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ============= SNAPSHOT TIMELINE ============= */
.snapshot-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.snapshot-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-primary);
  flex-shrink: 0;
  margin-top: 4px;
}

.snapshot-info {
  flex: 1;
}
.snapshot-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.snapshot-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============= ACTIVITY LOG ============= */
.log-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  transition: background var(--transition-fast);
}

.log-item:hover {
  background: var(--bg-table-hover);
}

.log-item:last-child {
  border-bottom: none;
}

.log-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.log-icon.start { background: rgba(0, 255, 0, 0.1); }
.log-icon.stop { background: rgba(150, 150, 150, 0.1); }
.log-icon.error { background: rgba(255, 0, 0, 0.1); }
.log-icon.create { background: rgba(255, 255, 255, 0.1); }

body.light-theme .log-icon.start { background: rgba(0, 170, 0, 0.1); }
body.light-theme .log-icon.stop { background: rgba(100, 100, 100, 0.1); }
body.light-theme .log-icon.error { background: rgba(204, 0, 0, 0.1); }
body.light-theme .log-icon.create { background: rgba(0, 0, 0, 0.05); }

.log-content {
  flex: 1;
}
.log-message {
  color: var(--text-secondary);
  line-height: 1.4;
}
.log-time {
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============= 404 PAGE ============= */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}

.error-code {
  font-size: 120px;
  font-weight: 900;
  line-height: 1;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -5px;
  animation: soft-bounce 0.6s var(--ease-spring);
}

.error-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 12px 0 8px;
}

.error-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ============= THEME SWITCHER ============= */
.theme-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-switcher:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-card-hover);
}

.theme-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition-fast);
  position: relative;
}

.theme-btn.active {
  background: var(--accent-primary);
  color: var(--bg-primary);
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
}

body.light-theme .theme-btn.active {
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

body.light-theme .theme-btn:hover:not(.active) {
  background: rgba(0, 0, 0, 0.03);
}

/* Smooth theme transitions */
.admin-sidebar,
.admin-header,
.admin-content,
.card,
.stat-card,
.btn,
input,
textarea,
select {
  transition: background-color var(--transition-normal),
              color var(--transition-normal),
              border-color var(--transition-normal),
              box-shadow var(--transition-normal);
}

@media (prefers-reduced-motion: no-preference) {
  body.theme-transitioning * {
    transition-duration: var(--transition-normal) !important;
  }
}

/* ============= TOOLTIPS ============= */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 10px;
  background: var(--bg-tooltip);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
  pointer-events: none;
  z-index: 300;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ============= CUSTOM CPU NAME ANIMATIONS ============= */
#custom_cpu_name_section {
  animation: slideDown 0.3s ease-out;
}

#custom_cpu_name {
  transition: all 0.2s ease;
  border: 1.5px solid var(--border-color);
}

#custom_cpu_name:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

body.light-theme #custom_cpu_name:focus {
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

#cpuNameValid {
  transition: opacity 0.2s ease;
  display: inline-block;
}

.form-check-input {
  transition: all 0.2s ease;
}

.form-check-input:hover {
  transform: scale(1.1);
}

.form-check-input:checked {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* ============= UTILITIES ============= */
.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }
.d-block { display: block; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted) !important; }
.text-primary-color { color: var(--text-primary) !important; }
.text-success { color: var(--accent-green) !important; }
.text-danger { color: var(--accent-red) !important; }
.text-warning { color: var(--accent-orange) !important; }
.text-info { color: var(--accent-blue) !important; }
.text-accent { color: var(--accent-primary) !important; }
.fw-bold { font-weight: 700; }
.fw-medium { font-weight: 500; }
.fs-small { font-size: 12px; }
.fs-large { font-size: 18px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 24px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.w-100 { width: 100%; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============= RESPONSIVE (SINGLE CONSOLIDATED SYSTEM) ============= */

/* Tablet */
@media (max-width: 1024px) {
  .admin-content {
    padding: 20px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile / Tablet sidebar collapse */
@media (max-width: 968px) {
  div[style*="grid-template-columns: 1fr 340px"] {
    grid-template-columns: 1fr !important;
  }
  
  div[style*="position: sticky; top: 100px"] {
    position: static !important;
    height: auto !important;
  }
}

@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
    z-index: 1000 !important;
  }

  .admin-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
    z-index: 1000 !important;
  }

  .sidebar-overlay {
    z-index: 999 !important;
  }

  .sidebar-overlay.open {
    z-index: 999 !important;
  }

  .admin-header {
    left: 0;
    z-index: 100;
  }

  .admin-main {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: flex;
  }

  .admin-content {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-actions {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .header-search {
    display: none;
  }

  .header-status {
    display: none;
  }

  .header-user-name {
    display: none;
  }

  .modal {
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .table {
    font-size: 12px;
  }
  .table th,
  .table td {
    padding: 10px 12px;
  }

  .network-type-grid {
    grid-template-columns: 1fr 1fr;
  }

  .template-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .breadcrumb {
    font-size: 12px;
  }

  .breadcrumb-separator {
    display: none;
  }
}

/* Small phones */
@media (max-width: 480px) {
  :root {
    --header-height: 56px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-value {
    font-size: 24px;
  }

  .template-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .radio-cards {
    grid-template-columns: 1fr 1fr;
  }

  .network-type-grid {
    grid-template-columns: 1fr;
  }

  .admin-content {
    padding: 12px;
  }

  .card-body {
    padding: 14px;
  }

  .login-card {
    padding: 24px 20px;
  }

  .error-code {
    font-size: 80px;
  }

  .page-title {
    font-size: 18px;
  }

  .btn-sm {
    padding: 4px 10px;
    font-size: 11px;
  }

  .header-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .dropdown-menu {
    position: fixed !important;
    min-width: calc(100vw - 24px) !important;
    max-width: none !important;
    left: 12px !important;
    right: 12px !important;
    max-height: 60vh;
    overflow-y: auto;
  }

  input,
  textarea,
  select {
    font-size: 16px;
  }
}

/* Disable hover transforms on touch devices */
@media (hover: none) {
  .table tbody tr:hover {
    background: none;
  }
  .vm-card:hover,
  .stat-card:hover,
  .btn:hover,
  .radio-card-label:hover,
  .template-card:hover .template-card-inner,
  .network-type-card:hover .network-type-inner {
    transform: none;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .btn {
    padding: 10px 16px;
  }
  .header-btn {
    width: 40px;
    height: 40px;
  }
  .nav-item {
    padding: 10px 12px;
  }
}

/* Landscape mode */
@media (max-height: 600px) and (orientation: landscape) {
  .admin-sidebar {
    height: 100vh;
    overflow-y: auto;
  }
  .admin-content {
    padding: 12px;
  }
  .stat-card {
    padding: 12px;
  }
  .page-title {
    font-size: 18px;
  }
}

/* ============= HIGH PERFORMANCE ============= */
.stat-card,
.vm-card,
.card {
  contain: content;
}

.admin-sidebar.open,
.admin-sidebar {
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .admin-sidebar {
    will-change: auto;
  }
}