:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-soft: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; padding-top: 72px; }

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar .brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.navbar .brand .logo-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: bold; font-size: 1rem;
}
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--primary); font-weight: 600; }
.nav-user { display: flex; align-items: center; gap: 1rem; font-size: 0.9rem; }
.nav-user .points {
  background: rgba(37, 99, 235, 0.2);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.mobile-toggle {
  display: none;
  background: none; border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
}
.container-sm { max-width: 720px; margin: 0 auto; padding: 1.5rem; }
.container-lg { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}
.card + .card { margin-top: 1.25rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.9rem 2rem; font-size: 1.05rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s;
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--success);
  color: var(--success);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th { color: var(--text-muted); font-weight: 600; background: var(--bg-soft); }
tbody tr:hover { background: rgba(255,255,255,0.02); }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: rgba(16,185,129,0.2); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.2); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.2); color: var(--warning); }
.badge-info { background: rgba(37,99,235,0.2); color: var(--primary); }
.badge-muted { background: var(--bg-soft); color: var(--text-muted); }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; gap: 0.5rem; }
.tabs button {
  background: none; border: none;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tabs button.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Sidebar layout */
.layout { display: flex; gap: 1.5rem; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
}
.sidebar a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}
.sidebar a:hover { background: var(--bg-soft); color: var(--text); }
.sidebar a.active { background: var(--primary); color: #fff; font-weight: 600; }
.sidebar-title { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); padding: 0.5rem 1rem; letter-spacing: 0.05em; }
.main-content { flex: 1; min-width: 0; }

/* Hero */
.hero {
  text-align: center;
  padding: 4rem 1.5rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}
.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p { font-size: 1.15rem; color: var(--text-muted); margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* Feature grid */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  max-width: 1200px;
  margin: 3rem auto;
  padding: 0 1.5rem;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  transition: transform 0.2s, border-color 0.2s;
}
.feature-card:hover { transform: translateY(-4px); border-color: var(--primary); }
.feature-icon {
  width: 48px; height: 48px; border-radius: 10px;
  background: rgba(37, 99, 235, 0.15);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin-bottom: 1rem;
}
.feature-card h3 { font-size: 1.15rem; margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

/* Progress */
.progress-bar {
  width: 100%; height: 8px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.3s;
}

/* Admin cards grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}
.stat-card .stat-label { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.4rem; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; }

/* QR Code */
.qr-code {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  display: inline-block;
}

/* Loader */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* OTP big display */
.otp-display {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  font-family: "SF Mono", Consolas, monospace;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  padding: 1.5rem 2rem;
  border-radius: 16px;
  text-align: center;
  margin: 1rem 0;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg-card); flex-direction: column; padding: 1rem; border-bottom: 1px solid var(--border); gap: 0; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
  .mobile-toggle { display: block; }
  .hero h1 { font-size: 2rem; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .form-row { flex-direction: column; gap: 0; }
  table { font-size: 0.8rem; }
  th, td { padding: 0.5rem; }
}

/* Hide utility */
.hidden { display: none !important; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
