:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #818cf8;
  --secondary: #0ea5e9;
  --success: #15803d;
  --danger: #dc2626;
  --warning: #b45309;
  --bg-dark: #f8fafc;
  --bg-card: #ffffff;
  --bg-card2: #f1f5f9;
  --sidebar-bg: #1e293b;
  --sidebar-width: 260px;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.02);
  --radius: 14px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.1);

  /* Mobile Scale Factor */
  --ms: 1;
}

@media (max-width: 480px) {
  :root {
    --ms: 0.85;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

/* ===== APP LAYOUT ===== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 2005;
  overflow-y: auto;
  transition: var(--transition);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2004;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}

.brand-tag {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
}

.sidebar-user {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card2);
  margin: 12px;
  border-radius: var(--radius-sm);
}

.user-avatar {
  font-size: 28px;
  color: var(--primary-light);
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.user-balance {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}

.sidebar-nav {
  padding: 8px 12px;
  flex: 1;
}

.nav-category {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 14px 10px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
  position: relative;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
}

.nav-item i {
  width: 18px;
  font-size: 15px;
}

.nav-item span {
  flex: 1;
}

.nav-item:hover {
  background: rgba(99, 102, 241, 0.12);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(14, 165, 233, 0.15));
  color: var(--primary-light);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.nav-item .badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 calc(24px * var(--ms));
  height: calc(64px * var(--ms));
  display: flex;
  align-items: center;
  gap: calc(16px * var(--ms));
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(15px);
  background: rgba(255, 255, 255, 0.8);
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: var(--transition);
  display: none;
}

.sidebar-toggle:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.balance-badge {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.admin-badge {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.btn-deposit {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  padding: 8px 18px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}

.btn-deposit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

/* ===== PAGE CONTENT ===== */
.page-content {
  padding: calc(24px * var(--ms));
  flex: 1;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: calc(24px * var(--ms));
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(99, 102, 241, 0.2);
}

.card-header {
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: calc(20px * var(--ms));
  display: flex;
  align-items: center;
  gap: calc(16px * var(--ms));
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--stat-color, var(--primary));
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: calc(52px * var(--ms));
  height: calc(52px * var(--ms));
  border-radius: 12px;
  background: var(--stat-bg, rgba(99, 102, 241, 0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(22px * var(--ms));
  color: var(--stat-color, var(--primary));
  flex-shrink: 0;
}

.stat-value {
  font-size: calc(22px * var(--ms));
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.stat-change {
  font-size: 11px;
  margin-top: 6px;
  font-weight: 600;
}

.stat-change.positive {
  color: var(--success);
}

.stat-change.negative {
  color: var(--danger);
}

/* ===== TABLES ===== */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: #f8fafc;
  padding: 14px 16px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  font-weight: 700;
  border-bottom: 2px solid #f1f5f9;
}

tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: var(--transition);
}

tbody tr:hover {
  background: #f8fafc;
}

tbody td {
  padding: 14px 16px;
  font-size: 13.5px;
  vertical-align: middle;
}

tbody tr:last-child {
  border-bottom: none;
}

/* ===== BADGES ===== */
.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-info {
  background: rgba(14, 165, 233, 0.15);
  color: var(--secondary);
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.badge-purple {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: calc(9px * var(--ms)) calc(18px * var(--ms));
  border-radius: var(--radius-sm);
  font-size: calc(13px * var(--ms));
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #16a34a;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-warning {
  background: var(--warning);
  color: #000;
}

.btn-warning:hover {
  background: #d97706;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  appearance: none;
  cursor: pointer;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* ===== ALERTS ===== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid transparent;
}

.alert-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}

.alert-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.alert-warning {
  background: #fffbeb;
  border-color: #fef3c7;
  color: #92400e;
}

.alert-info {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}

/* ===== PROGRESS ===== */
.progress {
  height: 8px;
  background: #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 10px;
  transition: width 0.5s ease;
}

/* ===== COURSE CARDS ===== */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.course-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.course-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  border-color: rgba(99, 102, 241, 0.3);
}

.course-thumbnail {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--primary-light);
}

.course-body {
  padding: 18px;
}

.course-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.course-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.course-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.course-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary-light);
}

.course-profit {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}

/* ===== VIDEO PLAYER ===== */
.video-wrapper {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}

.video-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 10;
  cursor: not-allowed;
  -webkit-user-select: none;
  user-select: none;
}

/* ===== VIDEO LIST ===== */
.video-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.video-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
  cursor: pointer;
}

.video-item:hover {
  border-color: rgba(99, 102, 241, 0.3);
}

.video-item.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

.video-item.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.video-item.completed {
  border-color: rgba(34, 197, 94, 0.3);
}

.video-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-light);
  flex-shrink: 0;
}

.video-item.completed .video-num {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.video-item.locked .video-num {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}

.video-info {
  flex: 1;
}

.video-title {
  font-size: 13.5px;
  font-weight: 600;
}

.video-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.video-earning {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}

/* ===== WALLET ===== */
.wallet-hero {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(14, 165, 233, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  margin-bottom: 24px;
}

.wallet-amount {
  font-size: 44px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.wallet-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== PROGRESS BAR ===== */
.progress {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 20px;
  transition: width 0.6s ease;
}

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--danger);
}

/* ===== AUTH PAGES ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-dark);
  background-image:
    radial-gradient(at 10% 20%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(14, 165, 233, 0.08) 0px, transparent 50%);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.auth-logo {
  text-align: center;
  margin-bottom: 30px;
}

.auth-logo .logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 14px;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.auth-logo h1 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}

.auth-logo p {
  font-size: 13px;
  color: var(--text-muted);
}

.auth-divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  position: relative;
  background: var(--bg-card);
  padding: 0 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.input-group {
  position: relative;
}

.input-group .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.input-group .form-control {
  padding-left: 40px;
}

/* ===== REFERRAL ===== */
.referral-link-box {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: monospace;
  font-size: 14px;
  word-break: break-all;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.2);
  }

  .sidebar-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    min-width: 0;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar-actions .btn-deposit {
    padding: 8px 12px;
    font-size: 11px;
  }

  .balance-badge {
    padding: 6px 10px;
    font-size: 11px;
    white-space: nowrap;
  }

  .topbar-actions {
    gap: 8px;
  }

  @media (max-width: 380px) {
    .btn-deposit span {
      display: none;
    }

    .topbar-title {
      font-size: 14px;
    }
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .page-content {
    padding: 16px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  /* Force stack any dashboard split layouts */
  [style*="grid-template-columns:1fr 380px"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar-title {
    font-size: 15px;
  }

  .sidebar-user {
    padding: 10px;
    margin: 8px;
  }

  .wallet-amount {
    font-size: calc(28px * var(--ms));
  }

  .card {
    padding: 12px !important;
  }

  .card-title {
    font-size: 14px;
  }

  .card-subtitle {
    font-size: 11px;
  }

  /* Prevent any element from causing horizontal scroll */
  * {
    max-width: 100%;
    overflow-wrap: break-word;
  }

  .table-responsive *,
  .sidebar *,
  .modal * {
    max-width: none;
    /* Exceptions */
  }
}

/* Global Responsive Utilities */
.grid-responsive {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 20px;
}

@media (max-width: 600px) {
  .grid-responsive {
    grid-template-columns: 1fr;
  }
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Table Stack Utility */
@media (max-width: 600px) {

  .table-stack,
  .table-stack tbody,
  .table-stack tr,
  .table-stack td {
    display: block;
    width: 100% !important;
  }

  .table-stack thead {
    display: none;
  }

  .table-stack tr {
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    background: var(--bg-card2);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  }

  .table-stack td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    text-align: right;
    padding: 4px 2px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    min-height: 28px;
    font-size: 11.5px;
  }

  .table-stack td:last-child {
    border-bottom: none;
  }

  .table-stack td::before {
    content: attr(data-label);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 9px;
    color: var(--text-muted);
    text-align: left;
    padding-right: 8px;
    flex-shrink: 0;
    margin-top: 1px;
  }

  /* Ensure long values don't push width */
  .table-stack td>*:not(::before) {
    word-break: break-all;
    max-width: 70%;
  }

  .table-responsive {
    overflow-x: hidden !important;
    margin-top: 10px !important;
  }
}

.img-fluid {
  max-width: 100%;
  height: auto;
}

/* ===== TOASTS ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

.toast-info {
  border-left: 4px solid var(--secondary);
}

/* ===== MISC ===== */
.separator {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.text-muted {
  color: var(--text-muted);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.text-primary-c {
  color: var(--primary-light);
}

.fw-bold {
  font-weight: 700;
}

.text-center {
  text-align: center;
}

.mt-1 {
  margin-top: 8px;
}

.mt-2 {
  margin-top: 16px;
}

.mt-3 {
  margin-top: 24px;
}

.mb-1 {
  margin-bottom: 8px;
}

.mb-2 {
  margin-bottom: 16px;
}

.mb-3 {
  margin-bottom: 24px;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 {
  gap: 8px;
}

.gap-2 {
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}