<style>
/* ========================================
   BASE STYLES
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8f9fa;
    color: #1f2937;
    line-height: 1.6;
}

/* ========================================
   RESPONSIVE UTILITY CLASSES
======================================== */
/* Mobile first */
.desktop-only {
    display: none !important;
}

.mobile-only {
    display: block !important;
}

/* Tablet & laptop */
@media (min-width: 769px) {
    .desktop-only {
        display: block !important;
    }

    .mobile-only {
        display: none !important;
    }
}


/* ========================================
   DASHBOARD CONTAINER
======================================== */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    background: #f8f9fa;
    min-height: 100vh;
}

@media (max-width: 768px) {
    .dashboard-container {
        padding: 12px;
    }
}

/* ========================================
   DASHBOARD HEADER
======================================== */
.dashboard-header {
    background: linear-gradient(135deg, #660066 0%, #8b008b 100%);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(102, 0, 102, 0.2);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.dashboard-title {
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px 0;
}

.dashboard-subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.user-info-card {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 12px;
    gap: 12px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 16px;
}

.user-role {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 768px) {
    .dashboard-header {
        padding: 20px;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .dashboard-title {
        font-size: 24px;
    }
    
    .dashboard-subtitle {
        font-size: 14px;
    }
    
    .user-info-card {
        width: 100%;
    }
}

/* ========================================
   STATS GRID
======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.stat-primary { border-color: #660066; }
.stat-success { border-color: #10b981; }
.stat-info { border-color: #3b82f6; }
.stat-warning { border-color: #f59e0b; }

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-primary .stat-icon {
    background: rgba(102, 0, 102, 0.1);
    color: #660066;
}

.stat-success .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-info .stat-icon {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.stat-warning .stat-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 8px 0;
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px 0;
}

.stat-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.stat-badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.stat-badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.stat-link {
    color: #660066;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.stat-link:hover {
    color: #8b008b;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-icon {
        width: 48px;
        height: 48px;
    }
}

/* ========================================
   LEVEL STATS
======================================== */
.level-stats-container {
    margin-bottom: 24px;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 20px 0;
}

/* Mobile Tabs for Levels */
.level-tabs-mobile {
    display: none;
    gap: 8px;
    margin-bottom: 16px;
}

.level-tab-btn {
    flex: 1;
    padding: 12px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.level-tab-btn.active {
    background: #660066;
    color: #ffffff;
    border-color: #660066;
}

.level-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.level-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.level-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.level-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-1 .level-header {
    background: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
}

.level-2 .level-header {
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
}

.level-3 .level-header {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
}

.level-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

.level-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.level-body {
    padding: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.level-body-mobile {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.level-stat {
    display: flex;
    flex-direction: column;
}

.level-stat-label {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 4px;
    font-weight: 500;
}

.level-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.level-stats-mobile {
    display: none;
}

.level-pane {
    display: none;
}

.level-pane.active {
    display: block;
}

.text-success {
    color: #10b981 !important;
}

@media (max-width: 768px) {
    .level-tabs-mobile {
        display: flex;
    }
    
    .level-stats-mobile {
        display: block !important;
    }
    
    .level-body {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px;
    }
    
    .section-title {
        font-size: 20px;
    }
}

/* ========================================
   SEARCH AND FILTER
======================================== */
.search-filter-section {
    margin-bottom: 24px;
}

.search-filter-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.search-form {
    width: 100%;
}

.search-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-input-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 120px;
}

.filter-select:focus {
    outline: none;
    border-color: #660066;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #660066;
}

.search-button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #660066 0%, #8b008b 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 0, 102, 0.3);
}

.clear-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}

.clear-filter-btn:hover {
    background: #e5e7eb;
}

@media (max-width: 768px) {
    .search-input-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .filter-select,
    .search-input,
    .search-button {
        width: 100%;
        min-width: 100%;
    }
}

/* ========================================
   TABS
======================================== */
.tabs-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 24px;
}

.tabs-header {
    display: flex;
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.tab-button {
    flex: 1;
    padding: 16px 24px;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    position: relative;
}

.tab-button:hover {
    background: rgba(102, 0, 102, 0.05);
    color: #660066;
}

.tab-button.active {
    color: #660066;
    background: #ffffff;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #660066;
}

.tab-label {
    display: inline;
}

.tabs-content {
    padding: 24px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

@media (max-width: 768px) {
    .tabs-header {
        gap: 4px;
    }
    
    .tab-button {
        padding: 12px 8px;
        font-size: 13px;
    }
    
    .tab-label {
        display: none;
    }
    
    .tab-button svg {
        width: 20px;
        height: 20px;
    }
    
    .tabs-content {
        padding: 16px;
    }
}

/* ========================================
   TABLE STYLES
======================================== */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-bottom: 16px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: #f9fafb;
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #6b7280;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.member-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, #660066 0%, #8b008b 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.member-avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.member-info {
    display: flex;
    flex-direction: column;
}

.member-name {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
}

.member-badge {
    font-size: 11px;
    color: #ef4444;
    font-weight: 500;
}

.text-muted {
    color: #9ca3af !important;
}

.text-bold {
    font-weight: 600;
    color: #111827;
}

.text-danger {
    color: #ef4444 !important;
}

.text-info {
    color: #3b82f6 !important;
}

.team-size-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: rgba(102, 0, 102, 0.1);
    color: #660066;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.generation-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.gen-1 {
    background: rgba(236, 72, 153, 0.1);
    color: #ec4899;
}

.gen-2 {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.gen-3 {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.percentage-badge {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.action-btn-primary {
    background: linear-gradient(135deg, #660066 0%, #8b008b 100%);
    color: #ffffff;
}

.action-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 0, 102, 0.3);
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
}

.empty-state svg {
    margin: 0 auto 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 8px 0;
}

.empty-state p {
    font-size: 14px;
    margin: 0;
}

/* ========================================
   MOBILE CARDS (REPLACES TABLES)
======================================== */
.mobile-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.member-mobile-card,
.rebate-mobile-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-bottom: 10px;
    overflow: hidden;
}

.member-mobile-header,
.rebate-mobile-header {
    padding: 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.member-mobile-info,
.rebate-mobile-info {
    flex: 1;
}

.member-mobile-info h4,
.rebate-mobile-info h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.member-mobile-info p,
.rebate-mobile-info p {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #6b7280;
    word-break: break-word;
}

.member-mobile-stats,
.rebate-mobile-stats {
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mobile-stat {
    display: flex;
    flex-direction: column;
}

.mobile-stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    font-weight: 500;
}

.mobile-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.member-mobile-footer,
.rebate-mobile-footer {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.member-mobile-footer .action-btn {
    width: 100%;
    justify-content: center;
}

.rebate-mobile-footer {
    text-align: center;
    font-size: 13px;
}

/* ========================================
   PAGINATION STYLES
======================================== */
.pagination-wrapper {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.pagination-wrapper nav {
    width: 100%;
}

.pagination-wrapper .pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.pagination-wrapper .page-item {
    display: inline-block;
}

.pagination-wrapper .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    color: #6b7280;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.pagination-wrapper .page-link:hover {
    background: #660066;
    border-color: #660066;
    color: #ffffff;
}

.pagination-wrapper .page-item.active .page-link {
    background: #660066;
    border-color: #660066;
    color: #ffffff;
}

.pagination-wrapper .page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 768px) {
    .pagination-wrapper .page-link {
        min-width: 36px;
        height: 36px;
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .pagination-wrapper .pagination {
        gap: 4px;
    }
}

/* ========================================
   BREADCRUMB
======================================== */
.breadcrumb-container {
    margin-bottom: 20px;
}

.breadcrumb-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #ffffff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #660066;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.breadcrumb-link:hover {
    background: #660066;
    color: #ffffff;
    transform: translateX(-4px);
}

/* ========================================
   MEMBER HEADER (DETAIL PAGE)
======================================== */
.member-header-card {
    background: linear-gradient(135deg, #660066 0%, #8b008b 100%);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(102, 0, 102, 0.2);
}

.member-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 24px;
}

.member-header-left {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.member-large-avatar {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    border: 3px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.member-header-info {
    flex: 1;
}

.member-header-title {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px 0;
}

.member-header-email {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 12px 0;
    word-break: break-word;
}

.member-header-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #ffffff;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ffffff;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #ffffff;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.quick-stat-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 16px 24px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.quick-stat-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 4px;
}

.quick-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

@media (max-width: 768px) {
    .member-header-card {
        padding: 20px;
    }
    
    .member-header-content {
        flex-direction: column;
    }
    
    .member-header-left {
        flex-direction: column;
        align-items: center;
        text-align: center;
        width: 100%;
    }
    
    .member-header-info {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .member-header-title {
        font-size: 22px;
    }
    
    .member-large-avatar {
        width: 64px;
        height: 64px;
        font-size: 24px;
    }
}

/* ========================================
   MEMBER STATS GRID (DETAIL PAGE)
======================================== */
.member-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.member-stat-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.member-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.member-stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-primary .member-stat-icon {
    background: rgba(102, 0, 102, 0.1);
    color: #660066;
}

.stat-success .member-stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-info .member-stat-icon {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.stat-warning .member-stat-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.member-stat-content {
    flex: 1;
}

.member-stat-label {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 8px 0;
    font-weight: 500;
}

.member-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 4px 0;
}

.member-stat-detail {
    font-size: 12px;
    color: #9ca3af;
}

@media (max-width: 768px) {
    .member-stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .member-stat-value {
        font-size: 24px;
    }
}

/* ========================================
   FINANCIAL OVERVIEW (DETAIL PAGE)
======================================== */
.financial-overview-section {
    margin-bottom: 24px;
}

.financial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.financial-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.financial-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.financial-card-header {
    background: #f9fafb;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
}

.financial-card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.financial-card-header svg {
    color: #9ca3af;
}

.financial-card-body {
    padding: 24px 20px;
}

.financial-amount {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.financial-amount-success {
    color: #10b981;
}

.financial-amount-danger {
    color: #ef4444;
}

.financial-label {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

@media (max-width: 768px) {
    .financial-grid {
        grid-template-columns: 1fr;
    }
    
    .financial-amount {
        font-size: 28px;
    }
}

/* ========================================
   DOWNLINE SECTION (DETAIL PAGE)
======================================== */
.downline-section {
    margin-bottom: 24px;
}

.downline-level-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.downline-level-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.downline-level-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.downline-level-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-1-card .downline-level-header {
    background: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
}

.level-2-card .downline-level-header {
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
}

.level-3-card .downline-level-header {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
}

.downline-level-title h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

.downline-level-badge {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.downline-level-count {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
}

.downline-level-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.downline-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.downline-metric:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.downline-metric-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.downline-metric-value {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

@media (max-width: 768px) {
    .downline-level-cards {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   MEMBERS TABLE SECTION (DETAIL PAGE)
======================================== */
.members-table-section {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 24px;
}

.members-table-section .section-title {
    padding: 20px 20px 0;
}

.members-tabs {
    display: flex;
    padding: 0 20px;
    border-bottom: 2px solid #e5e7eb;
    margin-top: 16px;
    gap: 4px;
}

.members-tab-btn {
    padding: 12px 16px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    white-space: nowrap;
}

.members-tab-btn:hover {
    color: #660066;
}

.members-tab-btn.active {
    color: #660066;
}

.members-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #660066;
}

.tab-label-full {
    display: inline;
}

.tab-label-short {
    display: none;
}

.members-tab-content {
    padding: 20px;
}

.members-tab-pane {
    display: none;
}

.members-tab-pane.active {
    display: block;
}

@media (max-width: 768px) {
    .members-tabs {
        padding: 0 12px;
        gap: 2px;
    }
    
    .members-tab-btn {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .tab-label-full {
        display: none;
    }
    
    .tab-label-short {
        display: inline;
    }
    
    .members-tab-content {
        padding: 12px;
    }
}

/* ========================================
   LEVEL INDICATORS (Lvl 1, Lvl 2, Lvl 3)
======================================== */
.level-indicator {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
}

.level-indicator.level-1 {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.level-indicator.level-2 {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.level-indicator.level-3 {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

@media (max-width: 768px) {
    .level-indicator {
        font-size: 10px;
        padding: 2px 6px;
        margin-left: 4px;
    }
}

/* ========================================
   6-CARD STATS GRID
======================================== */
.stats-grid-6 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* Clickable Stats Cards */
.stat-card.stat-clickable {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.stat-card.stat-clickable:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.stat-link-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #660066;
    margin-top: 4px;
}

/* Email Verified Card */
.stat-email-verified {
    border-left: 4px solid #10b981;
}

.stat-email-verified .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

/* Email Unverified Card */
.stat-email-unverified {
    border-left: 4px solid #f59e0b;
}

.stat-email-unverified .stat-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* KYC Verified Card */
.stat-kyc-verified {
    border-left: 4px solid #3b82f6;
}

.stat-kyc-verified .stat-icon {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

/* KYC Unverified Card */
.stat-kyc-unverified {
    border-left: 4px solid #ef4444;
}

.stat-kyc-unverified .stat-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

@media (max-width: 768px) {
    .stats-grid-6 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ========================================
   SINGLE DOWNLINE CARD (All Generations)
======================================== */
.downline-single-container {
    margin-bottom: 24px;
}

.downline-single-card {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.downline-single-header {
    background: linear-gradient(135deg, #660066 0%, #8b008b 100%);
    padding: 28px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.downline-single-title h3 {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
}

.downline-single-badge {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
}

.downline-single-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.downline-single-body {
    padding: 32px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.downline-single-stat {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    transition: background 0.2s;
}

.downline-single-stat:hover {
    background: #f3f4f6;
}

.downline-stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-icon-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.stat-icon-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.downline-stat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.downline-stat-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 6px;
}

.downline-stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #111827;
}

@media (max-width: 768px) {
    .downline-single-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px;
    }
    
    .downline-single-icon {
        width: 56px;
        height: 56px;
    }
    
    .downline-single-icon svg {
        width: 32px;
        height: 32px;
    }
    
    .downline-single-body {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 16px;
    }
    
    .downline-single-stat {
        padding: 16px;
    }
    
    .downline-stat-value {
        font-size: 22px;
    }
}

/* ========================================
   MEMBERS LIST PAGE STYLES
======================================== */
.members-list-header {
    background: linear-gradient(135deg, #660066 0%, #8b008b 100%);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(102, 0, 102, 0.2);
}

.members-list-header-content {
    display: flex;
    align-items: center;
    gap: 24px;
}

.members-list-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
}

.members-list-info {
    flex: 1;
}

.members-list-title {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px 0;
}

.members-list-subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 12px 0;
}

.members-list-count {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
}

.members-list-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 24px;
}

@media (max-width: 768px) {
    .members-list-header {
        padding: 20px;
    }
    
    .members-list-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .members-list-icon {
        width: 64px;
        height: 64px;
    }
    
    .members-list-icon svg {
        width: 32px;
        height: 32px;
    }
    
    .members-list-title {
        font-size: 22px;
    }
    
    .members-list-content {
        padding: 16px;
    }
}

/* ========================================
   VERIFICATION BADGES
======================================== */
.verification-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.verification-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-verified {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-unverified {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.verification-badge svg {
    width: 12px;
    height: 12px;
}

/* ========================================
   STAT BADGE PRIMARY
======================================== */
.stat-badge-primary {
    background: rgba(102, 0, 102, 0.1);
    color: #660066;
}
</style>