:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --bg: #f9fafb;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-secondary: #6b7280;
  --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Navbar */
.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}
.navbar-brand .logo {
  width: 32px;
  height: 32px;
  background: var(--text);
  color: white;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}
.navbar-links {
  display: flex;
  align-items: center;
  gap: 24px;
}
.navbar-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color .2s;
}
.navbar-links a:hover, .navbar-links a.active { color: var(--text); }
.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.navbar-points {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--warning);
  font-weight: 600;
}

/* Layout */
.container { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
.page-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 32px 24px;
}
.page-header .breadcrumb {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.page-header .breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.page-header h1 { font-size: 24px; margin-bottom: 4px; }
.page-header p { color: var(--text-secondary); font-size: 14px; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--card);
  color: var(--text);
  transition: all .2s;
  text-decoration: none;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { opacity: .9; }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.form-control:focus { border-color: var(--primary); }
textarea.form-control { min-height: 100px; resize: vertical; }

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  overflow-x: auto;
}
.tab-item {
  padding: 12px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all .2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--text); border-bottom-color: var(--text); font-weight: 500; }
.tab-content { display: none; padding: 24px 0; }
.tab-content.active { display: block; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-secondary); font-size: 13px; background: var(--bg); }

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-dark { background: #1f2937; color: white; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}
.stat-card {
  text-align: center;
  padding: 16px;
}
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* Profile */
.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--text);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 200px; }
.profile-info h2 { font-size: 18px; margin-bottom: 4px; }
.profile-info .email { font-size: 13px; color: var(--text-secondary); }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Invite */
.invite-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: 6px;
  flex-wrap: wrap;
}
.invite-code {
  font-family: monospace;
  font-size: 14px;
  background: var(--card);
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Toast */
.toast-container {
  position: fixed;
  top: 72px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 14px;
  background: var(--text);
  color: white;
  animation: slideIn .3s ease;
  max-width: 360px;
}
.toast-success { background: #166534; }
.toast-error { background: #991b1b; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Quick actions */
.quick-actions { display: flex; flex-direction: column; gap: 8px; }
.quick-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  background: var(--card);
  transition: background .2s;
  text-decoration: none;
  color: var(--text);
}
.quick-action:hover { background: var(--bg); }

/* Info box */
.info-box {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 16px;
  font-size: 14px;
}
.info-box h4 { margin-bottom: 8px; }
.info-box ul { margin-left: 16px; }
.info-box li { margin-bottom: 4px; }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
}
.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  cursor: pointer;
  font-size: 13px;
}
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Auth pages */
.auth-container {
  max-width: 400px;
  margin: 80px auto;
  padding: 0 16px;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.auth-card h1 { text-align: center; margin-bottom: 24px; font-size: 20px; }
.auth-footer { text-align: center; margin-top: 16px; font-size: 14px; color: var(--text-secondary); }
.auth-footer a { color: var(--primary); text-decoration: none; }

/* Responsive */
@media (max-width: 768px) {
  .navbar-links { display: none; }
  .container { padding: 16px 12px; }
  .profile-card { flex-direction: column; text-align: center; }
  .profile-actions { justify-content: center; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .footer { flex-direction: column; gap: 8px; }
}

/* Admin sidebar */
.admin-layout { display: flex; min-height: calc(100vh - 56px); }
.admin-sidebar {
  width: 220px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  flex-shrink: 0;
}
.admin-sidebar a {
  display: block;
  padding: 10px 24px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all .2s;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
  background: var(--bg);
  color: var(--text);
}
.admin-content { flex: 1; padding: 24px; overflow-x: auto; }

@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; display: flex; overflow-x: auto; padding: 0; border-right: none; border-bottom: 1px solid var(--border); }
  .admin-sidebar a { white-space: nowrap; padding: 12px 16px; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal h3 { margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
