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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f6fa;
    color: #2d3436;
    line-height: 1.6;
}

header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.last-updated {
    font-size: 0.85rem;
    opacity: 0.8;
}

.login-btn {
    padding: 0.5rem 1rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.login-btn:hover {
    background: #2980b9;
}

.user-info {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.connected {
    background: #27ae60;
}

.status-dot.disconnected {
    background: #e74c3c;
}

/* Navigation Tabs */
.tabs {
    display: flex;
    background: white;
    padding: 0 2rem;
    border-bottom: 1px solid #dfe6e9;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.tab-btn {
    padding: 1rem 1.5rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: #636e72;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #2c3e50;
    background-color: #f8f9fa;
}

.tab-btn.active {
    color: #2c3e50;
    border-bottom-color: #3498db;
    font-weight: 600;
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 1.5rem 2rem;
    animation: fadeIn 0.3s ease;
}

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

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

/* KPI Cards */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-left: 4px solid #3498db;
    transition: transform 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
}

.kpi-card.alert {
    border-left-color: #e74c3c;
}

.kpi-card.success {
    border-left-color: #27ae60;
}

.kpi-label {
    font-size: 0.85rem;
    color: #636e72;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
}

/* Charts */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.chart-container.full-width {
    grid-column: 1 / -1;
}

.chart-container h3 {
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.table-container h3 {
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

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

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background-color: #f8f9fa;
}

.status-over {
    color: #e74c3c;
    font-weight: 600;
}

.status-on {
    color: #27ae60;
    font-weight: 600;
}

/* Filters */
.filters-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filters-row select {
    padding: 0.75rem 1rem;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    min-width: 180px;
    cursor: pointer;
}

.filters-row select:focus {
    outline: none;
    border-color: #3498db;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .tabs {
        padding: 0 1rem;
        overflow-x: auto;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .tab-content {
        padding: 1rem;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .kpi-value {
        font-size: 1.5rem;
    }

    .rep-selector-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .sub-nav {
        gap: 0.25rem;
    }

    .sub-nav-pill {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .comm-tier-segment {
        font-size: 0.65rem;
        padding: 0 0.5rem;
        min-width: 50px;
    }
}

/* ============================================
   SALES REP TAB STYLES
   ============================================ */

/* Rep Selector Bar */
.rep-selector-bar {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.rep-selector-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rep-selector-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #636e72;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rep-selector-group select {
    padding: 0.5rem 1rem;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    min-width: 200px;
    cursor: pointer;
}

.rep-selector-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

/* Sub-Navigation Pills */
.sub-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    flex-wrap: wrap;
}

.sub-nav-pill {
    padding: 0.5rem 1.25rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: #636e72;
    transition: all 0.2s ease;
}

.sub-nav-pill:hover {
    background: #f0f2f5;
    color: #2c3e50;
}

.sub-nav-pill.active {
    background: #3498db;
    color: white;
    font-weight: 600;
}

/* Sub-sections */
.sr-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.sr-section.active {
    display: block;
}

/* Quota Progress Bars */
.quota-progress-wrapper {
    padding: 1rem 0;
}

.quota-progress-bar {
    position: relative;
    height: 28px;
    background: #ecf0f1;
    border-radius: 14px;
    overflow: visible;
    margin-bottom: 0.75rem;
}

.quota-progress-bar.large {
    height: 40px;
    border-radius: 20px;
    margin-bottom: 1rem;
}

.quota-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 14px;
    transition: width 0.8s ease;
    min-width: 0;
    max-width: 150%;
    position: relative;
    z-index: 1;
}

.quota-progress-bar.large .quota-progress-fill {
    border-radius: 20px;
}

.quota-marker {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 3px;
    background: #2c3e50;
    z-index: 2;
    border-radius: 2px;
}

.quota-marker.target {
    background: #27ae60;
    width: 4px;
}

.quota-marker.accelerator {
    background: #f39c12;
    width: 3px;
}

.quota-marker span {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    color: #636e72;
    white-space: nowrap;
}

.quota-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #636e72;
}

.quota-progress-detail {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #2c3e50;
    font-weight: 500;
}

.quota-summary {
    margin-top: 0.75rem;
    font-size: 0.95rem;
    color: #2c3e50;
}

.quota-annual-wrapper {
    padding: 2rem 1rem 1rem;
}

/* Mini Quota Bars (quarterly) */
.mini-quota-bar {
    height: 10px;
    background: #ecf0f1;
    border-radius: 5px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.mini-quota-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 5px;
    transition: width 0.6s ease;
}

.kpi-detail {
    font-size: 0.8rem;
    color: #636e72;
}

/* Pace Card */
.pace-card {
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.pace-card p {
    font-size: 0.95rem;
    color: #2c3e50;
    line-height: 1.6;
}

/* Placeholder Cards & Charts */
.placeholder-card {
    border-left-color: #bdc3c7 !important;
    opacity: 0.7;
}

.coming-soon {
    font-size: 0.75rem;
    color: #9b59b6;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.placeholder-chart {
    position: relative;
}

.placeholder-message {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #95a5a6;
    font-style: italic;
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dfe6e9;
}

/* Commission Tiers Visual */
.commission-tiers-visual {
    padding: 1rem 0;
}

.comm-tier-bar {
    display: flex;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.comm-tier-segment {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    min-width: 80px;
}

.comm-tier-segment.below {
    background: #95a5a6;
}

.comm-tier-segment.base {
    background: #3498db;
}

.comm-tier-segment.target {
    background: #27ae60;
}

.comm-tier-segment.accelerator {
    background: #f39c12;
}

.comm-rate {
    font-weight: 700;
    font-size: 0.9rem;
}

.commission-disclaimer {
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    background: #fef9e7;
    border-left: 4px solid #f39c12;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #7d6608;
    font-style: italic;
}

/* Leaderboard-specific */
#sr-leaderboard .kpi-card {
    border-left-color: #9b59b6;
}

/* Customer table styling */
#srCustomerTable .positive {
    color: #27ae60;
}

#srCustomerTable .negative {
    color: #e74c3c;
}

/* Blob Progress Toast */
.blob-progress-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: white;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 280px;
    max-width: 360px;
    border-left: 4px solid #3498db;
    animation: fadeIn 0.3s ease;
}

.blob-progress-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.blob-progress-bar-wrapper {
    height: 6px;
    background: #ecf0f1;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}

.blob-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.blob-progress-detail {
    font-size: 0.75rem;
    color: #636e72;
}

/* Loading State */
.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Value Colors */
.positive {
    color: #27ae60;
}

.negative {
    color: #e74c3c;
}
