@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; }

:root {
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #d1fae5;
  --secondary: #1e3a5f;
  --secondary-dark: #0f2744;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --surface: #ffffff;
  --bg: #f3f4f6;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 0.75rem;
  --radius-lg: 1.25rem;
  --sidebar-width: 260px;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--secondary) 0%, var(--secondary-dark) 100%);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  z-index: 50;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-container img {
  height: 36px;
  width: auto;
  background: white;
  padding: 3px;
  border-radius: 8px;
}

.logo-text {
  font-size: 1.3rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.02em;
}

.sidebar-user {
  margin: 1rem 1rem 0.5rem;
  padding: 1rem;
  background: rgba(255,255,255,0.07);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user-role {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16,185,129,0.25);
  color: #6ee7b7;
  margin-top: 3px;
}

.sidebar nav {
  flex: 1;
  padding: 0.5rem 0.75rem;
}

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  padding: 0.75rem 0.75rem 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.875rem;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  margin-bottom: 2px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: white;
  transform: translateX(3px);
}

.nav-item.active {
  background: rgba(16,185,129,0.25);
  color: #6ee7b7;
  font-weight: 600;
  border-left: 3px solid #10b981;
}

.nav-item i {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item-logout {
  color: rgba(252,165,165,0.8) !important;
}

.nav-item-logout:hover {
  background: rgba(239,68,68,0.2) !important;
  color: #fca5a5 !important;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: auto;
}

/* Overlay mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
  backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0,0,0,0.4);
  }
  .sidebar-overlay.active {
    display: block;
  }
}

/* ========================================
   LAYOUT
   ======================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Header mobile */
.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  background: white;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 30;
}

@media (max-width: 768px) {
  .topbar {
    display: flex;
  }
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-logo img {
  height: 28px;
}

.topbar-logo span {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--secondary);
}

.menu-btn {
  background: none;
  border: none;
  padding: 0.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  color: var(--text);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.menu-btn:hover {
  background: var(--bg);
}

.page-content {
  flex: 1;
  padding: 1.5rem 2rem;
  overflow-y: auto;
}

@media (max-width: 1024px) {
  .page-content { padding: 1.25rem 1.5rem; }
}

@media (max-width: 768px) {
  .page-content { padding: 1rem; }
}

/* ========================================
   PAGE HEADER
   ======================================== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16,185,129,0.4);
}

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg);
  border-color: #d1d5db;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 4px 12px rgba(239,68,68,0.25);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(239,68,68,0.35);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.btn-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 0.5rem;
}

.btn-icon-lg {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 0.625rem;
}

/* ========================================
   CARDS
   ======================================== */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0;
}

.card-title-accent {
  width: 3px;
  height: 18px;
  background: var(--primary);
  border-radius: 2px;
  display: inline-block;
}

.card-body {
  padding: 1.5rem;
}

/* ========================================
   STAT CARDS
   ======================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  border-radius: var(--radius-lg);
  padding: 1.375rem;
  color: white;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.875rem;
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 0.75rem;
  opacity: 0.8;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card-green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-card-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-card-amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-card-rose { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.stat-card-purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-card-cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }

/* ========================================
   TABLE
   ======================================== */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

thead tr {
  background: #f9fafb;
  border-bottom: 2px solid var(--border);
}

th {
  padding: 0.875rem 1.25rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.15s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: #f9fafb;
}

td {
  padding: 0.875rem 1.25rem;
  font-size: 0.875rem;
  vertical-align: middle;
}

.td-primary {
  font-weight: 600;
  color: var(--text);
}

.td-secondary {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

/* ========================================
   BADGES
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-gray { background: #f3f4f6; color: #374151; }
.badge-cyan { background: #cffafe; color: #0e7490; }

/* ========================================
   FORMS
   ======================================== */
.form-group {
  margin-bottom: 1.125rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.4rem;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: 0.6rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  background: white;
  color: var(--text);
  transition: all 0.2s;
  outline: none;
  -webkit-appearance: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.12);
}

.form-input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.form-input-icon {
  position: relative;
}

.form-input-icon i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.875rem;
}

.form-input-icon .form-input {
  padding-left: 2.25rem;
}

select.form-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  background-size: 1rem;
  padding-right: 2.25rem;
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.form-error {
  display: none;
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 0.3rem;
  font-weight: 500;
}

.form-error.show { display: block; }

.form-row {
  display: grid;
  gap: 1rem;
}

.form-row-2 { grid-template-columns: repeat(2, 1fr); }
.form-row-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 640px) {
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

/* ========================================
   MODAL
   ======================================== */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  background: white;
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.25s cubic-bezier(0.4,0,0.2,1);
}

.modal-lg {
  max-width: 720px;
}

.modal-sm {
  max-width: 400px;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 1rem;
}

.modal-close:hover {
  background: #fee2e2;
  color: var(--danger);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
  width: calc(100% - 2rem);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 10px 25px rgba(0,0,0,0.12);
  border-left: 4px solid;
  animation: slideIn 0.3s cubic-bezier(0.4,0,0.2,1);
}

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

.toast-success { border-color: var(--primary); }
.toast-error { border-color: var(--danger); }
.toast-warning { border-color: var(--warning); }
.toast-info { border-color: var(--info); }

.toast-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
  color: white;
}

.toast-success .toast-icon { background: var(--primary); }
.toast-error .toast-icon { background: var(--danger); }
.toast-warning .toast-icon { background: var(--warning); }
.toast-info .toast-icon { background: var(--info); }

.toast-message {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  line-height: 1.4;
}

/* ========================================
   SEARCH & FILTERS
   ======================================== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.search-box i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 0.55rem 0.875rem 0.55rem 2.25rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  background: white;
  outline: none;
  transition: all 0.2s;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
}

/* ========================================
   LOADING
   ======================================== */
.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  flex-direction: column;
  gap: 1rem;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.35;
}

.empty-state p {
  font-size: 0.9rem;
  margin: 0;
}

/* ========================================
   ACTIVATION CODE DISPLAY
   ======================================== */
.activation-code-box {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 2px solid #86efac;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
}

.activation-code {
  font-family: 'Courier New', monospace;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #065f46;
  word-break: break-all;
}

/* ========================================
   DASHBOARD CHARTS
   ======================================== */
.chart-container {
  position: relative;
  height: 200px;
}

/* ========================================
   LOGIN
   ======================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 50%, #a7f3d0 100%);
}

.login-card {
  background: white;
  border-radius: 1.5rem;
  box-shadow: 0 25px 60px rgba(0,0,0,0.12);
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.75rem;
}

.login-logo-inner {
  background: linear-gradient(135deg, #f0fdf4, #d1fae5);
  border: 2px solid #a7f3d0;
  border-radius: 1.25rem;
  padding: 1rem 1.5rem;
}

.login-logo img {
  height: 70px;
  width: auto;
  object-fit: contain;
}

/* ========================================
   PERFORMANCE TABLE
   ======================================== */
.perf-rank {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
}

.perf-rank-1 { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.perf-rank-2 { background: linear-gradient(135deg, #6b7280, #4b5563); color: white; }
.perf-rank-3 { background: linear-gradient(135deg, #92400e, #78350f); color: white; }
.perf-rank-other { background: #f3f4f6; color: #374151; }

/* ========================================
   QUICK ACTIONS
   ======================================== */
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.25s;
  text-align: center;
  background: none;
  font-family: inherit;
}

.quick-action:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.quick-action-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.625rem;
  background: white;
  box-shadow: var(--shadow);
  transition: transform 0.25s;
}

.quick-action:hover .quick-action-icon {
  transform: scale(1.1);
}

.quick-action-label {
  font-size: 0.8rem;
  font-weight: 700;
}

/* ========================================
   PROGRESS BAR
   ======================================== */
.progress-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transition: width 0.5s ease;
}

/* ========================================
   TABS
   ======================================== */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
  overflow-x: auto;
}

.tab-btn {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-btn:hover:not(.active) {
  color: var(--text);
}

/* ========================================
   ALERTS
   ======================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  border-left: 4px solid;
  margin-bottom: 1rem;
}

.alert-success { background: #f0fdf4; border-color: var(--primary); color: #065f46; }
.alert-error { background: #fef2f2; border-color: var(--danger); color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }
.alert-info { background: #eff6ff; border-color: var(--info); color: #1e40af; }

/* ========================================
   MISC
   ======================================== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.25rem 0;
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
}

.avatar-green { background: #d1fae5; color: #065f46; }
.avatar-blue { background: #dbeafe; color: #1e40af; }
.avatar-purple { background: #ede9fe; color: #5b21b6; }

.flex-1 { flex: 1; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }

/* PWA Install banner */
#pwa-install-banner {
  display: none;
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  z-index: 1000;
  max-width: 380px;
  width: calc(100% - 2rem);
  border: 1px solid var(--border);
}

#pwa-install-banner.show { display: flex; align-items: center; gap: 1rem; }

/* Responsive hide classes */
@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .hide-sm-show { display: block !important; }
}
@media (min-width: 641px) {
  .hide-sm-show { display: none !important; }
}
@media (max-width: 768px) {
  .hide-md { display: none !important; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* Print styles */
@media print {
  .sidebar, .topbar, .btn, #toast-container, #pwa-install-banner { display: none !important; }
  .page-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ========================================
   TOPBAR ACTIONS & PROFILE BUTTON
   ======================================== */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-profile-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.625rem 0.35rem 0.35rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  font-family: inherit;
}

.topbar-profile-btn:hover {
  background: var(--bg);
  border-color: var(--primary);
}

.topbar-username {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================
   AVATAR SIZES
   ======================================== */
.avatar-xl {
  width: 72px !important;
  height: 72px !important;
  font-size: 2rem !important;
  border-radius: 1.25rem !important;
}

/* ========================================
   PROFILE MODAL TABS
   ======================================== */
.profile-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  padding: 0 1.5rem;
  background: var(--bg);
  border-radius: 0 0 0 0;
}

.profile-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.profile-tab:hover {
  color: var(--text);
  background: rgba(16,185,129,0.05);
}

.profile-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: white;
}

.profile-tab-content {
  min-height: 200px;
}

/* ========================================
   PROFILE AVATAR SECTION
   ======================================== */
.profile-avatar-section {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  border: 1px solid #a7f3d0;
}

/* ========================================
   ALERT VARIANTS
   ======================================== */
.alert-success {
  background: #f0fdf4;
  border-color: #a7f3d0;
  color: #065f46;
}

.alert-success i { color: #10b981; }

/* ========================================
   PROFILE PAGE GRID
   ======================================== */
@media (max-width: 900px) {
  /* Profile page responsive */
  div[style*="grid-template-columns:300px 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ========================================
   SIDEBAR PROFILE BUTTON
   ======================================== */
.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* ========================================
   BUTTON WARNING
   ======================================== */
.btn-warning {
  background: var(--warning);
  color: white;
  border: none;
}
.btn-warning:hover {
  background: #d97706;
}

