:root {
  /* Colors */
  --bg-dark: #000000;
  --bg-medium: #0f0f0f;
  --bg-light: #1a1a1a;

  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;

  --border: #555555;
  --border-light: #333333;

  /* Accents - Pink/Magenta only */
  --accent-primary: #ff00ff;       /* Magenta */
  --accent-secondary: #ff66b2;     /* Pink */
  --accent-tertiary: #ff99cc;      /* Light Pink */
  --accent-magenta-dim: #cc00cc;
  --accent-pink-dim: #cc5290;
  --accent-orange: #ff9933;
  --accent-red: #ff4444;

  /* Effects */
  --glow-magenta: 0 0 10px rgba(255, 0, 255, 0.5);
  --glow-pink: 0 0 10px rgba(255, 102, 178, 0.5);
  --glow-green: 0 0 10px rgba(255, 102, 178, 0.5);  /* Aliased to pink for compatibility */
  --glow-cyan: 0 0 10px rgba(255, 153, 204, 0.5);   /* Aliased to light pink for compatibility */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 6px 20px rgba(0, 0, 0, 0.6);

  /* Config */
  --font-mono: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace;
  --font-sans: system-ui, -apple-system, sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 20px;
  --space-xl: 30px;
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased; /* Essential for dark mode contrast */
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0s !important; transition-duration: 0s !important; scroll-behavior: auto !important; }
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

h1 { font-size: 2rem; color: var(--accent-primary); }
h2 { font-size: 1.5rem; color: var(--accent-primary); border-bottom: 1px solid var(--border); padding-bottom: var(--space-sm); }
h3 { font-size: 1.2rem; color: var(--accent-secondary); }
p { margin-bottom: var(--space-md); color: var(--text-secondary); }

a { color: var(--accent-secondary); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }

code, pre { font-family: var(--font-mono); font-size: 0.9em; }
pre {
  background: var(--bg-medium);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
}

/* ============================================
   BUTTONS
   ============================================ */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--bg-medium);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.95em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

button:hover:not(:disabled), .btn:hover:not(:disabled) {
  background: var(--bg-light);
  border-color: var(--accent-primary);
  box-shadow: var(--glow-magenta);
}

button:disabled, .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(100%);
}

/* Variants - Holo style */
.btn-primary {
  background: rgba(255, 0, 255, 0.1);
  color: var(--accent-primary);
  border: 1px solid rgba(255, 0, 255, 0.4);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
  background: rgba(255, 0, 255, 0.18);
  border-color: var(--accent-primary);
  box-shadow: var(--glow-magenta), inset 0 0 20px rgba(255, 0, 255, 0.1);
}

.btn-secondary {
  background: rgba(255, 102, 178, 0.08);
  color: var(--accent-secondary);
  border: 1px solid rgba(255, 102, 178, 0.35);
  font-weight: 600;
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 102, 178, 0.15);
  border-color: var(--accent-secondary);
  box-shadow: var(--glow-pink), inset 0 0 20px rgba(255, 102, 178, 0.08);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 500;
}
.btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(255, 68, 68, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(255, 68, 68, 0.4);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(255, 68, 68, 0.2);
  border-color: var(--accent-red);
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.4);
}

.btn-block { display: flex; width: 100%; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent-tertiary); color: var(--accent-tertiary); box-shadow: var(--glow-pink); }

/* ============================================
   INPUTS
   ============================================ */
input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
textarea, select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-medium);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  transition: 0.2s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(255, 0, 255, 0.2);
}

/* Range Sliders (Unified) */
input[type="range"] {
  width: 100%;
  height: 8px;
  background: var(--border-light);
  border-radius: var(--radius-sm);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

/* Thumb styles mixin-logic via CSS duplication is necessary for cross-browser */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--accent-primary);
  border-radius: 50%;
  box-shadow: var(--glow-magenta);
  transition: transform 0.2s;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  background: var(--accent-primary);
  border: none; border-radius: 50%;
  box-shadow: var(--glow-magenta);
  transition: transform 0.2s;
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.2); }
input[type="range"]:hover::-moz-range-thumb { transform: scale(1.2); }

/* Checkboxes */
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent-primary); cursor: pointer; }
label { display: block; margin-bottom: var(--space-sm); color: var(--text-secondary); font-size: 0.9em; font-weight: 500; }

/* ============================================
   COMPONENTS
   ============================================ */
/* Cards */
.panel, .card {
  background: var(--bg-medium);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}
.panel-header, .card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--space-md); padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

/* Stats */
.stat-grid { display: grid; gap: var(--space-sm); grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat-card { background: var(--bg-dark); border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: var(--space-md); text-align: center; }
.stat-label { font-size: 0.75rem; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 0.08em; }
.stat-value { font-family: var(--font-mono); font-size: 1.1rem; color: var(--accent-primary); }

/* Toggles & Chips */
.toggle-group { display: inline-flex; gap: var(--space-sm); background: var(--bg-light); border-radius: var(--radius-full); padding: 4px; border: 1px solid var(--border); }
.toggle {
  border: none; background: transparent; color: var(--text-secondary);
  padding: 6px 16px; border-radius: var(--radius-full);
  font-size: 0.8rem; font-weight: 600; text-transform: uppercase; cursor: pointer; transition: 0.2s;
}
.toggle.active { background: rgba(255, 0, 255, 0.15); color: var(--accent-primary); box-shadow: var(--glow-magenta); }

.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px;
  background: var(--bg-light); border: 1px solid var(--border); border-radius: var(--radius-full);
  font-size: 0.85rem; color: var(--text-secondary);
}
.chip:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

/* Progress */
.progress-container { background: var(--bg-light); border-radius: var(--radius-md); height: 24px; border: 1px solid var(--border); overflow: hidden; }
.progress-bar {
  height: 100%; background: linear-gradient(90deg, var(--accent-primary), var(--accent-tertiary));
  display: flex; align-items: center; justify-content: center;
  color: #000; font-size: 0.75em; font-weight: 700; box-shadow: var(--glow-magenta);
}

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--bg-medium); border-radius: var(--radius-md); overflow: hidden; }
th { background: var(--bg-light); padding: var(--space-md); text-align: left; color: var(--accent-primary); border-bottom: 2px solid var(--border); }
td { padding: var(--space-md); border-bottom: 1px solid var(--border-light); }
tr:hover { background: var(--bg-light); }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0; /* Modern replacement for top/left/right/bottom */
  background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal {
  background: var(--bg-medium); border: 1px solid var(--accent-primary); border-radius: var(--radius-lg);
  padding: var(--space-xl); max-width: 90vw; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg), var(--glow-magenta);
}

/* Notifications */
.notification { padding: var(--space-md); border-radius: var(--radius-sm); margin-bottom: var(--space-md); border-left: 4px solid; background: var(--bg-light); display: flex; justify-content: space-between; }
.notification-info { border-left-color: var(--accent-tertiary); }
.notification-success { border-left-color: var(--accent-primary); }
.notification-warning { border-left-color: var(--accent-orange); }
.notification-error { border-left-color: var(--accent-red); }

/* ============================================
   UTILITIES
   ============================================ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.text-magenta { color: var(--accent-primary); }
.text-pink { color: var(--accent-secondary); }
.text-green { color: var(--accent-secondary); }  /* Alias for compatibility */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { animation: spin 1s linear infinite; }
.fade-in { animation: fadeIn 0.3s ease-in; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }