:root {
  --bg-primary: #0a0a12;
  --bg-secondary: #12121f;
  --bg-tertiary: #1a1a2e;
  --bg-glass: rgba(20, 20, 35, 0.85);
  --accent: #8b5cf6;
  --accent-secondary: #a78bfa;
  --accent-glow: rgba(139, 92, 246, 0.4);
  --accent-hot: #f472b6;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(139, 92, 246, 0.3);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --error: #ef4444;
  --error-glow: rgba(239, 68, 68, 0.3);
  --warning: #f59e0b;
  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-accent: linear-gradient(135deg, #8b5cf6 0%, #a855f7 50%, #f472b6 100%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 20% -20%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(244, 114, 182, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse 50% 80% at 0% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  animation: bgPulse 15s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* Glass effect - enhanced */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 
    0 4px 6px rgba(0, 0, 0, 0.3),
    0 0 40px rgba(139, 92, 246, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.glass:hover {
  border-color: var(--border-glow);
  box-shadow: 
    0 8px 25px rgba(0, 0, 0, 0.4),
    0 0 60px rgba(139, 92, 246, 0.08);
}

/* Views */
.view { display: block; position: relative; z-index: 1; }
.hidden { display: none !important; }

/* Login */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-card h1 {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.75rem;
  font-weight: 700;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px var(--accent-glow);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.select {
  padding: 0.625rem 1rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.select:hover {
  border-color: var(--accent);
}

/* Buttons */
.btn {
  padding: 0.875rem 1.75rem;
  border: none;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--gradient-accent);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--accent-glow), 0 0 40px var(--accent-glow);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 15px var(--error-glow);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--error-glow);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.error {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--error-glow);
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Layout */
#main-view {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  width: 260px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  border-right: 1px solid var(--border);
  border-left: none;
  border-top: none;
  border-bottom: none;
  background: var(--bg-glass);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}

.sidebar-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-header span {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-header span::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--success);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.nav-links {
  list-style: none;
  flex: 1;
}

.nav-links li {
  margin-bottom: 0.375rem;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.nav-links a:hover {
  background: rgba(139, 92, 246, 0.1);
  color: var(--text-primary);
}

.nav-links a.active {
  background: rgba(139, 92, 246, 0.15);
  color: var(--text-primary);
  border-left: 3px solid var(--accent);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
}

.content {
  flex: 1;
  padding: 2rem 2.5rem;
  overflow-y: auto;
}

/* Sections */
.section h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-header h1 {
  flex: 1;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.stat-card {
  padding: 1.75rem;
  text-align: center;
  transition: all 0.3s ease;
  cursor: default;
}

.stat-card:hover {
  transform: translateY(-4px);
}

.stat-card h3 {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Tables */
.table-container {
  overflow-x: auto;
  padding: 1.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 1rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

td {
  font-size: 0.875rem;
}

tr {
  transition: background 0.2s ease;
}

tr:hover {
  background: rgba(139, 92, 246, 0.05);
}

tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  box-shadow: 0 0 10px var(--success-glow);
}

.badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

/* Modal */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#modal {
  width: 100%;
  max-width: 520px;
  padding: 2rem;
  margin: 1rem;
  animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

/* Utilities */
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-gradient {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.5);
}

/* Selection */
::selection {
  background: rgba(139, 92, 246, 0.3);
  color: white;
}

/* Action buttons in tables */
td .btn {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

td .btn + .btn {
  margin-left: 0.5rem;
}
