/* ============================================================
   dashboard.css — SHS Marketing Dashboard
   Design System: Navy × Gold  |  Fonts: Sora + Inter
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
  /* Brand */
  --navy:          #0D1B3E;
  --navy-mid:      #1B2D5B;
  --navy-light:    #243B73;
  --gold:          #C9972C;
  --gold-light:    #E2B84A;
  --gold-pale:     #F5E6C0;
  --gold-dim:      #A37820;

  /* Semantic */
  --success:       #1A7A3C;
  --warning:       #F59E0B;
  --danger:        #B91C1C;
  --info:          #3B82F6;

  /* Surface */
  --white:         #FFFFFF;
  --off-white:     #F7F5EF;
  --bg:            #F9FAFB;
  --border:        #E5E7EB;
  --border-brand:  #DDD5B0;

  /* Text */
  --text:          #0D1B3E;
  --text-muted:    #5C6B8A;
  --text-faint:    #94A3B8;

  /* Shadows */
  --shadow-sm:     0 1px 3px rgba(0,0,0,.06);
  --shadow-md:     0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:     0 10px 24px rgba(0,0,0,.12);
  --shadow-gold:   0 8px 32px rgba(201,151,44,.28);

  /* Motion */
  --tr:            all 0.25s cubic-bezier(0.4,0,0.2,1);

  /* Layout */
  --sidebar-w:     280px;
  --header-h:      66px;
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }

/* ============================================================
   3. LAYOUT
   ============================================================ */
.dashboard-container {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   4. SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-mid) 60%, var(--navy-light) 100%);
  color: var(--white);
  position: fixed;
  left: 0; top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(0,0,0,.18);
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(201,151,44,.15);
  background: rgba(0,0,0,.15);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo > i {
  font-size: 28px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dim));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo h2 {
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -.3px;
  margin: 0;
}

.logo p {
  font-size: 10px;
  color: var(--gold-light);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 2px 0 0;
  opacity: .85;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.sidebar-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255,255,255,.60);
  transition: var(--tr);
  border: 1px solid transparent;
}

.nav-item a i {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item a:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.92);
}

.nav-item.active a {
  background: rgba(201,151,44,.16);
  border-color: rgba(201,151,44,.28);
  color: var(--gold-light);
  border-left: 3px solid var(--gold);
  padding-left: 14px;
}

.nav-item.active a i {
  color: var(--gold-light);
}

.sidebar-footer {
  padding: 12px 12px 24px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(185,28,28,.15);
  border: 1px solid rgba(185,28,28,.25);
  color: #fca5a5;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--tr);
}

.logout-btn:hover {
  background: rgba(185,28,28,.28);
  color: #fff;
}

/* ============================================================
   5. SIDEBAR OVERLAY & TOGGLE (MOBILE)
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.50);
  z-index: 999;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1100;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--navy);
  border: 1px solid rgba(201,151,44,.30);
  color: var(--gold-light);
  font-size: 17px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.30);
  transition: var(--tr);
}

.sidebar-toggle:hover {
  background: var(--navy-mid);
  border-color: var(--gold);
}

/* ============================================================
   6. MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  background: var(--bg);
  min-height: 100vh;
}

/* ============================================================
   7. DASHBOARD HEADER
   ============================================================ */
.dashboard-header {
  background: var(--white);
  height: var(--header-h);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left h1 {
  font-family: 'Sora', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -.3px;
  margin-bottom: 1px;
}

.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  transition: var(--tr);
}

.search-bar:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,151,44,.10);
}

.search-bar i { color: var(--text-muted); font-size: 13px; }

.search-bar input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  width: 180px;
}

.header-icons { display: flex; gap: 8px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: var(--tr);
}

.icon-btn:hover {
  background: rgba(201,151,44,.10);
  border-color: rgba(201,151,44,.25);
  color: var(--gold-dim);
}

.notification-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: var(--white);
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-profile img {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(201,151,44,.35);
  cursor: pointer;
  transition: var(--tr);
}
.user-profile img:hover { border-color: var(--gold); }

/* ============================================================
   8. CONTENT SECTIONS
   ============================================================ */
.content-section {
  display: none;
  padding: 32px 36px;
  max-width: 1400px;
  margin: 0 auto;
  animation: fadeUp .26s ease;
}

.content-section.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-header { margin-bottom: 28px; }

.section-header h1 {
  font-family: 'Sora', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -.4px;
  margin-bottom: 4px;
}

.section-header p {
  font-size: 14px;
  color: var(--text-muted);
}

/* ============================================================
   9. STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: 14px;
  padding: 22px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: var(--tr);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.stat-card.card-primary::before { background: linear-gradient(90deg, var(--gold-light), var(--gold-dim)); }
.stat-card.card-success::before { background: linear-gradient(90deg, #1A7A3C, #2da854); }
.stat-card.card-warning::before { background: linear-gradient(90deg, var(--warning), #d97706); }
.stat-card.card-info::before    { background: linear-gradient(90deg, var(--info), #60a5fa); }

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.card-primary .card-icon { background: rgba(201,151,44,.12); color: var(--gold-dim); }
.card-success .card-icon { background: rgba(26,122,60,.10);  color: var(--success); }
.card-warning .card-icon { background: rgba(245,158,11,.12); color: var(--warning); }
.card-info    .card-icon { background: rgba(59,130,246,.10); color: var(--info); }

.card-content { flex: 1; min-width: 0; }

.card-content h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.card-value {
  font-family: 'Sora', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 6px;
}

.card-info-text {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================================================
   10. DASHBOARD GRID + CHART
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  margin-bottom: 28px;
}

.chart-card,
.activity-card {
  background: var(--white);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

.chart-controls { display: flex; gap: 8px; }

.chart-controls button {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: var(--tr);
}

.chart-controls button:hover { border-color: var(--gold); color: var(--gold-dim); }

.chart-controls button.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.chart-container {
  height: 300px;
  padding: 16px 16px 16px;
}

/* Activity */
.view-all {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-dim);
  transition: var(--tr);
}
.view-all:hover { color: var(--gold); }

.activity-list {
  display: flex;
  flex-direction: column;
  padding: 0 22px 18px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.activity-icon.success { background: rgba(26,122,60,.10);  color: var(--success); }
.activity-icon.info    { background: rgba(59,130,246,.10); color: var(--info); }
.activity-icon.warning { background: rgba(245,158,11,.12); color: var(--warning); }

.activity-details { flex: 1; }
.activity-title { font-size: 13.5px; font-weight: 600; color: var(--navy); margin-bottom: 2px; }
.activity-time  { font-size: 11px; color: var(--text-muted); }

.activity-value {
  font-family: 'Sora', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  text-align: right;
  min-width: 72px;
}

/* ============================================================
   11. REFERRAL SECTION
   ============================================================ */
.referral-section { margin-top: 4px; margin-bottom: 28px; }

.referral-card {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  border-radius: 14px;
  padding: 28px;
  border: 1px solid rgba(201,151,44,.20);
  position: relative;
  overflow: hidden;
}

.referral-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(201,151,44,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201,151,44,.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.referral-header { margin-bottom: 20px; position: relative; }

.referral-header h2 {
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 5px;
}

.referral-header p {
  font-size: 13px;
  color: rgba(255,255,255,.55);
  margin: 0;
}

.referral-content { position: relative; }

.referral-input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(201,151,44,.28);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  font-family: 'Courier New', monospace;
  letter-spacing: .5px;
  transition: var(--tr);
}

.referral-input::placeholder { color: rgba(255,255,255,.30); }
.referral-input:focus { outline: none; border-color: var(--gold-light); }

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 20px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dim));
  color: var(--navy);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--tr);
  white-space: nowrap;
  flex-shrink: 0;
}

.copy-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-gold);
}

.referral-url { position: relative; }
.referral-url strong { font-size: 13px; color: var(--gold-light); }

.referral-url code {
  display: block;
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(201,151,44,.14);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.7;
  word-break: break-all;
  overflow-wrap: anywhere;
  color: rgba(255,255,255,.70);
  cursor: pointer;
  transition: var(--tr);
}

.referral-url code:hover {
  background: rgba(255,255,255,.10);
  border-color: rgba(201,151,44,.30);
}

.referral-url small {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255,255,255,.40);
}

/* ============================================================
   12. TEAM SECTION
   ============================================================ */
.team-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.team-stat-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: var(--tr);
  position: relative;
  overflow: hidden;
}

.team-stat-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-light), var(--gold-dim));
}

.team-stat-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.team-stat-item h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.team-stat-value {
  font-family: 'Sora', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
}

/* ============================================================
   13. TABLE CARD
   ============================================================ */
.table-card {
  background: var(--white);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.table-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.table-header h2 {
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

.search-input {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: var(--tr);
  width: 240px;
}

.search-input:focus {
  border-color: var(--gold);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(201,151,44,.10);
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table thead th {
  padding: 12px 18px;
  background: var(--bg);
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
}

.data-table tbody td {
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  color: var(--text);
}

.data-table tbody tr:hover { background: var(--bg); }

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}

.status-badge.active   { background: rgba(26,122,60,.12);  color: var(--success); }
.status-badge.pending  { background: rgba(245,158,11,.12); color: var(--warning); }
.status-badge.inactive { background: rgba(107,114,128,.12); color: #6B7280; }

.action-btn {
  padding: 6px 14px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--tr);
}
.action-btn:hover { background: var(--navy-mid); transform: translateY(-1px); }

/* ============================================================
   14. EARNINGS SECTION
   ============================================================ */
.earnings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.earnings-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--tr);
}

.earnings-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-light), var(--gold-dim));
}

.earnings-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.earnings-card h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.earnings-amount {
  font-family: 'Sora', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 6px;
}

.earnings-detail {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================================================
   15. PROFILE SECTION
   ============================================================ */
.profile-container {
  background: var(--white);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  max-width: 860px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 32px 28px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  border-bottom: 1px solid rgba(201,151,44,.15);
  position: relative;
  overflow: hidden;
}

.profile-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(201,151,44,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201,151,44,.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.profile-image {
  width: 88px; height: 88px;
  border-radius: 50%;
  border: 3px solid rgba(201,151,44,.45);
  object-fit: cover;
  flex-shrink: 0;
  position: relative;
}

.profile-info { position: relative; }

.profile-info h2 {
  font-family: 'Sora', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 4px;
}

.profile-info p {
  font-size: 13px;
  color: rgba(255,255,255,.55);
  margin-bottom: 12px;
}

.member-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(201,151,44,.20);
  border: 1px solid rgba(201,151,44,.35);
  color: var(--gold-light);
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 24px 28px 28px;
}

.profile-form h3 {
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin: 24px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-form h3::before {
  content: '';
  display: block;
  width: 3px; height: 14px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold-dim));
  border-radius: 2px;
  flex-shrink: 0;
}

.profile-form h3:first-child { margin-top: 0; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--navy);
}

.profile-form input,
.profile-form textarea,
.profile-form select {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--white);
  transition: var(--tr);
  width: 100%;
}

.profile-form input:focus,
.profile-form textarea:focus,
.profile-form select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,151,44,.10);
}

.profile-form input[readonly],
.profile-form textarea[readonly] {
  background: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
}

.profile-form small {
  font-size: 11px;
  color: var(--text-muted);
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dim));
  color: var(--navy);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--tr);
  box-shadow: 0 4px 14px rgba(201,151,44,.28);
  margin-top: 20px;
  font-family: 'Inter', sans-serif;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-gold);
}

/* ============================================================
   16. TREE SECTION
   ============================================================ */

/* Search panel */
.tree-search-panel { margin-bottom: 24px; }

.tree-search-card {
  background: var(--white);
  border-radius: 14px;
  padding: 28px 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.tree-search-card h2 {
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.tree-search-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.tree-search-input-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tree-search-input-group input,
.tree-search-input-group select {
  flex: 1;
  min-width: 180px;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: var(--tr);
}

.tree-search-input-group input:focus,
.tree-search-input-group select:focus { border-color: var(--gold); }

.tree-quick-info {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.tree-quick-info span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
}

.tree-quick-info i { color: var(--gold-dim); }

/* User bar */
.tree-user-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--navy);
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 20px;
  border: 1px solid rgba(201,151,44,.20);
  flex-wrap: wrap;
  gap: 10px;
}

.tree-user-details {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  flex-wrap: wrap;
}

.tree-user-details i { font-size: 20px; color: var(--gold-light); }

#viewingUser {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
}

.user-level-badge {
  background: rgba(201,151,44,.18);
  border: 1px solid rgba(201,151,44,.30);
  color: var(--gold-light);
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

/* Tree stats grid */
.tree-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.tree-stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: var(--tr);
}

.tree-stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.tree-stat-card i {
  font-size: 20px;
  color: var(--gold-dim);
  margin-bottom: 8px;
  display: block;
}

.tree-stat-value {
  font-family: 'Sora', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
}

.tree-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Level breakdown */
.tree-level-breakdown {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.tree-level-breakdown h3 {
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tree-level-breakdown h3 i { color: var(--gold-dim); }

.level-bar-item   { margin-bottom: 12px; }
.level-bar-item:last-child { margin-bottom: 0; }

.level-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.level-bar-label strong { color: var(--navy); }

.level-bar-track {
  height: 8px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
}

.level-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold-light), var(--gold-dim));
  transition: width .4s ease;
}

.level-bar-percent {
  font-size: 11px;
  color: var(--text-faint);
  text-align: right;
  margin-top: 2px;
}

/* Tree controls */
.tree-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 10px;
}

.tree-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tree-control-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.tree-control-group select,
#depthSelector {
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: var(--tr);
  background: var(--white);
}

.tree-control-group select:focus,
#depthSelector:focus { border-color: var(--gold); }

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dim));
  color: var(--navy);
  border: none;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--tr);
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-gold); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  color: rgba(255,255,255,.80);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--tr);
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}
.btn-secondary:hover {
  background: rgba(201,151,44,.15);
  border-color: rgba(201,151,44,.30);
  color: var(--gold-light);
}

.btn-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: var(--tr);
  flex-shrink: 0;
}

.btn-icon:hover {
  background: rgba(201,151,44,.10);
  border-color: rgba(201,151,44,.25);
  color: var(--gold-dim);
}

/* Tree container */
.tree-container {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  max-height: 70vh;
  min-height: 200px;
  cursor: grab;
}
.tree-container:active { cursor: grabbing; }

/* Tree root */
#treeRoot {
  display: block;
  overflow: visible;
  padding: 24px 16px 32px;
  box-sizing: border-box;
}

.tree-root {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: max-content;
  width: max-content;
  margin: 0 auto;
}

.tree-level {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
  position: relative;
}

.tree-level + .tree-level { margin-top: 24px; }

.tree-level + .tree-level::before {
  content: '';
  position: absolute;
  top: -12px; left: 50%;
  transform: translateX(-50%);
  width: 2px; height: 12px;
  background: var(--border-brand);
}

/* Loader */
.tree-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  gap: 14px;
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.tree-empty,
.tree-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-faint);
  text-align: center;
  gap: 12px;
}

.tree-empty i,
.tree-error i { font-size: 38px; opacity: .30; }

/* Tree nodes */
.tree-node-wrap { display: flex; flex-direction: column; align-items: center; }
.tree-node { position: relative; }

.node-card {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 8px 6px;
  width: 84px;
  cursor: pointer;
  transition: var(--tr);
  text-align: center;
  position: relative;
}

.node-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(201,151,44,.18);
}

.node-card.current-user {
  border-color: var(--navy);
  background: var(--gold-pale);
}

.node-card.max-reached { border-color: var(--success); }

.node-level-badge {
  position: absolute;
  top: -7px; right: -7px;
  background: var(--navy);
  color: var(--white);
  font-size: 9px;
  font-weight: 700;
  width: 17px; height: 17px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.node-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--gold-dim));
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 5px;
}

.current-user .node-avatar {
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: var(--navy);
}

.node-name { font-size: 10px; font-weight: 600; color: var(--navy); margin-bottom: 2px; word-break: break-word; line-height: 1.2; }
.node-id   { font-size: 9px; color: var(--text-faint); margin-bottom: 3px; }
.node-stats { font-size: 9px; color: var(--text-muted); display: flex; flex-direction: column; gap: 1px; }
.node-stats i { margin-right: 2px; }

.empty-slot {
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 8px 6px;
  width: 84px;
  text-align: center;
  color: var(--border);
  font-size: 9px;
  cursor: pointer;
  transition: var(--tr);
}
.empty-slot:hover { border-color: var(--gold); color: var(--gold-dim); }
.empty-slot i { font-size: 16px; display: block; margin-bottom: 3px; }

.node-children { display: contents; }
.children-collapsed > *:not(.toggle-children) { display: none; }

.toggle-children {
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 4px;
  width: 20px; height: 20px;
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   17. MODAL
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(13,27,62,.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 16px;
}

.modal.hidden { display: none; }

.modal-content {
  background: var(--white);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(13,27,62,.22);
  position: relative;
  border-top: 3px solid var(--gold);
}

.modal-close {
  position: absolute;
  top: 14px; right: 16px;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 50%;
  background: var(--bg);
  transition: var(--tr);
}
.modal-close:hover { background: var(--navy); color: var(--white); }

.modal-header {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-right: 48px;
}

.modal-header h3 {
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
}

.modal-level {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-dim);
  background: rgba(201,151,44,.10);
  border: 1px solid rgba(201,151,44,.22);
  padding: 3px 10px;
  border-radius: 20px;
}

.modal-body { padding: 16px 24px; }

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--bg);
  font-size: 13px;
  gap: 8px;
}
.detail-row:last-child { border-bottom: none; }

.detail-label  { color: var(--text-muted); flex-shrink: 0; }
.detail-value  { color: var(--navy); font-weight: 600; text-align: right; word-break: break-all; }

.modal-footer {
  padding: 14px 24px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
}

.modal-footer .btn-secondary {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}
.modal-footer .btn-secondary:hover { background: var(--navy); border-color: var(--navy); color: var(--white); }

/* ============================================================
   18. TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100vw - 40px);
}

.toast {
  background: var(--navy);
  color: var(--white);
  padding: 12px 18px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  transition: opacity .3s, transform .3s;
  min-width: 200px;
  border-left: 3px solid var(--gold);
}

.toast.success { background: var(--success); border-left-color: #4ade80; }
.toast.error   { background: var(--danger);  border-left-color: #fca5a5; }
.toast.warning { background: #92400e;        border-left-color: var(--gold-light); }

/* ============================================================
   19. MOBILE BOTTOM NAV
   ============================================================ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--navy);
  border-top: 1px solid rgba(201,151,44,.15);
  z-index: 1050;
  height: 62px;
  box-shadow: 0 -4px 20px rgba(13,27,62,.20);
}

.mobile-nav ul {
  display: flex;
  height: 100%;
  list-style: none;
}

.mobile-nav li { flex: 1; display: flex; }

.mobile-nav li a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,.45);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 6px 4px;
  transition: var(--tr);
}

.mobile-nav li a i { font-size: 18px; }
.mobile-nav li.active a  { color: var(--gold-light); }
.mobile-nav li a:hover   { color: rgba(255,255,255,.82); }

/* ============================================================
   20. UTILITIES
   ============================================================ */
.hidden { display: none !important; }

.a {
  text-decoration: none;
  color: inherit;
}

.nav-brand {
  color: var(--white);
  text-decoration: none;
}
.nav-brand:visited { color: var(--white); }

/* Highlight animation */
.highlight-section {
  animation: pulse-highlight 2s ease;
}

@keyframes pulse-highlight {
  0%   { box-shadow: 0 0 0 0 rgba(201,151,44,.40); }
  70%  { box-shadow: 0 0 0 12px rgba(201,151,44,.0); }
  100% { box-shadow: 0 0 0 0 rgba(201,151,44,.0); }
}

/* Custom notification (injected by dashboard.js) */
.custom-notification {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  max-width: 420px;
  border-radius: 10px;
  padding: 14px 20px;
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  z-index: 10000;
  box-shadow: var(--shadow-lg);
}

/* Pan indicator */
.pan-indicator {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13,27,62,.85);
  color: var(--gold-light);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  z-index: 9999;
}
.pan-indicator.show { opacity: 1; }

/* ============================================================
   21. SCROLLBAR
   ============================================================ */
::-webkit-scrollbar          { width: 5px; height: 5px; }
::-webkit-scrollbar-track    { background: transparent; }
::-webkit-scrollbar-thumb    { background: var(--border-brand); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   22. RESPONSIVE
   ============================================================ */

/* Large tablet */
@media (max-width: 1280px) {
  :root { --sidebar-w: 250px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .earnings-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Tablet landscape */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
  .content-section { padding: 24px 28px; }
  .tree-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Tablet portrait & large mobile */
@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    width: 270px !important;
    box-shadow: none;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 6px 0 28px rgba(0,0,0,.28);
  }

  .main-content {
    margin-left: 0 !important;
    padding-bottom: 70px;
  }

  .dashboard-header {
    padding: 0 16px 0 64px;
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-h);
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 8px;
  }

  .header-right { flex-wrap: wrap; gap: 8px; }
  .search-bar   { flex: 1; min-width: 140px; max-width: 100%; }
  .content-section { padding: 20px 16px; }

  .stats-grid      { grid-template-columns: 1fr 1fr; gap: 12px; }
  .dashboard-grid  { grid-template-columns: 1fr; }
  .earnings-grid   { grid-template-columns: 1fr 1fr; gap: 12px; }
  .team-stats      { grid-template-columns: 1fr 1fr; gap: 12px; }
  .tree-stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

  .form-row        { grid-template-columns: 1fr; }
  .profile-header  { flex-direction: column; align-items: center; text-align: center; }
  .profile-form    { padding: 20px 20px 24px; }

  .referral-card   { padding: 20px; }
  .chart-container { height: 220px; }

  .tree-controls { flex-direction: column; align-items: flex-start; }
  .tree-control-group { width: 100%; }
  .tree-container { max-height: 60vh; }

  .search-input { width: 100%; }
  .table-header { flex-direction: column; align-items: flex-start; padding: 16px; }

  .modal-footer { flex-direction: column; }
  .modal-footer .btn-primary,
  .modal-footer .btn-secondary { width: 100%; justify-content: center; }

  .tree-search-input-group { flex-direction: column; }
  .tree-search-input-group input,
  .tree-search-input-group select,
  .tree-search-input-group .btn-primary { width: 100%; }
}

/* Mobile */
@media (max-width: 480px) {
  .stats-grid      { grid-template-columns: 1fr 1fr; gap: 10px; }
  .earnings-grid   { grid-template-columns: 1fr 1fr; gap: 10px; }
  .team-stats      { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tree-stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  .card-value      { font-size: 22px; }
  .earnings-amount { font-size: 20px; }
  .team-stat-value { font-size: 22px; }
  .tree-stat-value { font-size: 18px; }

  .section-header h1 { font-size: 22px; }
  .chart-container   { height: 190px; }
  .breadcrumb        { display: none; }

  #team-sponsor-id {
    font-size: 12px !important;
    word-break: break-all;
    line-height: 1.3;
  }

  .node-card, .empty-slot { width: 76px; }
  .node-avatar { width: 28px; height: 28px; font-size: 10px; }
  .tree-level  { gap: 5px; }
}

/* Small mobile */
@media (max-width: 360px) {
  .content-section   { padding: 14px 12px; }
  .stats-grid        { grid-template-columns: 1fr; }
  .section-header h1 { font-size: 18px; }
  .search-bar        { display: none; }
  .card-value        { font-size: 20px; }
  .node-card, .empty-slot { width: 66px; }
  .node-name  { font-size: 9px; }
  .node-id    { font-size: 8px; }
  .tree-level { gap: 4px; }
}

/* ============================================================
   23. PRINT
   ============================================================ */
@media print {
  .sidebar,
  .sidebar-toggle,
  .sidebar-overlay,
  .dashboard-header,
  .mobile-nav,
  .icon-btn,
  .action-btn,
  .submit-btn,
  .copy-btn { display: none !important; }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    background: var(--white) !important;
  }

  .stat-card,
  .chart-card,
  .table-card,
  .earnings-card,
  .profile-container {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    page-break-inside: avoid;
  }
}