/* Sales Dashboard Styles - Airtable Style with Gradients */
:root {
    --primary-blue: #2563eb;
    --primary-green: #16a34a;
    --primary-red: #ef4444;
    --primary-purple: #7c3aed;
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
}

body {
    background-color: #f5f5f5;
    font-weight: 300;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
}

html {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
}

/* Sticky Header - HIGHEST Z-INDEX, FLUSH WITH TOP */
header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    /* Add safe area padding for notched phones */
    padding-top: env(safe-area-inset-top, 0) !important;
    padding-left: env(safe-area-inset-left, 0) !important;
    padding-right: env(safe-area-inset-right, 0) !important;
}

/* PWA Standalone mode - ensure flush with screen top */
@media all and (display-mode: standalone) {
    header {
        padding-top: env(safe-area-inset-top, 0) !important;
    }
    
    body {
        /* Prevent overscroll bounce on iOS */
        overscroll-behavior: none;
    }
}

/* iOS Safari standalone */
@supports (-webkit-touch-callout: none) {
    header {
        padding-top: env(safe-area-inset-top, 0) !important;
    }
}

body.dark-mode header {
    background: #1f2937;
}

/* Quick Stats Banner - FLUSH below header, NO GAPS */
#quickStatsBanner {
    position: fixed !important;
    top: 64px !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9998 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 8px 16px !important;
    padding-left: max(16px, env(safe-area-inset-left, 0)) !important;
    padding-right: max(16px, env(safe-area-inset-right, 0)) !important;
    border-radius: 0 !important;
    border: none !important;
    transform: none !important;
    transition: none !important;
    box-sizing: border-box !important;
    background: linear-gradient(to right, #9333ea, #6366f1) !important;
}

@media (max-width: 640px) {
    header {
        /* Mobile header height is smaller */
        min-height: calc(44px + env(safe-area-inset-top, 0)) !important;
    }
    
    #quickStatsBanner {
        /* Position right below header including safe area */
        top: calc(44px + env(safe-area-inset-top, 0)) !important;
        padding: 6px 12px !important;
        padding-left: max(12px, env(safe-area-inset-left, 0)) !important;
        padding-right: max(12px, env(safe-area-inset-right, 0)) !important;
    }
}

/* PWA Standalone quick stats positioning */
@media all and (display-mode: standalone) {
    @media (max-width: 640px) {
        #quickStatsBanner {
            top: calc(44px + env(safe-area-inset-top, 0)) !important;
        }
    }
}

/* Quick Stats Banner Colors */
#quickStatsBanner {
    background: linear-gradient(to right, #9333ea, #6366f1) !important; /* purple-600 to indigo-500 */
}

/* Ensure dark mode colors persist - slightly darker purple */
body.dark-mode #quickStatsBanner {
    background: linear-gradient(to right, #7e22ce, #4f46e5) !important; /* purple-700 to indigo-600 */
}

/* Ensure text colors stay visible */
#quickStatsBanner,
#quickStatsBanner span,
#quickStatsBanner .font-medium,
#quickStatsBanner .font-bold,
#quickStatsBanner i {
    color: white !important;
}

#quickStatsBanner #todayCashQuick {
    color: #86efac !important; /* green-300 */
}

#quickStatsBanner #todayCallsQuick {
    color: #93c5fd !important; /* blue-300 */
}

#quickStatsBanner #todayDealsQuick {
    color: #fde047 !important; /* yellow-300 */
}

#quickStatsBanner .text-purple-200 {
    color: #e9d5ff !important; /* purple-200 */
}

body.dark-mode #quickStatsBanner #todayCashQuick {
    color: #86efac !important; /* green-300 */
}

body.dark-mode #quickStatsBanner #todayCallsQuick {
    color: #93c5fd !important; /* blue-300 */
}

body.dark-mode #quickStatsBanner #todayDealsQuick {
    color: #fde047 !important; /* yellow-300 */
}

body.dark-mode #quickStatsBanner .text-purple-200 {
    color: #c4b5fd !important; /* purple-300 for better visibility in dark mode */
}

/* Main content padding to account for fixed header + Quick Stats banner */
main {
    margin-top: 110px !important; /* header (64px) + quick stats banner (~46px) */
    padding-top: 10px !important;
}

@media (max-width: 640px) {
    main {
        /* Mobile: header (44px) + safe-area + quick stats (36px) */
        margin-top: calc(80px + env(safe-area-inset-top, 0)) !important;
        padding-top: 8px !important;
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* PWA Standalone main content positioning */
@media all and (display-mode: standalone) {
    main {
        margin-top: calc(110px + env(safe-area-inset-top, 0)) !important;
    }
    
    @media (max-width: 640px) {
        main {
            margin-top: calc(80px + env(safe-area-inset-top, 0)) !important;
        }
    }
}

/* Ensure quick stats banner is flush on all devices */
#quickStatsBanner {
    margin: 0 !important;
    border-radius: 0 !important;
}

/* Mobile Header Fixes */
@media (max-width: 640px) {
    header {
        padding: 6px 0 !important;
        padding-top: calc(6px + env(safe-area-inset-top, 0)) !important;
        margin: 0 !important;
        width: 100vw !important;
        max-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
    }
    
    header > div {
        padding-left: 8px !important;
        padding-right: 8px !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
}

/* Extra small screens (< 400px) */
@media (max-width: 400px) {
    header {
        padding: 4px 6px !important;
    }
    
    .mobile-header-btn {
        padding: 6px 8px !important;
        min-width: 36px !important;
        min-height: 32px !important;
    }
    
    .mobile-header-btn i {
        font-size: 12px !important;
    }
}

/* Custom breakpoint for extra small */
@media (min-width: 360px) {
    .xs\:flex {
        display: flex !important;
    }
}

@media (max-width: 359px) {
    .xs\:flex {
        display: none !important;
    }
}

/* Mobile Touch Support for Buttons */
.touch-manipulation {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Header buttons - Minimum tap target */
.mobile-header-btn {
    position: relative;
    z-index: 100;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    cursor: pointer !important;
    pointer-events: auto !important;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

@media (min-width: 640px) {
    .mobile-header-btn {
        min-width: 44px;
        min-height: 40px;
    }
}

/* Active state feedback */
.mobile-header-btn:active {
    transform: scale(0.95);
    opacity: 0.9;
}

/* Ensure child elements don't block clicks */
.mobile-header-btn * {
    pointer-events: none;
}

/* Prevent text selection on buttons */
button {
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    -webkit-touch-callout: none;
    cursor: pointer;
}

/* Section Title */
.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

/* Metric Cards with Gradient Backgrounds */
.metric-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.metric-card-lg {
    padding: 16px 20px;
}

.metric-card-hero {
    padding: 24px 32px;
    text-align: center;
}

.metric-value-hero {
    font-size: 48px;
    font-weight: 600;
    line-height: 1.1;
}

@media (max-width: 768px) {
    .metric-value-hero { font-size: 32px; }
    .metric-card-hero { padding: 16px 20px; }
}

/* Gradient overlays for colored cards */
.metric-card.metric-blue {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(255, 255, 255, 0) 60%);
}

.metric-card.metric-green {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.08) 0%, rgba(255, 255, 255, 0) 60%);
}

.metric-card.metric-red {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(255, 255, 255, 0) 60%);
}

.metric-card.metric-purple {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, rgba(255, 255, 255, 0) 60%);
}

.metric-card.metric-orange {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.08) 0%, rgba(255, 255, 255, 0) 60%);
}

.metric-label {
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #6b7280;
}

.metric-value {
    font-size: 24px;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.2;
}

.metric-value-lg {
    font-size: 32px;
    font-weight: 600;
    line-height: 1.1;
}

.metric-sub {
    font-size: 11px;
    color: #9ca3af;
}

/* Color Classes */
.text-blue-600 { color: #2563eb !important; }
.text-green-600 { color: #16a34a !important; }
.text-red-500 { color: #ef4444 !important; }
.text-purple-600 { color: #7c3aed !important; }
.text-orange-500 { color: #f97316 !important; }

/* Filter Buttons */
.filter-group {
    position: relative;
    z-index: 100;
}

/* Ensure filter containers don't clip dropdowns */
.flex.flex-wrap.gap-2.mb-4 {
    overflow: visible !important;
}

section {
    overflow: visible !important;
}

/* Ensure dialing filters have higher z-index when active */
.filter-group:focus-within,
.filter-group:has(.filter-dropdown:not(.hidden)) {
    z-index: 99999;
}

.filter-btn {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 40px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    user-select: none;
    position: relative;
    z-index: 10;
}

.filter-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.filter-btn.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}

.filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 9000 !important; /* Below header (9999) but above content */
    min-width: 220px;
    max-height: 70vh; /* Use viewport height for better mobile support */
    overflow-y: auto;
    overflow-x: hidden;
    pointer-events: auto !important;
    touch-action: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Mobile dropdown improvements */
@media (max-width: 640px) {
    .filter-dropdown {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 60vh !important;
        border-radius: 16px 16px 0 0 !important;
        margin-top: 0 !important;
        animation: slideUp 0.2s ease-out;
    }
    
    .filter-dropdown.hidden {
        display: none !important;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

.filter-dropdown label,
.filter-dropdown input {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.filter-dropdown * {
    pointer-events: auto !important;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.1s;
    touch-action: manipulation;
    min-height: 36px;
}

.filter-option:hover {
    background: #f3f4f6;
}

.filter-option input {
    cursor: pointer;
}

.reset-btn {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 4px;
    font-size: 12px;
    color: #dc2626;
    cursor: pointer;
    transition: all 0.15s;
}

.reset-btn:hover {
    background: #fecaca;
}

/* Active Filter Tags */
.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    font-size: 11px;
    color: #1d4ed8;
}

.filter-tag button {
    background: none;
    border: none;
    cursor: pointer;
    color: #1d4ed8;
    padding: 0;
    font-size: 10px;
}

/* Chart Cards */
.chart-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chart-title {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 12px;
}

.chart-container {
    height: 280px;
    position: relative;
}

.chart-container-tall {
    height: 350px;
    position: relative;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.closed-won { background: #dcfce7; color: #16a34a; }
.status-badge.closed-lost { background: #fee2e2; color: #dc2626; }
.status-badge.no-show { background: #fef3c7; color: #d97706; }
.status-badge.disqualified { background: #fce7f3; color: #be185d; }
.status-badge.rescheduled { background: #f3e8ff; color: #7c3aed; }
.status-badge.pending { background: #e0e7ff; color: #4f46e5; }

/* Table Styles */
table { border-collapse: collapse; }
tbody tr { border-bottom: 1px solid #f3f4f6; }
tbody tr:hover { background: #f9fafb; }
tbody td { padding: 10px 16px; }

/* Table Container Shadow */
.bg-white.rounded-lg.border {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Commission Items */
.commission-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 4px;
    font-size: 13px;
}

.commission-item .name { font-weight: 500; color: #374151; }
.commission-item .amount { font-weight: 600; color: #16a34a; }

/* Objection Items */
.objection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #fef2f2;
    border-radius: 4px;
    border-left: 3px solid #ef4444;
    font-size: 13px;
}

.objection-item .name { font-weight: 500; color: #374151; }
.objection-item .count { font-weight: 600; color: #dc2626; }

/* Payment Status Colors */
.payment-due-red { 
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.15) 0%, rgba(255, 255, 255, 0) 100%);
}
.payment-due-orange { 
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.15) 0%, rgba(255, 255, 255, 0) 100%);
}
.payment-due-green { 
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.15) 0%, rgba(255, 255, 255, 0) 100%);
}

.due-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.due-badge.red { background: #fee2e2; color: #dc2626; }
.due-badge.orange { background: #fed7aa; color: #c2410c; }
.due-badge.green { background: #dcfce7; color: #16a34a; }

/* Recording Link */
.recording-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #eff6ff;
    border-radius: 4px;
    color: #3b82f6;
    transition: all 0.15s;
}

.recording-link:hover {
    background: #dbeafe;
    color: #1d4ed8;
}

/* Recording Link - Dark Mode: Use BLUE for visibility */
body.dark-mode .recording-link {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #60a5fa !important; /* Bright blue in dark mode */
}

body.dark-mode .recording-link:hover {
    background: rgba(59, 130, 246, 0.3) !important;
    color: #93c5fd !important;
}

body.dark-mode .recording-link i {
    color: inherit !important;
}

/* Loading Animation */
@keyframes spin { to { transform: rotate(360deg); } }
.loading { animation: spin 1s linear infinite; }

/* Pulse animation for live indicator */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* Subtle pulse for alerts */
@keyframes pulse-subtle {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}
.animate-pulse-subtle { animation: pulse-subtle 2s ease-in-out infinite; }

/* Responsive */
@media (max-width: 768px) {
    .metric-value { font-size: 18px; }
    .metric-value-lg { font-size: 24px; }
    .metric-value-hero { font-size: 28px !important; }
    .metric-label { font-size: 10px; }
    .chart-container { height: 200px; }
    
    .metric-card-hero {
        padding: 16px 20px;
    }
    
    .section-title {
        font-size: 14px;
    }
    
    /* Filter buttons on mobile */
    .filter-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    /* Tables scroll horizontally */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Goal cards */
    .goal-card {
        padding: 12px;
    }
    
    /* Leaderboard items */
    .leaderboard-item {
        padding: 10px;
        gap: 8px;
    }
    
    .leaderboard-item .rank {
        font-size: 1.2rem;
        min-width: 32px;
    }
    
    .leaderboard-item .cash,
    .leaderboard-item .sets {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .metric-value { font-size: 16px; }
    .metric-value-hero { font-size: 24px !important; }
    .metric-label { font-size: 9px; }
    
    .section-title {
        font-size: 13px;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    /* Stack filter buttons */
    .filter-group {
        width: 100%;
    }
    
    .filter-btn {
        width: 100%;
        justify-content: space-between;
    }
}

/* Hidden class */
.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a1a1a1; }

/* Shadow utility class for all boards */
.shadow-sm {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Appointment status badges */
.status-badge.scheduled { background: #dbeafe; color: #1d4ed8; }
.status-badge.confirmed { background: #dcfce7; color: #16a34a; }
.status-badge.cancelled { background: #fee2e2; color: #dc2626; }
.status-badge.no-show { background: #fef3c7; color: #d97706; }
.status-badge.closed-won { background: #dcfce7; color: #16a34a; font-weight: 600; }
.status-badge.closed-lost { background: #fee2e2; color: #dc2626; }
.status-badge.rescheduled { background: #f3e8ff; color: #7c3aed; }
.status-badge.pending { background: #e0e7ff; color: #4f46e5; }

/* KPI Cards */
.kpi-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

.kpi-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #6b7280;
}

.kpi-value {
    font-size: 20px;
    font-weight: 500;
    color: #1f2937;
}

.kpi-floor {
    font-size: 9px;
    color: #9ca3af;
    line-height: 1.3;
}

.kpi-status {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.kpi-status[data-status="above"] {
    background: #dcfce7;
    color: #16a34a;
}

.kpi-status[data-status="meeting"] {
    background: #fef3c7;
    color: #d97706;
}

.kpi-status[data-status="below"] {
    background: #fee2e2;
    color: #dc2626;
}

.kpi-status[data-status="pending"] {
    background: #f3f4f6;
    color: #9ca3af;
}

/* KPI Card Border Colors */
.kpi-card[data-status="above"] {
    border-left: 4px solid #16a34a;
    background: linear-gradient(90deg, rgba(22, 163, 74, 0.05) 0%, rgba(255, 255, 255, 0) 50%);
}

.kpi-card[data-status="meeting"] {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.05) 0%, rgba(255, 255, 255, 0) 50%);
}

.kpi-card[data-status="below"] {
    border-left: 4px solid #ef4444;
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.05) 0%, rgba(255, 255, 255, 0) 50%);
}

/* Diagnostics Items */
.diagnostics-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
}

.diagnostics-item i {
    margin-top: 2px;
}

.diagnostics-good {
    background: #dcfce7;
    color: #166534;
    border-left: 4px solid #16a34a;
}

.diagnostics-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.diagnostics-critical {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.diagnostics-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* Goals Progress Bars */
.goal-card {
    padding: 16px;
    background: #fafafa;
    border-radius: 8px;
}

.progress-bar-container {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: none; /* JavaScript handles animation */
    position: relative;
    overflow: hidden;
}

/* Shimmer effect for loading bars */
.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.progress-green { background: linear-gradient(90deg, #22c55e, #16a34a); }
.progress-blue { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.progress-purple { background: linear-gradient(90deg, #8b5cf6, #7c3aed); }

/* Smooth number animations - prevent layout shift */
.metric-value, .metric-value-hero {
    font-variant-numeric: tabular-nums;
    min-width: fit-content;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .progress-bar::after {
        animation: none;
    }
    .metric-value, .metric-value-hero {
        transition: none !important;
    }
}

/* Mobile optimization for animations */
@media (max-width: 768px) {
    .progress-bar::after {
        animation-duration: 3s; /* Slower on mobile for performance */
    }
}

/* Leaderboard Styles */
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.leaderboard-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.leaderboard-item.rank-1 {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fbbf24;
}

.leaderboard-item.rank-2 {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border: 1px solid #d1d5db;
}

.leaderboard-item.rank-3 {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    border: 1px solid #fb923c;
}

.rank-badge {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
}

.rank-badge.gold { background: #fbbf24; color: #78350f; }
.rank-badge.silver { background: #9ca3af; color: #1f2937; }
.rank-badge.bronze { background: #fb923c; color: #7c2d12; }
.rank-badge.default { background: #e5e7eb; color: #6b7280; }

.leaderboard-name {
    flex: 1;
    font-weight: 500;
    color: #1f2937;
}

.leaderboard-value {
    font-weight: 600;
    color: #16a34a;
}

.leaderboard-streak {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #f97316;
}

/* Achievement Badges */
.achievement-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border: 1px solid #c4b5fd;
    border-radius: 20px;
    font-size: 12px;
    color: #6d28d9;
    transition: transform 0.2s;
}

.achievement-badge:hover {
    transform: scale(1.05);
}

.achievement-badge i {
    font-size: 16px;
}

.achievement-badge.gold {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #fbbf24;
    color: #b45309;
}

.achievement-badge.fire {
    background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
    border-color: #fb923c;
    color: #c2410c;
}

.achievement-badge.star {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #34d399;
    color: #047857;
}

/* Comparison Indicators */
.comparison-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.comparison-indicator.up {
    background: #dcfce7;
    color: #16a34a;
}

.comparison-indicator.down {
    background: #fee2e2;
    color: #dc2626;
}

.comparison-indicator.neutral {
    background: #f3f4f6;
    color: #6b7280;
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #111827;
    color: #f9fafb;
}

/* All text defaults to white in dark mode */
body.dark-mode,
body.dark-mode p,
body.dark-mode span:not([class*="text-blue"]):not([class*="text-green"]):not([class*="text-red"]):not([class*="text-purple"]):not([class*="text-orange"]):not([class*="text-yellow"]):not([class*="text-pink"]):not([class*="text-teal"]):not([class*="text-indigo"]):not(.status-badge):not(.due-badge):not(.badge),
body.dark-mode div,
body.dark-mode td,
body.dark-mode th,
body.dark-mode li,
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6,
body.dark-mode label {
    color: #f9fafb !important;
}

body.dark-mode .metric-card,
body.dark-mode .chart-card,
body.dark-mode .bg-white,
body.dark-mode .goal-card,
body.dark-mode .leaderboard-item {
    background: #1f2937 !important;
    border-color: #374151 !important;
    color: #f9fafb;
}

body.dark-mode .metric-card.metric-blue { background: linear-gradient(135deg, rgba(37, 99, 235, 0.2) 0%, rgba(31, 41, 55, 0) 60%) !important; }
body.dark-mode .metric-card.metric-green { background: linear-gradient(135deg, rgba(22, 163, 74, 0.2) 0%, rgba(31, 41, 55, 0) 60%) !important; }
body.dark-mode .metric-card.metric-red { background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(31, 41, 55, 0) 60%) !important; }
body.dark-mode .metric-card.metric-purple { background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(31, 41, 55, 0) 60%) !important; }
body.dark-mode .metric-card.metric-orange { background: linear-gradient(135deg, rgba(249, 115, 22, 0.2) 0%, rgba(31, 41, 55, 0) 60%) !important; }

/* Labels - make them WHITE not gray */
body.dark-mode .metric-label,
body.dark-mode .kpi-label,
body.dark-mode .chart-title {
    color: #f9fafb !important;
}

body.dark-mode .metric-value,
body.dark-mode .kpi-value {
    color: #f9fafb !important;
}

body.dark-mode .section-title {
    color: #f9fafb !important;
}

/* Gray text classes - make them WHITE in dark mode */
body.dark-mode .text-gray-400,
body.dark-mode .text-gray-500,
body.dark-mode .text-gray-600,
body.dark-mode .text-gray-700,
body.dark-mode .text-gray-800,
body.dark-mode .text-gray-900,
body.dark-mode .text-gray-300 {
    color: #f9fafb !important;
}

/* Uppercase tracking labels */
body.dark-mode .uppercase,
body.dark-mode .tracking-wide {
    color: #f9fafb !important;
}

/* Font weight classes */
body.dark-mode .font-medium,
body.dark-mode .font-semibold,
body.dark-mode .font-bold {
    color: #f9fafb !important;
}

/* Text size classes that aren't colored */
body.dark-mode .text-xs:not([class*="text-blue"]):not([class*="text-green"]):not([class*="text-red"]):not([class*="text-purple"]):not([class*="text-orange"]):not([class*="text-yellow"]):not([class*="text-pink"]):not([class*="text-teal"]):not([class*="text-indigo"]),
body.dark-mode .text-sm:not([class*="text-blue"]):not([class*="text-green"]):not([class*="text-red"]):not([class*="text-purple"]):not([class*="text-orange"]):not([class*="text-yellow"]):not([class*="text-pink"]):not([class*="text-teal"]):not([class*="text-indigo"]) {
    color: #f9fafb !important;
}

/* ================================
   PRESERVE ALL COLORED TEXT IN DARK MODE
   ================================ */
body.dark-mode .text-blue-500,
body.dark-mode .text-blue-600,
body.dark-mode .text-blue-700 {
    color: #3b82f6 !important;
}

body.dark-mode .text-green-500,
body.dark-mode .text-green-600,
body.dark-mode .text-green-700 {
    color: #22c55e !important;
}

body.dark-mode .text-red-500,
body.dark-mode .text-red-600,
body.dark-mode .text-red-700 {
    color: #ef4444 !important;
}

body.dark-mode .text-purple-500,
body.dark-mode .text-purple-600,
body.dark-mode .text-purple-700 {
    color: #a855f7 !important;
}

body.dark-mode .text-orange-500,
body.dark-mode .text-orange-600,
body.dark-mode .text-orange-700 {
    color: #f97316 !important;
}

body.dark-mode .text-yellow-500,
body.dark-mode .text-yellow-600,
body.dark-mode .text-yellow-700 {
    color: #eab308 !important;
}

body.dark-mode .text-pink-500,
body.dark-mode .text-pink-600,
body.dark-mode .text-pink-700 {
    color: #ec4899 !important;
}

body.dark-mode .text-teal-500,
body.dark-mode .text-teal-600,
body.dark-mode .text-teal-700 {
    color: #14b8a6 !important;
}

body.dark-mode .text-indigo-500,
body.dark-mode .text-indigo-600,
body.dark-mode .text-indigo-700 {
    color: #6366f1 !important;
}

/* Hero metric values - preserve their colors */
body.dark-mode .metric-value-hero.text-blue-600 {
    color: #3b82f6 !important;
}

body.dark-mode .metric-value-hero.text-green-600 {
    color: #22c55e !important;
}

body.dark-mode .metric-value-lg.text-blue-600 {
    color: #3b82f6 !important;
}

body.dark-mode .metric-value-lg.text-green-600 {
    color: #22c55e !important;
}

/* Opacity text - still white */
body.dark-mode .opacity-75 {
    color: #f9fafb !important;
}

body.dark-mode table thead {
    background: #374151;
    color: #f9fafb;
}

body.dark-mode table thead th {
    color: #f9fafb;
}

body.dark-mode table tbody tr {
    border-color: #374151;
}

body.dark-mode table tbody td {
    color: #f9fafb;
}

body.dark-mode table tbody tr:hover {
    background: #374151;
}

body.dark-mode .filter-btn,
body.dark-mode .filter-dropdown,
body.dark-mode select,
body.dark-mode input[type="date"],
body.dark-mode input[type="text"] {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

body.dark-mode .filter-option {
    color: #f9fafb;
}

body.dark-mode .filter-option:hover {
    background: #4b5563;
}

body.dark-mode .kpi-card {
    background: #1f2937;
    border-color: #374151;
}

/* KPI cards with colored status - keep text in matching color */
body.dark-mode .kpi-card[data-status="above"] {
    background: linear-gradient(90deg, rgba(22, 163, 74, 0.15) 0%, rgba(31, 41, 55, 0) 50%);
}

body.dark-mode .kpi-card[data-status="above"] .kpi-label,
body.dark-mode .kpi-card[data-status="above"] .kpi-value,
body.dark-mode .kpi-card[data-status="above"] .kpi-floor {
    color: #22c55e !important;
}

body.dark-mode .kpi-card[data-status="meeting"] {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.15) 0%, rgba(31, 41, 55, 0) 50%);
}

body.dark-mode .kpi-card[data-status="meeting"] .kpi-label,
body.dark-mode .kpi-card[data-status="meeting"] .kpi-value,
body.dark-mode .kpi-card[data-status="meeting"] .kpi-floor {
    color: #f59e0b !important;
}

body.dark-mode .kpi-card[data-status="below"] {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.15) 0%, rgba(31, 41, 55, 0) 50%);
}

body.dark-mode .kpi-card[data-status="below"] .kpi-label,
body.dark-mode .kpi-card[data-status="below"] .kpi-value,
body.dark-mode .kpi-card[data-status="below"] .kpi-floor {
    color: #ef4444 !important;
}

/* Pending status - white text */
body.dark-mode .kpi-card[data-status="pending"] .kpi-label,
body.dark-mode .kpi-card[data-status="pending"] .kpi-value {
    color: #f9fafb !important;
}

body.dark-mode .kpi-floor {
    color: #9ca3af;
}

/* KPI status badges keep their colors */
body.dark-mode .kpi-status[data-status="above"] {
    background: #dcfce7 !important;
    color: #16a34a !important;
}

body.dark-mode .kpi-status[data-status="meeting"] {
    background: #fef3c7 !important;
    color: #d97706 !important;
}

body.dark-mode .kpi-status[data-status="below"] {
    background: #fee2e2 !important;
    color: #dc2626 !important;
}

body.dark-mode .kpi-status[data-status="pending"] {
    background: #374151 !important;
    color: #9ca3af !important;
}

body.dark-mode .progress-bar-container {
    background: #374151;
}

/* Diagnostics items - keep their colored styling in dark mode */
body.dark-mode .diagnostics-item.diagnostics-good {
    background: rgba(22, 163, 74, 0.15);
    border-left: 4px solid #22c55e;
}

body.dark-mode .diagnostics-item.diagnostics-good,
body.dark-mode .diagnostics-item.diagnostics-good span,
body.dark-mode .diagnostics-item.diagnostics-good i {
    color: #22c55e !important;
}

body.dark-mode .diagnostics-item.diagnostics-warning {
    background: rgba(245, 158, 11, 0.15);
    border-left: 4px solid #f59e0b;
}

body.dark-mode .diagnostics-item.diagnostics-warning,
body.dark-mode .diagnostics-item.diagnostics-warning span,
body.dark-mode .diagnostics-item.diagnostics-warning i {
    color: #f59e0b !important;
}

body.dark-mode .diagnostics-item.diagnostics-critical {
    background: rgba(239, 68, 68, 0.15);
    border-left: 4px solid #ef4444;
}

body.dark-mode .diagnostics-item.diagnostics-critical,
body.dark-mode .diagnostics-item.diagnostics-critical span,
body.dark-mode .diagnostics-item.diagnostics-critical i {
    color: #ef4444 !important;
}

body.dark-mode .diagnostics-item.diagnostics-info {
    background: rgba(59, 130, 246, 0.15);
    border-left: 4px solid #3b82f6;
}

body.dark-mode .diagnostics-item.diagnostics-info,
body.dark-mode .diagnostics-item.diagnostics-info span,
body.dark-mode .diagnostics-item.diagnostics-info i {
    color: #3b82f6 !important;
}

body.dark-mode footer {
    background: #1f2937;
    border-color: #374151;
    color: #f9fafb;
}

/* ================================
   Dark Mode - Colored Boxes Fix
   Keep text colors on colored backgrounds readable
   ================================ */

/* Yellow/Deposits boxes - keep dark text on yellow background */
body.dark-mode .bg-yellow-50 {
    background-color: rgba(254, 243, 199, 0.9) !important;
}

body.dark-mode .bg-yellow-50 .text-yellow-800,
body.dark-mode .bg-yellow-50 .text-yellow-700,
body.dark-mode .bg-yellow-50 .text-yellow-600,
body.dark-mode .bg-yellow-50 span,
body.dark-mode .bg-yellow-100 .text-yellow-700,
body.dark-mode .bg-yellow-100 span {
    color: #92400e !important; /* Keep dark brown/amber text visible */
}

/* Green boxes - keep readable */
body.dark-mode .bg-green-50 {
    background-color: rgba(220, 252, 231, 0.9) !important;
}

body.dark-mode .bg-green-50 span,
body.dark-mode .bg-green-100 span {
    color: #166534 !important;
}

/* Blue boxes - keep readable */
body.dark-mode .bg-blue-50 {
    background-color: rgba(219, 234, 254, 0.9) !important;
}

body.dark-mode .bg-blue-50 span,
body.dark-mode .bg-blue-100 span {
    color: #1e40af !important;
}

/* Red boxes - keep readable */
body.dark-mode .bg-red-50 {
    background-color: rgba(254, 226, 226, 0.9) !important;
}

body.dark-mode .bg-red-50 span,
body.dark-mode .bg-red-100 span {
    color: #b91c1c !important;
}

/* Purple/Indigo boxes - keep readable */
body.dark-mode .bg-purple-50,
body.dark-mode .bg-indigo-50 {
    background-color: rgba(237, 233, 254, 0.9) !important;
}

body.dark-mode .bg-purple-50 span,
body.dark-mode .bg-indigo-50 span {
    color: #6b21a8 !important;
}

/* Orange boxes - keep readable */
body.dark-mode .bg-orange-50 {
    background-color: rgba(255, 237, 213, 0.9) !important;
}

body.dark-mode .bg-orange-50 span,
body.dark-mode .bg-orange-100 span {
    color: #9a3412 !important;
}

/* Gray info badges should stay light background in dark mode */
body.dark-mode .bg-gray-100 span {
    color: #374151 !important;
}

/* Commission and objection items */
body.dark-mode .commission-item,
body.dark-mode .objection-item {
    color: #f9fafb;
}

body.dark-mode .commission-item .name,
body.dark-mode .objection-item .name {
    color: #f9fafb;
}

/* Active filter tags */
body.dark-mode .active-filter-tag {
    background: #374151;
    color: #f9fafb;
}

/* Placeholder text */
body.dark-mode ::placeholder {
    color: #9ca3af;
}

/* Border colors */
body.dark-mode .border,
body.dark-mode .border-b,
body.dark-mode .border-t {
    border-color: #374151 !important;
}

/* Subtle white shadow on all cards/sections in dark mode */
body.dark-mode .metric-card,
body.dark-mode .chart-card,
body.dark-mode .kpi-card,
body.dark-mode .goal-card,
body.dark-mode .leaderboard-item,
body.dark-mode .bg-white,
body.dark-mode .rounded-lg.border,
body.dark-mode section > .bg-white,
body.dark-mode .diagnostics-item {
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.08), 0 1px 3px rgba(255, 255, 255, 0.05) !important;
}

/* Background adjustments */
body.dark-mode .bg-gray-50,
body.dark-mode .bg-gray-100 {
    background-color: #1f2937 !important;
}

/* ================================
   MASTER OVERRIDE - All non-colored text WHITE
   ================================ */
body.dark-mode * {
    color: #f9fafb;
}

/* Now re-apply colored text */
body.dark-mode .text-blue-500, body.dark-mode .text-blue-600, body.dark-mode .text-blue-700,
body.dark-mode [class*="text-blue-5"], body.dark-mode [class*="text-blue-6"], body.dark-mode [class*="text-blue-7"] {
    color: #3b82f6 !important;
}

body.dark-mode .text-green-500, body.dark-mode .text-green-600, body.dark-mode .text-green-700,
body.dark-mode [class*="text-green-5"], body.dark-mode [class*="text-green-6"], body.dark-mode [class*="text-green-7"] {
    color: #22c55e !important;
}

body.dark-mode .text-red-500, body.dark-mode .text-red-600, body.dark-mode .text-red-700,
body.dark-mode [class*="text-red-5"], body.dark-mode [class*="text-red-6"], body.dark-mode [class*="text-red-7"] {
    color: #ef4444 !important;
}

body.dark-mode .text-purple-500, body.dark-mode .text-purple-600, body.dark-mode .text-purple-700,
body.dark-mode [class*="text-purple-5"], body.dark-mode [class*="text-purple-6"], body.dark-mode [class*="text-purple-7"] {
    color: #a855f7 !important;
}

body.dark-mode .text-orange-500, body.dark-mode .text-orange-600, body.dark-mode .text-orange-700,
body.dark-mode [class*="text-orange-5"], body.dark-mode [class*="text-orange-6"], body.dark-mode [class*="text-orange-7"] {
    color: #f97316 !important;
}

body.dark-mode .text-yellow-500, body.dark-mode .text-yellow-600, body.dark-mode .text-yellow-700,
body.dark-mode [class*="text-yellow-5"], body.dark-mode [class*="text-yellow-6"], body.dark-mode [class*="text-yellow-7"] {
    color: #eab308 !important;
}

body.dark-mode .text-pink-500, body.dark-mode .text-pink-600, body.dark-mode .text-pink-700,
body.dark-mode [class*="text-pink-5"], body.dark-mode [class*="text-pink-6"], body.dark-mode [class*="text-pink-7"] {
    color: #ec4899 !important;
}

body.dark-mode .text-teal-500, body.dark-mode .text-teal-600, body.dark-mode .text-teal-700,
body.dark-mode [class*="text-teal-5"], body.dark-mode [class*="text-teal-6"], body.dark-mode [class*="text-teal-7"] {
    color: #14b8a6 !important;
}

body.dark-mode .text-indigo-500, body.dark-mode .text-indigo-600, body.dark-mode .text-indigo-700,
body.dark-mode [class*="text-indigo-5"], body.dark-mode [class*="text-indigo-6"], body.dark-mode [class*="text-indigo-7"] {
    color: #6366f1 !important;
}

/* ================================
   Dark Mode - Preserve colored bubble/badge text
   ================================ */
/* Status badges keep their original colors */
body.dark-mode .status-badge,
body.dark-mode .status-badge span {
    color: inherit !important;
}

body.dark-mode .status-badge.closed-won { background: #dcfce7; color: #16a34a !important; }
body.dark-mode .status-badge.closed-lost { background: #fee2e2; color: #dc2626 !important; }
body.dark-mode .status-badge.no-show { background: #fef3c7; color: #d97706 !important; }
body.dark-mode .status-badge.disqualified { background: #fce7f3; color: #be185d !important; }
body.dark-mode .status-badge.rescheduled { background: #f3e8ff; color: #7c3aed !important; }
body.dark-mode .status-badge.pending { background: #e0e7ff; color: #4f46e5 !important; }
body.dark-mode .status-badge.scheduled { background: #dbeafe; color: #1d4ed8 !important; }
body.dark-mode .status-badge.confirmed { background: #dcfce7; color: #16a34a !important; }

/* Due date badges keep their colors */
body.dark-mode .due-badge,
body.dark-mode .due-badge span {
    color: inherit !important;
}

body.dark-mode .due-badge.green { background: #dcfce7; color: #16a34a !important; }
body.dark-mode .due-badge.orange { background: #fef3c7; color: #d97706 !important; }
body.dark-mode .due-badge.red { background: #fee2e2; color: #dc2626 !important; }

/* KPI status badges keep their colors */
body.dark-mode .kpi-status,
body.dark-mode .kpi-status span {
    color: inherit !important;
}

/* Gamification badges keep their colors */
body.dark-mode .badge.badge-gold { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e !important; }
body.dark-mode .badge.badge-diamond { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #4338ca !important; }
body.dark-mode .badge.badge-fire { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #dc2626 !important; }
body.dark-mode .badge.badge-silver { background: linear-gradient(135deg, #f3f4f6, #e5e7eb); color: #374151 !important; }

/* Colored background pills/badges - preserve background AND text color */
/* Blue badges (Profile Funnel, etc.) */
body.dark-mode .bg-blue-100 {
    background-color: #dbeafe !important;
}
body.dark-mode .bg-blue-100.text-blue-700,
body.dark-mode .bg-blue-100 .text-blue-700,
body.dark-mode [class*="bg-blue-1"][class*="text-blue"] {
    color: #1d4ed8 !important;
}

/* Purple badges (VSL Funnel, Monthly Goals, etc.) */
body.dark-mode .bg-purple-100 {
    background-color: #f3e8ff !important;
}
body.dark-mode .bg-purple-100.text-purple-700,
body.dark-mode .bg-purple-100 .text-purple-700,
body.dark-mode [class*="bg-purple-1"][class*="text-purple"] {
    color: #7c3aed !important;
}

/* Green badges */
body.dark-mode .bg-green-100 {
    background-color: #dcfce7 !important;
}
body.dark-mode .bg-green-100.text-green-700,
body.dark-mode .bg-green-100 .text-green-700,
body.dark-mode [class*="bg-green-1"][class*="text-green"] {
    color: #16a34a !important;
}

/* Red badges */
body.dark-mode .bg-red-100 {
    background-color: #fee2e2 !important;
}
body.dark-mode .bg-red-100.text-red-700,
body.dark-mode .bg-red-100 .text-red-700,
body.dark-mode [class*="bg-red-1"][class*="text-red"] {
    color: #dc2626 !important;
}

/* Orange badges */
body.dark-mode .bg-orange-100 {
    background-color: #ffedd5 !important;
}
body.dark-mode .bg-orange-100.text-orange-700,
body.dark-mode .bg-orange-100 .text-orange-700,
body.dark-mode [class*="bg-orange-1"][class*="text-orange"] {
    color: #c2410c !important;
}

/* Yellow badges */
body.dark-mode .bg-yellow-100 {
    background-color: #fef3c7 !important;
}
body.dark-mode .bg-yellow-100.text-yellow-700,
body.dark-mode .bg-yellow-100 .text-yellow-700,
body.dark-mode [class*="bg-yellow-1"][class*="text-yellow"] {
    color: #a16207 !important;
}

/* Pink badges */
body.dark-mode .bg-pink-100 {
    background-color: #fce7f3 !important;
}
body.dark-mode .bg-pink-100.text-pink-700,
body.dark-mode .bg-pink-100 .text-pink-700,
body.dark-mode [class*="bg-pink-1"][class*="text-pink"] {
    color: #be185d !important;
}

/* Month label badge */
body.dark-mode .bg-purple-100 {
    background: #f3e8ff !important;
    color: #7c3aed !important;
}

body.dark-mode .bg-purple-100 span {
    color: #7c3aed !important;
}

/* Rounded pill badges */
body.dark-mode .rounded-full[class*="bg-"] {
    color: inherit !important;
}

/* ================================
   Dark Mode - Badge/KPI Text Colors
   Text on colored KPI badges should match the box color
   ================================ */

/* Synced with Dashboard badge (green) - keep green text */
body.dark-mode .bg-green-100 {
    background-color: #dcfce7 !important;
}
body.dark-mode .bg-green-100 span,
body.dark-mode .bg-green-100.text-green-600,
body.dark-mode .bg-green-100 .text-green-600,
body.dark-mode .text-green-600 {
    color: #16a34a !important;
}

/* Reset button arrows - make red */
body.dark-mode .reset-btn i,
body.dark-mode button[onclick*="reset"] i.fa-undo,
.reset-btn i.fa-undo,
button[onclick*="reset"] i.fa-undo {
    color: #ef4444 !important;
}

/* Metric card colored text - preserve colors */
body.dark-mode .metric-card.metric-yellow .metric-value,
body.dark-mode .metric-card.metric-yellow span {
    color: #ca8a04 !important; /* yellow-600 */
}

body.dark-mode .metric-card.metric-green .metric-value.text-green-600,
body.dark-mode .metric-green .text-green-600 {
    color: #16a34a !important;
}

body.dark-mode .metric-card.metric-blue .metric-value.text-blue-600,
body.dark-mode .metric-blue .text-blue-600 {
    color: #2563eb !important;
}

body.dark-mode .metric-card.metric-purple .metric-value.text-purple-600,
body.dark-mode .metric-purple .text-purple-600 {
    color: #9333ea !important;
}

body.dark-mode .metric-card.metric-red .metric-value.text-red-600,
body.dark-mode .metric-red .text-red-600 {
    color: #dc2626 !important;
}

body.dark-mode .metric-card.metric-orange .metric-value.text-orange-600,
body.dark-mode .metric-orange .text-orange-600 {
    color: #ea580c !important;
}

body.dark-mode .metric-card.metric-teal .metric-value.text-teal-600,
body.dark-mode .metric-teal .text-teal-600 {
    color: #0d9488 !important;
}

/* Settings modal - team member names white */
body.dark-mode #settingsModal input[type="text"],
body.dark-mode #settingsModal .team-member-name,
body.dark-mode #settingsModal span.font-medium {
    color: #f9fafb !important;
}

/* Call recording button - blue in dark mode */
body.dark-mode .recording-link,
body.dark-mode a[href*="recording"],
body.dark-mode button.recording-btn {
    color: #3b82f6 !important;
    background-color: rgba(59, 130, 246, 0.1) !important;
}

body.dark-mode .recording-link:hover,
body.dark-mode a[href*="recording"]:hover {
    background-color: rgba(59, 130, 246, 0.2) !important;
}

/* Deposits metric card - better contrast */
body.dark-mode .metric-card.metric-yellow {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.25) 0%, rgba(31, 41, 55, 0) 60%) !important;
}

body.dark-mode .metric-card.metric-yellow .metric-label {
    color: #fde047 !important; /* yellow-300 for better visibility */
}

body.dark-mode .metric-card.metric-yellow .metric-value {
    color: #facc15 !important; /* yellow-400 */
}

/* ================================
   Leaderboard & Gamification
   ================================ */
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.leaderboard-item:hover {
    background: #f3f4f6;
    transform: translateX(4px);
}

.leaderboard-item.top-performer {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(255, 255, 255, 0) 60%);
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.leaderboard-item .rank {
    font-size: 1.5rem;
    min-width: 40px;
    text-align: center;
}

.leaderboard-item .info {
    flex: 1;
}

.leaderboard-item .name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}

.leaderboard-item .badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.leaderboard-item .stats {
    text-align: right;
}

.leaderboard-item .cash,
.leaderboard-item .sets {
    display: block;
    font-weight: 600;
    color: #16a34a;
    font-size: 1rem;
}

.leaderboard-item .deals,
.leaderboard-item .dials {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 500;
    border-radius: 9999px;
    background: #f3f4f6;
    color: #4b5563;
}

.badge-gold {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.badge-diamond {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: #4338ca;
}

.badge-fire {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #dc2626;
}

.badge-silver {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    color: #374151;
}

/* Achievement Cards */
.achievement-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.achievement-card.unlocked {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.1) 0%, rgba(255, 255, 255, 0) 60%);
    border-color: rgba(22, 163, 74, 0.3);
}

.achievement-card .icon {
    font-size: 1.25rem;
}

.achievement-card .label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #4b5563;
}

/* Comparison Indicators */
.comparison-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.comparison-indicator.text-green-600 {
    background: rgba(22, 163, 74, 0.1);
}

.comparison-indicator.text-red-500 {
    background: rgba(239, 68, 68, 0.1);
}

.comparison-indicator.text-gray-400 {
    background: rgba(156, 163, 175, 0.1);
}

/* Dark Mode Leaderboard */
body.dark-mode .leaderboard-item {
    background: #374151;
    color: #f9fafb;
}

body.dark-mode .leaderboard-item:hover {
    background: #4b5563;
}

body.dark-mode .leaderboard-item.top-performer {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.2) 0%, rgba(55, 65, 81, 0) 60%);
}

body.dark-mode .leaderboard-item .name {
    color: #f9fafb;
}

body.dark-mode .leaderboard-item .deals,
body.dark-mode .leaderboard-item .dials {
    color: #d1d5db;
}

body.dark-mode .badge {
    background: #4b5563;
    color: #f9fafb;
}

body.dark-mode .achievement-card {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

body.dark-mode .achievement-card .label {
    color: #f9fafb;
}

/* Dark mode for status badges - keep their colors */
body.dark-mode .status-badge {
    color: inherit;
}

/* Dark mode text that should stay white */
body.dark-mode .font-medium,
body.dark-mode .font-semibold {
    color: #f9fafb;
}

/* Ensure colored text keeps its color in dark mode */
body.dark-mode .text-blue-600,
body.dark-mode .text-green-600,
body.dark-mode .text-red-500,
body.dark-mode .text-red-600,
body.dark-mode .text-purple-600,
body.dark-mode .text-orange-500,
body.dark-mode .text-orange-600 {
    /* These keep their original colors */
}

/* Small/muted text in dark mode */
body.dark-mode .text-xs,
body.dark-mode .text-sm {
    color: #e5e7eb;
}

/* Ensure all spans and divs inside cards are white */
body.dark-mode .metric-card span,
body.dark-mode .metric-card div,
body.dark-mode .chart-card span,
body.dark-mode .chart-card div,
body.dark-mode .kpi-card span,
body.dark-mode .kpi-card div {
    color: #f9fafb;
}

/* Re-apply label colors (slightly muted) */
body.dark-mode .metric-card .metric-label,
body.dark-mode .kpi-card .kpi-label {
    color: #d1d5db;
}

/* ================================
   DARK MODE - COMPREHENSIVE FIXES
   ================================ */

/* 1. Reset button - RED and BOLD including icon */
body.dark-mode .reset-btn,
body.dark-mode button[onclick*="reset"],
body.dark-mode .filter-btn.reset-btn {
    color: #ef4444 !important;
    font-weight: 700 !important;
    border-color: #ef4444 !important;
}

body.dark-mode .reset-btn i,
body.dark-mode .reset-btn .fa-undo,
body.dark-mode button[onclick*="reset"] i {
    color: #ef4444 !important;
}

/* 2. Commission section - make names visible */
body.dark-mode .commission-item,
body.dark-mode .commission-item *,
body.dark-mode #setterCommissionsList *,
body.dark-mode #closerCommissionsList * {
    color: #f9fafb !important;
}

body.dark-mode .commission-item .name {
    color: #f9fafb !important;
    font-weight: 600 !important;
}

body.dark-mode .commission-item .amount {
    color: #22c55e !important;
    font-weight: 700 !important;
}

/* 3. Objection breakdown - make visible */
body.dark-mode .objection-item,
body.dark-mode .objection-item *,
body.dark-mode #setterObjectionsList *,
body.dark-mode #closerObjectionsList * {
    color: #f9fafb !important;
}

body.dark-mode .objection-item .name {
    color: #f9fafb !important;
    font-weight: 500 !important;
}

body.dark-mode .objection-item .count {
    color: #ef4444 !important;
    font-weight: 700 !important;
}

/* 4. DM Funnel header - PURPLE and BOLD */
body.dark-mode .section-title:has(i.text-purple-500),
body.dark-mode h2.section-title:has(.fa-comments) {
    color: #a855f7 !important;
    font-weight: 700 !important;
}

/* 5. Profile Funnel & VSL Funnel badges - remove bubble, make colored bold text */
body.dark-mode .bg-blue-100.text-blue-700,
body.dark-mode span.bg-blue-100 {
    background: transparent !important;
    color: #3b82f6 !important;
    font-weight: 700 !important;
}

body.dark-mode .bg-purple-100.text-purple-700,
body.dark-mode span.bg-purple-100 {
    background: transparent !important;
    color: #a855f7 !important;
    font-weight: 700 !important;
}

/* 6. Monthly Goals date badge - PURPLE and BOLD */
body.dark-mode #currentMonthLabel {
    background: transparent !important;
    color: #a855f7 !important;
    font-weight: 700 !important;
}

/* 7. Section titles with icons - colored and bold */
body.dark-mode .section-title i.text-purple-500 + span,
body.dark-mode .section-title i.text-blue-500 + span {
    font-weight: 700 !important;
}

/* 8. Chart titles visible */
body.dark-mode .chart-title,
body.dark-mode h4.text-sm.font-medium {
    color: #f9fafb !important;
    font-weight: 600 !important;
}

/* 9. All h3, h4 headers white and visible */
body.dark-mode h3,
body.dark-mode h4 {
    color: #f9fafb !important;
}

/* 10. Table header text */
body.dark-mode thead th,
body.dark-mode .bg-gray-50 {
    color: #f9fafb !important;
}

/* 11. Metric cards with colored classes - text matches color */
body.dark-mode .metric-card.metric-blue .metric-label,
body.dark-mode .metric-card.metric-blue .metric-value {
    color: #3b82f6 !important;
    font-weight: 600 !important;
}

body.dark-mode .metric-card.metric-green .metric-label,
body.dark-mode .metric-card.metric-green .metric-value {
    color: #22c55e !important;
    font-weight: 600 !important;
}

body.dark-mode .metric-card.metric-red .metric-label,
body.dark-mode .metric-card.metric-red .metric-value {
    color: #ef4444 !important;
    font-weight: 600 !important;
}

body.dark-mode .metric-card.metric-purple .metric-label,
body.dark-mode .metric-card.metric-purple .metric-value {
    color: #a855f7 !important;
    font-weight: 600 !important;
}

body.dark-mode .metric-card.metric-orange .metric-label,
body.dark-mode .metric-card.metric-orange .metric-value {
    color: #f97316 !important;
    font-weight: 600 !important;
}

/* 12. KPI cards - text color matches status - ABOVE = GREEN */
body.dark-mode .kpi-card[data-status="above"],
body.dark-mode .kpi-card[data-status="above"] * {
    color: #22c55e !important;
}

body.dark-mode .kpi-card[data-status="above"] .kpi-label,
body.dark-mode .kpi-card[data-status="above"] .kpi-value,
body.dark-mode .kpi-card[data-status="above"] .kpi-floor,
body.dark-mode .kpi-card[data-status="above"] span {
    color: #22c55e !important;
    font-weight: 700 !important;
}

body.dark-mode .kpi-card[data-status="above"] {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.2) 0%, rgba(31, 41, 55, 0) 50%) !important;
    border-left: 4px solid #22c55e !important;
}

/* KPI cards - MEETING = ORANGE */
body.dark-mode .kpi-card[data-status="meeting"],
body.dark-mode .kpi-card[data-status="meeting"] * {
    color: #f59e0b !important;
}

body.dark-mode .kpi-card[data-status="meeting"] .kpi-label,
body.dark-mode .kpi-card[data-status="meeting"] .kpi-value,
body.dark-mode .kpi-card[data-status="meeting"] .kpi-floor,
body.dark-mode .kpi-card[data-status="meeting"] span {
    color: #f59e0b !important;
    font-weight: 700 !important;
}

body.dark-mode .kpi-card[data-status="meeting"] {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.2) 0%, rgba(31, 41, 55, 0) 50%) !important;
    border-left: 4px solid #f59e0b !important;
}

/* KPI cards - BELOW = RED */
body.dark-mode .kpi-card[data-status="below"],
body.dark-mode .kpi-card[data-status="below"] * {
    color: #ef4444 !important;
}

body.dark-mode .kpi-card[data-status="below"] .kpi-label,
body.dark-mode .kpi-card[data-status="below"] .kpi-value,
body.dark-mode .kpi-card[data-status="below"] .kpi-floor,
body.dark-mode .kpi-card[data-status="below"] span {
    color: #ef4444 !important;
    font-weight: 700 !important;
}

body.dark-mode .kpi-card[data-status="below"] {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.2) 0%, rgba(31, 41, 55, 0) 50%) !important;
    border-left: 4px solid #ef4444 !important;
}

/* KPI cards - PENDING = white text */
body.dark-mode .kpi-card[data-status="pending"] .kpi-label,
body.dark-mode .kpi-card[data-status="pending"] .kpi-value {
    color: #f9fafb !important;
    font-weight: 600 !important;
}

body.dark-mode .kpi-card[data-status="pending"] .kpi-floor {
    color: #9ca3af !important;
}

/* KPI Status badges */
body.dark-mode .kpi-status[data-status="above"] {
    background: #dcfce7 !important;
    color: #16a34a !important;
    font-weight: 700 !important;
}

body.dark-mode .kpi-status[data-status="meeting"] {
    background: #fef3c7 !important;
    color: #d97706 !important;
    font-weight: 700 !important;
}

body.dark-mode .kpi-status[data-status="below"] {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    font-weight: 700 !important;
}

body.dark-mode .kpi-status[data-status="pending"] {
    background: #374151 !important;
    color: #9ca3af !important;
}

/* 13. Performance Analysis badge - remove bubble in dark mode */
body.dark-mode .bg-gray-100.text-gray-700,
body.dark-mode span.bg-gray-100 {
    background: transparent !important;
    color: #9ca3af !important;
    font-weight: 600 !important;
}

/* 14. Diagnostics - colored text */
body.dark-mode .diagnostics-good,
body.dark-mode .diagnostics-good *,
body.dark-mode .diagnostics-item.diagnostics-good,
body.dark-mode .diagnostics-item.diagnostics-good * {
    color: #22c55e !important;
    font-weight: 700 !important;
    background: rgba(34, 197, 94, 0.15) !important;
}

body.dark-mode .diagnostics-warning,
body.dark-mode .diagnostics-warning *,
body.dark-mode .diagnostics-item.diagnostics-warning,
body.dark-mode .diagnostics-item.diagnostics-warning * {
    color: #f59e0b !important;
    font-weight: 700 !important;
    background: rgba(245, 158, 11, 0.15) !important;
}

body.dark-mode .diagnostics-critical,
body.dark-mode .diagnostics-critical *,
body.dark-mode .diagnostics-item.diagnostics-critical,
body.dark-mode .diagnostics-item.diagnostics-critical * {
    color: #ef4444 !important;
    font-weight: 700 !important;
    background: rgba(239, 68, 68, 0.15) !important;
}

body.dark-mode .diagnostics-info,
body.dark-mode .diagnostics-info *,
body.dark-mode .diagnostics-item.diagnostics-info,
body.dark-mode .diagnostics-item.diagnostics-info * {
    color: #3b82f6 !important;
    font-weight: 700 !important;
    background: rgba(59, 130, 246, 0.15) !important;
}

/* 14. Filter labels and options */
body.dark-mode .filter-option label,
body.dark-mode .filter-dropdown label {
    color: #f9fafb !important;
}

/* 15. Goals section text */
body.dark-mode .goal-card * {
    color: #f9fafb !important;
}

body.dark-mode .goal-card .text-green-600,
body.dark-mode #goalCashCollected {
    color: #22c55e !important;
    font-weight: 700 !important;
}

body.dark-mode .goal-card .text-blue-600,
body.dark-mode #goalCallsBooked {
    color: #3b82f6 !important;
    font-weight: 700 !important;
}

body.dark-mode .goal-card .text-purple-600,
body.dark-mode #goalDealsClosed,
body.dark-mode #dailyPaceNeeded {
    color: #a855f7 !important;
    font-weight: 700 !important;
}

/* ================================
   MODAL STYLES
   ================================ */

/* Modal Overlay - Full screen dark background - ALL MODALS */
#callModal,
#sdrModal,
#paymentModal,
#marketingModal,
#settingsModal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
    z-index: 99999 !important;
    display: none;
    justify-content: center !important;
    align-items: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    overflow-y: auto !important; /* Allow scrolling the modal overlay if content is too tall */
    -webkit-overflow-scrolling: touch;
}

/* Modal Content Box - The white popup - ALL MODALS */
#callModal > .modal-content,
#sdrModal > .modal-content,
#paymentModal > .modal-content,
#marketingModal > .modal-content,
#settingsModal > .modal-content {
    background: white !important;
    border-radius: 16px !important;
    width: 100% !important;
    max-width: 700px !important;
    max-height: calc(100vh - 40px) !important; /* Leave 20px padding on each side */
    overflow: visible !important; /* Allow overflow for the flex container */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
    position: relative !important;
    margin: auto !important;
    animation: modalSlideIn 0.3s ease-out;
    display: flex !important;
    flex-direction: column !important;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header - Fixed at top - ALL MODALS */
#callModal .modal-header,
#sdrModal .modal-header,
#paymentModal .modal-header,
#marketingModal .modal-header,
#settingsModal .modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 20px 24px !important;
    border-bottom: 1px solid #e5e7eb !important;
    background: white !important;
    z-index: 10 !important;
    border-radius: 16px 16px 0 0 !important;
    flex-shrink: 0 !important; /* Don't shrink header */
}

/* Modal Body - Scrollable content area - ALL MODALS */
#callModal .modal-body,
#sdrModal .modal-body,
#paymentModal .modal-body,
#marketingModal .modal-body,
#settingsModal .modal-body {
    padding: 24px !important;
    background: white !important;
    overflow-y: auto !important; /* Only the body scrolls */
    flex: 1 1 auto !important; /* Take remaining space */
    -webkit-overflow-scrolling: touch !important; /* Smooth scrolling on iOS */
    overscroll-behavior: contain !important; /* Prevent scroll chaining */
    max-height: calc(100vh - 180px) !important; /* Ensure scrolling works on desktop */
}

/* Modal Footer - Fixed at bottom - ALL MODALS */
#callModal .modal-footer,
#sdrModal .modal-footer,
#paymentModal .modal-footer,
#marketingModal .modal-footer,
#settingsModal .modal-footer {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    padding: 16px 24px !important;
    border-top: 1px solid #e5e7eb !important;
    background: #f9fafb !important;
    border-radius: 0 0 16px 16px !important;
    flex-shrink: 0 !important; /* Don't shrink footer */
}

/* Mobile Modal Styles - ALL MODALS */
@media (max-width: 640px) {
    #callModal,
    #sdrModal,
    #paymentModal,
    #marketingModal,
    #settingsModal {
        padding: 8px !important;
        align-items: flex-start !important;
        overflow-y: auto !important;
    }
    
    #callModal > .modal-content,
    #sdrModal > .modal-content,
    #paymentModal > .modal-content,
    #marketingModal > .modal-content,
    #settingsModal > .modal-content {
        max-width: 100% !important;
        max-height: none !important;
        height: auto !important;
        border-radius: 12px !important;
        margin: 0 auto !important;
    }
    
    #callModal .modal-header,
    #sdrModal .modal-header,
    #paymentModal .modal-header,
    #marketingModal .modal-header,
    #settingsModal .modal-header {
        padding: 16px !important;
        border-radius: 12px 12px 0 0 !important;
    }
    
    #callModal .modal-body,
    #sdrModal .modal-body,
    #paymentModal .modal-body,
    #marketingModal .modal-body,
    #settingsModal .modal-body {
        padding: 16px !important;
        max-height: none !important;
        overflow-y: visible !important;
    }
    
    #callModal .modal-footer,
    #sdrModal .modal-footer,
    #paymentModal .modal-footer,
    #marketingModal .modal-footer,
    #settingsModal .modal-footer {
        padding: 12px 16px !important;
        flex-direction: column !important;
        border-radius: 0 0 12px 12px !important;
    }
    
    #callModal .modal-footer button,
    #sdrModal .modal-footer button,
    #paymentModal .modal-footer button,
    #marketingModal .modal-footer button,
    #settingsModal .modal-footer button {
        width: 100% !important;
    }
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
}

/* ================================
   Dark Mode Modal Styles
   ================================ */
body.dark-mode #callModal > .modal-content,
body.dark-mode #sdrModal > .modal-content,
body.dark-mode #paymentModal > .modal-content,
body.dark-mode #marketingModal > .modal-content,
body.dark-mode #settingsModal > .modal-content {
    background: #1f2937 !important;
    border: 1px solid #374151 !important;
}

body.dark-mode #callModal .modal-header,
body.dark-mode #sdrModal .modal-header,
body.dark-mode #paymentModal .modal-header,
body.dark-mode #marketingModal .modal-header,
body.dark-mode #settingsModal .modal-header {
    background: #1f2937 !important;
    border-bottom-color: #374151 !important;
}

body.dark-mode #callModal .modal-header h3,
body.dark-mode #sdrModal .modal-header h3,
body.dark-mode #paymentModal .modal-header h3,
body.dark-mode #marketingModal .modal-header h3,
body.dark-mode #settingsModal .modal-header h3 {
    color: white !important;
}

body.dark-mode #callModal .modal-body,
body.dark-mode #sdrModal .modal-body,
body.dark-mode #paymentModal .modal-body,
body.dark-mode #marketingModal .modal-body,
body.dark-mode #settingsModal .modal-body {
    background: #1f2937 !important;
    color: #e5e7eb !important;
}

body.dark-mode #callModal .modal-footer,
body.dark-mode #sdrModal .modal-footer,
body.dark-mode #paymentModal .modal-footer,
body.dark-mode #marketingModal .modal-footer,
body.dark-mode #settingsModal .modal-footer {
    background: #111827 !important;
    border-top-color: #374151 !important;
}

/* Dark mode form inputs */
body.dark-mode .form-input {
    background: #374151 !important;
    border-color: #4b5563 !important;
    color: #f3f4f6 !important;
}

body.dark-mode .form-input:focus {
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2) !important;
}

body.dark-mode .form-input::placeholder {
    color: #9ca3af !important;
}

body.dark-mode .form-label {
    color: #d1d5db !important;
}

body.dark-mode .form-input[readonly] {
    background: #1f2937 !important;
    color: #9ca3af !important;
}

/* Dark mode btn-secondary */
body.dark-mode .btn-secondary {
    background: #374151 !important;
    color: #f3f4f6 !important;
    border-color: #4b5563 !important;
}

body.dark-mode .btn-secondary:hover {
    background: #4b5563 !important;
}

/* Dark mode modal colored sections */
body.dark-mode .bg-blue-50,
body.dark-mode .bg-green-50,
body.dark-mode .bg-purple-50,
body.dark-mode .bg-pink-50,
body.dark-mode .bg-orange-50,
body.dark-mode .bg-indigo-50 {
    background: rgba(55, 65, 81, 0.5) !important;
}

body.dark-mode .bg-blue-50 h4,
body.dark-mode .bg-green-50 h4,
body.dark-mode .bg-purple-50 h4,
body.dark-mode .bg-pink-50 h4,
body.dark-mode .bg-orange-50 h4,
body.dark-mode .bg-indigo-50 h4 {
    color: #f3f4f6 !important;
}

body.dark-mode .bg-red-50 {
    background: rgba(239, 68, 68, 0.15) !important;
}

/* All modals base styles - FIXED for scrolling */
#callModal,
#sdrModal,
#paymentModal,
#marketingModal,
#settingsModal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
    z-index: 99999 !important;
    display: none;
    justify-content: center !important;
    align-items: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

#callModal > .modal-content,
#sdrModal > .modal-content,
#paymentModal > .modal-content,
#marketingModal > .modal-content,
#settingsModal > .modal-content {
    background: white !important;
    border-radius: 16px !important;
    width: 100% !important;
    max-width: 700px !important;
    max-height: calc(100vh - 40px) !important;
    overflow: hidden !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
    position: relative !important;
    margin: 0 auto !important;
    animation: modalSlideIn 0.3s ease-out;
    display: flex !important;
    flex-direction: column !important;
}

#callModal .modal-header,
#sdrModal .modal-header,
#paymentModal .modal-header,
#marketingModal .modal-header,
#settingsModal .modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 16px 20px !important;
    border-bottom: 1px solid #e5e7eb !important;
    background: white !important;
    z-index: 10 !important;
    border-radius: 16px 16px 0 0 !important;
    flex-shrink: 0 !important;
    min-height: 56px !important;
}

#callModal .modal-body,
#sdrModal .modal-body,
#paymentModal .modal-body,
#marketingModal .modal-body,
#settingsModal .modal-body {
    padding: 20px !important;
    background: white !important;
    overflow-y: auto !important;
    flex: 1 1 auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    min-height: 0 !important;
}

#callModal .modal-footer,
#sdrModal .modal-footer,
#paymentModal .modal-footer,
#marketingModal .modal-footer,
#settingsModal .modal-footer {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    padding: 16px 20px !important;
    border-top: 1px solid #e5e7eb !important;
    background: #f9fafb !important;
    border-radius: 0 0 16px 16px !important;
    flex-shrink: 0 !important;
    min-height: 64px !important;
}

/* Dark mode modal styles - COMPREHENSIVE */
body.dark-mode #callModal > .modal-content,
body.dark-mode #sdrModal > .modal-content,
body.dark-mode #paymentModal > .modal-content,
body.dark-mode #marketingModal > .modal-content,
body.dark-mode #settingsModal > .modal-content {
    background: #1f2937 !important;
    border: 1px solid #374151 !important;
}

body.dark-mode #callModal .modal-header,
body.dark-mode #sdrModal .modal-header,
body.dark-mode #paymentModal .modal-header,
body.dark-mode #marketingModal .modal-header,
body.dark-mode #settingsModal .modal-header {
    background: #1f2937 !important;
    border-bottom-color: #374151 !important;
}

body.dark-mode #callModal .modal-body,
body.dark-mode #sdrModal .modal-body,
body.dark-mode #paymentModal .modal-body,
body.dark-mode #marketingModal .modal-body,
body.dark-mode #settingsModal .modal-body {
    background: #1f2937 !important;
}

body.dark-mode #callModal .modal-footer,
body.dark-mode #sdrModal .modal-footer,
body.dark-mode #paymentModal .modal-footer,
body.dark-mode #marketingModal .modal-footer,
body.dark-mode #settingsModal .modal-footer {
    background: #111827 !important;
    border-top-color: #374151 !important;
}

/* Mobile styles for ALL modals */
@media (max-width: 640px) {
    #callModal,
    #sdrModal,
    #paymentModal,
    #marketingModal,
    #settingsModal {
        padding: 8px !important;
        align-items: flex-start !important;
        overflow-y: auto !important;
    }
    
    #callModal > .modal-content,
    #sdrModal > .modal-content,
    #paymentModal > .modal-content,
    #marketingModal > .modal-content,
    #settingsModal > .modal-content {
        max-width: 100% !important;
        max-height: calc(100vh - 16px) !important;
        min-height: 0 !important;
        height: auto !important;
        border-radius: 12px !important;
        margin: 8px auto !important;
    }
    
    #callModal .modal-header,
    #sdrModal .modal-header,
    #paymentModal .modal-header,
    #marketingModal .modal-header,
    #settingsModal .modal-header {
        padding: 12px 16px !important;
        border-radius: 12px 12px 0 0 !important;
        min-height: 48px !important;
    }
    
    #callModal .modal-header h2,
    #sdrModal .modal-header h2,
    #paymentModal .modal-header h2,
    #marketingModal .modal-header h2,
    #settingsModal .modal-header h2 {
        font-size: 1rem !important;
    }
    
    #callModal .modal-body,
    #sdrModal .modal-body,
    #paymentModal .modal-body,
    #marketingModal .modal-body,
    #settingsModal .modal-body {
        padding: 16px !important;
        max-height: calc(100vh - 140px) !important;
        overflow-y: auto !important;
    }
    
    #callModal .modal-footer,
    #sdrModal .modal-footer,
    #paymentModal .modal-footer,
    #marketingModal .modal-footer,
    #settingsModal .modal-footer {
        padding: 12px 16px !important;
        flex-direction: column !important;
        border-radius: 0 0 12px 12px !important;
        gap: 8px !important;
        min-height: auto !important;
    }
    
    #callModal .modal-footer button,
    #sdrModal .modal-footer button,
    #paymentModal .modal-footer button,
    #marketingModal .modal-footer button,
    #settingsModal .modal-footer button {
        width: 100% !important;
        padding: 12px 16px !important;
    }
    
    /* Ensure Submit button appears ABOVE Cancel on mobile */
    #callModal .modal-footer button[type="submit"],
    #sdrModal .modal-footer button[type="submit"],
    #paymentModal .modal-footer button[type="submit"],
    #marketingModal .modal-footer button[type="submit"],
    #settingsModal .modal-footer button[type="submit"] {
        order: -1 !important;
    }
}

/* Form Styles - Light Mode Enhanced Readability */
.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #9ca3af;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: white;
    color: #111827;
}

.form-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.form-input::placeholder {
    color: #6b7280;
}

.form-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #7c3aed;
    cursor: pointer;
}

/* Modal section headings in light mode */
#settingsModal h4,
#marketingModal h4,
#callModal h4,
#sdrModal h4,
#paymentModal h4 {
    color: #111827 !important;
    font-weight: 700 !important;
}

/* Modal text in light mode */
#settingsModal .modal-body,
#marketingModal .modal-body,
#callModal .modal-body,
#sdrModal .modal-body,
#paymentModal .modal-body {
    color: #1f2937 !important;
}

#settingsModal .modal-body p,
#marketingModal .modal-body p,
#settingsModal .modal-body span,
#marketingModal .modal-body span {
    color: #374151 !important;
}

/* Colored section boxes text in light mode */
.bg-blue-50 h4, .bg-green-50 h4, .bg-purple-50 h4, 
.bg-pink-50 h4, .bg-orange-50 h4, .bg-indigo-50 h4,
.bg-gray-50 h4 {
    color: #1f2937 !important;
    font-weight: 700 !important;
}

.bg-blue-50 .form-label, .bg-green-50 .form-label, .bg-purple-50 .form-label, 
.bg-pink-50 .form-label, .bg-orange-50 .form-label, .bg-indigo-50 .form-label,
.bg-gray-50 .form-label {
    color: #374151 !important;
}

.bg-blue-50 span, .bg-green-50 span, .bg-purple-50 span, 
.bg-pink-50 span, .bg-orange-50 span, .bg-indigo-50 span {
    color: #374151 !important;
}

/* Dark mode overrides for modal text */
body.dark-mode #settingsModal h4,
body.dark-mode #marketingModal h4,
body.dark-mode #callModal h4,
body.dark-mode #sdrModal h4,
body.dark-mode #paymentModal h4 {
    color: #f3f4f6 !important;
}

body.dark-mode #settingsModal .modal-body,
body.dark-mode #marketingModal .modal-body,
body.dark-mode #callModal .modal-body,
body.dark-mode #sdrModal .modal-body,
body.dark-mode #paymentModal .modal-body {
    color: #e5e7eb !important;
}

body.dark-mode #settingsModal .modal-body p,
body.dark-mode #marketingModal .modal-body p,
body.dark-mode #settingsModal .modal-body span,
body.dark-mode #marketingModal .modal-body span {
    color: #d1d5db !important;
}

/* Team member tags in dark mode */
body.dark-mode #closersList span,
body.dark-mode #settersList span {
    color: #f3f4f6 !important;
    background: #374151 !important;
}

/* Full Call Log Modal dark mode */
body.dark-mode #fullCallLogModal .bg-white {
    background: #1f2937 !important;
}

body.dark-mode #fullCallLogModal table {
    color: #f3f4f6 !important;
}

body.dark-mode #fullCallLogModal th {
    color: #e5e7eb !important;
    background: #374151 !important;
}

body.dark-mode #fullCallLogModal td {
    color: #e5e7eb !important;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: white;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: white;
    color: #374151;
    font-weight: 500;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.btn-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Success/Error States */
.form-success {
    background: #dcfce7;
    border: 1px solid #22c55e;
    color: #16a34a;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-error {
    background: #fee2e2;
    border: 1px solid #ef4444;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Loading Spinner for buttons */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Dark Mode Modal Styles */
body.dark-mode .modal-content {
    background: #1f2937;
    border: 1px solid #374151;
}

body.dark-mode .modal-header {
    background: #1f2937;
    border-color: #374151;
}

body.dark-mode .modal-header h3 {
    color: #f9fafb !important;
}

body.dark-mode .modal-footer {
    background: #111827;
    border-color: #374151;
}

body.dark-mode .form-label {
    color: #d1d5db;
}

body.dark-mode .form-input {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

body.dark-mode .form-input:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

body.dark-mode .form-input::placeholder {
    color: #9ca3af;
}

body.dark-mode .btn-secondary {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

body.dark-mode .btn-secondary:hover {
    background: #4b5563;
    border-color: #6b7280;
}

body.dark-mode h4.text-sm {
    color: #f9fafb !important;
}

body.dark-mode #paymentPlanFields {
    background: rgba(59, 130, 246, 0.1) !important;
}

/* Mobile Modal Fixes */
@media (max-width: 640px) {
    .modal-content {
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
    }
    
    .modal-footer button {
        width: 100%;
    }
    
    .form-input {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* ================================
   Collapsible Sections
   ================================ */
.section-title {
    cursor: pointer;
    user-select: none;
}

.section-title:hover {
    opacity: 0.8;
}

.section-title::after {
    content: '\f078'; /* fa-chevron-down */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-left: 8px;
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    display: inline-block;
}

.section-title.collapsed::after {
    transform: rotate(-90deg);
}

.section-content {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.section-content.collapsed {
    max-height: 0 !important;
    opacity: 0;
    margin: 0;
    padding: 0;
}

/* Streak Badge Animation */
@keyframes fireGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(249, 115, 22, 0.5); }
    50% { box-shadow: 0 0 15px rgba(249, 115, 22, 0.8); }
}

.badge-fire {
    animation: fireGlow 1.5s ease-in-out infinite;
}

/* Personal Best Badge */
@keyframes goldenPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.personal-best-badge {
    animation: goldenPulse 2s ease-in-out infinite;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

/* Mobile Bottom Nav safe area padding */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    #mobileBottomNav {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    main {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
}

/* Print-Friendly Styles */
@media print {
    #mobileBottomNav,
    #quickStatsBanner,
    #alertsPanel,
    header,
    footer,
    .btn-primary,
    .btn-secondary,
    .mobile-header-btn,
    #toastContainer {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .metric-card,
    .chart-card,
    .kpi-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    main {
        max-width: 100% !important;
        padding: 0 !important;
    }
}

/* ================================
   NOTIFICATION CENTER / ALERTS PANEL
   ================================ */

#alertsPanel {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

#alertsPanel::-webkit-scrollbar {
    width: 6px;
}

#alertsPanel::-webkit-scrollbar-track {
    background: transparent;
}

#alertsPanel::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

/* Alert Tab Styles */
.alert-tab {
    transition: all 0.2s ease;
}

.alert-tab:hover {
    background-color: rgba(239, 68, 68, 0.05);
}

.alert-tab.active {
    border-bottom-color: #ef4444 !important;
    color: #ef4444 !important;
}

body.dark-mode .alert-tab.active {
    color: #f87171 !important;
    border-bottom-color: #f87171 !important;
}

/* Notification Items */
/* Only animate NEW notifications, not on re-render */
#alertsList > div.new-notification {
    animation: slideIn 0.2s ease-out;
}

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

/* Alerts Panel - flush with top on PWA */
#alertsPanel {
    padding-top: env(safe-area-inset-top, 0) !important;
}

#alertsPanel > div:first-child {
    /* Header padding includes safe area */
    padding-top: max(16px, env(safe-area-inset-top, 0)) !important;
}

/* Mobile Alerts Panel */
@media (max-width: 640px) {
    #alertsPanel {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    #alertsPanel .p-4 {
        padding: 12px !important;
    }
    
    #alertsPanel > div:first-child {
        padding-top: max(12px, env(safe-area-inset-top, 0)) !important;
    }
    
    /* Make close button more accessible on mobile */
    #alertsPanel button[onclick="toggleAlertsPanel()"] {
        min-width: 48px !important;
        min-height: 48px !important;
    }
}

/* PWA Standalone alerts panel */
@media all and (display-mode: standalone) {
    #alertsPanel > div:first-child {
        padding-top: max(16px, env(safe-area-inset-top, 0)) !important;
    }
}

/* ================================
   LIGHT MODE TEXT FIXES
   Ensure proper dark text on light backgrounds
   ================================ */

/* Light mode (default) - ensure dark text colors */
body:not(.dark-mode) {
    color: #1f2937;
}

body:not(.dark-mode) main .metric-card,
body:not(.dark-mode) main .chart-card,
body:not(.dark-mode) main .bg-white,
body:not(.dark-mode) main .kpi-card,
body:not(.dark-mode) main .goal-card {
    color: #1f2937;
}

body:not(.dark-mode) main .metric-label,
body:not(.dark-mode) main .kpi-label,
body:not(.dark-mode) main .chart-title {
    color: #374151 !important;
}

body:not(.dark-mode) main .section-title {
    color: #1f2937 !important;
}

body:not(.dark-mode) main h1,
body:not(.dark-mode) main h2,
body:not(.dark-mode) main h3,
body:not(.dark-mode) main h4,
body:not(.dark-mode) main h5,
body:not(.dark-mode) main h6 {
    color: #1f2937 !important;
}

body:not(.dark-mode) main p,
body:not(.dark-mode) main span:not([class*="text-"]):not(.status-badge):not(.badge),
body:not(.dark-mode) main div:not([class*="bg-"]),
body:not(.dark-mode) main td,
body:not(.dark-mode) main th,
body:not(.dark-mode) main li,
body:not(.dark-mode) main label {
    color: #374151;
}

/* Header should ALWAYS have white text (it has purple background) */
header,
header *,
header span,
header i,
header button {
    color: white !important;
}

header .text-purple-200 {
    color: #e9d5ff !important;
}

header .bg-green-400 {
    background-color: #4ade80 !important;
}

/* Light mode - gray text should be gray not white */
body:not(.dark-mode) .text-gray-400 { color: #9ca3af !important; }
body:not(.dark-mode) .text-gray-500 { color: #6b7280 !important; }
body:not(.dark-mode) .text-gray-600 { color: #4b5563 !important; }
body:not(.dark-mode) .text-gray-700 { color: #374151 !important; }
body:not(.dark-mode) .text-gray-800 { color: #1f2937 !important; }
body:not(.dark-mode) .text-gray-900 { color: #111827 !important; }

/* Light mode filter buttons */
body:not(.dark-mode) .filter-btn {
    background: white;
    border-color: #d1d5db;
    color: #374151;
}

body:not(.dark-mode) .filter-dropdown {
    background: white;
    color: #374151;
}

body:not(.dark-mode) .filter-option {
    color: #374151;
}

body:not(.dark-mode) .filter-option:hover {
    background: #f3f4f6;
}

/* Light mode table text */
body:not(.dark-mode) table thead th {
    color: #374151 !important;
    background: #f9fafb;
}

body:not(.dark-mode) table tbody td {
    color: #1f2937;
}

/* Light mode leaderboard */
body:not(.dark-mode) .leaderboard-item .name {
    color: #1f2937 !important;
}

body:not(.dark-mode) .leaderboard-item .deals,
body:not(.dark-mode) .leaderboard-item .dials {
    color: #6b7280 !important;
}

/* Light mode inputs */
body:not(.dark-mode) input[type="text"],
body:not(.dark-mode) input[type="date"],
body:not(.dark-mode) input[type="number"],
body:not(.dark-mode) select {
    background: white;
    color: #1f2937;
    border-color: #d1d5db;
}

/* Light mode KPI cards - proper colors */
body:not(.dark-mode) .kpi-card {
    background: #f9fafb !important;
    border-color: #e5e7eb !important;
}

body:not(.dark-mode) .kpi-card .kpi-label {
    color: #4b5563 !important;
}

body:not(.dark-mode) .kpi-card .kpi-value {
    color: #1f2937 !important;
}

body:not(.dark-mode) .kpi-floor {
    color: #6b7280 !important;
}

/* KPI status-based colors in light mode */
body:not(.dark-mode) .kpi-card[data-status="above"] {
    background: linear-gradient(90deg, rgba(22, 163, 74, 0.08) 0%, #f9fafb 50%) !important;
    border-left: 4px solid #16a34a !important;
}

body:not(.dark-mode) .kpi-card[data-status="above"] .kpi-label,
body:not(.dark-mode) .kpi-card[data-status="above"] .kpi-value {
    color: #166534 !important;
}

body:not(.dark-mode) .kpi-card[data-status="meeting"] {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.08) 0%, #f9fafb 50%) !important;
    border-left: 4px solid #f59e0b !important;
}

body:not(.dark-mode) .kpi-card[data-status="meeting"] .kpi-label,
body:not(.dark-mode) .kpi-card[data-status="meeting"] .kpi-value {
    color: #b45309 !important;
}

body:not(.dark-mode) .kpi-card[data-status="below"] {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.08) 0%, #f9fafb 50%) !important;
    border-left: 4px solid #ef4444 !important;
}

body:not(.dark-mode) .kpi-card[data-status="below"] .kpi-label,
body:not(.dark-mode) .kpi-card[data-status="below"] .kpi-value {
    color: #dc2626 !important;
}

/* KPI status badges in light mode */
body:not(.dark-mode) .kpi-status[data-status="above"] {
    background: #dcfce7 !important;
    color: #16a34a !important;
}

body:not(.dark-mode) .kpi-status[data-status="meeting"] {
    background: #fef3c7 !important;
    color: #d97706 !important;
}

body:not(.dark-mode) .kpi-status[data-status="below"] {
    background: #fee2e2 !important;
    color: #dc2626 !important;
}

body:not(.dark-mode) .kpi-status[data-status="pending"] {
    background: #f3f4f6 !important;
    color: #6b7280 !important;
}

/* Light mode commission/objection items */
body:not(.dark-mode) .commission-item .name,
body:not(.dark-mode) .objection-item .name {
    color: #1f2937 !important;
}

/* ================================
   LIGHT MODE BACKGROUND FIXES
   Override dark backgrounds in light mode
   ================================ */

/* Filter bar and sections - white background in light mode */
body:not(.dark-mode) #topFilterBar,
body:not(.dark-mode) .bg-white,
body:not(.dark-mode) section > .bg-white {
    background-color: white !important;
}

/* Dark mode background classes should NOT apply in light mode */
body:not(.dark-mode) .dark\:bg-gray-800,
body:not(.dark-mode) .dark\:bg-gray-900,
body:not(.dark-mode) .dark\:bg-gray-700 {
    background-color: white !important;
}

/* Ensure metric cards have white background in light mode */
body:not(.dark-mode) .metric-card {
    background-color: white !important;
    border-color: #e5e7eb !important;
}

/* Colored metric card gradients in light mode */
body:not(.dark-mode) .metric-card.metric-blue {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(255, 255, 255, 0) 60%) !important;
}

body:not(.dark-mode) .metric-card.metric-green {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.08) 0%, rgba(255, 255, 255, 0) 60%) !important;
}

body:not(.dark-mode) .metric-card.metric-red {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(255, 255, 255, 0) 60%) !important;
}

body:not(.dark-mode) .metric-card.metric-purple {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, rgba(255, 255, 255, 0) 60%) !important;
}

body:not(.dark-mode) .metric-card.metric-orange {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.08) 0%, rgba(255, 255, 255, 0) 60%) !important;
}

body:not(.dark-mode) .metric-card.metric-yellow {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.08) 0%, rgba(255, 255, 255, 0) 60%) !important;
}

body:not(.dark-mode) .metric-card.metric-teal {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.08) 0%, rgba(255, 255, 255, 0) 60%) !important;
}

/* Chart cards white in light mode */
body:not(.dark-mode) .chart-card {
    background-color: white !important;
    border-color: #e5e7eb !important;
}

/* KPI cards white in light mode */
body:not(.dark-mode) .kpi-card {
    background-color: white !important;
    border-color: #e5e7eb !important;
}

/* Tables - white background in light mode */
body:not(.dark-mode) table {
    background-color: white !important;
}

body:not(.dark-mode) table thead {
    background-color: #f9fafb !important;
}

body:not(.dark-mode) table tbody tr {
    background-color: white !important;
    border-color: #e5e7eb !important;
}

body:not(.dark-mode) table tbody tr:hover {
    background-color: #f9fafb !important;
}

/* Leaderboard items */
body:not(.dark-mode) .leaderboard-item {
    background-color: #f9fafb !important;
}

body:not(.dark-mode) .leaderboard-item:hover {
    background-color: #f3f4f6 !important;
}

/* Recent payments and other sections */
body:not(.dark-mode) .rounded-lg.border,
body:not(.dark-mode) .rounded-xl.border {
    background-color: white !important;
    border-color: #e5e7eb !important;
}

/* Active payment plans section */
body:not(.dark-mode) #activePaymentPlans,
body:not(.dark-mode) #recentPaymentsSection {
    background-color: white !important;
}

/* Border colors in light mode */
body:not(.dark-mode) .border,
body:not(.dark-mode) .border-b,
body:not(.dark-mode) .border-t,
body:not(.dark-mode) .border-gray-200 {
    border-color: #e5e7eb !important;
}

body:not(.dark-mode) .dark\:border-gray-700,
body:not(.dark-mode) .dark\:border-gray-600 {
    border-color: #e5e7eb !important;
}
