:root {
  --primary: hsl(351, 85%, 54%);
  --primary-glow: hsla(351, 85%, 54%, 0.4);
  --success: hsl(151, 62%, 46%);
  --warning: hsl(38, 92%, 50%);
  --danger: hsl(351, 85%, 54%);

  /* Dark Mode Tokens */
  --bg: hsl(233, 24%, 12%);
  --bg-soft: hsl(233, 24%, 16%);
  --card: hsla(233, 24%, 18%, 0.8);
  --card-border: hsla(220, 13%, 91%, 0.08);
  --text: hsl(210, 20%, 94%);
  --text-dim: hsl(215, 14%, 74%);
  --text-muted: hsl(215, 13%, 62%);
  --sidebar-w: 260px;
  --header-h: 70px;
  --radius: 16px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-mode {
  --bg: hsl(210, 40%, 96%);
  --bg-soft: hsl(210, 40%, 94%);
  --card: hsla(0, 0%, 100%, 0.8);
  --card-border: hsla(215, 13%, 17%, 0.1);
  --text: hsl(222, 47%, 11%);
  --text-dim: hsl(215, 16%, 35%);
  --text-muted: hsl(215, 14%, 48%);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  transition: background-color var(--transition);
  overflow-x: hidden;
}

/* Background Gradients */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 10% 20%, var(--primary-glow) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, hsla(215, 100%, 50%, 0.1) 0%, transparent 40%);
  pointer-events: none;
  z-index: -1;
}

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

/* Glass Effect */
.glass {
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 24px;
  z-index: 100;
  transition: transform var(--transition);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px;
  max-width: 1400px;
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 20px;
  }
}

/* Typography */
h1,
h2,
h3 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, hsl(340, 85%, 45%) 100%);
  color: white;
  box-shadow: 0 8px 20px -6px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -6px var(--primary-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
}

.btn-ghost:hover {
  background: var(--card-border);
  color: var(--text);
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.app-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform var(--transition);
  cursor: pointer;
}

.app-card:hover {
  transform: translateY(-5px);
  background: var(--bg-soft);
}

.app-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
}

/* Nav */
.nav-link {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
  margin-bottom: 4px;
}

.nav-link.active,
.nav-link:hover {
  background: var(--card-border);
  color: var(--text);
}

.nav-link svg {
  margin-right: 12px;
  width: 20px;
  height: 20px;
}

/* Header */
.header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--primary);
}

/* Inputs */
.input-group {
  margin-bottom: 20px;
}

.input-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--text);
  transition: border-color var(--transition);
}

.input-control:focus {
  border-color: var(--primary);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  padding: 32px;
  animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
}

th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
}

td {
  font-size: 0.9375rem;
}

tr:hover td {
  background: var(--card-border);
}

/* Badges */
.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge.premium {
  background: var(--primary);
  color: white;
}

.badge.free {
  background: var(--card-border);
  color: var(--text-muted);
}

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

.badge.pending {
  background: var(--warning);
  color: white;
}

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

.badge.rejected {
  background: var(--danger);
  color: white;
}

/* Dashboard Cards */
.status-banner {
  padding: 32px;
  background: linear-gradient(135deg, hsla(351, 85%, 54%, 0.1) 0%, transparent 100%);
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: var(--radius);
}

.referral-card {
  padding: 24px;
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: hsla(151, 62%, 46%, 0.05);
  border-color: hsla(151, 62%, 46%, 0.2);
}


/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 16px 24px;
  z-index: 1000;
  transform: translateY(100px);
  transition: transform 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

#toast.active {
  transform: translateY(0);
}

/* Auth Pages */
.auth-container {
  max-width: 400px;
  width: 100%;
  margin: 100px auto;
  padding: 40px;
}

.logo-large {
  width: 80px;
  height: 80px;
  background: var(--primary);
  border-radius: 20px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: white;
}

/* Premium Duration Modal */
.duration-option {
  transition: all var(--transition);
}

.duration-option:hover {
  border-color: var(--primary) !important;
  background: hsla(351, 85%, 54%, 0.08);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px -4px var(--primary-glow);
}